Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r573a26b2a0273a4983b1de1cbff5bed63e01dce0 -r51c295e1dc413d3774dae303e7f98b2f4c86bae4 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 573a26b2a0273a4983b1de1cbff5bed63e01dce0) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 51c295e1dc413d3774dae303e7f98b2f4c86bae4) @@ -58,14 +58,14 @@ static U32 currentBalChamberSwitchingCounter; ///< Counter (in task interval) to monitor the timing spent during balancing chamber fill/drain operation. static BOOL isBalChamberFillInProgress; ///< Flag indicating balancing chamber fill/drain is in progress. static BOOL isPressureStalbilizedDuringFill; ///< Flag indicating that the pressure is stablized due to fill complete. -static BOOL isPressureDroppedDuringFill; ///< Flag indicating that the pressure is dropped due to BC fill (state 1 or state 2) in progress condition. static BAL_CHAMBER_SW_STATE_T balChamberSWState; ///< Current balancing chamber switching state ( state 1 or state 2). static U32 balChamberDataPublicationTimerCounter; ///< Used to schedule balancing chamber data publication to CAN bus. static U32 balChamberFillPressureDropCounter; ///< Counter to check balancing chamber valves opened and there by pressure drop is seen. -static U32 balChamberFillCompleteStablePressureCounter; ///< Counter to check balancing chamber fill complete and stable pressure is met. static OVERRIDE_U32_T balChamberDataPublishInterval; ///< Balancing chamber data publish interval. static BOOL balanceChamberSwitchingOnly; ///< Balancing chamber switching without any pressure check and dosing delivery. +static BOOL isPressureDroppedDuringFill; ///< Flag indicating that the pressure is dropped due to BC fill (state 1 or state 2) in progress condition. static BOOL isFirstCycleBCSwitchingCompleted; ///< Flag indicating that first time balancing chamber swithcing is done to trigger alarms from next cycle onwards. +static U32 balChamberFillCompleteStablePressureCounter; ///< Counter to check balancing chamber fill complete and stable pressure is met. static OVERRIDE_F32_T acidDoseVolume; ///< Acid concentrate volume in ml ( overrideable). static OVERRIDE_F32_T bicarbDoseVolume; ///< Bicarb concentrate volume in ml ( overrideable). static F32 lastTdDialysateFlowrate; ///< Previous TD dialysate flow rate @@ -403,10 +403,13 @@ F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); // Check fresh and spent dialysate pressure in range or BC switch only flag set - //if ( 1 ) +#ifndef __BC_PRESSURE_ALARM__ + if ( 1 ) +#else if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) || ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) +#endif { //Valve control for state 1 fill valveControlForBCState1FillStart(); @@ -428,10 +431,10 @@ } else { -//#ifdef ENABLE_ALARM_2 +#ifdef __BC_PRESSURE_ALARM__ //Alarm when pressure is not in range SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); -//#endif +#endif } return state; @@ -507,8 +510,7 @@ F32 spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh and spent dialysate pressure back in range to indicate fill complete. - //if ( 1 ) - //if ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) +#ifdef __BC_PRESSURE_ALARM__ if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) ) { @@ -519,7 +521,11 @@ isBalChamberFillInProgress = FALSE; } } +#else + isPressureStalbilizedDuringFill = FALSE; +#endif + // Switching time met or pressure in range, close valves if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || ( TRUE == isPressureStalbilizedDuringFill ) ) @@ -536,28 +542,26 @@ if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { +#ifdef __BC_PRESSURE_ALARM__ if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) { -//#ifdef ENABLE_ALARM_2 // When fill initiated, pressure is not dropped to the expected range, possible valve failures. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); -//#endif } else if ( TRUE != isPressureStalbilizedDuringFill ) { -//#ifdef ENABLE_ALARM_2 // Alarm when switching time expired, but still pressure not in range which indicates fill is not yet completed. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE1_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); -//#endif } else { // Move to next state when pressure is in range. state = BAL_CHAMBER_STATE2_FILL_START; } - - //TODO : Temporarily allow to proceed next state even though pressure is not stabilized. - //state = BAL_CHAMBER_STATE2_FILL_START; +#else + // Allow to proceed next state even though pressure is not stabilized. + state = BAL_CHAMBER_STATE2_FILL_START; +#endif } else { @@ -593,10 +597,13 @@ F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); // Check fresh and spent dialysate pressure in range - //if ( 1 ) +#ifndef __BC_PRESSURE_ALARM__ + if ( 1 ) +#else if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) || ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) +#endif { // Valve control for state 2 fill valveControlForBCState2FillStart(); @@ -618,10 +625,10 @@ } else { -//#ifdef ENABLE_ALARM_2 +#ifdef __BC_PRESSURE_ALARM__ //Alarm when pressure is not in range SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); -//#endif +#endif } return state; } @@ -646,8 +653,7 @@ F32 spentDialPressure = getFilteredPressure( D51_PRES ); // Check fresh and spent dialysate pressure back in range to indicate fill complete. - //if ( 1 ) - //if ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) +#ifdef __BC_PRESSURE_ALARM__ if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) && ( ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ) ) ) { @@ -657,8 +663,10 @@ isPressureStalbilizedDuringFill = TRUE; isBalChamberFillInProgress = FALSE; } - //isPressureStalbilizedDuringFill = FALSE; } +#else + isPressureStalbilizedDuringFill = FALSE; +#endif // Check switching cycle time or pressure check for valve closure if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || @@ -677,33 +685,32 @@ // Pressure alarm check if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { +#ifdef __BC_PRESSURE_ALARM__ if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) { -//#ifdef ENABLE_ALARM_2 // When fill initiated, pressure is not dropped to the expected range, possible valve failures. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); -//#endif } else if ( TRUE != isPressureStalbilizedDuringFill ) { -//#ifdef ENABLE_ALARM_2 // Alarm when switching time expired, but still pressure not in range which indicates fill is not completed. SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_END_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); -//#endif } else { // Move to next state when pressure is in range. state = BAL_CHAMBER_STATE1_FILL_START; + // Trigger pressure drop alarm after first cycle of balancing chamber switching complete if ( FALSE == isFirstCycleBCSwitchingCompleted ) { isFirstCycleBCSwitchingCompleted = TRUE; } } - - //TODO : Temporarily allow to proceed next state even though pressure is not stabilized. - //state = BAL_CHAMBER_STATE1_FILL_START; +#else + // Allow to proceed next state even though pressure is not stabilized. + state = BAL_CHAMBER_STATE1_FILL_START; +#endif } else { Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r4d529ed12453439c30f85108ce8b357a3df83348 -r51c295e1dc413d3774dae303e7f98b2f4c86bae4 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 4d529ed12453439c30f85108ce8b357a3df83348) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 51c295e1dc413d3774dae303e7f98b2f4c86bae4) @@ -51,7 +51,7 @@ #define HEATERS_DUTY_CYCLE_CONVERSION_FACTOR 100.0F ///< Heaters duty cycle 0: OFF, 100: 100% duty cycle. #define HEATERS_ZERO_EFFICIENCY 0.0F ///< Zero heater efficiency #define HEATER_CNTL_TRANSFER_DELTA_TEMP_C 0.50F ///< AC heater delta temperature to transfer control from open to close loop -#define MAX_ADJ_DELTA_TEMP_C 2.0F ///< Maximum adjusted delta temperature to add/remove from calculated target temperature +#define MAX_ADJ_DELTA_TEMP_C 3.0F ///< Maximum adjusted delta temperature to add/remove from calculated target temperature #define D5_HEAT_TX_INIT_FEED_FORWARD 0.0F ///< Initial Feed forward term for heater control //#define D5_HEAT_TX_P_COEFFICIENT 0.050F ///< P Term for AC primary heater control during treatment mode. Index: firmware/App/DDCommon.h =================================================================== diff -u -r573a26b2a0273a4983b1de1cbff5bed63e01dce0 -r51c295e1dc413d3774dae303e7f98b2f4c86bae4 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision 573a26b2a0273a4983b1de1cbff5bed63e01dce0) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision 51c295e1dc413d3774dae303e7f98b2f4c86bae4) @@ -36,9 +36,6 @@ //Uncomment the below line for new dosing pump testing //#define __PUMPTEST__ 1 -//Uncomment below line for future hardware version -//#define __ALPHA_AO_VER__ 1 - //Uncomment below for dialysate pump PI testing //#define __PITEST__ 1 @@ -57,6 +54,9 @@ //Uncomment below once characterization/study completed //#define ENABLE_ALARM_2 +//Uncomment below if balancing chamber pressure alarm is required +#define __BC_PRESSURE_ALARM__ 1 + //Uncomment below to disable heaters debug message #define __HEATERS_DEBUG__ 1