Index: firmware/App/Controllers/UVReactors.c =================================================================== diff -u -r5b735aaed9feb2168f612b65c34849dc95e28577 -rae9755ad4c929ce5c75c97e856e62f7065355abb --- firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision 5b735aaed9feb2168f612b65c34849dc95e28577) +++ firmware/App/Controllers/UVReactors.c (.../UVReactors.c) (revision ae9755ad4c929ce5c75c97e856e62f7065355abb) @@ -1,14 +1,14 @@ /************************************************************************** * -* Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. +* Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file UVReactors.c * * @author (last) Dara Navaei -* @date (last) 12-Oct-2022 +* @date (last) 05-Apr-2024 * * @author (original) Dara Navaei * @date (original) 24-Nov-2020 @@ -79,8 +79,8 @@ // ********** private data ********** static UV_REACTOR_STATUS_T reactorsStatus[ NUM_OF_UV_REACTORS ]; ///< UV reactors status array. -static UV_REACTORS_SELF_TEST_STATE_T uvReactorsSelfTestStates = UV_REACTORS_SELF_TEST_OFF; ///< UV reactors self test state. -static SELF_TEST_STATUS_T uvReactorsSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; ///< Valves self test result. +static UV_REACTORS_SELF_TEST_STATE_T uvReactorsSelfTestStates; ///< UV reactors self test state. +static SELF_TEST_STATUS_T uvReactorsSelfTestResult; ///< Valves self test result. static OVERRIDE_U32_T uvReactorsDataPublishInterval = { UV_REACTORS_DATA_PUB_INTERVAL, UV_REACTORS_DATA_PUB_INTERVAL, 0, 0 }; ///< UV reactors data publish interval. @@ -137,9 +137,10 @@ setReactorEnableStatus( reactor, PIN_SIGNAL_LOW ); } - initPersistentAlarm( ALARM_ID_UV_REACTOR_NOT_HEALTHY, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ); - initPersistentAlarm( ALARM_ID_DG_INLET_UV_REACTOR_ON_WITH_NO_FLOW, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ); - initPersistentAlarm( ALARM_ID_DG_OUTLET_UV_REACTOR_ON_WITH_NO_FLOW, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ); + initPersistentAlarm( ALARM_ID_DG_INLET_UV_REACTOR_NOT_HEALTHY, 0, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ); + initPersistentAlarm( ALARM_ID_DG_OUTLET_UV_REACTOR_NOT_HEALTHY, 0, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ); + initPersistentAlarm( ALARM_ID_DG_INLET_UV_REACTOR_ON_WITH_NO_FLOW, 0, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ); + initPersistentAlarm( ALARM_ID_DG_OUTLET_UV_REACTOR_ON_WITH_NO_FLOW, 0, UV_REACTORS_ON_NO_FLOW_TIMEOUT_MS ); } /*********************************************************************//** @@ -282,7 +283,7 @@ if ( reactor < NUM_OF_UV_REACTORS ) { reactorsStatus[ reactor ].switchState = TURN_OFF; - result = TRUE; + result = TRUE; } else { @@ -294,6 +295,19 @@ /*********************************************************************//** * @brief + * The resetUVReactorsPOSTState function resets the UV reactors POST state. + * @details Inputs: none + * @details Outputs: uvReactorsSelfTestStates, uvReactorsSelfTestResult + * @return none + *************************************************************************/ +void resetUVReactorsPOSTState( void ) +{ + uvReactorsSelfTestResult = SELF_TEST_STATUS_IN_PROGRESS; + uvReactorsSelfTestStates = UV_REACTORS_SELF_TEST_OFF; +} + +/*********************************************************************//** + * @brief * The handleUVReactorsSelfTestOff function handles the self test off state. * @details Inputs: selfTestElapsedTime * @details Outputs: selfTestElapsedTime @@ -341,11 +355,11 @@ // Check which reactor has not been healthy and raise an alarm if ( FALSE == isInletHealthy ) { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_UV_REACTOR_NOT_HEALTHY, INLET_UV_REACTOR ); + activateAlarmNoData( ALARM_ID_DG_INLET_UV_REACTOR_NOT_HEALTHY ); } - else + if ( FALSE == isOutletHealthy ) { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_UV_REACTOR_NOT_HEALTHY, OUTLET_UV_REACTOR ); + activateAlarmNoData( ALARM_ID_DG_OUTLET_UV_REACTOR_NOT_HEALTHY ); } } @@ -369,8 +383,14 @@ *************************************************************************/ static UV_REACTOR_STATE_T handleUVReactorStateOff( UV_REACTORS_T reactor ) { - UV_REACTOR_STATE_T state = UV_REACTOR_STATE_OFF; + UV_REACTOR_STATE_T state = UV_REACTOR_STATE_OFF; + ALARM_ID_T reactorHealthAlarm = ( INLET_UV_REACTOR == reactor ? ALARM_ID_DG_INLET_UV_REACTOR_NOT_HEALTHY : ALARM_ID_DG_OUTLET_UV_REACTOR_NOT_HEALTHY ); + ALARM_ID_T reactorFlowAlarm = ( INLET_UV_REACTOR == reactor ? ALARM_ID_DG_INLET_UV_REACTOR_ON_WITH_NO_FLOW : ALARM_ID_DG_OUTLET_UV_REACTOR_ON_WITH_NO_FLOW ); + // When the reactor is off, clear its health and on with no flow alarms + checkPersistentAlarm( reactorHealthAlarm, FALSE, 0.0F, 0.0F ); + checkPersistentAlarm( reactorFlowAlarm, FALSE, 0.0F, 0.0F ); + // Set the health status to be off. When the reactor is off, it does not report its health status reactorsStatus[ reactor ].healthStatus.data = (U32)UV_REACTOR_OFF; @@ -396,6 +416,7 @@ { UV_REACTOR_STATE_T state = UV_REACTOR_STATE_ON; BOOL isReactorUnhealthy = ( UV_REACTOR_HEALTHY == getUVReactorHealth( reactor ) ? FALSE : TRUE ); + ALARM_ID_T reactorAlarm = ( INLET_UV_REACTOR == reactor ? ALARM_ID_DG_INLET_UV_REACTOR_NOT_HEALTHY : ALARM_ID_DG_OUTLET_UV_REACTOR_NOT_HEALTHY ); // Update the UV reactor's health. It should be either healthy (1) or not healthy (0) reactorsStatus[ reactor ].healthStatus.data = getReactorHealth( reactor ); @@ -404,9 +425,9 @@ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_UV_REACTORS ) != SW_CONFIG_ENABLE_VALUE ) #endif { - checkPersistentAlarm( ALARM_ID_UV_REACTOR_NOT_HEALTHY, isReactorUnhealthy, (U32)reactor, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ); + checkPersistentAlarm( reactorAlarm, isReactorUnhealthy, (U32)reactor, MAX_ALLOWED_UNHEALTHY_REACTOR_PERIOD ); - if ( TRUE == isAlarmActive( ALARM_ID_UV_REACTOR_NOT_HEALTHY ) ) + if ( TRUE == isAlarmActive( reactorAlarm ) ) { // The UV reactor is not healthy turn it off and trigger the alarm reactorsStatus[ reactor ].switchState = TURN_OFF;