Index: firmware/App/Controllers/DryBiCart.c =================================================================== diff -u -rf1dc3383b840c39f202b15679e0bbe2b2f7a2f83 -r42541cc4700d748d524400f61d99e288a0e11f3e --- firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision f1dc3383b840c39f202b15679e0bbe2b2f7a2f83) +++ firmware/App/Controllers/DryBiCart.c (.../DryBiCart.c) (revision 42541cc4700d748d524400f61d99e288a0e11f3e) @@ -169,7 +169,7 @@ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberPressureCheckState( void ); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentStartState(void); static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentEndState(void); -static BOOL isDryBicartBalChamberFillWindowOpen( void ); +static BOOL isDryBicartChamberFillWindowOpen( void ); static void closeD65IfBalChamberSwitchImminent( void ); // Drain static DRY_BICART_DRAIN_EXEC_STATE_T handleDryBicartDrainStartState( void ); @@ -560,14 +560,14 @@ /*********************************************************************//** * @brief - * The isDryBicartBalChamberFillWindowOpen function checks whether D65 may be + * The isDryBicartChamberFillWindowOpen function checks whether D65 may be * opened for dry bicarb refill: fresh-side BC valves closed and BC switch not - * within the 100 ms valve-close window. + * within the 50 ms valve-close window. * @details \b Inputs: getBalChamberFreshSideValvesClosedStatus, isBalChamberSwitchImminent * @details \b Outputs: none - * @return TRUE when the BC fresh-side fill window is open for D65. + * @return TRUE when the BC fill is completed and allow D65 to fill Chamber F *************************************************************************/ -static BOOL isDryBicartBalChamberFillWindowOpen( void ) +static BOOL isDryBicartChamberFillWindowOpen( void ) { BOOL result = FALSE; @@ -887,16 +887,16 @@ F32 d66Pressure = getFilteredPressure( D66_PRES ); F32 fillCompletePressure = GET_FILL_COMPLETE_PRESSURE_PSI; - // Close dry bicart inlet water if D66 pressure is 17 PSI + // Close dry bicart inlet water if D66 pressure is equal to fill complete pressure if ( d66Pressure >= fillCompletePressure ) { - // start the persistence timer once d66 reaches 17 PSI + // start the persistence timer once d66 reaches fill complete pressure if ( 0 == dryBiCartPersistenceStartTime ) { dryBiCartPersistenceStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure since pressure overshoot just after D65 opening + // defined persistence on D66 pressure since pressure overshoot just after D65 opening if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); @@ -963,15 +963,15 @@ //Vent chamber F to atmosphere setValveState( D64_VALV, VALVE_STATE_OPEN ); - // D66 pressure drops to below 1.5 PSI + // D66 pressure drops to below fill vent complete pressure if ( ( d66Pressure <= DRY_BICART_FILL_VENT_COMPLETE_PRESSURE_PSI ) ) { - // start the persistence timer once d66 reaches 1.5 PSI + // start the persistence timer once d66 reaches fill vent complete pressure if ( 0 == dryBiCartPersistenceStartTime ) { dryBiCartPersistenceStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure since pressure drop below 1.5 PSI after opening D64 + // defined persistence on D66 pressure since pressure drop below fill vent complete pressure after opening D64 if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED ); @@ -1095,8 +1095,9 @@ * @brief * The handleBicarbChamberStartState function wait for bicarb chamber fill request * @details \b Inputs: bicarbChamberFillRequested - * @details \b Outputs: none - * @return the next drybicart fluid drain state. + * @details \b Outputs: dryBiCartVentCycleWaitTimeStartedFlag, dryBiCartPressureDecayStartTimeFlag, + * dryBiCartVentCycleStartTime. + * @return the next drybicart fluid supply state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberStartState( void ) { @@ -1106,7 +1107,6 @@ if ( TRUE == getU32OverrideValue( &bicarbChamberFillRequested ) ) { - //state = BICARB_CARTRIDGE_FILL_WATER_START_STATE; state = BICARB_CHAMBER_SUPPLY_STATE; if ( FALSE == dryBiCartVentCycleWaitTimeStartedFlag ) @@ -1129,12 +1129,11 @@ { BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_CARTRIDGE_FILL_WATER_START_STATE; - if ( TRUE == isDryBicartBalChamberFillWindowOpen() ) + if ( TRUE == isDryBicartChamberFillWindowOpen() ) { // Close vent valves and descaling valve setValveState( D80_VALV, VALVE_STATE_CLOSED ); setValveState( D81_VALV, VALVE_STATE_CLOSED ); - //setValveState( D83_VALV, VALVE_STATE_CLOSED ); setValveState( D85_VALV, VALVE_STATE_CLOSED ); // open inlet water to bicart only when fresh-side BC valves are closed @@ -1152,8 +1151,8 @@ /*********************************************************************//** * @brief - * The handleBicarbChamberCartridgeFillWaterStartState function stop water in the dry bicart - * @details \b Inputs: D66 pressure, dryBiCartPersistenceStartTime + * The handleBicarbChamberCartridgeFillWaterStartState function stop water in the fill water end state + * @details \b Inputs: dryBiCartPersistenceStartTime * @details \b Outputs: valve states * @return the next bicarb chamber check level state. *************************************************************************/ @@ -1164,16 +1163,16 @@ F32 fillCompletePressure = GET_FILL_COMPLETE_PRESSURE_PSI; LVL_STATE_T bicarbChamberLevel = getBicarbChamberLevelStatus(); - if ( FALSE == isDryBicartBalChamberFillWindowOpen() ) + if ( FALSE == isDryBicartChamberFillWindowOpen() ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); } - else if ( TRUE == isDryBicartBalChamberFillWindowOpen() ) + else if ( TRUE == isDryBicartChamberFillWindowOpen() ) { setValveState( D65_VALV, VALVE_STATE_OPEN ); } - // check D66 pressure greater than or equal to 17 PSI + // check D66 pressure greater than or equal to Fill complete pressure if ( d66Pressure >= fillCompletePressure ) { // start the persistence timer once d66 reaches 17 PSI @@ -1182,8 +1181,7 @@ dryBiCartPersistenceStartTime = getMSTimerCount(); } - //TODO: revert after testing - // 2s persistence on D66 pressure since pressure overshoot just after D65 opening only for chamber fill + // Defined persistence on D66 pressure since pressure overshoot just after D65 opening only for chamber fill if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { // Close water inlet valve as D66 pressure reaches 11 PSI after persistence @@ -1222,7 +1220,6 @@ BICARB_CHAMBER_FILL_EXEC_STATE_T state = BICARB_CHAMBER_PRESSURE_CHECK_STATE; // TODO: set supply in progress to inform BC control to disable alarm - //setValveState( D64_VALV, VALVE_STATE_CLOSED ); setValveState( D64_VALV, VALVE_STATE_OPEN ); // Open the Bicarb chamber inlet valve @@ -1240,10 +1237,9 @@ * @brief * The handleBicarbChamberPressureCheckStartState function actuates the vent valve * present in the Bicart assembly. - * @details \b Inputs: D66 Pressure, D63 level, dryBiCarbSupplyStartTime, - * dryBiCarbSypplyVentStartTime, dryBiCartPersistenceStartTime, bicarbChamberLevel, - * dryBiCartPressureDecayStartTimeFlag, drybicartPersistenceOnLowercartPressureStartTime - * @details \b Outputs: dryBiCarbSypplyVentStartTime + * @details \b Inputs: dryBiCarbSupplyStartTime, dryBiCarbSypplyVentStartTime, dryBiCartPersistenceStartTime, + * bicarbChamberLevel, dryBiCartPressureDecayStartTimeFlag, drybicartPersistenceOnLowercartPressureStartTime + * @details \b Outputs: dryBiCarbSypplyVentStartTime, valve states * @return the next bicarb chamber Supply Vent Start state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberPressureCheckState( void ) @@ -1267,7 +1263,7 @@ dryBiCarbSupplyStartTime = getMSTimerCount(); dryBiCartPressureDecayStartTimeFlag = TRUE; } - // do not close the D80 valve, wait till d66 decays to 3 PSI + // do not close the D80 valve, wait till d66 decays to supply decay complete pressure if ( TRUE == didTimeout( dryBiCarbSupplyStartTime, DRY_BICART_SUPPLY_COMPLETE_TIME_MS ) ) { if ( d66Pressure <= DRY_BICART_SUPPLY_DECAY_COMPLETE_PRESSURE_PSI ) @@ -1301,9 +1297,9 @@ drybicartPersistenceOnLowercartPressureStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure + // defined persistence on D66 pressure if ( ( TRUE == didTimeout( drybicartPersistenceOnLowercartPressureStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) && - ( TRUE == isDryBicartBalChamberFillWindowOpen() ) ) + ( TRUE == isDryBicartChamberFillWindowOpen() ) ) { setValveState( D65_VALV, VALVE_STATE_OPEN ); setValveState( D80_VALV, VALVE_STATE_CLOSED ); @@ -1319,7 +1315,7 @@ dryBiCartPersistenceStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure since pressure overshoot just after D65 opening + // defined persistence on D66 pressure since pressure overshoot just after D65 opening if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D65_VALV, VALVE_STATE_CLOSED ); @@ -1341,7 +1337,7 @@ * The handleBicarbChamberSupplyVentStartState function actuates the vent valve * present in the Bicart assembly. * @details \b Inputs: dryBiCarbSypplyVentStartTime, dryBiCartPersistenceStartTime - * @details \b Outputs: dryBiCarbSypplyVentStartTime + * @details \b Outputs: dryBiCarbSypplyVentStartTime, valve states * @return the next bicarb chamber Supply Vent End state. *************************************************************************/ static BICARB_CHAMBER_FILL_EXEC_STATE_T handleBicarbChamberSupplyVentStartState(void) @@ -1354,15 +1350,15 @@ //Vent chamber F to atmosphere setValveState( D64_VALV, VALVE_STATE_OPEN ); - // D66 pressure drops to below 1.5 PSI or time out + // D66 pressure drops to below fill vent complete pressure or time out if ( ( d66Pressure <= DRY_BICART_FILL_VENT_COMPLETE_PRESSURE_PSI ) ) { - // start the persistence timer once d66 reaches if it drops below 1.5 + // start the persistence timer once d66 reaches if it drops below fill vent complete pressure if ( 0 == dryBiCartPersistenceStartTime ) { dryBiCartPersistenceStartTime = getMSTimerCount(); } - // 200 ms persistence on D66 pressure since pressure overshoot just after D65 opening + // defined persistence on D66 pressure since pressure overshoot just after D65 opening if ( TRUE == didTimeout( dryBiCartPersistenceStartTime, DRY_BICART_PERSISTENCE_DURATION_MS ) ) { setValveState( D85_VALV, VALVE_STATE_CLOSED );