Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -r1ebbe403d260d9f65695c13d6dbafbe1a93cfdde -r8691c0722f9fa690de0b789a2c020b1ad8e86def --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 1ebbe403d260d9f65695c13d6dbafbe1a93cfdde) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 8691c0722f9fa690de0b789a2c020b1ad8e86def) @@ -85,7 +85,6 @@ #define DOP_SPEED_ADC_TO_RPM_FACTOR 1.751752 ///< Conversion factor from ADC counts to RPM for dialysate outlet pump motor. #define DOP_MOTOR_RPM_TO_PWM_DC_FACTOR 0.000193 ///< ~52 BP motor RPM = 1% PWM duty cycle -#define UF_PWM_DC_PCT_PER_ML_PER_MIN 0.004 ///< Estimated DPo PWM duty cycle amount per each mL/min of ultrafiltration desired. #define DOP_CURRENT_ADC_TO_MA_FACTOR 3.002 ///< Conversion factor from ADC counts to mA for dialysate outlet pump motor. #define DOP_ADC_FULL_SCALE_V 3.0 ///< DPo analog signals are 0-3V (while int. ADC ref V may be different). #define DOP_ADC_ZERO 1998 ///< Mid-point (zero) for ADC readings. @@ -515,7 +514,7 @@ } else { // Closed loop UF control is only controlling offset from DPi PWM - resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, (F32)( (S32)lastGivenRate - getTargetDialInFlowRate() ) * UF_PWM_DC_PCT_PER_ML_PER_MIN ); + resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, dialOutPumpPWMDutyCyclePctSet - getDialInPumpPWMDutyCyclePct() ); } dialOutPumpControlModeSet = dialOutPumpControlMode; setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePctSet ); @@ -560,7 +559,7 @@ } else { // Closed loop UF control is only controlling offset from DPi PWM - resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, (F32)( (S32)lastGivenRate - getTargetDialInFlowRate() ) * UF_PWM_DC_PCT_PER_ML_PER_MIN ); + resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, dialOutPumpPWMDutyCyclePctSet - getDialInPumpPWMDutyCyclePct() ); } dialOutPumpControlModeSet = dialOutPumpControlMode; setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePctSet );