Index: firmware/App/Modes/ModeChemicalDisinfect.c =================================================================== diff -u -r9e5ee62245eb2a73b167eabd6c274a71a76a7b0e -r939e488d71ae8511cba65e4a27e31660259e06ac --- firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision 9e5ee62245eb2a73b167eabd6c274a71a76a7b0e) +++ firmware/App/Modes/ModeChemicalDisinfect.c (.../ModeChemicalDisinfect.c) (revision 939e488d71ae8511cba65e4a27e31660259e06ac) @@ -178,6 +178,14 @@ static DISINFECT_NV_OPS_T disinfectNVOps; ///< Disinfect non-volatile memory operations. static BOOL haveDrainParamsBeenInit[ NUM_OF_DG_RESERVOIRS ]; ///< Boolean flag to indicate whether the drain parameters have been reset or not. +#ifndef _RELEASE_ +/* Nelson Labs is in charge of testing the efficacy of the disinfects (heat and chem). The codes that contain the name Nelson are used to + * support the special conditions that are needed to be created to test the disinfects. The support codes are not compiled in a release + * build. + */ +static NELSON_SUPPORT_T nelsonSupport; // Nelson support. +#endif + // ********** private function prototypes ********** static DG_CHEM_DISINFECT_STATE_T handleChemicalDisinfectStartState( void ); @@ -207,6 +215,10 @@ static void monitorModeChemicalDisinfect( void ); static void writeDisinfectDataToNV( DG_USAGE_INFO_ITEMS_T info ); +#ifndef _RELEASE_ +static void setNelsonSupportConditions( void ); +#endif + /*********************************************************************//** * @brief * The initChemicalDisinfectMode function initializes the chemical @@ -268,6 +280,10 @@ R2FullVolume = 0.0F; disinfectantMixRatio = 0.0F; +#ifndef _RELEASE_ + setNelsonSupportConditions(); +#endif + initPersistentAlarm( ALARM_ID_DG_CHEM_DISINFECT_TARGET_TEMP_OUT_OF_RANGE, DISINFECT_TEMP_OUT_OF_RANGE_TIMEOUT_MS, DISINFECT_TEMP_OUT_OF_RANGE_TIMEOUT_MS ); initPersistentAlarm( ALARM_ID_DG_CHEM_DISINFECT_TARGET_COND_OUT_OF_RANGE, DISINFECT_COND_OUT_OF_RANGE_TIMEOUT_MS, DISINFECT_COND_OUT_OF_RANGE_TIMEOUT_MS ); } @@ -289,7 +305,12 @@ setCPLDCleanLEDColor( CPLD_CLEAN_LED_YELLOW ); - activateAlarmNoData( ALARM_ID_DG_CHEM_DISINFECT_INSERT_ACID ); +#ifndef _RELEASE_ + if ( nelsonSupport != NELSON_POS_CONTROL_CHEM_DISINFECT ) +#endif + { + activateAlarmNoData( ALARM_ID_DG_CHEM_DISINFECT_INSERT_ACID ); + } return chemDisinfectState; } @@ -555,7 +576,14 @@ setValveState( VRD2, VALVE_STATE_CLOSED ); setValveState( VPI, VALVE_STATE_OPEN ); setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); - turnOnUVReactor( INLET_UV_REACTOR ); + +#ifndef _RELEASE_ + if ( nelsonSupport != NELSON_POS_CONTROL_CHEM_DISINFECT ) +#endif + { + turnOnUVReactor( INLET_UV_REACTOR ); + } + stateTrialCounter = 0; stateTimer = getMSTimerCount(); state = DG_CHEM_DISINFECT_STATE_FLUSH_DRAIN; @@ -593,11 +621,18 @@ // set pumps and valves for next state, flush circulation setValveState( VPD, VALVE_STATE_OPEN_C_TO_NC ); setROPumpTargetFlowRateLPM( RO_PUMP_TARGET_FLUSH_FLOW_RATE_LPM, MAX_RO_PUMP_FLUSH_FILL_PRESSURE_PSI ); - // Start heating the water while we are flushing - setHeaterTargetTemperature( DG_PRIMARY_HEATER, CHEM_DISINFECT_HEATER_CONTROL_TEMPERATURE_C ); - startHeater( DG_PRIMARY_HEATER ); - // The UV reactors will be on for the entire disinfect cycle - turnOnUVReactor( OUTLET_UV_REACTOR ); + +#ifndef _RELEASE_ + if ( nelsonSupport != NELSON_POS_CONTROL_CHEM_DISINFECT ) +#endif + { + // Start heating the water while we are flushing + setHeaterTargetTemperature( DG_PRIMARY_HEATER, CHEM_DISINFECT_HEATER_CONTROL_TEMPERATURE_C ); + startHeater( DG_PRIMARY_HEATER ); + // The UV reactors will be on for the entire disinfect cycle + turnOnUVReactor( OUTLET_UV_REACTOR ); + } + flushCircWaitTime = FLUSH_CICRCULATION_INITIAL_WAIT_TIME_MS; stateTimer = getMSTimerCount(); state = DG_CHEM_DISINFECT_STATE_FLUSH_CIRCULATION; @@ -726,7 +761,8 @@ handleDisinfectantMixing( getMeasuredFlowRateLPM( RO_FLOW_SENSOR ) * ML_PER_LITER, disinfectantMixRatio ); #ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_DISINFECT_CONDUCTIVITY_CHECK ) != SW_CONFIG_ENABLE_VALUE ) + if ( ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_DISINFECT_CONDUCTIVITY_CHECK ) != SW_CONFIG_ENABLE_VALUE ) && + ( ( nelsonSupport != NELSON_POS_CONTROL_CHEM_DISINFECT ) || ( nelsonSupport != NELSON_CHEM_DISINFECT ) ) ) #endif { if ( cd2Conductivity < MIN_PRIME_ACID_CONDUCTIVITY_US_PER_CM ) @@ -1061,6 +1097,14 @@ chemDisinfectUIState = CHEM_DISINFECT_UI_STATE_FLUSH_AFTER_DISINFECT; stateTimer = getMSTimerCount(); state = DG_CHEM_DISINFECT_STATE_DRAIN_R1; + +#ifndef _RELEASE_ + if ( ( NELSON_POS_CONTROL_CHEM_DISINFECT == nelsonSupport ) || ( NELSON_CHEM_DISINFECT == nelsonSupport ) ) + { + deenergizeActuators( NO_PARK_CONC_PUMPS ); + state = DG_CHEM_DISINFECT_STATE_COMPLETE; + } +#endif } else { @@ -1238,7 +1282,17 @@ chemDisinfectUIState = CHEM_DISINFECT_UI_STATE_COMPLETE; - requestNewOperationMode( DG_MODE_CHFL ); +#ifndef _RELEASE_ + if ( nelsonSupport != NELSON_NONE ) + { + nelsonSupport = NELSON_NONE; + requestNewOperationMode( DG_MODE_STAN ); + } + else +#endif + { + requestNewOperationMode( DG_MODE_CHFL ); + } return state; } @@ -1259,6 +1313,7 @@ { SET_ALARM_WITH_1_U32_DATA( alarmDetectedPendingTrigger, prevChemDisinfectState ) } + requestNewOperationMode( DG_MODE_FAUL ); } @@ -1569,9 +1624,9 @@ } else { - uiData.chemDisinfectCountdownTime = 0.0; - data.R1FillLevel = 0.0; - data.R2FillLevel = 0.0; + uiData.chemDisinfectCountdownTime = 0.0F; + data.R1FillLevel = 0.0F; + data.R2FillLevel = 0.0F; } data.chemDisinfectUIState = chemDisinfectUIState; @@ -1632,7 +1687,7 @@ } #ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) != SW_CONFIG_ENABLE_VALUE ) + if ( ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_CAPS_MONITOR ) != SW_CONFIG_ENABLE_VALUE ) && ( NELSON_NONE == nelsonSupport ) ) #endif { // If the dialysate cap is open during any state, alarm @@ -1697,3 +1752,74 @@ } /**@}*/ + +// ********** Nelson Support Functions ********** + +#ifndef _RELEASE_ +/*********************************************************************//** + * @brief + * The setNelsonSupportMode function sets the requested Nelson support + * mode (i.e. inoculate, ...) + * @details Inputs: none + * @details Outputs: nelsonSupport + * @param support the type Nelson support (i.e. inoculate, heat disinfect) + * @return none + *************************************************************************/ +void setChemNelsonSupportMode( NELSON_SUPPORT_T support ) +{ + nelsonSupport = support; +} +#endif + +#ifndef _RELEASE_ +/*********************************************************************//** + * @brief + * The setNelsonSupportConditions function sets the disinfect variables for + * Nelson support. + * @details Inputs: nelsonSupport + * @details Outputs: chemDisinfectState, flushCircWaitTime, stateTimer + * @return: none + *************************************************************************/ +static void setNelsonSupportConditions( void ) +{ + switch ( nelsonSupport ) + { + case NELSON_POS_CONTROL_CHEM_DISINFECT: + case NELSON_CHEM_DISINFECT: + + // Set the valves to start flush circulation + setValveState( VPI, VALVE_STATE_OPEN ); + setValveState( VBF, VALVE_STATE_CLOSED ); + setValveState( VPD, VALVE_STATE_OPEN_C_TO_NC ); + setValveState( VDR, VALVE_STATE_DRAIN_C_TO_NO ); + setValveState( VRC, VALVE_STATE_DRAIN_C_TO_NO ); + setValveState( VPO, VALVE_STATE_NOFILL_C_TO_NO ); + setValveState( VRF, VALVE_STATE_R2_C_TO_NO ); + setValveState( VRO, VALVE_STATE_R1_C_TO_NO ); + setValveState( VRI, VALVE_STATE_R1_C_TO_NO ); + setValveState( VRD1, VALVE_STATE_CLOSED ); + setValveState( VRD2, VALVE_STATE_CLOSED ); + setROPumpTargetFlowRateLPM( RO_PUMP_TARGET_FLUSH_FLOW_RATE_LPM, MAX_RO_PUMP_FLUSH_FILL_PRESSURE_PSI ); + +#ifndef _RELEASE_ + if ( NELSON_CHEM_DISINFECT == nelsonSupport ) +#endif + { + setHeaterTargetTemperature( DG_PRIMARY_HEATER, CHEM_DISINFECT_HEATER_CONTROL_TEMPERATURE_C ); + startHeater( DG_PRIMARY_HEATER ); + turnOnUVReactor( INLET_UV_REACTOR ); + turnOnUVReactor( OUTLET_UV_REACTOR ); + } + + flushCircWaitTime = FLUSH_CICRCULATION_INITIAL_WAIT_TIME_MS; + stateTimer = getMSTimerCount(); + chemDisinfectState = DG_CHEM_DISINFECT_STATE_FLUSH_CIRCULATION; + break; + + case NELSON_NONE: + default: + // Do nothing for these cases. + break; + } +} +#endif