Index: firmware/App/Controllers/ConductivitySensors.c =================================================================== diff -u -r8c3db9c2d3957a1a9d53ad5d20d9594a09bc21be -r92ec01cb48d91fe7315baa987e1aa051dd12df75 --- firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 8c3db9c2d3957a1a9d53ad5d20d9594a09bc21be) +++ firmware/App/Controllers/ConductivitySensors.c (.../ConductivitySensors.c) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) @@ -16,8 +16,10 @@ ***************************************************************************/ #include "ConductivitySensors.h" -#include "SystemCommMessages.h" #include "FPGA.h" +#include "PersistentAlarm.h" +#include "SystemCommMessages.h" +#include "TaskGeneral.h" #include "TaskPriority.h" #include "TemperatureSensors.h" #include "Utilities.h" @@ -29,40 +31,49 @@ // ********** private definitions ********** -#define COND_SENSOR_PROBE_TYPE 100 ///< 1K cell constant conductivity probe -#define COND_SENSOR_DECIMAL_CONVERSION 100 ///< Conductivity value from FPGA has two decimal place -#define COND_SENSOR_TEMPERATURE_COEF 0.02 ///< Linear temperature coefficient of variation at 25 Celcius for fresh water -#define COND_SENSOR_REFERENCE_TEMPERATURE 25 ///< Reference temperature for conductivity sensor -#define COND_SENSOR_REPORT_PERIOD (1000 / TASK_PRIORITY_INTERVAL) ///< Broadcast conductivity values message every 1000 ms. +#define COND_SENSOR_PROBE_TYPE 100 ///< 1K cell constant conductivity probe +#define COND_SENSOR_DECIMAL_CONVERSION 100 ///< Conductivity value from FPGA has two decimal place +#define COND_SENSOR_TEMPERATURE_COEF 0.02 ///< Linear temperature coefficient of variation at 25 Celcius for fresh water +#define COND_SENSOR_REFERENCE_TEMPERATURE 25 ///< Reference temperature for conductivity sensor +#define COND_SENSOR_REPORT_PERIOD (MS_PER_SECOND / TASK_PRIORITY_INTERVAL) ///< Broadcast conductivity values message every second -#define COND_SENSOR_CPI_CPO_MAX_VALUE 2000 ///< Maximum inlet water conductivity -#define COND_SENSOR_CPI_CPO_MIN_VALUE 100 ///< Minimum inlet water conductivity +#define COND_SENSOR_CPI_CPO_MAX_VALUE 2000 ///< Maximum inlet water conductivity +#define COND_SENSOR_CPI_CPO_MIN_VALUE 100 ///< Minimum inlet water conductivity +#define COND_SENSOR_PERSISTENCE_COUNT (5 * MS_PER_SECOND / TASK_GENERAL_INTERVAL) ///< Number of persistence count for conductivity sensor out of range error -#define MAX_ALLOWED_UNCHANGED_CONDUCTIVITY_READS 100 ///< New reading every 640 ms, expect to get new reading in 1s -#define MAX_CONDUCTIVITY_SENSOR_FAILURES 5 ///< maximum number of conductivity sensor errors within window period before alarm -#define MAX_CONDUCTIVITY_SENSOR_FAILURE_WINDOW_MS (60 * MS_PER_SECOND) ///< Conductivity sensor error window +#define MAX_ALLOWED_UNCHANGED_CONDUCTIVITY_READS 100 ///< New reading every 640 ms, expect to get new reading in 1s +#define MAX_CONDUCTIVITY_SENSOR_FAILURES 5 ///< maximum number of conductivity sensor errors within window period before alarm +#define MAX_CONDUCTIVITY_SENSOR_FAILURE_WINDOW_MS (60 * MS_PER_SECOND) ///< Conductivity sensor error window +#define RO_REJECTION_RATIO_REPORT_PERIOD (MS_PER_SECOND / TASK_PRIORITY_INTERVAL) ///< Broadcast RO rejection ratio message every second +#define RO_REJECTION_RATIO_OUT_OF_RANGE_VALUE 1 ///< Out of range value for RO rejection ratio when CPi conductivity is zero +#define MAX_RO_REJECTION_RATIO_ALLOW 0.1 ///< Maximum RO Rejection ratio +#define MAX_CPO_CONDUCTIVITY_ALLOW 15 ///< Maximum CPo sensor conductivity value +#define RO_REJECTION_RATIO_PERSISTENCE_COUNT (10 * MS_PER_SECOND / TASK_GENERAL_INTERVAL) ///< Number of persistence count for RO rejection ro + // ********** private data ********** /// Conductivity sensors' associated temperature sensors static U32 associateTempSensor[ NUM_OF_CONDUCTIVITY_SENSORS ] = { - TEMPSENSORS_INLET_PRIMARY_HEATER, ///< Inlet temperature sensor - TEMPSENSORS_OUTLET_PRIMARY_HEATER, ///< Outlet temperature sensor + TEMPSENSORS_INLET_PRIMARY_HEATER, ///< Inlet temperature sensor + TEMPSENSORS_OUTLET_PRIMARY_HEATER, ///< Outlet temperature sensor }; -static U08 readCount[ NUM_OF_CONDUCTIVITY_SENSORS ]; ///< Read count for conductivity readings. -static U32 internalErrorCount[ NUM_OF_CONDUCTIVITY_SENSORS ]; ///< Internal error count for conductivity readings. -static OVERRIDE_F32_T compensatedConductivityValues[ NUM_OF_CONDUCTIVITY_SENSORS ]; ///< Latest compensated conductivity values. +static U08 readCount[ NUM_OF_CONDUCTIVITY_SENSORS ]; ///< Read count for conductivity readings. +static U32 internalErrorCount[ NUM_OF_CONDUCTIVITY_SENSORS ]; ///< Internal error count for conductivity readings. +static OVERRIDE_F32_T compensatedConductivityValues[ NUM_OF_CONDUCTIVITY_SENSORS ]; ///< Latest compensated conductivity values. +static OVERRIDE_F32_T roRejectionRatio; ///< Latest RO rejection ratio static OVERRIDE_U32_T conductivityDataPublishInterval = { COND_SENSOR_REPORT_PERIOD, - COND_SENSOR_REPORT_PERIOD, 0, 0 }; ///< Conductivity sensors publish time interval override -static U32 conductivityDataPublicationTimerCounter = 0; ///< Conductivity sensors data publish timer counter + COND_SENSOR_REPORT_PERIOD, 0, 0 }; ///< Conductivity sensors publish time interval override +static U32 conductivityDataPublicationTimerCounter = 0; ///< Conductivity sensors data publish timer counter // ********** private function prototypes ********** static void processCPiCPoSensorRead( U32 sensorId, U32 fgpaRead, U08 fpgaReadCount, U08 fpgaErrorCount ); static F32 calcCompensatedConductivity( F32 conductivity, F32 temperature); - +static void calcRORejectionRatio( void ); +static F32 getRORejectionRatio( void ); static DATA_GET_PROTOTYPE( U32, getConductivityDataPublishInterval ); /************************************************************************* @@ -91,8 +102,15 @@ // setFPGAConductivityProbeType( COND_SENSOR_PROBE_TYPE ); } - initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_CONDUCTIVITY_SENSOR_ERROR, - MAX_CONDUCTIVITY_SENSOR_FAILURES, MAX_CONDUCTIVITY_SENSOR_FAILURE_WINDOW_MS ); + roRejectionRatio.data = 0.0; + roRejectionRatio.ovData = 0.0; + roRejectionRatio.ovInitData = 0.0; + roRejectionRatio.override = OVERRIDE_RESET; + + initTimeWindowedCount( TIME_WINDOWED_COUNT_FPGA_CONDUCTIVITY_SENSOR_ERROR, MAX_CONDUCTIVITY_SENSOR_FAILURES, MAX_CONDUCTIVITY_SENSOR_FAILURE_WINDOW_MS ); + initPersistentAlarm( ALARM_ID_INLET_WATER_HIGH_CONDUCTIVITY, ALARM_DATA_TYPE_F32, COND_SENSOR_PERSISTENCE_COUNT, COND_SENSOR_PERSISTENCE_COUNT ); + initPersistentAlarm( ALARM_ID_INLET_WATER_LOW_CONDUCTIVITY, ALARM_DATA_TYPE_F32, COND_SENSOR_PERSISTENCE_COUNT, COND_SENSOR_PERSISTENCE_COUNT ); + initPersistentAlarm( ALARM_ID_RO_REJECTION_RATIO_OUT_OF_RANGE, ALARM_DATA_TYPE_F32, RO_REJECTION_RATIO_PERSISTENCE_COUNT, RO_REJECTION_RATIO_PERSISTENCE_COUNT ); } /************************************************************************* @@ -107,14 +125,16 @@ void execConductivitySensors( void ) { processCPiCPoSensorRead( CONDUCTIVITYSENSORS_CPI_SENSOR, getFPGACPi(), getFPGACPiReadCount(), getFPGACPiErrorCount() ); - processCPiCPoSensorRead( CONDUCTIVITYSENSORS_CPO_SENSOR, getFPGACPi(), getFPGACPoReadCount(), getFPGACPoErrorCount() ); + processCPiCPoSensorRead( CONDUCTIVITYSENSORS_CPO_SENSOR, getFPGACPo(), getFPGACPoReadCount(), getFPGACPoErrorCount() ); if ( ++conductivityDataPublicationTimerCounter >= getConductivityDataPublishInterval() ) { conductivityDataPublicationTimerCounter = 0; - broadcastConductivityData( getConductivityValue(CONDUCTIVITYSENSORS_CPI_SENSOR), + calcRORejectionRatio(); + broadcastConductivityData( getRORejectionRatio(), getConductivityValue(CONDUCTIVITYSENSORS_CPI_SENSOR), getConductivityValue(CONDUCTIVITYSENSORS_CPO_SENSOR) ); } + } /************************************************************************* @@ -124,31 +144,44 @@ * @details * Inputs : none * Outputs : Trigger alarms when conductivity is out of allowed range - * @param state : Operational state of DG * @return none *************************************************************************/ -void checkInletWaterConductivity( U32 state ) +void checkInletWaterConductivity( void ) { - F32 const conductivity = getConductivityValue(CONDUCTIVITYSENSORS_CPI_SENSOR); - if ( conductivity > COND_SENSOR_CPI_CPO_MAX_VALUE ) - { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_INLET_WATER_HIGH_CONDUCTIVITY, conductivity, state ); - } + F32 const conductivity = getConductivityValue( CONDUCTIVITYSENSORS_CPI_SENSOR ); + BOOL const isCondTooHigh = ( conductivity > COND_SENSOR_CPI_CPO_MAX_VALUE ); + BOOL const isCondTooLow = ( conductivity < COND_SENSOR_CPI_CPO_MIN_VALUE ); - if ( conductivity < COND_SENSOR_CPI_CPO_MIN_VALUE ) - { - SET_ALARM_WITH_2_F32_DATA( ALARM_ID_INLET_WATER_LOW_CONDUCTIVITY, conductivity, state ); - } + checkPersistentAlarm( ALARM_ID_INLET_WATER_HIGH_CONDUCTIVITY, isCondTooHigh, conductivity ); + checkPersistentAlarm( ALARM_ID_INLET_WATER_LOW_CONDUCTIVITY, isCondTooLow, conductivity ); } /************************************************************************* * @brief + * The checkRORejectionRatio checks RO rejection ratio and outlet water + * conductivity. The function triggers an alarm when RO rejection ratio or + * outlet water conductivity is out of allowed range for period of time. + * @details + * Inputs : none + * Outputs : Triggered alarm + * @return none + *************************************************************************/ +void checkRORejectionRatio( void ) +{ + F32 const roRejectionRatio = getRORejectionRatio(); + F32 const cpo = getConductivityValue( CONDUCTIVITYSENSORS_CPO_SENSOR ); + BOOL const isRORejectionRatioOutOfRange = ( roRejectionRatio > MAX_RO_REJECTION_RATIO_ALLOW ) || ( cpo >= MAX_CPO_CONDUCTIVITY_ALLOW ); + checkPersistentAlarm( ALARM_ID_RO_REJECTION_RATIO_OUT_OF_RANGE, isRORejectionRatioOutOfRange, roRejectionRatio ); +} + +/************************************************************************* + * @brief * The getConductivityValue function gets the compensated conductivity * value for a given conductivity sensor id. * @details * Inputs : compensatedConductivityValues[] * Outputs : none - * @param sensorId : Id of conductivity sensor to get conductivity value + * @param sensorId Id of conductivity sensor to get conductivity value * @return compensated conductivity *************************************************************************/ F32 getConductivityValue( U32 sensorId ) @@ -182,8 +215,8 @@ * @details * Inputs : temperature * Outputs : none - * @param conductivity : Conductivity value - * @param temperature : Temperature to compensate conductivity with + * @param conductivity Conductivity value + * @param temperature Temperature to compensate conductivity with * @return compensated conductivity based on temperature *************************************************************************/ static F32 calcCompensatedConductivity( F32 conductivity, F32 temperature) @@ -196,23 +229,64 @@ /************************************************************************* * @brief + * The getRORejectionRatio function gets the latest RO rejection ratio + * @details + * Inputs: roRejectionRatio + * Outputs: none + * @return RO rejection ratio + *************************************************************************/ +F32 getRORejectionRatio( void ) +{ + F32 result = roRejectionRatio.data; + + if ( OVERRIDE_KEY == roRejectionRatio.override ) + { + result = roRejectionRatio.ovData; + } + + return result; +} + +/************************************************************************* + * @brief + * The calcRORejectionRatio function calculates the RO rejection ratio using + * the cpi sensor conductivity value and cpo sensor conductivity value. + * @details + * Inputs: CPi sensor conductivity and CPo sensor conductivity + * Outputs: RO rejection ratio + * @return none + *************************************************************************/ +static void calcRORejectionRatio( void ) +{ + F32 const cpi = getConductivityValue( CONDUCTIVITYSENSORS_CPI_SENSOR ); + F32 const cpo = getConductivityValue( CONDUCTIVITYSENSORS_CPO_SENSOR ); + roRejectionRatio.data = RO_REJECTION_RATIO_OUT_OF_RANGE_VALUE; + + if ( cpi > 0 ) + { + roRejectionRatio.data = cpo / cpi; + } +} + +/************************************************************************* + * @brief * The processCPiCPoSensorRead function checks if there is an error in FPGA * and FPGA read count. If there is any error in the FPGA error, it raises an * alarm. If the read count has changed, the new reading will be processed. * @details * Inputs : none * Outputs : none - * @param sensorId : Conductivity sensor id to process - * @param fgpaRead : FPGA conductivity reading value - * @param fpgaReadCount : FPGA read count - * @param fpgaErrorCount : FPGA error count + * @param sensorId Conductivity sensor id to process + * @param fgpaRead FPGA conductivity reading value + * @param fpgaReadCount FPGA read count + * @param fpgaErrorCount FPGA error count * @return none *************************************************************************/ static void processCPiCPoSensorRead( U32 sensorId, U32 fgpaRead, U08 fpgaReadCount, U08 fpgaErrorCount ) { if ( fpgaErrorCount == 0 ) { - if ( (readCount[ sensorId ] != fpgaReadCount) ) + if ( ( readCount[ sensorId ] != fpgaReadCount ) ) { F32 const temperature = getTemperatureValue( associateTempSensor[ sensorId ] ); F32 const conductivity = ( (F32)( fgpaRead ) / COND_SENSOR_DECIMAL_CONVERSION ); @@ -259,7 +333,6 @@ return result; } - /************************************************************************* * TEST SUPPORT FUNCTIONS *************************************************************************/ @@ -272,8 +345,8 @@ * @details * Inputs : compensatedConductivityValues[] * Outputs : compensatedConductivityValues[] - * @param sensorId : Id of conductivity sensor to get conductivity value - * @param value : override compensated conductivity value + * @param sensorId Id of conductivity sensor to get conductivity value + * @param value Override compensated conductivity value * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetConductivityOverride( U32 sensorId, F32 value ) @@ -300,7 +373,7 @@ * @details * Inputs : compensatedConductivityValues[] * Outputs : compensatedConductivityValues[] - * @param sensorId : Id of the conductivity sensor to override. + * @param sensorId Id of the conductivity sensor to override. * @return TRUE if reset successful, FALSE if not *************************************************************************/ BOOL testResetConductivityOverride( U32 sensorId ) @@ -322,12 +395,58 @@ /************************************************************************* * @brief + * The testSetRORejectionRatioOverride function overrides the RO Rejection ratio. + * @details + * Inputs : roRejectionRatio + * Outputs : roRejectionRatio + * @param value Override RO Rejection ratio value + * @return TRUE if override successful, FALSE if not + *************************************************************************/ +BOOL testSetRORejectionRatioOverride( F32 value ) +{ + BOOL result = FALSE; + + if ( isTestingActivated() ) + { + result = TRUE; + roRejectionRatio.ovData = value; + roRejectionRatio.override = OVERRIDE_KEY; + } + + return result; +} + +/************************************************************************* + * @brief + * The testResetRORejectionRatioOverride function resets the override of + * the RO Rejection ratio. + * @details + * Inputs : roRejectionRatio + * Outputs : roRejectionRatio + * @return TRUE if reset successful, FALSE if not + *************************************************************************/ +BOOL testResetRORejectionRatioOverride( void ) +{ + BOOL result = FALSE; + + if ( isTestingActivated() ) + { + result = TRUE; + roRejectionRatio.ovData = roRejectionRatio.ovInitData; + roRejectionRatio.override = OVERRIDE_RESET; + } + + return result; +} + +/************************************************************************* + * @brief * The testSetConductivityDataPublishIntervalOverride function overrides * the conductivity data publish interval. * @details * Inputs : conductivityDataPublishInterval * Outputs : conductivityDataPublishInterval - * @param value : override conductivity data publish interval with (in ms) + * @param value Override conductivity data publish interval with (in ms) * @return TRUE if override successful, FALSE if not *************************************************************************/ BOOL testSetConductivityDataPublishIntervalOverride( U32 interval_ms ) Index: firmware/App/Controllers/ConductivitySensors.h =================================================================== diff -u -r0dec8744af40d0c87a6d7cd1923920c1c2bd1d2f -r92ec01cb48d91fe7315baa987e1aa051dd12df75 --- firmware/App/Controllers/ConductivitySensors.h (.../ConductivitySensors.h) (revision 0dec8744af40d0c87a6d7cd1923920c1c2bd1d2f) +++ firmware/App/Controllers/ConductivitySensors.h (.../ConductivitySensors.h) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) @@ -44,13 +44,17 @@ void initConductivitySensors( void ); void execConductivitySensors( void ); -void checkInletWaterConductivity( U32 state ); +void checkInletWaterConductivity( void ); +void checkRORejectionRatio( void ); DATA_ARRAY_GET_PROTOTYPE ( F32, getConductivityValue, sensor ); BOOL testSetConductivityOverride( U32 sensor, F32 value ); BOOL testResetConductivityOverride( U32 sensor ); +BOOL testSetRORejectionRatioOverride( F32 value ); +BOOL testResetRORejectionRatioOverride( void ); + BOOL testSetConductivityDataPublishIntervalOverride( U32 interval_ms ); BOOL testResetConductivityDataPublishIntervalOverride( void ); Index: firmware/App/Modes/ModeDrain.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r92ec01cb48d91fe7315baa987e1aa051dd12df75 --- firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Modes/ModeDrain.c (.../ModeDrain.c) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) @@ -22,8 +22,8 @@ #include "OperationModes.h" #include "Pressures.h" #include "Reservoirs.h" -#include "Valves.h" #include "TemperatureSensors.h" +#include "Valves.h" /** * @addtogroup DGDrainMode @@ -44,10 +44,10 @@ /*********************************************************************//** * @brief - * The initOpParamsMode function initializes the Drain Mode module. + * The initDrainMode function initializes the drain mode module. * @details * Inputs : none - * Outputs : Operating Parameters Mode module initialized. + * Outputs : drainState * @return none *************************************************************************/ void initDrainMode( void ) @@ -61,7 +61,7 @@ * mode. * @details * Inputs : none - * Outputs : + * Outputs : Drain mode initialized * @return none *************************************************************************/ void transitionToDrainMode( void ) @@ -76,18 +76,19 @@ /*********************************************************************//** * @brief - * The execDrainMode function executes the Drain Mode state machine. + * The execDrainMode function executes the drain mode state machine. * @details - * Inputs : none - * Outputs : + * Inputs : drainState + * Outputs : Check water quality, drainState * @return current state. *************************************************************************/ U32 execDrainMode( void ) { - // check inlet water conductivity, temperature, and pressure - checkInletWaterConductivity( drainState ); + // check inlet water conductivity, temperature, pressure, and RO rejection ratio + checkInletWaterConductivity(); checkInletWaterTemperature(); checkInletPressure(); + checkRORejectionRatio(); // execute current drain state switch ( drainState ) @@ -111,11 +112,11 @@ /*********************************************************************//** * @brief - * The handleDrainState function handles the drain state of the Drain Mode \n + * The handleDrainState function handles the drain state of the drain mode \n * state machine. * @details * Inputs : none - * Outputs : + * Outputs : Drain out from reservoir * @return the next state *************************************************************************/ static DG_DRAIN_STATE_T handleDrainState( void ) Index: firmware/App/Modes/ModeFill.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r92ec01cb48d91fe7315baa987e1aa051dd12df75 --- firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Modes/ModeFill.c (.../ModeFill.c) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) @@ -22,9 +22,9 @@ #include "OperationModes.h" #include "Pressures.h" #include "Reservoirs.h" +#include "TemperatureSensors.h" #include "Timers.h" #include "Valves.h" -#include "TemperatureSensors.h" /** * @addtogroup DGFillMode @@ -47,10 +47,10 @@ /*********************************************************************//** * @brief initFillMode - * The initFillMode function initializes the Fill Mode module. + * The initFillMode function initializes the fill mode module. * @details * Inputs : none - * Outputs : Fill Mode module initialized. + * Outputs : Fill mode module initialized. * @return none *************************************************************************/ void initFillMode( void ) @@ -64,7 +64,7 @@ * fill mode. * @details * Inputs : none - * Outputs : fillState + * Outputs : Re-initialized fill mode * @return none *************************************************************************/ void transitionToFillMode( void ) @@ -80,18 +80,19 @@ /*********************************************************************//** * @brief execFillMode - * The execFillMode function executes the Fill Mode state machine. + * The execFillMode function executes the fill mode state machine. * @details * Inputs : fillState - * Outputs : fillState + * Outputs : Check water quality, fillState * @return current state. *************************************************************************/ U32 execFillMode( void ) { - // check inlet water conductivity, temperature, and pressure - checkInletWaterConductivity( fillState ); + // check inlet water conductivity, temperature, pressure, and RO rejection ratio + checkInletWaterConductivity(); checkInletWaterTemperature(); checkInletPressure(); + checkRORejectionRatio(); // execute current Fill state switch ( fillState ) @@ -120,10 +121,10 @@ /*********************************************************************//** * @brief * The handleDialysateProductionState function executes the Dialysate Production \n - * state of the Fill Mode state machine. + * state of the fill mode state machine. * @details * Inputs : none - * Outputs : + * Outputs : none * @return the next state *************************************************************************/ static DG_FILL_MODE_STATE_T handleDialysateProductionState( void ) @@ -143,10 +144,10 @@ /*********************************************************************//** * @brief * The handleDeliverDialysateState function executes the Deliver Dialysate \n - * state of the Fill Mode state machine. + * state of the fill mode state machine. * @details * Inputs : none - * Outputs : + * Outputs : Deliver Dialysate * @return the next state *************************************************************************/ static DG_FILL_MODE_STATE_T handleDeliverDialysateState( void ) Index: firmware/App/Modes/ModeRecirculate.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r92ec01cb48d91fe7315baa987e1aa051dd12df75 --- firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Modes/ModeRecirculate.c (.../ModeRecirculate.c) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) @@ -27,9 +27,9 @@ #include "Pressures.h" #include "ROPump.h" #include "TaskGeneral.h" +#include "TemperatureSensors.h" #include "Timers.h" #include "Valves.h" -#include "TemperatureSensors.h" /** * @addtogroup DGRecirculateMode @@ -54,10 +54,10 @@ /*********************************************************************//** * @brief - * The initRecirculateMode function initializes the Fill Mode module. + * The initRecirculateMode function initializes the re-circulate mode module. * @details * Inputs : none - * Outputs : Fill Mode module initialized. + * Outputs : Re-circulate mode module initialized * @return none *************************************************************************/ void initRecirculateMode( void ) @@ -69,10 +69,10 @@ /*********************************************************************//** * @brief * The transitionToRecirculateMode function prepares for transition to \n - * fill mode. + * re-circulate mode. * @details * Inputs : none - * Outputs : recircState + * Outputs : Re-initialized re-circulate mode * @return none *************************************************************************/ void transitionToRecirculateMode( void ) @@ -102,18 +102,19 @@ /*********************************************************************//** * @brief - * The execRecirculateMode function executes the Re-circulate Mode state machine. + * The execRecirculateMode function executes the re-circulate mode state machine. * @details * Inputs : recircState - * Outputs : recircState + * Outputs : Check water quality, recircState * @return current state *************************************************************************/ U32 execRecirculateMode( void ) { - // check inlet water conductivity, temperature, and pressure - checkInletWaterConductivity( recircState ); + // check inlet water conductivity, temperature, pressure, and RO rejection ratio + checkInletWaterConductivity(); checkInletWaterTemperature(); checkInletPressure(); + checkRORejectionRatio(); // execute current re-circulate state switch ( recircState ) @@ -145,11 +146,11 @@ /*********************************************************************//** * @brief - * The handleCheckInletWaterState function executes the flush lines \n - * state of the Re-circulate Mode state machine. + * The handleFlushLinesState function executes the flush lines \n + * state of the re-circulate mode state machine. * @details * Inputs : none - * Outputs : + * Outputs : Integrate volume of water moved through line * @return the next state *************************************************************************/ static DG_RECIRCULATE_MODE_STATE_T handleFlushLinesState( void ) @@ -173,11 +174,11 @@ /*********************************************************************//** * @brief - * The handleRecircProductWaterState function executes the re-circulate \n - * water state of the Re-circulate Mode state machine. + * The handleRecircWaterState function executes the re-circulate \n + * water state of the re-circulate mode state machine. * @details * Inputs : none - * Outputs : + * Outputs : none * @return the next state *************************************************************************/ static DG_RECIRCULATE_MODE_STATE_T handleRecircWaterState( void ) @@ -190,10 +191,10 @@ /*********************************************************************//** * @brief * The handleRecircPauseState function executes the pause state of the \n - * Re-circulate Mode state machine. + * re-circulate mode state machine. * @details * Inputs : none - * Outputs : + * Outputs : none * @return the next state *************************************************************************/ static DG_RECIRCULATE_MODE_STATE_T handleRecircPauseState( void ) Index: firmware/App/Services/MessagePayloads.h =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r92ec01cb48d91fe7315baa987e1aa051dd12df75 --- firmware/App/Services/MessagePayloads.h (.../MessagePayloads.h) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/MessagePayloads.h (.../MessagePayloads.h) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) @@ -81,6 +81,7 @@ typedef struct { + F32 roRejectionRatio; F32 cpi; F32 cpo; } CONDUCTIVITY_DATA_T; Index: firmware/App/Services/SystemCommMessages.c =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r92ec01cb48d91fe7315baa987e1aa051dd12df75 --- firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/SystemCommMessages.c (.../SystemCommMessages.c) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) @@ -656,11 +656,12 @@ * @details * Inputs : none * Outputs : conductivity data msg constructed and queued - * @param cpi: water inlet conductivity data. - * @param cpo : water outlet conductivity data. + * @param roRejectionRatio RO rejection ratio + * @param cpi water inlet conductivity data + * @param cpo water outlet conductivity data * @return TRUE if msg successfully queued for transmit, FALSE if not *************************************************************************/ -BOOL broadcastConductivityData( F32 cpi, F32 cpo ) +BOOL broadcastConductivityData( F32 roRejectionRatio, F32 cpi, F32 cpo ) { BOOL result; MESSAGE_T msg; @@ -672,6 +673,7 @@ msg.hdr.msgID = MSG_ID_DG_CONDUCTIVITY_DATA; msg.hdr.payloadLen = sizeof( CONDUCTIVITY_DATA_T ); + payload.roRejectionRatio = roRejectionRatio; payload.cpi = cpi; payload.cpo = cpo; Index: firmware/App/Services/SystemCommMessages.h =================================================================== diff -u -rdc0d9b087c609e71cacdb7f0395cccf29d749c00 -r92ec01cb48d91fe7315baa987e1aa051dd12df75 --- firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision dc0d9b087c609e71cacdb7f0395cccf29d749c00) +++ firmware/App/Services/SystemCommMessages.h (.../SystemCommMessages.h) (revision 92ec01cb48d91fe7315baa987e1aa051dd12df75) @@ -68,7 +68,7 @@ BOOL broadcastTemperatureSensorsData ( U08 *sensorsValue, U32 byteLength ); // MSG_ID_DG_CONDUCTIVITY_DATA -BOOL broadcastConductivityData( F32 cpi, F32 cpo ); +BOOL broadcastConductivityData( F32 roRejectionRatio, F32 cpi, F32 cpo ); // MSG_ID_POWER_OFF_WARNING void handlePowerOffWarning( MESSAGE_T *message );