Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -rbaa9fb9bb10eed6cd211abaa80e9f9acffdeb20d -r023b561bbcfe0c8e93f375cfcb96f9b801d93ffd --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision baa9fb9bb10eed6cd211abaa80e9f9acffdeb20d) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 023b561bbcfe0c8e93f375cfcb96f9b801d93ffd) @@ -85,11 +85,12 @@ #ifndef V2_0_SYSTEM #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.000198 ///< ~40 BP motor RPM = 1% PWM duty cycle + #define DOP_MOTOR_RPM_TO_PWM_DC_FACTOR 0.000193 ///< ~52 BP motor RPM = 1% PWM duty cycle #else #define DOP_SPEED_ADC_TO_RPM_FACTOR 1.280938 ///< Conversion factor from ADC counts to RPM for blood pump motor #define DOP_MOTOR_RPM_TO_PWM_DC_FACTOR 0.0003125 ///< ~32 BP motor RPM = 1% PWM duty cycle #endif +#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. @@ -522,7 +523,7 @@ } else { // Closed loop UF control is only controlling offset from DPi PWM - resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, dialOutPumpPWMDutyCyclePctSet - getDialInPumpPWMDutyCyclePct() ); + resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, (F32)( (S32)lastGivenRate - getTargetDialInFlowRate() ) * UF_PWM_DC_PCT_PER_ML_PER_MIN ); } dialOutPumpControlModeSet = dialOutPumpControlMode; setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePctSet ); @@ -567,7 +568,7 @@ } else { // Closed loop UF control is only controlling offset from DPi PWM - resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, dialOutPumpPWMDutyCyclePctSet - getDialInPumpPWMDutyCyclePct() ); + resetPIController( PI_CONTROLLER_ID_ULTRAFILTRATION, (F32)( (S32)lastGivenRate - getTargetDialInFlowRate() ) * UF_PWM_DC_PCT_PER_ML_PER_MIN ); } dialOutPumpControlModeSet = dialOutPumpControlMode; setDialOutPumpControlSignalPWM( dialOutPumpPWMDutyCyclePct );