Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -red96c724f65f6763233b2c427456b6efd19717e6 -rcceb0bf86fc6ddb1131701844960f59d968988c5 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision ed96c724f65f6763233b2c427456b6efd19717e6) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision cceb0bf86fc6ddb1131701844960f59d968988c5) @@ -52,6 +52,7 @@ #define SPENT_DIFF_COUNT_DEADBAND 1 ///< Stop changing D48 pump speed when fill difference reaches close to target count #define D48_SPEED_ADJUST_FACTOR 0.5F ///< D48 speed adjustment factor ( 50% of speed adjustment = 0.5) #define D48_SPEED_RANGE_LIMIT 0.25F ///< D48 speed adjustment range check limit ( D48 speed can vary +/-25% of initial calculated speed) +#define BAL_CHAMBER_FILL_TIMEOUT_FACTOR 1.5 ///< Balancing Chamber fill timeout factor (150% of observed fill count) /// Payload record structure for balancing chamber switch only request typedef struct @@ -85,8 +86,9 @@ static F32 prevSpentDialPressure; ///< Previous spent side dialysate pressure static F32 lastPrevSpentDialPressure; ///< Last previous spent side dialysate pressure static U32 currentBalChamberFillCounter; ///< Counter (in task interval) to monitor the timing spent for the spent side fill operation. +static U32 balChamberFillTimeoutCount; ///< Timeout count (in task interval) to detect BC fill timeout. static S32 diffSpentFillCompleteCount; ///< Difference between spent target fill to actual fill count -static BOOL isSpentFillComplete; +static BOOL isSpentFillComplete; ///< Flag indicating spent side fill complete. // ********** private function prototypes ********** @@ -133,7 +135,7 @@ balChamberValveClosePeriod = 0; isBalChamberFillInProgress = FALSE; currentBalChamberSwitchingCounter = 0; - isPressureStabilizedDuringFill = FALSE; + isPressureStabilizedDuringFill = FALSE; lastTdDialysateFlowrate = 0.0F; balChamberDataPublicationTimerCounter = 0; balChamberFillPressureDropCounter = 0; @@ -145,6 +147,7 @@ prevSpentDialPressure = 0.0F; lastPrevSpentDialPressure = 0.0F; currentBalChamberFillCounter = 0; + balChamberFillTimeoutCount = 0; diffSpentFillCompleteCount = 0; isSpentFillComplete = FALSE; } @@ -431,6 +434,7 @@ currentBalChamberSwitchingCounter = 0; balChamberSWState = BAL_CHAMBER_SW_STATE1; currentBalChamberFillCounter = 0; + balChamberFillTimeoutCount = 0; isBalChamberFillInProgress = FALSE; isPressureStabilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; @@ -545,6 +549,12 @@ freshDialPressure = getFilteredPressure( D18_PRES ); spentDialPressure = getFilteredPressure( D51_PRES ); + // If fill is taking too long, set an alarm for fill timeout + if ( ( balChamberFillTimeoutCount > 0 ) && ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) ) + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_BC_FILL_TIMEOUT_FAULT, currentBalChamberFillCounter, balChamberFillTimeoutCount ); + } + // Check fresh dialysate pressure back in range to indicate fresh fill complete. if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) { @@ -561,6 +571,12 @@ // Check both spent and fresh side fill is complete if ( ( TRUE == isSpentFillComplete ) && ( TRUE == isPressureStabilizedDuringFill ) || ( FALSE == isFirstCycleBCSwitchingCompleted ) ) { + // On successful completion, learn timeout as 150% of the observed fill count (once per cycle). + if ( balChamberFillTimeoutCount == 0U ) + { + balChamberFillTimeoutCount = currentBalChamberFillCounter * BAL_CHAMBER_FILL_TIMEOUT_FACTOR; + } + // close the state 1 opened valves valveControlForBCState1FillEnd(); isBalChamberFillInProgress = FALSE; @@ -649,6 +665,7 @@ isPressureDroppedDuringFill = FALSE; balChamberSWState = BAL_CHAMBER_SW_STATE2; currentBalChamberFillCounter = 0; + balChamberFillTimeoutCount = 0; isSpentFillComplete = FALSE; lastPrevSpentDialPressure = 0.0F; prevSpentDialPressure = 0.0F; @@ -717,12 +734,24 @@ } } + // If fill is taking too long, set an alarm for fill timeout + if ( ( balChamberFillTimeoutCount > 0 ) && ( currentBalChamberFillCounter > balChamberFillTimeoutCount ) ) + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DD_BC_FILL_TIMEOUT_FAULT, currentBalChamberFillCounter, balChamberFillTimeoutCount ); + } + // Spent side of balancing chamber fill is complete or not checkSpentFillComplete( spentDialPressure ); // Check switching cycle time or pressure check for valve closure if ( ( TRUE == isSpentFillComplete ) && ( TRUE == isPressureStabilizedDuringFill ) || ( FALSE == isFirstCycleBCSwitchingCompleted ) ) { + // On successful completion, learn timeout as 150% of the observed fill count (once per cycle). + if ( balChamberFillTimeoutCount == 0U ) + { + balChamberFillTimeoutCount = currentBalChamberFillCounter * BAL_CHAMBER_FILL_TIMEOUT_FACTOR; + } + // close the valves valveControlForBCState2FillEnd(); isBalChamberFillInProgress = FALSE; Index: firmware/App/Controllers/DialysatePumps.h =================================================================== diff -u -red96c724f65f6763233b2c427456b6efd19717e6 -rcceb0bf86fc6ddb1131701844960f59d968988c5 --- firmware/App/Controllers/DialysatePumps.h (.../DialysatePumps.h) (revision ed96c724f65f6763233b2c427456b6efd19717e6) +++ firmware/App/Controllers/DialysatePumps.h (.../DialysatePumps.h) (revision cceb0bf86fc6ddb1131701844960f59d968988c5) @@ -36,7 +36,7 @@ #define MAX_DIALYSATE_PUMP_RPM 2650 ///< Maximum RPM target for D12 pump and D48 Diener 2000 pump. #define D48_DIENER_1000_MIN_RPM 134 ///< Minimum RPM for D48 Diener 1000 pump (test config enabled). -#define D48_DIENER_1000_MAX_RPM 2770 ///< Maximum RPM for D48 Diener 1000 pump (test config enabled). +#define D48_DIENER_1000_MAX_RPM 2770 ///< Maximum RPM for D48 Diener 1000 pump (test config enabled). #define DEGAS_PUMP_TARGET_PRES_ADJ_THRESHOLD -1.0F ///< Dialysate Pump(D12) target pressure threshold adjustment factor. Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -red96c724f65f6763233b2c427456b6efd19717e6 -rcceb0bf86fc6ddb1131701844960f59d968988c5 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision ed96c724f65f6763233b2c427456b6efd19717e6) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision cceb0bf86fc6ddb1131701844960f59d968988c5) @@ -654,13 +654,13 @@ if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DIENER_2000_PUMP ) ) { - slope = PUMP_SPEED_SLOPE_FACTOR_DIENER_1000; - intercept = PUMP_SPEED_INTERCEPT_FACTOR_DIENER_1000; + slope = PUMP_SPEED_SLOPE_FACTOR_DIENER_2000; + intercept = PUMP_SPEED_INTERCEPT_FACTOR_DIENER_2000; } else { - slope = PUMP_SPEED_SLOPE_FACTOR_DIENER_2000; - intercept = PUMP_SPEED_INTERCEPT_FACTOR_DIENER_2000; + slope = PUMP_SPEED_SLOPE_FACTOR_DIENER_1000; + intercept = PUMP_SPEED_INTERCEPT_FACTOR_DIENER_1000; } // Calculate nominal speed from Qd. Index: firmware/App/Services/FpgaDD.c =================================================================== diff -u -red96c724f65f6763233b2c427456b6efd19717e6 -rcceb0bf86fc6ddb1131701844960f59d968988c5 --- firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision ed96c724f65f6763233b2c427456b6efd19717e6) +++ firmware/App/Services/FpgaDD.c (.../FpgaDD.c) (revision cceb0bf86fc6ddb1131701844960f59d968988c5) @@ -143,9 +143,9 @@ #define PUMP_SPEED_OFFSET 168.7F ///< Speed Scale adjustment intercept factor #define PUMP_SPEED_FULL_SCALE 3187.0F ///< Speed scale adjustment slope factor -#define DIENER_1000_PUMP_SLOPE 0.000296F -#define DIENER_1000_PUMP_INTERCEPT 0.07040F -#define DIENER_1000_PUMP_SPEED_FULL_SCALE 3150 +#define DIENER_1000_PUMP_SLOPE 0.000296F ///< Speed adjustment slope factor (Diener 1000 pump) +#define DIENER_1000_PUMP_INTERCEPT 0.07040F ///< Speed adjustment intercept factor (Diener 1000 pump) +#define DIENER_1000_PUMP_SPEED_FULL_SCALE 3150 ///< Maximum speed factor (Diener 1000 pump) #pragma pack(push,1) /// FPGA header struct.