Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -ra89d6b091874136d75a9bfbdbbc1ff00f42467b3 -r00aab2d131cccd39bfe478cfb4457b5661e9cefc --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision a89d6b091874136d75a9bfbdbbc1ff00f42467b3) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 00aab2d131cccd39bfe478cfb4457b5661e9cefc) @@ -7,8 +7,8 @@ * * @file Heaters.c * -* @author (last) Dara Navaei -* @date (last) 04-Aug-2022 +* @author (last) Bill Bracken +* @date (last) 22-Aug-2022 * * @author (original) Dara Navaei * @date (original) 23-Apr-2020 @@ -64,22 +64,11 @@ #define DELTA_TEMPERATURE_TIME_COSNTANT_C 8.6F ///< Delta temperature calculated from time constant. #define PRIMARY_HEATER_DUTY_CYCLE_PER_TEMPERATURE_C 0.03F ///< Primary heaters duty cycle per temperature in C. #define DATA_PUBLISH_COUNTER_START_COUNT 70 ///< Data publish counter start count. +#define MIN_RO_HEATER_FLOWRATE_LPM 0.2F ///< Minimum target RO heater flow rate in L/min. static const F32 WATER_SPECIFIC_HEAT_DIVIDED_BY_MINUTES = 4184 / SEC_PER_MIN; ///< Water specific heat in J/KgC / 60. static const F32 PRIMARY_HEATERS_MAXIMUM_POWER_WATTS = 475 + 237.5F; ///< Primary heaters maximum power (main primary = 475W and small primary = 237.5W). -/// Heaters exec states -typedef enum Heaters_Exec_States -{ - HEATER_EXEC_STATE_OFF = 0, ///< Heater exec state off. - HEATER_EXEC_STATE_PRIMARY_RAMP_TO_TARGET, ///< Heater exec state primary ramp to target. - HEATER_EXEC_STATE_PRIMARY_CONTROL_TO_TARGET, ///< Heater exec state primary control to target. - HEATER_EXEC_STATE_CONTROL_TO_DISINFECT_TARGET, ///< Heater exec state control to disinfect (heat or chemical) target. - HEATER_EXEC_STATE_TRIMMER_RAMP_TO_TARGET, ///< Heater exec state trimmer ramp to target. - HEATER_EXEC_STATE_TRIMMER_CONTROL_TO_TARGET, ///< Heater exec state trimmer control to target. - NUM_OF_HEATERS_STATE, ///< Number of heaters state. -} HEATERS_STATE_T; - /// Heaters data structure typedef struct { @@ -90,7 +79,7 @@ F32 dutycycle; ///< Heater duty cycle. F32 targetFlow; ///< Heater target flow. BOOL hasTargetTempChanged; ///< Heater target temperature change flag indicator. - F32 heaterEfficiency; ///< Heater efficiency during the run. + F32 heaterEstGain; ///< Heater efficiency during the run. BOOL hasTargetBeenReached; ///< Heater flag to indicate whether the target temperature has been reached. F32 calculatedTemperature; ///< Heater calculated temperature. DG_RESERVOIR_ID_T inactiveRsrvr; ///< Heater inactive reservoir. @@ -145,7 +134,7 @@ heatersStatus[ heater ].dutycycle = 0.0; heatersStatus[ heater ].targetFlow = 0.0; heatersStatus[ heater ].hasTargetTempChanged = FALSE; - heatersStatus[ heater ].heaterEfficiency = 1.0; // Assuming 100% efficiency during initialization until it is updated + heatersStatus[ heater ].heaterEstGain = 1.0; // Assuming 100% efficiency during initialization until it is updated heatersStatus[ heater ].hasTargetBeenReached = FALSE; } @@ -331,7 +320,7 @@ // TODO add the function that gets the flow of the new flow sensor for DG. For now it is assumed that trimmer heater flow sensor // is not 0 so the heater can run if needed F32 measFlow = ( DG_PRIMARY_HEATER == heater ? getMeasuredROFlowRateLPM() : 50.0 ); - F32 minFlow = ( DG_PRIMARY_HEATER == heater ? MIN_RO_FLOWRATE_LPM : MIN_RO_FLOWRATE_LPM ); + F32 minFlow = ( DG_PRIMARY_HEATER == heater ? MIN_RO_HEATER_FLOWRATE_LPM : MIN_RO_HEATER_FLOWRATE_LPM ); BOOL isFlowLow = ( measFlow < minFlow ? TRUE : FALSE ); checkPersistentAlarm( ALARM_ID_DG_FLOW_TOO_LOW_WHILE_HEATER_ON, isFlowLow, measFlow, minFlow ); @@ -363,8 +352,8 @@ *************************************************************************/ void resetHeatersEfficiency( void ) { - heatersStatus[ DG_PRIMARY_HEATER ].heaterEfficiency = 1.0; - heatersStatus[ DG_TRIMMER_HEATER ].heaterEfficiency = 1.0; + heatersStatus[ DG_PRIMARY_HEATER ].heaterEstGain = 1.0; + heatersStatus[ DG_TRIMMER_HEATER ].heaterEstGain = 1.0; } /*********************************************************************//** @@ -629,7 +618,7 @@ static F32 calculatePrimaryHeaterDutyCycle( F32 targetTemperature, F32 currentTemperature, F32 flow, BOOL checkEfficiency ) { // Get the primary heater's efficiency and the last fill temperature from the ModeFill - F32 heaterEfficiency = heatersStatus[ DG_PRIMARY_HEATER ].heaterEfficiency; + F32 heaterEfficiency = heatersStatus[ DG_PRIMARY_HEATER ].heaterEstGain; #ifndef _RELEASE_ if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_HEATERS_EFFICIENCY ) != SW_CONFIG_ENABLE_VALUE ) @@ -657,7 +646,7 @@ heaterEfficiency = MAX( heaterEfficiency, 0.0 ); // Update the heaters efficiency - heatersStatus[ DG_PRIMARY_HEATER ].heaterEfficiency = heaterEfficiency; + heatersStatus[ DG_PRIMARY_HEATER ].heaterEstGain = heaterEfficiency; } } @@ -689,7 +678,7 @@ static F32 calculateTrimmerHeaterDutyCycle( F32 targetTemperature, F32 currentTemperature, F32 flow, BOOL checkEfficiency ) { // Get the primary heater's efficiency and the last fill temperature from the ModeFill - F32 heaterEfficiency = heatersStatus[ DG_TRIMMER_HEATER ].heaterEfficiency; + F32 heaterEfficiency = heatersStatus[ DG_TRIMMER_HEATER ].heaterEstGain; F32 dutyCycle = 0.0; #ifndef _RELEASE_ @@ -802,7 +791,7 @@ data.trimmerTargetTemp = heatersStatus[ DG_TRIMMER_HEATER ].targetTemp; data.primaryHeaterState = heatersStatus[ DG_PRIMARY_HEATER ].state; data.trimmerHeaterState = heatersStatus[ DG_TRIMMER_HEATER ].state; - data.primaryEfficiency = heatersStatus[ DG_PRIMARY_HEATER ].heaterEfficiency * 100; + data.primaryEfficiency = heatersStatus[ DG_PRIMARY_HEATER ].heaterEstGain * 100; data.primaryCalcTargetTemp = heatersStatus[ DG_PRIMARY_HEATER ].calculatedTemperature; data.trimmerCalcCurrentTemp = heatersStatus[ DG_TRIMMER_HEATER ].calculatedTemperature;