Index: firmware/App/Controllers/BloodFlow.c =================================================================== diff -u -rffef40f212d885498157395a1a3375542747a603 -re1b010909170d0656a7b87400f295387423fd383 --- firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision ffef40f212d885498157395a1a3375542747a603) +++ firmware/App/Controllers/BloodFlow.c (.../BloodFlow.c) (revision e1b010909170d0656a7b87400f295387423fd383) @@ -69,7 +69,10 @@ #define BP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0 ///< Maximum motor speed (RPM) while motor is commanded off. #define BP_MAX_ROTOR_VS_MOTOR_DIFF_RPM 5.0 ///< Maximum difference in speed between motor and rotor (in rotor RPM). #define BP_MAX_MOTOR_SPEED_ERROR_RPM 300.0 ///< Maximum difference in speed between measured and commanded RPM. +#define BP_MAX_FLOW_VS_SPEED_DIFF_RPM 200.0 ///< Maximum difference between measured speed and speed implied by measured flow. +/// Persist time (task intervals) for flow vs. motor speed error condition. +static const U32 BP_FLOW_VS_SPEED_PERSIST = ( 5 * MS_PER_SECOND ); /// Persist time (task intervals) for motor off error condition. static const U32 BP_OFF_ERROR_PERSIST = ( 5 * MS_PER_SECOND ); /// Persist time (task intervals) motor speed error condition. @@ -244,6 +247,7 @@ initPersistentAlarm( ALARM_ID_BLOOD_PUMP_MC_DIRECTION_CHECK, 0, BP_DIRECTION_ERROR_PERSIST ); initPersistentAlarm( ALARM_ID_BLOOD_PUMP_ROTOR_SPEED_TOO_HIGH, 0, BP_MAX_ROTOR_SPEED_ERROR_PERSIST ); initPersistentAlarm( ALARM_ID_BLOOD_PUMP_MC_CURRENT_CHECK, 0, BP_MAX_CURR_ERROR_DURATION_MS ); + initPersistentAlarm( ALARM_ID_BLOOD_PUMP_FLOW_VS_MOTOR_SPEED_CHECK, 0, BP_FLOW_VS_SPEED_PERSIST ); initPersistentAlarm( ALARM_ID_HD_BLOOD_FLOW_OUT_OF_RANGE, 0, BP_MAX_FLOW_RATE_OUT_OF_RANGE_PERSIST ); } @@ -1145,14 +1149,31 @@ *************************************************************************/ static void checkBloodPumpFlowRate( void ) { +#ifndef DISABLE_PUMP_FLOW_CHECKS F32 flow = getMeasuredBloodFlowRate(); // Range check on measure BP flow rate. -#ifndef DISABLE_PUMP_FLOW_CHECKS if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_HD_BLOOD_FLOW_OUT_OF_RANGE, ( flow > BP_MAX_FLOW_RATE ) || ( flow < BP_MIN_FLOW_RATE ) ) ) { SET_ALARM_WITH_1_F32_DATA( ALARM_ID_HD_BLOOD_FLOW_OUT_OF_RANGE, flow ); } + + // Flow vs. speed check only performed while in treatment mode and while we are in control to target state + if ( ( MODE_TREA == getCurrentOperationMode() ) && ( BLOOD_PUMP_CONTROL_TO_TARGET_STATE == bloodPumpState ) ) + { + F32 speed = getMeasuredBloodPumpSpeed(); + F32 impliedSpeed = ( (F32)targetBloodFlowRate / (F32)ML_PER_LITER ) * BP_REV_PER_LITER * BP_GEAR_RATIO; + F32 delta = fabs( speed - impliedSpeed ); + + if ( TRUE == isPersistentAlarmTriggered( ALARM_ID_BLOOD_PUMP_FLOW_VS_MOTOR_SPEED_CHECK, delta > BP_MAX_FLOW_VS_SPEED_DIFF_RPM ) ) + { + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_BLOOD_PUMP_FLOW_VS_MOTOR_SPEED_CHECK, flow, speed ); + } + } + else + { + resetPersistentAlarmTimer( ALARM_ID_BLOOD_PUMP_FLOW_VS_MOTOR_SPEED_CHECK ); + } #endif } Index: firmware/App/Controllers/DialInFlow.c =================================================================== diff -u -r02d6de097fc53e769c4851a8f1f6438c5ff5e280 -re1b010909170d0656a7b87400f295387423fd383 --- firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision 02d6de097fc53e769c4851a8f1f6438c5ff5e280) +++ firmware/App/Controllers/DialInFlow.c (.../DialInFlow.c) (revision e1b010909170d0656a7b87400f295387423fd383) @@ -65,9 +65,7 @@ #define DIP_MAX_FLOW_RATE 1320.0 ///< Maximum measured BP flow rate allowed. #define DIP_MIN_FLOW_RATE -1320.0 ///< Minimum measured BP flow rate allowed. -#ifdef USE_FMD_FLOW_SENSOR #define DIP_MAX_FLOW_VS_SPEED_DIFF_RPM 200.0 ///< Maximum difference between measured motor speed and speed implied by measured flow. -#endif #define DIP_MAX_MOTOR_SPEED_WHILE_OFF_RPM 100.0 ///< Maximum motor speed (RPM) while motor is commanded off. #define DIP_MAX_ROTOR_VS_MOTOR_DIFF_RPM 5.0 ///< Maximum difference in speed between motor and rotor (in rotor RPM). #define DIP_MAX_MOTOR_SPEED_ERROR_RPM 300.0 ///< Maximum difference in speed between measured and commanded RPM. @@ -490,7 +488,7 @@ dialInFlowSignalStrength.data = getFPGADialysateFlowSignalStrength(); #else - dipFlow = getDGDialysateFlowRateMlMin(); // get dialysate flow from DG + dipFlow = getDGDialysateFlowRateMlMin() * (F32)ML_PER_LITER; // get dialysate flow from DG #endif adcDialInPumpMCSpeedRPM.data = (F32)(SIGN_FROM_12_BIT_VALUE(dipRPM)) * DIP_SPEED_ADC_TO_RPM_FACTOR; @@ -1269,11 +1267,10 @@ } #endif -#ifdef USE_FMD_FLOW_SENSOR // Check only performed while in treatment mode and while we are in control to target state if ( ( MODE_TREA == getCurrentOperationMode() ) && ( DIAL_IN_PUMP_CONTROL_TO_TARGET_STATE == dialInPumpState ) ) { - F32 flow = getMeasuredDialInFlowRate(); + F32 flow = (F32)targetDialInFlowRate; F32 speed = getMeasuredDialInPumpSpeed(); F32 impliedSpeed = ( flow / (F32)ML_PER_LITER ) * DIP_REV_PER_LITER * DIP_GEAR_RATIO; F32 delta = fabs( speed - impliedSpeed ); @@ -1296,7 +1293,6 @@ { errorDialInFlowVsMotorSpeedPersistTimerCtr = 0; } -#endif } /*********************************************************************//** Index: firmware/App/HDCommon.h =================================================================== diff -u -r8cebc7f282f403c99f712d422454c15414b6fc73 -re1b010909170d0656a7b87400f295387423fd383 --- firmware/App/HDCommon.h (.../HDCommon.h) (revision 8cebc7f282f403c99f712d422454c15414b6fc73) +++ firmware/App/HDCommon.h (.../HDCommon.h) (revision e1b010909170d0656a7b87400f295387423fd383) @@ -46,14 +46,14 @@ // #define DISABLE_ACCELS 1 // Disable accelerometer POST and monitoring // #define DISABLE_CRC_ERROR 1 // Do not error on bad CRC for CAN messages #define DISABLE_ACK_ERRORS 1 // Do not error on failure of other node(s) to ACK a message - #define USE_FMD_FLOW_SENSOR 1 // Use FMD flow sensor (on HD) instead of FMD on DG +// #define USE_FMD_FLOW_SENSOR 1 // Use FMD flow sensor (on HD) instead of FMD on DG // #define RUN_BP_OPEN_LOOP 1 // Run blood pump in open loop mode // #define RUN_DPI_OPEN_LOOP 1 // Run dialysate inlet pump in open loop mode #define WORN_OUT_CARTRIDGE 1 // Running with an old worn out cartridge (max wear) #define DISABLE_MOTOR_CURRENT_CHECKS 1 // Do not error on HD pump current checks #define DISABLE_PUMP_FLOW_CHECKS 1 // Do not error on HD pump flow checks #define DISABLE_PUMP_SPEED_CHECKS 1 // Do not error on HD pump speed checks -// #define DISABLE_PUMP_DIRECTION_CHECKS 1 // Do not error on HD pump direction checks + #define DISABLE_PUMP_DIRECTION_CHECKS 1 // Do not error on HD pump direction checks #define DISABLE_SYRINGE_PUMP 1 // Disable syringe pump functionality #define ALWAYS_ALLOW_SYRINGE_PUMP_CMDS 1 // Allow syringe pump commands at any time except when pump is busy // #define DISABLE_PRESSURE_CHECKS 1 // Do not error on HD pressure checks