Index: firmware/App/Controllers/BalancingChamber.c =================================================================== diff -u -r8cc2ab43a8f0f051dd0ccb2a4768c0b12f4e44bc -r0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960 --- firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 8cc2ab43a8f0f051dd0ccb2a4768c0b12f4e44bc) +++ firmware/App/Controllers/BalancingChamber.c (.../BalancingChamber.c) (revision 0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960) @@ -7,8 +7,8 @@ * * @file BalancingChamber.c * -* @author (last) Sameer Kalliadan Poyil -* @date (last) 22-Feb-2026 +* @author (last) Jashwant Gantyada +* @date (last) 05-Mar-2026 * * @author (original) Vinayakam Mani * @date (original) 28-Jan-2025 @@ -19,10 +19,10 @@ #include "Conductivity.h" #include "ConcentratePumps.h" #include "DialysatePumps.h" -#include "DryBiCart.h" #include "FpgaDD.h" #include "Heaters.h" #include "ModeStandby.h" +#include "ModeGenDialysate.h" #include "Messaging.h" #include "OperationModes.h" #include "Pressure.h" @@ -39,16 +39,25 @@ // ********** private definitions ********** -#define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. -#define BAL_CHAMBER_FILL_PRES_DROP_MS ( 200 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber filling started and corresponding valves opened. -#define BAL_CHAMBER_FILL_COMPLETE_MS ( 300 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber fill completed and pressure is within range -#define BICARB_CHAMBER_PERIODIC_FILL_TIME ( 1 * SEC_PER_MIN * ( MS_PER_SECOND / TASK_GENERAL_INTERVAL ) ) ///< Periodic bicarb chamber fill request 60 sec x 20 = 1200 +#define BAL_CHAMBER_DATA_PUBLISH_INTERVAL ( 250 / TASK_GENERAL_INTERVAL ) ///< Interval (ms/task time) at which the balancing chamber data published. +#define BAL_CHAMBER_FILL_PRES_DROP_MS ( 200 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber filling started and corrosponding valves opened. +#define BAL_CHAMBER_FILL_COMPLETE_MS ( 300 / TASK_GENERAL_INTERVAL ) ///< Time (ms/tasktime) to confirm the balancing chamber fill completed and pressure is within range +#define SPENT_FILL_COMPLETE_PRES 25.0F ///< Spent fill complete pressure (PSI) for Diener 2000 pump. +#define SPENT_FILL_COMPLETE_PRES_QD_LOW_PSIG 3.5F ///< Spent fill complete pressure (PSI) when Diener 1000 and Qd <= 200. +#define SPENT_FILL_COMPLETE_PRES_QD_MID_PSIG 15.0F ///< Spent fill complete pressure (PSI) when Diener 1000 and 200 < Qd <= 400. +#define SPENT_FILL_COMPLETE_PRES_QD_HIGH_PSIG 20.0F ///< Spent fill complete pressure (PSI) when Diener 1000 and Qd > 400. +#define QD_THRESHOLD_LOW_MLPM 200.0F ///< Qd threshold (mL/min) below which low pressure limit applies. +#define QD_THRESHOLD_HIGH_MLPM 400.0F ///< Qd threshold (mL/min) below which mid pressure limit applies. +#define SPENT_DIFF_COUNT_ZERO 0 ///< Zero count difference for spent side fill comparing target count +#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) /// Payload record structure for balancing chamber switch only request typedef struct { - U32 startStop; ///< Balancing chamber switching only start:1 and stop: 0 - F32 flowrate; ///< Dialysate flowrate in ml/min + U32 startStop; ///< balancing chamber switching only start:1 and stop: 0 + F32 flowrate; ///< dialysate flowrate in ml/min } BC_SWITCHING_ONLY_START_CMD_PAYLOAD_T; // ********** private data ********** @@ -59,7 +68,7 @@ static U32 balChamberValveClosePeriod; ///< Close balancing chamber valves with the defined time prior switching state. 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 isPressureStabilizedDuringFill; ///< Flag indicating that the pressure is stabilized due to fill complete. +static BOOL isPressureStalbilizedDuringFill; ///< Flag indicating that the pressure is stablized due to fill complete. 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. @@ -80,6 +89,12 @@ //TODO: remove later once level sensor working static U32 bicarbChamberPeriodicFillCounter; ///< Counter for checking the timeout for drybicart chamber fill request. +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 S32 diffSpentFillCompleteCount; ///< Difference between spent target fill to actual fill count +static BOOL isSpentFillComplete; + // ********** private function prototypes ********** static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillStart( void ); @@ -92,6 +107,7 @@ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberStateIdle( void ); static void publishBalChamberData( void ); static U32 getBalChamberDataPublishInterval( void ); +static void checkSpentFillComplete( F32 spentDialPressure ); /*********************************************************************//** * @brief @@ -125,7 +141,7 @@ balChamberValveClosePeriod = 0; isBalChamberFillInProgress = FALSE; currentBalChamberSwitchingCounter = 0; - isPressureStabilizedDuringFill = FALSE; + isPressureStalbilizedDuringFill = FALSE; lastTdDialysateFlowrate = 0.0F; balChamberDataPublicationTimerCounter = 0; balChamberFillPressureDropCounter = 0; @@ -140,8 +156,14 @@ //TODO:remove once level sensor working bicarbChamberPeriodicFillCounter = 0; - } + prevSpentDialPressure = 0.0F; + lastPrevSpentDialPressure = 0.0F; + currentBalChamberFillCounter = 0; + diffSpentFillCompleteCount = 0; + isSpentFillComplete = FALSE; +} + /*********************************************************************//** * @brief * The transitionToBalChamberFill function prepares for transition to @@ -206,24 +228,9 @@ { // Increment counter indicating fill is in progress. currentBalChamberSwitchingCounter += 1; + currentBalChamberFillCounter += 1; - if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DRY_BICARB ) == TRUE ) - { - //Increment counter for dry bicarb chamber fill - bicarbChamberPeriodicFillCounter += 1; - // Fill bicarb chamber once every 60secs. - if ( bicarbChamberPeriodicFillCounter >= BICARB_CHAMBER_PERIODIC_FILL_TIME ) - { - if ( FALSE == setBicarbChamberFillRequested() ) - { - // TODO - //drybicart state machines are combined and so this is not an issue in future - //set alarm ? - } - bicarbChamberPeriodicFillCounter = 0; - } - } - + // execute current balancing chamber exec state switch ( balChamberExecState ) { case BAL_CHAMBER_STATE_IDLE: @@ -296,43 +303,20 @@ /*********************************************************************//** * @brief - * The valveControlForBCClosedState function closes the all balancing - * chamber valves. + * The valveControlForBCState1FillStart function actuates the valve combination + * for state 1 fill/drain process. * @details \b Inputs: none * @details \b Outputs: valve states * @return none. *************************************************************************/ -void valveControlForBCClosedState( void ) +static void valveControlForBCState1FillStart( void ) { // Close balancing chamber valve combinations D23,D20 and D21,D26 setValveState( D23_VALV, VALVE_STATE_CLOSED ); setValveState( D20_VALV, VALVE_STATE_CLOSED ); setValveState( D21_VALV, VALVE_STATE_CLOSED ); setValveState( D26_VALV, VALVE_STATE_CLOSED ); - //Close balancing chamber valve combinations D19,D24 and D25,D22 - setValveState( D19_VALV, VALVE_STATE_CLOSED ); - setValveState( D24_VALV, VALVE_STATE_CLOSED ); - setValveState( D25_VALV, VALVE_STATE_CLOSED ); - setValveState( D22_VALV, VALVE_STATE_CLOSED ); -} - -/*********************************************************************//** - * @brief - * The valveControlForBCOpenState function opens all of the balancing - * chamber valves. - * @details \b Inputs: none - * @details \b Outputs: valve states - * @return none. - *************************************************************************/ -void valveControlForBCOpenState( void ) -{ - // Open balancing chamber valve combinations D23,D20 and D21,D26 - setValveState( D23_VALV, VALVE_STATE_OPEN ); - setValveState( D20_VALV, VALVE_STATE_OPEN ); - setValveState( D21_VALV, VALVE_STATE_OPEN ); - setValveState( D26_VALV, VALVE_STATE_OPEN ); - //Open balancing chamber valve combinations D19,D24 and D25,D22 setValveState( D19_VALV, VALVE_STATE_OPEN ); setValveState( D24_VALV, VALVE_STATE_OPEN ); @@ -342,115 +326,46 @@ /*********************************************************************//** * @brief - * The valveControlForBCFreshSideOnlyOpenState function opens the fresh side - * balancing chamber valves and closes the spent side valves. + * The valveControlForBCState1FillEnd function closes the valve opened + * for state 1 fill/drain process. * @details \b Inputs: none * @details \b Outputs: valve states * @return none. *************************************************************************/ -void valveControlForBCFreshSideOnlyOpenState( void ) +static void valveControlForBCState1FillEnd( void ) { - // Open fresh balancing chamber valves D19,D20,D21,D22 - setValveState( D19_VALV, VALVE_STATE_OPEN ); - setValveState( D20_VALV, VALVE_STATE_OPEN ); - setValveState( D21_VALV, VALVE_STATE_OPEN ); - setValveState( D22_VALV, VALVE_STATE_OPEN ); - - // Close spent side valves D23,D24,D25,D26 - setValveState( D23_VALV, VALVE_STATE_CLOSED ); - setValveState( D25_VALV, VALVE_STATE_CLOSED ); + //Close balancing chamber valve combinations D19,D24 and D25,D22 + setValveState( D19_VALV, VALVE_STATE_CLOSED ); setValveState( D24_VALV, VALVE_STATE_CLOSED ); - setValveState( D26_VALV, VALVE_STATE_CLOSED ); + setValveState( D25_VALV, VALVE_STATE_CLOSED ); + setValveState( D22_VALV, VALVE_STATE_CLOSED ); } /*********************************************************************//** * @brief - * The getCurrentBalancingChamberExecState function returns the current state - * of the balancing chamber. - * @details \b Inputs: balChamberExecState - * @details \b Outputs: none - * @return the current state of balancing chamber states. + * The valveControlForBCState2FillStart function actuates the valve combination + * for state 2 fill/drain process. + * @details \b Inputs: none + * @details \b Outputs: valve states + * @return none. *************************************************************************/ -BAL_CHAMBER_EXEC_STATE_T getCurrentBalancingChamberExecState( void ) +static void valveControlForBCState2FillStart( void ) { - return balChamberExecState; -} + //Close balancing chamber valve combinations D19,D24 and D25,D22 + setValveState( D19_VALV, VALVE_STATE_CLOSED ); + setValveState( D24_VALV, VALVE_STATE_CLOSED ); + setValveState( D25_VALV, VALVE_STATE_CLOSED ); + setValveState( D22_VALV, VALVE_STATE_CLOSED ); -/*********************************************************************//** - * @brief - * The getBalancingChamberFillinProgressStatus function returns the current - * balancing chamber fill in progress status. - * @details \b Inputs: isBalChamberFillInProgress - * @details \b Outputs: none - * @return the current balancing chamber fill in progress. - *************************************************************************/ -BOOL getBalancingChamberFillinProgressStatus( void ) -{ - return isBalChamberFillInProgress; + // Open balancing chamber valve combinations D23,D20 and D21,D26 + setValveState( D23_VALV, VALVE_STATE_OPEN ); + setValveState( D20_VALV, VALVE_STATE_OPEN ); + setValveState( D21_VALV, VALVE_STATE_OPEN ); + setValveState( D26_VALV, VALVE_STATE_OPEN ); } /*********************************************************************//** * @brief - * The getBalChamberSwitchingFreq function gets the balancing chamber switching - * frequency value. - * @details \b Inputs: balChamberSwitchingFreq - * @details \b Outputs: none - * @return balancing chamber switching frequency - *************************************************************************/ -F32 getBalChamberSwitchingFreq( void ) -{ - F32 result = balChamberSwitchingFreq.data; - - if ( OVERRIDE_KEY == balChamberSwitchingFreq.override ) - { - result = balChamberSwitchingFreq.ovData; - } - - return result; -} - -/*********************************************************************//** - * @brief - * The setBalChamberSwitchingOnlyStatus function sets the balancing chamber - * switching only On/Off status. - * @details \b Inputs: balanceChamberSwitchingOnly - * @details \b Outputs: none - * @return none - *************************************************************************/ -void setBalChamberSwitchingOnlyStatus( BOOL OnOff ) -{ - balanceChamberSwitchingOnly = OnOff; -} - -/*********************************************************************//** - * @brief - * The getBalChamberSwitchingOnlyStatus function gets the balancing chamber - * switching only status. - * @details \b Inputs: balanceChamberSwitchingOnly - * @details \b Outputs: none - * @return balancing chamber switching only without any pressure validation - * and dosing delivery - *************************************************************************/ -BOOL getBalChamberSwitchingOnlyStatus( void ) -{ - return balanceChamberSwitchingOnly; -} - -/*********************************************************************//** - * @brief - * The getBalChamberSwitchingPeriod function gets the balancing chamber - * switching period. - * @details \b Inputs: balChamberSwitchingPeriod - * @details \b Outputs: none - * @return balancing chamber switching period - *************************************************************************/ -U32 getBalChamberSwitchingPeriod( void ) -{ - return balChamberSwitchingPeriod; -} - -/*********************************************************************//** - * @brief * The valveControlForBCState2FillEnd function closes the valve opened * for state 2 fill/drain process. * @details \b Inputs: none @@ -468,65 +383,71 @@ /*********************************************************************//** * @brief - * The valveControlForBCState1FillStart function actuates the valve combination - * for state 1 fill/drain process. + * The valveControlForBCClosedState function closes the all balancing + * chamber valves. * @details \b Inputs: none * @details \b Outputs: valve states * @return none. *************************************************************************/ -static void valveControlForBCState1FillStart( void ) +void valveControlForBCClosedState( void ) { // Close balancing chamber valve combinations D23,D20 and D21,D26 setValveState( D23_VALV, VALVE_STATE_CLOSED ); setValveState( D20_VALV, VALVE_STATE_CLOSED ); setValveState( D21_VALV, VALVE_STATE_CLOSED ); setValveState( D26_VALV, VALVE_STATE_CLOSED ); - //Open balancing chamber valve combinations D19,D24 and D25,D22 - setValveState( D19_VALV, VALVE_STATE_OPEN ); - setValveState( D24_VALV, VALVE_STATE_OPEN ); - setValveState( D25_VALV, VALVE_STATE_OPEN ); - setValveState( D22_VALV, VALVE_STATE_OPEN ); + //Close balancing chamber valve combinations D19,D24 and D25,D22 + setValveState( D19_VALV, VALVE_STATE_CLOSED ); + setValveState( D24_VALV, VALVE_STATE_CLOSED ); + setValveState( D25_VALV, VALVE_STATE_CLOSED ); + setValveState( D22_VALV, VALVE_STATE_CLOSED ); } /*********************************************************************//** * @brief - * The valveControlForBCState1FillEnd function closes the valve opened - * for state 1 fill/drain process. + * The valveControlForBCOpenState function open the all balancing + * chamber valves. * @details \b Inputs: none * @details \b Outputs: valve states * @return none. *************************************************************************/ -static void valveControlForBCState1FillEnd( void ) +void valveControlForBCOpenState( void ) { - //Close balancing chamber valve combinations D19,D24 and D25,D22 - setValveState( D19_VALV, VALVE_STATE_CLOSED ); - setValveState( D24_VALV, VALVE_STATE_CLOSED ); - setValveState( D25_VALV, VALVE_STATE_CLOSED ); - setValveState( D22_VALV, VALVE_STATE_CLOSED ); + // Open balancing chamber valve combinations D23,D20 and D21,D26 + setValveState( D23_VALV, VALVE_STATE_OPEN ); + setValveState( D20_VALV, VALVE_STATE_OPEN ); + setValveState( D21_VALV, VALVE_STATE_OPEN ); + setValveState( D26_VALV, VALVE_STATE_OPEN ); + + //Open balancing chamber valve combinations D19,D24 and D25,D22 + setValveState( D19_VALV, VALVE_STATE_OPEN ); + setValveState( D24_VALV, VALVE_STATE_OPEN ); + setValveState( D25_VALV, VALVE_STATE_OPEN ); + setValveState( D22_VALV, VALVE_STATE_OPEN ); } /*********************************************************************//** * @brief - * The valveControlForBCState2FillStart function actuates the valve combination - * for state 2 fill/drain process. + * The valveControlForBCFreshSideOnlyOpenState function opens the fresh side + * balancing chamber valves and closes the spent side valves. * @details \b Inputs: none * @details \b Outputs: valve states * @return none. *************************************************************************/ -static void valveControlForBCState2FillStart( void ) +void valveControlForBCFreshSideOnlyOpenState( void ) { - //Close balancing chamber valve combinations D19,D24 and D25,D22 - setValveState( D19_VALV, VALVE_STATE_CLOSED ); - setValveState( D24_VALV, VALVE_STATE_CLOSED ); - setValveState( D25_VALV, VALVE_STATE_CLOSED ); - setValveState( D22_VALV, VALVE_STATE_CLOSED ); - - // Open balancing chamber valve combinations D23,D20 and D21,D26 - setValveState( D23_VALV, VALVE_STATE_OPEN ); + // Open fresh balancing chamber valves D19,D20,D21,D22 + setValveState( D19_VALV, VALVE_STATE_OPEN ); setValveState( D20_VALV, VALVE_STATE_OPEN ); setValveState( D21_VALV, VALVE_STATE_OPEN ); - setValveState( D26_VALV, VALVE_STATE_OPEN ); + setValveState( D22_VALV, VALVE_STATE_OPEN ); + + // Close spent side valves D23,D24,D25,D26 + setValveState( D23_VALV, VALVE_STATE_CLOSED ); + setValveState( D25_VALV, VALVE_STATE_CLOSED ); + setValveState( D24_VALV, VALVE_STATE_CLOSED ); + setValveState( D26_VALV, VALVE_STATE_CLOSED ); } /*********************************************************************//** @@ -536,17 +457,21 @@ * @details \b Inputs: Pressure * @details \b Outputs: valve states * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_START_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balacing chamber fill start. + * when pressure is not in range during balancing chamber fill start. * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillStart( void ) { BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_FILL_START; currentBalChamberSwitchingCounter = 0; + balChamberSWState = BAL_CHAMBER_SW_STATE1; + currentBalChamberFillCounter = 0; isBalChamberFillInProgress = FALSE; - isPressureStabilizedDuringFill = FALSE; + isPressureStalbilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; - balChamberSWState = BAL_CHAMBER_SW_STATE1; + isSpentFillComplete = FALSE; + lastPrevSpentDialPressure = 0.0F; + prevSpentDialPressure = 0.0F; F32 acidVolume = getF32OverrideValue( &acidDoseVolume ); F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); @@ -564,13 +489,9 @@ setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); } - BOOL isFreshDialysatePressureInRange = ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ); - BOOL isSpentDialysatePressureInRange = ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ); - BOOL isBCSwitchOnlyStatus = ( TRUE == getBalChamberSwitchingOnlyStatus() ); - BOOL isDisableBCPressureAlarms = ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ); - // Check fresh and spent dialysate pressure in range or BC switch only flag set - if ( ( TRUE == isFreshDialysatePressureInRange && TRUE == isSpentDialysatePressureInRange ) || ( TRUE == isBCSwitchOnlyStatus ) || ( TRUE == isDisableBCPressureAlarms ) ) + if ( ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) || + ( TRUE == getBalChamberSwitchingOnlyStatus() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) { //Valve control for state 1 fill valveControlForBCState1FillStart(); @@ -581,9 +502,9 @@ // Deliver dosing during generate dialysate mode if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { - // start acid and bicarb pump with the expected rate, speed in mL/min - setConcentratePumpTargetSpeed( D11_PUMP, DOSING_CONCENTRATE_PUMP_SPEED, acidVolume ); - setConcentratePumpTargetSpeed( D10_PUMP, DOSING_CONCENTRATE_PUMP_SPEED, bicarbVolume ); + // start acid and bicarb pump with the expected quantity + setConcentratePumpTargetSpeed( D11_PUMP, CONCENTRATE_PUMP_MAX_SPEED, acidVolume ); + setConcentratePumpTargetSpeed( D10_PUMP, CONCENTRATE_PUMP_MAX_SPEED, bicarbVolume ); requestConcentratePumpOn( D11_PUMP ); requestConcentratePumpOn( D10_PUMP ); } @@ -605,7 +526,7 @@ /*********************************************************************//** * @brief * The handleBalChamberConcentrateControl function handles the Acid and Bicarb - * concentrate doisng and checks the conductivity of the dialysate for the treatment. + * concentrate dosing and checks the conductivity of the dialysate for the treatment. * @details \b Inputs: balChamberSWState , Concentrate volume * @details \b Outputs: isPressureDroppedDuringFill, state * @return next balancing chamber state. @@ -616,7 +537,7 @@ freshDialPressure = getFilteredPressure( D18_PRES ); spentDialPressure = getFilteredPressure( D51_PRES ); - if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) + if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) { state = BAL_CHAMBER_STATE1_BICARB_ACID_DOSING_CNTRL; } @@ -639,6 +560,10 @@ ( TRUE == isConcentratePumpDosingCompleted( D10_PUMP ) ) ) || ( TRUE == getBalChamberSwitchingOnlyStatus() ) ) { + //Collect first sample of spent pressure + lastPrevSpentDialPressure = prevSpentDialPressure; + prevSpentDialPressure = spentDialPressure; + if ( BAL_CHAMBER_SW_STATE1 == balChamberSWState ) { state = BAL_CHAMBER_STATE1_VALVES_CLOSE; @@ -657,38 +582,41 @@ * The handleBalChamberState1ValvesClose function check for the balancing chamber * fill complete and close the currently opened valves. * @details \b Inputs: currentBalChamberSwitchingCounter, spent and fresh dialysate pressure - * @details \b Outputs: isPressureStabilizedDuringFill,isBalChamberFillInProgress + * @details \b Outputs: isPressureStalbilizedDuringFill,isBalChamberFillInProgress * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1ValvesClose( void ) { BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_VALVES_CLOSE; + freshDialPressure = getFilteredPressure( D18_PRES ); + spentDialPressure = getFilteredPressure( D51_PRES ); - freshDialPressure = getFilteredPressure( D18_PRES ); - spentDialPressure = getFilteredPressure( D51_PRES ); - - BOOL isFreshDialysatePressureInRange = ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ); - BOOL isSpentDialysatePressureInRange = ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ); - - // Check fresh and spent dialysate pressure back in range to indicate fill complete. - if ( TRUE == isFreshDialysatePressureInRange && TRUE == isSpentDialysatePressureInRange ) + // 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 ) ) { if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) { - // stabilized pressure indicating fill is complete - isPressureStabilizedDuringFill = TRUE; + // stabilized pressure indicating fresh side fill is complete + isPressureStalbilizedDuringFill = TRUE; } } - // Switching time met or pressure in range, close valves - if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || - ( TRUE == isPressureStabilizedDuringFill ) ) + // Spent side of balancing chamber fill is complete or not + checkSpentFillComplete( spentDialPressure ); + + // Check both spent and fresh side fill is complete + if ( ( TRUE == isSpentFillComplete ) && ( TRUE == isPressureStalbilizedDuringFill ) || ( FALSE == isFirstCycleBCSwitchingCompleted ) ) { // close the state 1 opened valves valveControlForBCState1FillEnd(); isBalChamberFillInProgress = FALSE; + //setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + if ( TRUE == isFirstCycleBCSwitchingCompleted ) + { + setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + } - //Transition to next state + // Transition to next state state = BAL_CHAMBER_STATE1_FILL_END; } @@ -698,56 +626,52 @@ /*********************************************************************//** * @brief * The handleBalChamberState1FillEnd function check for the balancing chamber - * switching period and tranistion to next state switching. + * switching period and transition to next state switching. * @details \b Inputs: currentBalChamberSwitchingCounter, balChamberSwitchingPeriod * @details \b Outputs: balChamberFillPressureDropCounter,balChamberFillCompleteStablePressureCounter * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_PRESSURE_DROP_OUT_OF_RANGE - * when pressure drop is not in range during balacing chamber fill in progress. + * when pressure drop is not in range during balancing chamber fill in progress. * @details \b Alarm: ALARM_ID_DD_BC_STATE1_FILL_END_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balacing chamber fill complete. + * when pressure is not in range during balancing chamber fill complete. * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState1FillEnd( void ) { BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE1_FILL_END; - // On completion of cycle time, transition to next state - if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) - { - balChamberFillPressureDropCounter = 0; - balChamberFillCompleteStablePressureCounter = 0; + balChamberFillPressureDropCounter = 0; + balChamberFillCompleteStablePressureCounter = 0; - if ( TRUE != getBalChamberSwitchingOnlyStatus() ) + if ( TRUE != getBalChamberSwitchingOnlyStatus() ) + { + if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) { - if ( getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) != TRUE ) + if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) { - if ( ( TRUE != isPressureDroppedDuringFill ) && ( TRUE == isFirstCycleBCSwitchingCompleted ) ) - { - // 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 ); - } - else if ( TRUE != isPressureStabilizedDuringFill ) - { - // 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 ); - } - else - { - // Move to next state when pressure is in range. - state = BAL_CHAMBER_STATE2_FILL_START; - } + // 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 ); } + else if ( TRUE != isPressureStalbilizedDuringFill ) + { + // 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 ); + } else { - // Allow to proceed next state even though pressure is not stabilized. + // Move to next state when pressure is in range. state = BAL_CHAMBER_STATE2_FILL_START; } } else { + // Allow to proceed next state even though pressure is not stabilized. state = BAL_CHAMBER_STATE2_FILL_START; } } + else + { + state = BAL_CHAMBER_STATE2_FILL_START; + } // Keep Clearing the On request flag in case an On request was made while the switching is active isBalChamberSwitchingOnRequested = FALSE; @@ -775,17 +699,21 @@ * @details \b Inputs: fresh and spent dialysate pressure * @details \b Outputs: valve states * @details \b Alarm: ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE - * when pressure is not in range during balacing chamber state 2 fill start. + * when pressure is not in range during balancing chamber state 2 fill start. * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2FillStart( void ) { BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE2_FILL_START; currentBalChamberSwitchingCounter = 0; isBalChamberFillInProgress = FALSE; - isPressureStabilizedDuringFill = FALSE; + isPressureStalbilizedDuringFill = FALSE; isPressureDroppedDuringFill = FALSE; balChamberSWState = BAL_CHAMBER_SW_STATE2; + currentBalChamberFillCounter = 0; + isSpentFillComplete = FALSE; + lastPrevSpentDialPressure = 0.0F; + prevSpentDialPressure = 0.0F; F32 acidVolume = getF32OverrideValue( &acidDoseVolume ); F32 bicarbVolume = getF32OverrideValue( &bicarbDoseVolume ); @@ -803,13 +731,10 @@ setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); } - BOOL isFreshDialysatePressureInRange = ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ); - BOOL isSpentDialysatePressureInRange = ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ); - BOOL isBCSwitchOnlyStatus = ( TRUE == getBalChamberSwitchingOnlyStatus() ); - BOOL isDisableBCPressureAlarms = ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ); - - // Check fresh and spent dialysate pressure in range - if ( ( TRUE == isFreshDialysatePressureInRange && TRUE == isSpentDialysatePressureInRange ) || ( TRUE == isBCSwitchOnlyStatus ) || ( TRUE == isDisableBCPressureAlarms ) ) + // Check fresh dialysate pressure in range + 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() ) || ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_DISABLE_BC_PRESSURE_ALARMS ) ) ) { // Valve control for state 2 fill valveControlForBCState2FillStart(); @@ -820,9 +745,9 @@ // Deliver dosing during generate dialysate mode if ( TRUE != getBalChamberSwitchingOnlyStatus() ) { - // start acid and bicarb pump with the expected rate, speed in mL/min - setConcentratePumpTargetSpeed( D11_PUMP, DOSING_CONCENTRATE_PUMP_SPEED, acidVolume ); - setConcentratePumpTargetSpeed( D10_PUMP, DOSING_CONCENTRATE_PUMP_SPEED, bicarbVolume ); + // start acid and bicarb pump with the expected quantity + setConcentratePumpTargetSpeed( D11_PUMP, CONCENTRATE_PUMP_MAX_SPEED, acidVolume ); + setConcentratePumpTargetSpeed( D10_PUMP, CONCENTRATE_PUMP_MAX_SPEED, bicarbVolume ); requestConcentratePumpOn( D11_PUMP ); requestConcentratePumpOn( D10_PUMP ); } @@ -837,6 +762,7 @@ SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DD_BC_STATE2_FILL_START_PRESSURE_OUT_OF_RANGE, freshDialPressure, spentDialPressure ); } } + return state; } @@ -845,7 +771,7 @@ * The handleBalChamberState2ValvesClose function check for the balancing chamber * fill complete and close the currently opened valves. * @details \b Inputs: currentBalChamberSwitchingCounter, spent and fresh dialysate pressure - * @details \b Outputs: isPressureStabilizedDuringFill,isBalChamberFillInProgress + * @details \b Outputs: isPressureStalbilizedDuringFill,isBalChamberFillInProgress * @return next balancing chamber state. *************************************************************************/ static BAL_CHAMBER_EXEC_STATE_T handleBalChamberState2ValvesClose( void ) @@ -859,22 +785,29 @@ BOOL isSpentDialysatePressureInRange = ( spentDialPressure >= SPENT_DIAL_PRESSURE_MIN_PSIG ) && ( spentDialPressure <= SPENT_DIAL_PRESSURE_MAX_PSIG ); // Check fresh and spent dialysate pressure back in range to indicate fill complete. - if ( ( TRUE == isFreshDialysatePressureInRange ) && ( TRUE == isSpentDialysatePressureInRange ) ) + if ( ( freshDialPressure >= FRESH_DIAL_PRESSURE_MIN_PSIG ) && ( freshDialPressure <= FRESH_DIAL_PRESSURE_MAX_PSIG ) ) { if ( ++balChamberFillCompleteStablePressureCounter >= BAL_CHAMBER_FILL_COMPLETE_MS ) { - // stabilized pressure indicating fill is complete - isPressureStabilizedDuringFill = TRUE; + // stabilized pressure indicating fresh side fill is complete + isPressureStalbilizedDuringFill = TRUE; } } + // Spent side of balancing chamber fill is complete or not + checkSpentFillComplete( spentDialPressure ); + // Check switching cycle time or pressure check for valve closure - if ( ( currentBalChamberSwitchingCounter >= balChamberValveClosePeriod ) || - ( TRUE == isPressureStabilizedDuringFill ) ) + if ( ( TRUE == isSpentFillComplete ) && ( TRUE == isPressureStalbilizedDuringFill ) || ( FALSE == isFirstCycleBCSwitchingCompleted ) ) { // close the valves valveControlForBCState2FillEnd(); isBalChamberFillInProgress = FALSE; + //setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + if ( TRUE == isFirstCycleBCSwitchingCompleted ) + { + setDialysatePumpTargetRPM( D48_PUMP, getD48PumpSpeedForBCFill(), TRUE ); + } //Transition to next state state = BAL_CHAMBER_STATE2_FILL_END; @@ -888,7 +821,7 @@ * The handleBalChamberState2FillEnd function check for the balancing chamber * switching period complete and transition to next state. * @details \b Inputs: currentBalChamberSwitchingCounter, balChamberSwitchingPeriod - * @details \b Outputs: isPressureStabilizedDuringFill,isBalChamberFillInProgress + * @details \b Outputs: isPressureStalbilizedDuringFill,isBalChamberFillInProgress * @details \b Alarm: ALARM_ID_DD_BC_STATE2_FILL_PRESSURE_DROP_OUT_OF_RANGE * when pressure is not in range during balacing chamber state 2 fill in progress. * @details \b Alarm: ALARM_ID_DD_BC_STATE2_FILL_END_PRESSURE_OUT_OF_RANGE @@ -899,11 +832,8 @@ { BAL_CHAMBER_EXEC_STATE_T state = BAL_CHAMBER_STATE2_FILL_END; - // On completion of cycle time, transition to next state - if ( currentBalChamberSwitchingCounter >= balChamberSwitchingPeriod ) - { - balChamberFillPressureDropCounter = 0; - balChamberFillCompleteStablePressureCounter = 0; + balChamberFillPressureDropCounter = 0; + balChamberFillCompleteStablePressureCounter = 0; // Pressure alarm check if ( TRUE != getBalChamberSwitchingOnlyStatus() ) @@ -915,7 +845,7 @@ // 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 ); } - else if ( TRUE != isPressureStabilizedDuringFill ) + else if ( TRUE != isPressureStalbilizedDuringFill ) { // 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 ); @@ -924,12 +854,6 @@ { // 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; - } } } else @@ -942,8 +866,13 @@ { state = BAL_CHAMBER_STATE1_FILL_START; } - } + // Trigger pressure drop alarm after first cycle of balancing chamber switching complete + if ( FALSE == isFirstCycleBCSwitchingCompleted ) + { + isFirstCycleBCSwitchingCompleted = TRUE; + } + // Keep Clearing the On request flag in case an On request was made while the switching is active isBalChamberSwitchingOnRequested = FALSE; @@ -995,6 +924,173 @@ /*********************************************************************//** * @brief + * The checkSpentFillComplete function checks the pressure difference for + * spent side fill completion and adjusts the D48 pump speed to align the + * fill timing close to the switching period time. + * @details \b Inputs: balChamberExecState + * @details \b Outputs: none + * @return the current state of balancing chamber states. + *************************************************************************/ +static void checkSpentFillComplete( F32 spentDialPressure ) +{ + F32 diffInSpentPressure = 0.0F; + U32 absDiffSpentFillCount = 0; + U32 adjustedSpeed = 0; + U32 spentDialPumpSpeed = getD48PumpSpeedForBCFill(); + U32 initialD48PumpSpeed = getCalculatedD48PumpSpeedForBCFill(); + U32 minD48Speed = initialD48PumpSpeed - ( initialD48PumpSpeed * D48_SPEED_RANGE_LIMIT ); + U32 maxD48Speed = initialD48PumpSpeed + ( initialD48PumpSpeed * D48_SPEED_RANGE_LIMIT ); + U32 d48SpeedPostRangeCheck = 0; + F32 qdMlpm = getTDDialysateFlowrate(); + F32 spentFillCompletePresPsig; + + // Diener 1000 pump: spent fill complete pressure depends on Qd (7/15/20 PSI). Other pump: use legacy 25 PSI. + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DIENER_1000_PUMP ) ) + { + if ( qdMlpm <= QD_THRESHOLD_LOW_MLPM ) + { + spentFillCompletePresPsig = SPENT_FILL_COMPLETE_PRES_QD_LOW_PSIG; + } + else if ( qdMlpm <= QD_THRESHOLD_HIGH_MLPM ) + { + spentFillCompletePresPsig = SPENT_FILL_COMPLETE_PRES_QD_MID_PSIG; + } + else + { + spentFillCompletePresPsig = SPENT_FILL_COMPLETE_PRES_QD_HIGH_PSIG; + } + } + else + { + spentFillCompletePresPsig = SPENT_FILL_COMPLETE_PRES; + } + + // Collect the next sample of spent pressure + lastPrevSpentDialPressure = prevSpentDialPressure; + prevSpentDialPressure = spentDialPressure; + // find the pressure difference for pressure spike detection + diffInSpentPressure = fabs(spentDialPressure - lastPrevSpentDialPressure); + + if ( ( spentDialPressure >= spentFillCompletePresPsig ) && ( isSpentFillComplete != TRUE ) ) + { + // Check spent fill time against the balancing chamber closing period + diffSpentFillCompleteCount = balChamberValveClosePeriod - currentBalChamberFillCounter; + absDiffSpentFillCount = abs(diffSpentFillCompleteCount); + adjustedSpeed = ( ( (F32)absDiffSpentFillCount / (F32)balChamberValveClosePeriod ) * spentDialPumpSpeed ) * D48_SPEED_ADJUST_FACTOR; + + //Not adjust the D48 pump speed if the fill counter is just 50ms difference from the closing period. + if ( absDiffSpentFillCount > SPENT_DIFF_COUNT_DEADBAND ) + { + if ( diffSpentFillCompleteCount < SPENT_DIFF_COUNT_ZERO ) + { + // Increase the D48 pump speed + spentDialPumpSpeed += adjustedSpeed; + } + else + { + //Decrease the D48 pump speed + spentDialPumpSpeed -= adjustedSpeed; + } + + d48SpeedPostRangeCheck = RANGE( spentDialPumpSpeed, minD48Speed, maxD48Speed ); + + // Update the D48 pump speed + setD48PumpSpeedForBCFill( d48SpeedPostRangeCheck ); + } + + //Update spent fill is complete + isSpentFillComplete = TRUE; + } +} + +/*********************************************************************//** + * @brief + * The getCurrentBalancingChamberExecState function returns the current state + * of the balancing chamber. + * @details \b Inputs: balChamberExecState + * @details \b Outputs: none + * @return the current state of balancing chamber states. + *************************************************************************/ +BAL_CHAMBER_EXEC_STATE_T getCurrentBalancingChamberExecState( void ) +{ + return balChamberExecState; +} + +/*********************************************************************//** + * @brief + * The getBalancingChamberFillinProgressStatus function returns the current + * balancing chamber fill in progress status. + * @details \b Inputs: isBalChamberFillInProgress + * @details \b Outputs: none + * @return the current balancing chamber fill in progress. + *************************************************************************/ +BOOL getBalancingChamberFillinProgressStatus( void ) +{ + return isBalChamberFillInProgress; +} + +/*********************************************************************//** + * @brief + * The getBalChamberSwitchingFreq function gets the balancing chamber switching + * frequency value. + * @details \b Inputs: balChamberSwitchingFreq + * @details \b Outputs: none + * @return balancing chamber switching frequency + *************************************************************************/ +F32 getBalChamberSwitchingFreq( void ) +{ + F32 result = balChamberSwitchingFreq.data; + + if ( OVERRIDE_KEY == balChamberSwitchingFreq.override ) + { + result = balChamberSwitchingFreq.ovData; + } + + return result; +} + +/*********************************************************************//** + * @brief + * The setBalChamberSwitchingOnlyStatus function sets the balancing chamber + * switching only On/Off status. + * @details \b Inputs: balanceChamberSwitchingOnly + * @details \b Outputs: none + * @return none + *************************************************************************/ +void setBalChamberSwitchingOnlyStatus( BOOL OnOff ) +{ + balanceChamberSwitchingOnly = OnOff; +} + +/*********************************************************************//** + * @brief + * The getBalChamberSwitchingOnlyStatus function gets the balancing chamber + * switching only status. + * @details \b Inputs: balanceChamberSwitchingOnly + * @details \b Outputs: none + * @return balancing chamber switching only without any pressure validation + * and dosing delivery + *************************************************************************/ +BOOL getBalChamberSwitchingOnlyStatus( void ) +{ + return balanceChamberSwitchingOnly; +} + +/*********************************************************************//** + * @brief + * The getBalChamberSwitchingPeriod function gets the balancing chamber + * switching period. + * @details \b Inputs: balChamberSwitchingPeriod + * @details \b Outputs: none + * @return balancing chamber switching period + *************************************************************************/ +U32 getBalChamberSwitchingPeriod( void ) +{ + return balChamberSwitchingPeriod; +} + +/*********************************************************************//** + * @brief * The getBalChamberDataPublishInterval function gets the balancing chamber * data publish interval. * @details \b Inputs: balChamberDataPublishInterval @@ -1032,10 +1128,10 @@ data.balChamberExecState = (U32)balChamberExecState; data.balChamberSWState = (U32)balChamberSWState; data.balChamberSWFreq = getBalChamberSwitchingFreq(); - data.balChamberSwPeriod = balChamberSwitchingPeriod; - data.isBalChamberFillInProgress = isBalChamberFillInProgress; - data.currentBalChamberSwitchingCounter = currentBalChamberSwitchingCounter; - data.isPressureStabilizedDuringFill = isPressureStabilizedDuringFill; + data.balChamberSwPeriod = getD48PumpSpeedForBCFill(); + data.isBalChamberFillInProgress = isSpentFillComplete; + data.currentBalChamberSwitchingCounter = currentBalChamberFillCounter; + data.isPressureStabilizedDuringFill = isPressureStalbilizedDuringFill; data.balChamberSWOnlyState = balanceChamberSwitchingOnly; data.isBalChamberSwitchingActive = isBalChamberSwitchingActive; @@ -1133,7 +1229,7 @@ { BOOL result = FALSE; - // Verify tester has logged in with DD + // Verify tester has logged in with TD if ( TRUE == isTestingActivated() ) { // Verify payload length is valid Index: firmware/App/Controllers/BalancingChamber.h =================================================================== diff -u -r97eba3d39e6ddf44276b77b1aea1171805ca142d -r0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960 --- firmware/App/Controllers/BalancingChamber.h (.../BalancingChamber.h) (revision 97eba3d39e6ddf44276b77b1aea1171805ca142d) +++ firmware/App/Controllers/BalancingChamber.h (.../BalancingChamber.h) (revision 0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960) @@ -50,6 +50,7 @@ U32 currentBalChamberSwitchingCounter; ///< Current balancing chamber switching counter BOOL isPressureStabilizedDuringFill; ///< Whether pressure stabilized during fill or not BOOL balChamberSWOnlyState; ///< Balancing chamber switching only status ( On/Off) + BOOL isBalChamberSwitchingActive; ///< Balancing chamber switching status } BAL_CHAMBER_DATA_T; // ********** public function prototypes ********** @@ -58,6 +59,7 @@ void transitionToBalChamberFill( void ); // Prepares for transition to balancing chamber execution U32 execBalancingChamberControl( void ); // Execute the balancing chamber state machine +void requestBalChamberSwitching( BOOL activate ); // Activates or Deactivates Balancing Chamber Switching. void updateBalChamberSwitchingPeriod( void ); // Update the balancing chamber switching period BAL_CHAMBER_EXEC_STATE_T getCurrentBalancingChamberExecState( void ); // Get the current state of the balancing chamber execution F32 getBalChamberSwitchingFreq( void ); // Get the balancing chamber switching frequency Index: firmware/App/Controllers/DialysatePumps.c =================================================================== diff -u -r3643a2e648ab2b216fd08579e56bdc02fb94836d -r0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960 --- firmware/App/Controllers/DialysatePumps.c (.../DialysatePumps.c) (revision 3643a2e648ab2b216fd08579e56bdc02fb94836d) +++ firmware/App/Controllers/DialysatePumps.c (.../DialysatePumps.c) (revision 0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960) @@ -30,6 +30,7 @@ #include "SafetyShutdown.h" #include "TaskGeneral.h" #include "TaskPriority.h" +#include "TestSupport.h" #include "Timers.h" #include "Utilities.h" @@ -73,6 +74,7 @@ #define D12_PUMP_I_COEFFICIENT 60.0F ///< I term for fresh dialysate pump delta pressure control. #define D48_PUMP_P_COEFFICIENT 20.0F ///< P term for spent dialysate pump delta pressure control. #define D48_PUMP_I_COEFFICIENT 60.0F ///< I term for spent dialysate pump delta pressure control. +#define D48_PUMP_CLOSED_LOOP_DEADBAND_RPM 50.0F ///< Deadband on PI output so pump speed does not fluctuate frequently. #define DIAL_PUMP_NO_FEED_FORWARD 0.0F ///< Feedforward term for dialysate pump control #define DEGAS_PUMP_SLOPE_FACTOR -0.0156F ///< Dialysate pump target pressure multiply factor ( m factor in 'y = mx + b' equation) #define DEGAS_PUMP_INTERCEPT_FACTOR 0.1153F ///< Dialysate pump target pressure addition factor ( b factor in 'y = mx + b' equation) @@ -156,6 +158,46 @@ /*********************************************************************//** * @brief + * The getD48MinPumpRPM function returns the minimum RPM limit for the D48 pump + * based on test configuration (Diener 1000 vs Diener 2000). + * @details \b Inputs: Test configuration TEST_CONFIG_DD_ENABLE_DIENER_1000_PUMP. + * @details \b Outputs: none + * @return Minimum RPM for D48 pump (134 when Diener 1000 enabled, 200 otherwise). + *************************************************************************/ +U32 getD48MinPumpRPM( void ) +{ + U32 minRpm = MIN_DIALYSATE_PUMP_RPM; + + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DIENER_1000_PUMP ) ) + { + minRpm = D48_DIENER_1000_MIN_RPM; + } + + return minRpm; +} + +/*********************************************************************//** + * @brief + * The getD48MaxPumpRPM function returns the maximum RPM limit for the D48 pump + * based on test configuration (Diener 1000 vs Diener 2000). + * @details \b Inputs: Test configuration TEST_CONFIG_DD_ENABLE_DIENER_1000_PUMP. + * @details \b Outputs: none + * @return Maximum RPM for D48 pump (2770 when Diener 1000 enabled, 2650 otherwise). + *************************************************************************/ +U32 getD48MaxPumpRPM( void ) +{ + U32 maxRpm = MAX_DIALYSATE_PUMP_RPM; + + if ( TRUE == getTestConfigStatus( TEST_CONFIG_DD_ENABLE_DIENER_1000_PUMP ) ) + { + maxRpm = D48_DIENER_1000_MAX_RPM; + } + + return maxRpm; +} + +/*********************************************************************//** + * @brief * The initDialysatePump function initializes the DialysatePumps unit. * @details \b Inputs: none * @details \b Outputs: Dialysate pump unit variables initialized. @@ -192,7 +234,14 @@ dialysatePumpMeasuredCurrentA[ pumpId ].ovInitData = 0.0F; dialysatePumpMeasuredCurrentA[ pumpId ].ovData = 0.0F; dialysatePumpMeasuredCurrentA[ pumpId ].override = OVERRIDE_RESET; - dialysatePumps[ pumpId ].currentPumpSpeed = MIN_DIALYSATE_PUMP_RPM; + if ( D48_PUMP == pumpId ) + { + dialysatePumps[ pumpId ].currentPumpSpeed = getD48MinPumpRPM(); + } + else + { + dialysatePumps[ pumpId ].currentPumpSpeed = MIN_DIALYSATE_PUMP_RPM; + } dialysatePumps[ pumpId ].prevPumpTargetSpeed = 0.0F; dialysatePumps[ pumpId ].control = DIALYSATE_PUMP_CONTROL_STOP; dialysatePumps[ pumpId ].directionErrorCount = 0; @@ -221,14 +270,14 @@ initializePIController( PI_CONTROLLER_ID_D12_PUMP, FRESH_DIAL_OPEN_LOOP_SPEED_RPM, D12_PUMP_P_COEFFICIENT, D12_PUMP_I_COEFFICIENT, MIN_DIALYSATE_PUMP_RPM, MAX_DIALYSATE_PUMP_RPM, FALSE, DIAL_PUMP_NO_FEED_FORWARD ); - // Initialize spent dialysate pump PI controller + // Initialize spent dialysate pump PI controller (use Diener 1000 range to support both pump types) initializePIController( PI_CONTROLLER_ID_D48_PUMP, SPENT_DIAL_OPEN_LOOP_SPEED_RPM, D48_PUMP_P_COEFFICIENT, D48_PUMP_I_COEFFICIENT, - MIN_DIALYSATE_PUMP_RPM, MAX_DIALYSATE_PUMP_RPM,FALSE, DIAL_PUMP_NO_FEED_FORWARD ); + D48_DIENER_1000_MIN_RPM, D48_DIENER_1000_MAX_RPM, FALSE, DIAL_PUMP_NO_FEED_FORWARD ); // Init the dialysate pump with valid PWM while motor is disabled. // when enable triggers, we dont want invlid RPM set that triggers alarm in motor controller. setFPGAD12PumpSpeed( MIN_DIALYSATE_PUMP_RPM ); - setFPGAD48PumpSpeed( MIN_DIALYSATE_PUMP_RPM ); + setFPGAD48PumpSpeed( getD48MinPumpRPM() ); #ifdef __PITEST__ for ( i = 0; i < NUM_OF_CONTROLLER_SIGNAL; i++ ) @@ -287,37 +336,50 @@ BOOL setDialysatePumpTargetRPM( DIALYSATE_PUMPS_T pumpId, U32 rpm, BOOL isOpenLoopControlEnabled ) { BOOL result = FALSE; + U32 minRPM; + U32 maxRPM; + if ( D48_PUMP == pumpId ) + { + minRPM = getD48MinPumpRPM(); + maxRPM = getD48MaxPumpRPM(); + } + else + { + minRPM = MIN_DIALYSATE_PUMP_RPM; + maxRPM = MAX_DIALYSATE_PUMP_RPM; + } + if ( pumpId < NUM_OF_DIALYSATE_PUMPS ) { - if ( ( MIN_DIALYSATE_PUMP_RPM <= rpm ) && ( rpm <= MAX_DIALYSATE_PUMP_RPM ) ) + if ( ( minRPM <= rpm ) && ( rpm <= maxRPM ) ) { pumpTargetSpeed[ pumpId ].data = rpm; } - else if ( rpm < MIN_DIALYSATE_PUMP_RPM ) + else if ( rpm < minRPM ) { - // Lets assign minimum speed to make sure, driver is not getting into fault mode - pumpTargetSpeed[ pumpId ].data = MIN_DIALYSATE_PUMP_RPM; + // Assign minimum speed so driver does not enter fault mode. + pumpTargetSpeed[ pumpId ].data = minRPM; } else { - pumpTargetSpeed[ pumpId ].data = MAX_DIALYSATE_PUMP_RPM; + pumpTargetSpeed[ pumpId ].data = maxRPM; } // Assign Open loop or close loop control isDialPumpOpenLoopEnabled[ pumpId ] = isOpenLoopControlEnabled; #ifdef __BARO_PRES_SENSOR__ - //Update Degas pump target speed + // Update degas pump target speed. calculateDegasPumpTargetPressure(); #endif - //handle target speed update when pump is running + // Handle target speed update when pump is running. if ( DIALYSATE_PUMP_CONTROL_TO_TARGET_STATE == dialysatePumps[ pumpId ].dialysatePumpState ) { F32 diffSpeed = fabs( getDialysatePumpTargetSpeed( pumpId ) - dialysatePumps[ pumpId ].prevPumpTargetSpeed ); if ( diffSpeed > PUMP_TRANS_TO_RAMP_SPEED_THRESHOLD ) { - // change to ramp state + // Change to ramp state. dialysatePumps[ pumpId ].dialysatePumpState = DIALYSATE_PUMP_RAMP_UP_STATE; } } @@ -344,10 +406,9 @@ *************************************************************************/ void signalDialysatePumpHardStop( DIALYSATE_PUMPS_T pumpId ) { - //Update control to stop the dialysate pump + // Update control to stop the dialysate pump. if ( D12_PUMP == pumpId ) { - // dialysate pump control run enable dialysatePumps[ pumpId ].control = DIALYSATE_PUMP_CONTROL_STOP; setFPGAD12PumpControl( dialysatePumps[ pumpId ].control ); setFPGAD12PumpSpeed( MIN_DIALYSATE_PUMP_RPM ); @@ -356,18 +417,25 @@ { dialysatePumps[ pumpId ].control = DIALYSATE_PUMP_CONTROL_STOP; setFPGAD48PumpControl( dialysatePumps[ pumpId ].control ); - setFPGAD48PumpSpeed( MIN_DIALYSATE_PUMP_RPM ); + setFPGAD48PumpSpeed( getD48MinPumpRPM() ); } - // Reset all the variables to stop mode - dialysatePumps[ pumpId ].currentPumpSpeed = MIN_DIALYSATE_PUMP_RPM; + // Reset all the variables to stop mode. + if ( D48_PUMP == pumpId ) + { + dialysatePumps[ pumpId ].currentPumpSpeed = getD48MinPumpRPM(); + } + else + { + dialysatePumps[ pumpId ].currentPumpSpeed = MIN_DIALYSATE_PUMP_RPM; + } pumpTargetSpeed[ pumpId ].data = 0.0F; dialysatePumps[ pumpId ].dialysatePumpState = DIALYSATE_PUMP_OFF_STATE; dialysatePumps[ pumpId ].controlTimerCounter = 0; dialysatePumps[ pumpId ].isDialPumpOn = FALSE; isDialPumpOpenLoopEnabled[ pumpId ] = FALSE; - //Reset PI Controller + // Reset PI controller. if ( D12_PUMP == pumpId ) { resetPIController( PI_CONTROLLER_ID_D12_PUMP, FRESH_DIAL_OPEN_LOOP_SPEED_RPM, DIAL_PUMP_NO_FEED_FORWARD ); @@ -660,12 +728,22 @@ { DIALYSATE_PUMP_STATE_T result = DIALYSATE_PUMP_OFF_STATE; F32 targetSpeed = getDialysatePumpTargetSpeed( pumpId ); + U32 minRPM; - if ( targetSpeed >= MIN_DIALYSATE_PUMP_RPM ) + if ( D48_PUMP == pumpId ) { + minRPM = getD48MinPumpRPM(); + } + else + { + minRPM = MIN_DIALYSATE_PUMP_RPM; + } + + if ( targetSpeed >= minRPM ) + { if ( D12_PUMP == pumpId ) { - // dialysate pump control run enable, forward run only. + // Dialysate pump control run enable, forward run only. dialysatePumps[ pumpId ].control = DIALYSATE_PUMP_CONTROL_RUN; setFPGAD12PumpControl( dialysatePumps[ pumpId ].control ); } @@ -729,6 +807,7 @@ F32 speedIncrease = 0.0F; BOOL hasTgtBeenReached = FALSE; F32 currentToTargetDiff = fabs( getDialysatePumpTargetSpeed( pumpId ) - dialysatePumps[ pumpId ].currentPumpSpeed ); + U32 minRPM; if ( currentToTargetDiff > ZERO_SPEED ) { @@ -742,7 +821,7 @@ hasTgtBeenReached = TRUE; } - // Subtract current speed when target speed is smaller + // Subtract current speed when target speed is smaller. if ( getDialysatePumpTargetSpeed( pumpId ) < dialysatePumps[ pumpId ].currentPumpSpeed ) { speedIncrease *= -1.0F; @@ -757,16 +836,25 @@ // } } - if ( dialysatePumps[ pumpId ].currentPumpSpeed >= MIN_DIALYSATE_PUMP_RPM ) + if ( D48_PUMP == pumpId ) { + minRPM = getD48MinPumpRPM(); + } + else + { + minRPM = MIN_DIALYSATE_PUMP_RPM; + } + + if ( dialysatePumps[ pumpId ].currentPumpSpeed >= minRPM ) + { if ( D12_PUMP == pumpId ) { - // Set fresh dialyate pump speed + // Set fresh dialysate pump speed. setFPGAD12PumpSpeed( (U16)dialysatePumps[ pumpId ].currentPumpSpeed ); } else { - // Set spent dialyate pump speed + // Set spent dialysate pump speed. setFPGAD48PumpSpeed( (U16)dialysatePumps[ pumpId ].currentPumpSpeed ); } } @@ -837,7 +925,23 @@ } } } + else if ( TRUE == isDialPumpOpenLoopEnabled[ pumpId ] ) + { + // Get current pump speed + dialysatePumps[ pumpId ].currentPumpSpeed = getDialysatePumpTargetSpeed( pumpId ); + if ( D12_PUMP == pumpId ) + { + //Set fresh dialyate pump speed + setFPGAD12PumpSpeed( (U16)dialysatePumps[ pumpId ].currentPumpSpeed ); + } + else + { + //Set spent dialyate pump speed + setFPGAD48PumpSpeed( (U16)dialysatePumps[ pumpId ].currentPumpSpeed ); + } + } + return state; } @@ -1162,15 +1266,29 @@ if ( (DIALYSATE_PUMPS_T)payload.pumpID < NUM_OF_DIALYSATE_PUMPS ) { - // Handle start command + U32 minRPM; + U32 maxRPM; + + if ( D48_PUMP == (DIALYSATE_PUMPS_T)payload.pumpID ) + { + minRPM = getD48MinPumpRPM(); + maxRPM = getD48MaxPumpRPM(); + } + else + { + minRPM = MIN_DIALYSATE_PUMP_RPM; + maxRPM = MAX_DIALYSATE_PUMP_RPM; + } + + // Handle start command. if ( ( TRUE == payload.startStop ) && - ( ( payload.rpm >= MIN_DIALYSATE_PUMP_RPM ) && ( payload.rpm <= MAX_DIALYSATE_PUMP_RPM ) ) ) + ( ( payload.rpm >= minRPM ) && ( payload.rpm <= maxRPM ) ) ) { setDialysatePumpTargetRPM( (DIALYSATE_PUMPS_T)payload.pumpID, payload.rpm, (BOOL)payload.pumpControl ); result = TRUE; } - //Handle stop command + // Handle stop command. if ( FALSE == payload.startStop ) { signalDialysatePumpHardStop( (DIALYSATE_PUMPS_T)payload.pumpID ); Index: firmware/App/Controllers/DialysatePumps.h =================================================================== diff -u -r8cb3950f846ba6e3946cbcc1b321b7849d64c23f -r0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960 --- firmware/App/Controllers/DialysatePumps.h (.../DialysatePumps.h) (revision 8cb3950f846ba6e3946cbcc1b321b7849d64c23f) +++ firmware/App/Controllers/DialysatePumps.h (.../DialysatePumps.h) (revision 0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960) @@ -31,13 +31,13 @@ */ // ********** public definitions ********** -#ifdef __MAXON_SPEED_UPDATE__ -#define MIN_DIALYSATE_PUMP_RPM 200 ///< Minimum RPM target for dialysate pump (though zero is allowed if turning pump off). -#else -#define MIN_DIALYSATE_PUMP_RPM 350 ///< Minimum RPM target for dialysate pump (though zero is allowed if turning pump off). -#endif -#define MAX_DIALYSATE_PUMP_RPM 2650 ///< Maximum RPM target for dialysate pump. +#define MIN_DIALYSATE_PUMP_RPM 200 ///< Minimum RPM target for D12 pump and D48 Diener 2000 pump. +#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 DEGAS_PUMP_TARGET_PRES_ADJ_THRESHOLD -1.0F ///< Dialysate Pump(D12) target pressure threshold adjustment factor. #define MIN_DIALYSATE_FLOW_RATE ( 100.0F ) ///< Minimum dialysate flow rate @@ -84,6 +84,8 @@ void execDialysatePumpController( void ); SELF_TEST_STATUS_T execDialysatePumpSelfTest( void ); +U32 getD48MinPumpRPM( void ); +U32 getD48MaxPumpRPM( void ); F32 getDialysatePumpTargetSpeed( DIALYSATE_PUMPS_T pumpId ); F32 getDialysatePumpMeasuredSpeed( DIALYSATE_PUMPS_T pumpId ); F32 getDialysatePumpTargetPressure( DIALYSATE_PUMPS_T pumpId ); Index: firmware/App/DDCommon.h =================================================================== diff -u -r2607bf6329b1851bdeaf8b39d6e226e5a568bf1b -r0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960 --- firmware/App/DDCommon.h (.../DDCommon.h) (revision 2607bf6329b1851bdeaf8b39d6e226e5a568bf1b) +++ firmware/App/DDCommon.h (.../DDCommon.h) (revision 0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960) @@ -48,9 +48,6 @@ //Uncomment below for bicarb chamber filling //#define __BICARB_CHAMBER_FILL__ 1 -//Uncomment below for Maxon controller speed change -#define __MAXON_SPEED_UPDATE__ 1 - //UnComment below for DryBicarb testing //#define __DRY_BICARB__ 1 @@ -60,6 +57,7 @@ //Uncomment below to disable Teensy conductivity driver #define __TEENSY_CONDUCTIVITY_DRIVER__ 1 + #include #include #endif Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r97eba3d39e6ddf44276b77b1aea1171805ca142d -r0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 97eba3d39e6ddf44276b77b1aea1171805ca142d) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 0bcd9e3ddfeb40efa313e7ed8d8d58f996a13960) @@ -173,6 +173,8 @@ initGenDialysateMode(); setCurrentSubState( NO_SUB_STATE ); + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); //calculateD48PumpSpeedForBCFill(); initialD48PumpSpeed = getCalculatedD48PumpSpeedForBCFill(); setD48PumpSpeedForBCFill( initialD48PumpSpeed ); @@ -221,6 +223,9 @@ switch( state ) { case DD_GEND_STATE_START: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); + // Do nothing break; @@ -250,7 +255,14 @@ startHeater( D5_HEAT ); //Turn on Trimmer heater - setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) == TRUE ) + { + setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + } + else + { + setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); + } startHeater( D45_HEAT ); //Testing : Enable close loop once testing is complete @@ -263,13 +275,18 @@ setRinsePumpState( RINSE_PUMP_STATE_ON ); transitionToBalChamberFill(); + // Activate Balancing Chamber Switching + requestBalChamberSwitching( TRUE ); //Testing bypassStateDelayStartTimeMS = getMSTimerCount(); delayBypassStateFlag = TRUE; break; case DD_GEND_DIALYSATE_DELIVERY_STATE: + // Activate Balancing Chamber Switching + requestBalChamberSwitching( TRUE ); + //Previous state setValveState( D47_VALV, VALVE_STATE_CLOSED ); // spent chamber purge valve setValveState( D8_VALV, VALVE_STATE_CLOSED ); @@ -287,7 +304,14 @@ startHeater( D5_HEAT ); //Turn on Trimmer heater - setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + if ( getTestConfigStatus( TEST_CONFIG_DD_FP_ENABLE_BETA_1_0_HW ) == TRUE ) + { + setHeaterTargetTemperature( D45_HEAT, getD4AverageTemperature() ); + } + else + { + setHeaterTargetTemperature( D45_HEAT, getD99AverageTemperature() ); + } startHeater( D45_HEAT ); //setDialysatePumpTargetRPM( D12_PUMP, FRESH_DIAL_PUMP_INITIAL_RPM, FALSE ); @@ -311,6 +335,9 @@ break; case DD_GEND_SPENT_CHAMBER_FILL_STATE: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); + //Set valves and actuators setValveState( D35_VALV, VALVE_STATE_CLOSED ); // VDI setValveState( D40_VALV, VALVE_STATE_CLOSED ); // VDO @@ -354,6 +381,9 @@ break; case DD_GEND_BICARB_CHAMBER_FILL_STATE: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); + requestConcentratePumpOff( D11_PUMP, FALSE ); requestConcentratePumpOff( D10_PUMP, FALSE ); requestConcentratePumpOff( D76_PUMP, FALSE ); @@ -390,6 +420,9 @@ break; case DD_GEND_DIALYSATE_DELIVERY_PAUSE: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); + setDialysatePumpTargetRPM( D12_PUMP, FRESH_DIAL_PUMP_INITIAL_RPM, TRUE ); signalDialysatePumpHardStop( D48_PUMP ); requestConcentratePumpOff( D11_PUMP, FALSE ); @@ -431,6 +464,8 @@ break; case DD_GEND_ISOLATED_UF_STATE: + // Deactivate Balancing Chamber Switching + requestBalChamberSwitching( FALSE ); //TODO : define actuators states break; @@ -706,11 +741,6 @@ delayBypassStateFlag = FALSE; } } - else - { - //Execute balancing chamber - execBalancingChamberControl(); - } if ( getTestConfigStatus( TEST_CONFIG_DD_ENABLE_SPENT_CHAMBER_H_FILL ) == TRUE ) { @@ -787,9 +817,6 @@ #endif else { - //Execute balancing chamber - execBalancingChamberControl(); - //Execute ultrafiltration execUFControl(); }