Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -r41dc41df4e268be6c96e21196ad0ee4e697848b6 -rdf09fff0839168942138d42c61549d48d4df7bc6 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 41dc41df4e268be6c96e21196ad0ee4e697848b6) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision df09fff0839168942138d42c61549d48d4df7bc6) @@ -171,8 +171,8 @@ // NOTE: This variable should be initialized here because the init function is called every time and then it cannot be initialized there. This variable is // set via Dialin for calibration check purposes only static DIALIN_FILL_FOR_CAL_CHECK_T dialinFillForCalCheck = DIALIN_FILL_FOR_CAL_NONE; ///< Dialin fill for calibration check. -// NOTE: this variable should be initialized here because the init function is called every time and then this variable is set to 0.0. -static F32 maxRORejectionRatioFromHD = 0.0F; ///< Max RO rejection ratio from HD. +// NOTE: this variable should be initialized here because the init function is called every time and then this variable is set to 0. +static U32 minRORejectionRatioPCTFromHD = 0; ///< Min RO rejection ratio in percent from HD. static OVERRIDE_U32_T fillModeDataPublishInterval = { FILL_MODE_DATA_PUB_INTERVAL, FILL_MODE_DATA_PUB_INTERVAL, 0, 0 }; ///< Interval (in ms) at which to publish fill mode data to CAN bus. static OVERRIDE_F32_T integratedVolumeML = { 0.0, 0.0, 0.0, 0.0 }; ///< Total RO flow rate over period of time. @@ -553,17 +553,17 @@ /*********************************************************************//** * @brief - * The setMaxRORejectionRatio function sets the RO rejection ratio that has - * been received from the HD institutional record. + * The setMinRORejectionRatioPCT function sets the RO rejection ratio in + * percent that has been received from the HD institutional record. * @details Inputs: none * @details Outputs: roRejectionRatioFromHD * @param RO rejection ratio * @return none *************************************************************************/ -void setMaxRORejectionRatio( F32 roRejectionRatio ) +void setMinRORejectionRatioPCT( U32 roRejectionRatio ) { - maxRORejectionRatioFromHD = roRejectionRatio; - SEND_EVENT_WITH_2_F32_DATA( DG_EVENT_MAX_RO_REJECTION_RATIO_FROM_HD_INSTIT_RECORD, maxRORejectionRatioFromHD, 0.0F ) + minRORejectionRatioPCTFromHD = roRejectionRatio; + SEND_EVENT_WITH_2_U32_DATA( DG_EVENT_MIN_RO_REJECTION_RATIO_PCT_FROM_HD_INSTIT_RECORD, minRORejectionRatioPCTFromHD, 0 ) } /*********************************************************************//** @@ -922,16 +922,19 @@ { F32 avgCPo = sumFillCPoConductivity / (F32)fillCPoConductivitySampleCnt; // sample count incremented above w/o condition so no need for divide by zero checks F32 avgRR = sumFillRejRatio / (F32)fillCPoConductivitySampleCnt; + // The rejection ratio = 1 - (institutional RR value in percent) / 100 + // If the instit RR value is 0% the converted RR becomes 1. But If the instit RR value is 0, the RR alarm is not checked + F32 convRR = 1.0F - ( ( (F32)minRORejectionRatioPCTFromHD ) / FRACTION_TO_PERCENT_FACTOR ); if ( ( avgCPo > MAX_CPO_CONDUCTIVITY_ALLOW ) && ( getTestConfigStatus( TEST_CONFIG_MIX_WITH_WATER ) != TRUE ) ) { // Fault alarm per PRS 483 SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_OUTLET_PRIMARY_CONDUCTIVITY_OUT_OF_RANGE, avgCPo, MAX_CPO_CONDUCTIVITY_ALLOW ); } - if ( ( avgRR > maxRORejectionRatioFromHD ) && ( isROOnlyModeEnabled() != TRUE ) ) + if ( ( avgRR > convRR ) && ( isROOnlyModeEnabled() != TRUE ) && ( minRORejectionRatioPCTFromHD > 0 ) ) { // Fault alarm per PRS 483 - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_RO_REJECTION_RATIO_OUT_OF_RANGE, avgRR, maxRORejectionRatioFromHD ); + SET_ALARM_WITH_2_F32_DATA( ALARM_ID_DG_RO_REJECTION_RATIO_OUT_OF_RANGE, avgRR, convRR ); } }