Index: firmware/App/Controllers/DialOutFlow.c =================================================================== diff -u -rbd1a18097721b1e331761ad88aca0cc2ecb85e1f -r17c0be2f41c52e631be4704a3f7e6f1f6710d8f8 --- firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision bd1a18097721b1e331761ad88aca0cc2ecb85e1f) +++ firmware/App/Controllers/DialOutFlow.c (.../DialOutFlow.c) (revision 17c0be2f41c52e631be4704a3f7e6f1f6710d8f8) @@ -64,6 +64,7 @@ #define P_CORR 0.1666F ///< P term for volume error feedback into dialysate outlet pump flow estimate correction offset. #define RPM_2_ML_MIN_CONVERSION 0.215964F ///< Conversion factor for estimating flow rate from pump motor RPM. +#define OFFSET_2_PWM_OFFSET 0.135F ///< Conversion factor for estimating PWM duty cycle offset for a given rate offset. #define SIZE_OF_ROLLING_AVG 100 ///< Number of samples in DPo flow estimation moving average. #define DOP_HOME_SPEED 400 ///< Target pump speed (in RPM) for homing. @@ -105,8 +106,8 @@ #define DOP_GEAR_RATIO 32.0F ///< Pump motor to pump gear ratio. #define DOP_PWM_ZERO_OFFSET 0.1F ///< 10% PWM duty cycle = zero speed. #define DOP_100_PCT_PWM_RPM_RANGE 4000.0F ///< 10-90% PWM range yields 0-3,200 RPM range. Full 100% PWM range would yield 4,000 RPM range. -#define DOP_RATE_CORRECTION_SCALAR 0.08F ///< Scalar for estimating DPo rate correction offset based on target Qd. -#define DOP_RATE_CORRECTION_OFFSET 25.0F ///< Offset for estimating DPo rate correction offset based on target Qd. +#define DOP_RATE_CORRECTION_SCALAR 0.194F ///< Scalar for estimating DPo rate correction offset based on target Qd. +#define DOP_RATE_CORRECTION_OFFSET -19.40F ///< Offset for estimating DPo rate correction offset based on target Qd. /// Macro converts a flow rate to an estimated PWM duty cycle %. #define DOP_PWM_FROM_ML_PER_MIN(rate) ( ( ( rate ) * 0.0009F ) + 0.0972F + DOP_PWM_ZERO_OFFSET ) @@ -287,14 +288,12 @@ pwmDC = ( 0 == flowRate ? DOP_PWM_ZERO_OFFSET : DOP_PWM_FROM_ML_PER_MIN( (F32)flowRate ) ); } else - { // if rate correction offset not yet set, set it based on target dialysate flow rate - if ( fabs( dopRateCorrectionOffset ) < NEARLY_ZERO ) - { // set initial estimate for rate correction offset - dopRateCorrectionOffset = ( (F32)getTargetDialInFlowRate() + getCurrentUFSetRate() ) * DOP_RATE_CORRECTION_SCALAR + DOP_RATE_CORRECTION_OFFSET; - // adjust initial pwm duty cycle % estimate per set UF rate and rate correction offset - offsetPWMDutyCyclePct = ( ( ( getCurrentUFSetRate() - dopRateCorrectionOffset ) / RPM_2_ML_MIN_CONVERSION ) / DOP_100_PCT_PWM_RPM_RANGE ); - pwmDC += offsetPWMDutyCyclePct; - } + { + // set initial estimate for rate correction offset + dopRateCorrectionOffset = ( (F32)getTargetDialInFlowRate() + getCurrentUFSetRate() ) * DOP_RATE_CORRECTION_SCALAR + DOP_RATE_CORRECTION_OFFSET; + // adjust initial pwm duty cycle % estimate per set UF rate and rate correction offset + offsetPWMDutyCyclePct = ( ( ( getCurrentUFSetRate() - dopRateCorrectionOffset ) / OFFSET_2_PWM_OFFSET ) / DOP_100_PCT_PWM_RPM_RANGE ); + pwmDC += offsetPWMDutyCyclePct; } // Don't interrupt pump control unless rate or mode is changing if ( ( fabs( pwmDC - dialOutPumpPWMDutyCyclePct ) > NEARLY_ZERO ) || ( mode != dialOutPumpControlMode ) ) Index: firmware/App/Controllers/PresOccl.c =================================================================== diff -u -r4f3b9e168915ab13dfcdc74462d7142115cc2d57 -r17c0be2f41c52e631be4704a3f7e6f1f6710d8f8 --- firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 4f3b9e168915ab13dfcdc74462d7142115cc2d57) +++ firmware/App/Controllers/PresOccl.c (.../PresOccl.c) (revision 17c0be2f41c52e631be4704a3f7e6f1f6710d8f8) @@ -96,7 +96,6 @@ #define CARTRIDGE_LOADED_THRESHOLD 5000 ///< Threshold above which a cartridge is considered loaded. #define MIN_OCCLUSION_COUNTS 2000 ///< Minimum occlusion sensor reading for range check. -#define MAX_OCCLUSION_COUNTS 32766 ///< Maximum occlusion sensor reading for range check. #define OCCLUSION_CARTRIDGE_LOADED_PRESSURE_READING_MAX 24500 ///< Occlusion sensors maximum pressure reading limit when cartridge is considered loaded. #define EMPTY_SALINE_BAG_THRESHOLD_MMHG -300.0F ///< Threshold below which the saline bag is considered empty (in mmHg). @@ -789,7 +788,7 @@ static void checkOcclusions( void ) { U32 bpOccl = getMeasuredBloodPumpOcclusion(); - BOOL outOfRange = ( bpOccl < MIN_OCCLUSION_COUNTS || bpOccl > MAX_OCCLUSION_COUNTS ? TRUE : FALSE ); + BOOL outOfRange = ( bpOccl < MIN_OCCLUSION_COUNTS ? TRUE : FALSE ); #ifndef _RELEASE_ if( HW_CONFIG_BETA == getHardwareConfigStatus() )