Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -r22176ce95e49213c48454f34ddf5d29b8109f2cb -r87ebf31788a90216c65e0264e2b8cb21d25e5b9b --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 22176ce95e49213c48454f34ddf5d29b8109f2cb) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 87ebf31788a90216c65e0264e2b8cb21d25e5b9b) @@ -8,7 +8,7 @@ * @file Heaters.c * * @author (last) Dara Navaei -* @date (last) 23-May-2022 +* @date (last) 04-Aug-2022 * * @author (original) Dara Navaei * @date (original) 23-Apr-2020 @@ -53,24 +53,18 @@ #define MINIMUM_TARGET_TEMPERATURE 10.0F ///< Minimum allowed target temperature for the heaters. #define MAXIMUM_TARGET_TEMPERATURE 90.0F ///< Maximum allowed target temperature for the heaters. -#define MAXIMUM_IDLE_DRAIN_TARGET_TEMPERATURE 58.0F ///< Maximum allowed target temperature for the idle and drain modes. -#define HEATERS_CONTROL_STATE_CHECK_INTERVAL_COUNT ( ( 10 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ) ///< Temperature sensors interval count. -#define HEATERS_ON_WITH_NO_FLOW_TIMEOUT_COUNT ( ( 3 * MS_PER_SECOND ) / TASK_PRIORITY_INTERVAL ) ///< Heaters are on but there is no sufficient flow timeout in counts. -#define HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_C 170.0F ///< Heaters max allowed internal temperature in C. -#define HEATERS_MAX_ALLOWED_COLD_JUNCTION_TEMPERATURE_C 80.0F ///< Heaters max allowed cold junction temperature in C. -#define HEATERS_MAX_ALLOWED_INTERNAL_TEMPERATURE_TIMEOUT_MS ( 2 * SEC_PER_MIN * MS_PER_SECOND ) ///< Heaters max allowed internal temperature timeout in milliseconds. #define HEATERS_ON_NO_FLOW_TIMEOUT_MS ( 1 * MS_PER_SECOND ) ///< Heaters on with no flow time out in milliseconds. #define HEATERS_MAX_OPERATING_VOLTAGE_V 24.0F ///< Heaters max operating voltage in volts. #define HEATERS_VOLTAGE_OUT_OF_RANGE_TIMEOUT_MS ( 2 * MS_PER_SECOND ) ///< Heaters voltage out of range time out in milliseconds. #define HEATERS_MAX_VOLTAGE_OUT_OF_RANGE_TOL 0.2F ///< Heaters max voltage out of range tolerance. -#define HEATERS_MIN_RAMP_TIME_MS ( 6 * MS_PER_SECOND ) ///< Heaters minimum time that they have to stay in the ramp state in milliseconds. -#define TEMPERATURES_MOVING_AVG_SIZE 3U ///< Heaters ramp state temperatures moving average size. +#define TRIMMER_HEATER_MAX_POWER_W 66.5F ///< Trimmer heater maximum power in Watts. +#define TRIMMER_HEATER_CONTROL_CHECK_INTERVAL_COUNT ( ( 30 * MS_PER_SECOND ) / TASK_GENERAL_INTERVAL ) ///< Trimmer heater control interval count. #define DELTA_TEMPERATURE_TIME_COSNTANT_C 8.6F ///< Delta temperature calculated from time constant. -#define MAXIMUM_ALLOWED_TARGET_TEMPERATURE_DEVIATION_C 0.25F ///< Maximum allowed temperature deviation from target temperature in C. #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). @@ -95,16 +89,17 @@ BOOL startHeaterSignal; ///< Heater start indication flag. BOOL isHeaterOn; ///< Heater on/off status flag. F32 dutycycle; ///< Heater duty cycle. - F32 targetROFlow; ///< Heater target flow. + F32 targetFlow; ///< Heater target flow. BOOL hasTargetTempChanged; ///< Heater target temperature change flag indicator. F32 heaterEfficiency; ///< Heater efficiency during the run. BOOL hasTargetBeenReached; ///< Heater flag to indicate whether the target temperature has been reached. - - F32 temporaryInterimTemperature; ///< TODO remove + F32 calculatedTemperature; ///< Heater calculated temperature. + DG_RESERVOIR_ID_T inactiveRsrvr; ///< Heater inactive reservoir. } HEATER_STATUS_T; static HEATER_STATUS_T heatersStatus[ NUM_OF_DG_HEATERS ]; ///< Heaters status. static U32 dataPublicationTimerCounter; ///< Data publication timer counter. +static U32 trimmerHeaterControlCounter; ///< Trimmer heater control counter. static OVERRIDE_U32_T heatersDataPublishInterval = { HEATERS_DATA_PUBLISH_INTERVAL, HEATERS_DATA_PUBLISH_INTERVAL, 0, 0 }; ///< Heaters data publish time interval. // ********** private function prototypes ********** @@ -132,13 +127,15 @@ * The initHeaters initializes the heaters driver. * @details Inputs: none * @details Outputs: voltageMonitorTimeCounter, heaterStatus, - * hasTreatmentInternalTempBeenSet, dataPublicationTimerCounter + * hasTreatmentInternalTempBeenSet, dataPublicationTimerCounter, + * trimmerHeaterControlCounter * @return none *************************************************************************/ void initHeaters( void ) { DG_HEATERS_T heater; dataPublicationTimerCounter = DATA_PUBLISH_COUNTER_START_COUNT; + trimmerHeaterControlCounter = 0; for ( heater = DG_PRIMARY_HEATER; heater < NUM_OF_DG_HEATERS; heater++ ) { @@ -147,7 +144,7 @@ heatersStatus[ heater ].startHeaterSignal = FALSE; heatersStatus[ heater ].isHeaterOn = FALSE; heatersStatus[ heater ].dutycycle = 0.0; - heatersStatus[ heater ].targetROFlow = 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 ].hasTargetBeenReached = FALSE; @@ -174,10 +171,12 @@ * @param heater: heater ID that its target temperature is set * @param targetTemperature: target temperature of that the heater has to * heat the fluid - * @return none + * @return TRUE if the temperature was set otherwise, FALSE *************************************************************************/ -void setHeaterTargetTemperature( DG_HEATERS_T heater, F32 targetTemperature ) +BOOL setHeaterTargetTemperature( DG_HEATERS_T heater, F32 targetTemperature ) { + BOOL result = FALSE; + if( heater < NUM_OF_DG_HEATERS ) { // Assume the target temperature has not changed @@ -188,13 +187,15 @@ { heatersStatus[ heater ].targetTemp = targetTemperature; heatersStatus[ heater ].hasTargetTempChanged = TRUE; - // TODO alarm if temperature if out of range or just reject? + result = TRUE; } } else { SET_ALARM_WITH_2_U32_DATA( ALARM_ID_DG_SOFTWARE_FAULT, SW_FAULT_ID_HEATERS_INVALID_HEATER_ID_SELECTED, heater ) } + + return result; } /*********************************************************************//** @@ -225,7 +226,7 @@ { if ( TRUE == heatersStatus[ heater ].hasTargetTempChanged ) { - status = TRUE; + status = TRUE; heatersStatus[ heater ].startHeaterSignal = TRUE; } } @@ -311,51 +312,6 @@ /*********************************************************************//** * @brief - * The handleTrimmerHeaterCmd handles a start trimmer heater command from the HD. - * It resets the trimmer heater's state and sets the duty cycle of the trimmer heater. - * @details Inputs: none - * @details Outputs: process command and send back response - * @param heaterCmdPtr pointer to heater command data record - * @return status - *************************************************************************/ -void handleTrimmerHeaterCmd( TRIMMER_HEATER_CMD_T *heaterCmdPtr ) -{ - DG_CMD_RESPONSE_T cmdResponse; - - cmdResponse.commandID = DG_CMD_START_TRIMMER_HEATER; - cmdResponse.rejected = TRUE; - cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_NONE; - - if ( TRUE == heaterCmdPtr->startHeater ) - { - if ( ( heaterCmdPtr->targetTemp >= MINIMUM_TARGET_TEMPERATURE ) && ( heaterCmdPtr->targetTemp <= MAXIMUM_TARGET_TEMPERATURE ) ) - { - cmdResponse.rejected = FALSE; - heatersStatus[ DG_TRIMMER_HEATER ].targetTemp = heaterCmdPtr->targetTemp; // TODo do we need to remove this since the trimmer heater is set in the reservoirs - -#ifndef _RELEASE_ - if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_TRIMMER_HEATER ) != SW_CONFIG_ENABLE_VALUE ) -#endif - { - heatersStatus[ DG_TRIMMER_HEATER ].startHeaterSignal = TRUE; - } - } - else - { - cmdResponse.rejectCode = DG_CMD_REQUEST_REJECT_REASON_INVALID_PARAMETER; - } - } - else - { - cmdResponse.rejected = FALSE; - stopHeater( DG_TRIMMER_HEATER ); - } - - sendCommandResponseMsg( &cmdResponse ); -} - -/*********************************************************************//** - * @brief * The execHeatersMonitor function monitors the status of the heaters. * The internal temperature sensors and the voltages of the heaters are * monitored. The flow is continuously checked and if there is no flow @@ -376,7 +332,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 ); @@ -457,31 +413,29 @@ if ( DG_MODE_FILL == opMode ) { // If the previous average fill flow rate is 0, use the nominal target RO flow from the RO pump - targetFlow = ( getAvgFillFlowRate() - 0.0 > NEARLY_ZERO ? getAvgFillFlowRate() : getTargetROPumpFlowRate() ); + targetFlow = ( getAvgFillFlowRateLPM() - 0.0 > NEARLY_ZERO ? getAvgFillFlowRateLPM() : getTargetROPumpFlowRateLPM() ); dutyCycle = calculatePrimaryHeaterDutyCycle( targetTemperature, inletTemperature, targetFlow, TRUE ); state = HEATER_EXEC_STATE_PRIMARY_CONTROL_TO_TARGET; } else if ( ( DG_MODE_GENE == opMode ) || ( DG_MODE_DRAI == opMode ) ) { targetTemperature += DELTA_TEMPERATURE_TIME_COSNTANT_C; // Use target flow rate during Idle and drain - targetFlow = getTargetROPumpFlowRate(); + targetFlow = getTargetROPumpFlowRateLPM(); dutyCycle = calculatePrimaryHeaterDutyCycle( targetTemperature, inletTemperature, targetFlow, FALSE ); state = HEATER_EXEC_STATE_PRIMARY_CONTROL_TO_TARGET; } else if ( ( DG_MODE_HEAT == opMode ) || ( DG_MODE_CHEM == opMode ) ) { // If the mode is any of the disinfects, especially heat, use the target flow rate instead of the avg. flow // Most of the times the heater should be running at 100% duty cycle since the target temperature is 81 C - targetFlow = getTargetROPumpFlowRate(); + targetFlow = getTargetROPumpFlowRateLPM(); dutyCycle = calculatePrimaryHeaterDutyCycle( targetTemperature, inletTemperature, targetFlow, FALSE ); state = HEATER_EXEC_STATE_CONTROL_TO_DISINFECT_TARGET; } - // TODO remove once dialysate heating is done - heatersStatus[ DG_PRIMARY_HEATER ].temporaryInterimTemperature = targetTemperature; - // TODO remove - + // Update the calculated target temperature + heatersStatus[ DG_PRIMARY_HEATER ].calculatedTemperature = targetTemperature; setHeaterDutyCycle( heater, dutyCycle ); return state; @@ -564,15 +518,15 @@ HEATERS_STATE_T state = HEATER_EXEC_STATE_TRIMMER_RAMP_TO_TARGET; DG_HEATERS_T heater = DG_TRIMMER_HEATER; F32 currentTemperature = 0.0; - F32 targetFlow = getTargetDialysateFlowLPM(); + F32 targetFlowLPM = getTargetDialysateFlowLPM(); F32 dutyCycle = 0.0; F32 targetTemperature = heatersStatus[ heater ].targetTemp; DG_OP_MODE_T opMode = getCurrentOperationMode(); if ( ( DG_MODE_FILL == opMode ) || ( DG_MODE_GENE == opMode ) || ( DG_MODE_DRAI == opMode ) ) { - currentTemperature = getReservoirActualTemperature(); - dutyCycle = calculateTrimmerHeaterDutyCycle( targetTemperature, currentTemperature, targetFlow, TRUE ); + currentTemperature = getTrimmerHeaterTargetTemperature(); + dutyCycle = calculateTrimmerHeaterDutyCycle( targetTemperature, currentTemperature, targetFlowLPM, TRUE ); state = HEATER_EXEC_STATE_TRIMMER_CONTROL_TO_TARGET; } else if ( DG_MODE_HEAT == opMode ) @@ -581,11 +535,16 @@ // Most of the times the heater should be running at 100% duty cycle since the target temperature is 81 C and // it is far from the inlet temperature. currentTemperature = getTemperatureValue( (U32)TEMPSENSORS_HEAT_DISINFECT ); - targetFlow = getTargetROPumpFlowRate(); - dutyCycle = calculateTrimmerHeaterDutyCycle( targetTemperature, currentTemperature, targetFlow, FALSE ); + targetFlowLPM = getTargetROPumpFlowRateLPM(); + dutyCycle = calculateTrimmerHeaterDutyCycle( targetTemperature, currentTemperature, targetFlowLPM, FALSE ); state = HEATER_EXEC_STATE_CONTROL_TO_DISINFECT_TARGET; } + // Update the calculated target temperature + heatersStatus[ heater ].calculatedTemperature = currentTemperature; + heatersStatus[ heater ].inactiveRsrvr = getInactiveReservoir(); + heatersStatus[ heater ].targetFlow = targetFlowLPM; + trimmerHeaterControlCounter = 0; setHeaterDutyCycle( heater, dutyCycle ); return state; @@ -594,21 +553,35 @@ /*********************************************************************//** * @brief * The handleHeaterStateTrimmerControlToTarget function handles the trimmer - * heater's control to target. - * @details Inputs: heaterStatus - * @details Outputs: heaterStatus + * heater's control to target state. + * @details Inputs: heaterStatus, trimmerHeaterControlCounter + * @details Outputs: heaterStatus, trimmerHeaterControlCounter * @return next state of the state machine *************************************************************************/ static HEATERS_STATE_T handleHeaterStateTrimmerControlToTarget( void ) { HEATERS_STATE_T state = HEATER_EXEC_STATE_TRIMMER_CONTROL_TO_TARGET; - DG_HEATERS_T heater = DG_TRIMMER_HEATER; - if ( TRUE == haveHeaterControlConditionsChanged( heater ) ) // TODO do we need this kind of check from trimmer?? + // If the inactive reservoir has changed from the last run transition to ramp state to recalculate the + // duty cycle for the next delivery + if ( heatersStatus[ DG_TRIMMER_HEATER ].inactiveRsrvr != getInactiveReservoir() ) { state = HEATER_EXEC_STATE_TRIMMER_RAMP_TO_TARGET; } + else if ( ++trimmerHeaterControlCounter > TRIMMER_HEATER_CONTROL_CHECK_INTERVAL_COUNT ) + { + // When the trimmer heater is on, its duty cycle is adjusted at the control interval. For this control check, + // dialysate inlet temperature sensor is used rather than the theoretical calculations. + F32 outletRedundantTemperature = getTemperatureValue( TEMPSENSORS_INLET_DIALYSATE ); // TODO Change to TRo in DVT + F32 targetTemperature = heatersStatus[ DG_TRIMMER_HEATER ].targetTemp; + F32 targetFlowLPM = heatersStatus[ DG_TRIMMER_HEATER ].targetFlow; + F32 dutyCycle = calculateTrimmerHeaterDutyCycle( targetTemperature, outletRedundantTemperature, targetFlowLPM, TRUE ); + trimmerHeaterControlCounter = 0; + + setHeaterDutyCycle( DG_TRIMMER_HEATER, dutyCycle ); + } + return state; } @@ -671,7 +644,7 @@ // If the last fill temperature > target temperature, it means the primary heater overshot the duty cycle // so with its efficiency is toned down for the next fill cycle // If the heater under-shoots the duty cycle, the efficiency increases the duty cycle for the next fill cycle - if ( lastFillTemperature - primaryTargetTemperature > MAXIMUM_ALLOWED_TARGET_TEMPERATURE_DEVIATION_C ) + if ( lastFillTemperature - primaryTargetTemperature < 0.0F ) { heaterEfficiency -= ( lastFillTemperature - primaryTargetTemperature ) * PRIMARY_HEATER_DUTY_CYCLE_PER_TEMPERATURE_C; } @@ -680,7 +653,9 @@ heaterEfficiency += ( primaryTargetTemperature - lastFillTemperature ) * PRIMARY_HEATER_DUTY_CYCLE_PER_TEMPERATURE_C; } - heaterEfficiency = heaterEfficiency <= 0.0 ? 0.0 : heaterEfficiency; + // If the efficiency is less than 0, set it to 0 but if the efficiency is greater than 100, it is not enforced + // to be 100 since the duty cycle range check will cap the duty cycle to 100 anyways. + heaterEfficiency = MAX( heaterEfficiency, 0.0 ); // Update the heaters efficiency heatersStatus[ DG_PRIMARY_HEATER ].heaterEfficiency = heaterEfficiency; @@ -693,8 +668,8 @@ fabs( targetTemperature - currentTemperature ) * flow ) / PRIMARY_HEATERS_MAXIMUM_POWER_WATTS ) * heaterEfficiency; // Check the boundaries of the calculated duty cycle - dutyCycle = ( dutyCycle > HEATERS_MAX_DUTY_CYCLE ? HEATERS_MAX_DUTY_CYCLE : dutyCycle ); - dutyCycle = ( dutyCycle < HEATERS_MIN_DUTY_CYCLE ? HEATERS_MIN_DUTY_CYCLE : dutyCycle ); + dutyCycle = MIN( dutyCycle, HEATERS_MAX_DUTY_CYCLE ); + dutyCycle = MAX( dutyCycle, HEATERS_MIN_DUTY_CYCLE ); return dutyCycle; } @@ -718,18 +693,23 @@ F32 heaterEfficiency = heatersStatus[ DG_TRIMMER_HEATER ].heaterEfficiency; F32 dutyCycle = 0.0; -#ifndef DISABLE_HEATERS_EFFICIENCY - if ( TRUE == checkEfficiency ) +#ifndef _RELEASE_ + if ( getSoftwareConfigStatus( SW_CONFIG_DISABLE_HEATERS_EFFICIENCY ) != SW_CONFIG_ENABLE_VALUE ) +#endif { - // TODO Do we need to recalculate the efficiency? + if ( TRUE == checkEfficiency ) + { + // TODO Do we need efficiency for the trimmer heater? + } } -#endif - dutyCycle = flow * WATER_SPECIFIC_HEAT_DIVIDED_BY_MINUTES * ( targetTemperature - currentTemperature ) * heaterEfficiency; + // Duty cycle = ( 69.73 * flow rate * deltaT / primary heater maximum power ) and multiply the duty cycle to the heater efficiency + dutyCycle = ( ( flow * WATER_SPECIFIC_HEAT_DIVIDED_BY_MINUTES * + ( targetTemperature - currentTemperature ) * heaterEfficiency ) / TRIMMER_HEATER_MAX_POWER_W ) * heaterEfficiency; // Check the boundaries of the calculated duty cycle dutyCycle = MIN( dutyCycle, HEATERS_MAX_DUTY_CYCLE ); - dutyCycle = MIN( dutyCycle, HEATERS_MIN_DUTY_CYCLE ); + dutyCycle = MAX( dutyCycle, HEATERS_MIN_DUTY_CYCLE ); return dutyCycle; } @@ -747,16 +727,14 @@ static BOOL haveHeaterControlConditionsChanged( DG_HEATERS_T heater ) { BOOL status = FALSE; - F32 targetFlow = ( DG_PRIMARY_HEATER == heater ? getTargetROPumpFlowRate() : getTargetDialysateFlowLPM() ); - BOOL hasFlowChanged = ( fabs( targetFlow - heatersStatus[ heater ].targetROFlow ) > NEARLY_ZERO ? TRUE : FALSE ); + F32 targetFlow = ( DG_PRIMARY_HEATER == heater ? getTargetROPumpFlowRateLPM() : getTargetDialysateFlowLPM() ); + BOOL hasFlowChanged = ( fabs( targetFlow - heatersStatus[ heater ].targetFlow ) > NEARLY_ZERO ? TRUE : FALSE ); // Check if the target flow has changed or the target temperature has changed. if ( ( TRUE == hasFlowChanged ) || ( TRUE == heatersStatus[ heater ].hasTargetTempChanged ) ) { - status = TRUE; - - // Moving back from control to target to ramp. - heatersStatus[ heater ].targetROFlow = targetFlow; + status = TRUE; + heatersStatus[ heater ].targetFlow = targetFlow; heatersStatus[ heater ].hasTargetTempChanged = FALSE; } @@ -816,21 +794,19 @@ { HEATERS_DATA_T data; - data.mainPrimayHeaterDC = heatersStatus[ DG_PRIMARY_HEATER ].dutycycle * 100.0; + data.mainPrimayHeaterDC = heatersStatus[ DG_PRIMARY_HEATER ].dutycycle * 100.0; // The duty cycle of the primary heater is divided into 2 parts and is applied to main // and small primary heaters. So they are always the same. - data.smallPrimaryHeaterDC = heatersStatus[ DG_PRIMARY_HEATER ].dutycycle * 100.0; - data.trimmerHeaterDC = heatersStatus[ DG_TRIMMER_HEATER ].dutycycle * 100.0; - data.primaryTargetTemp = heatersStatus[ DG_PRIMARY_HEATER ].targetTemp; - 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.smallPrimaryHeaterDC = heatersStatus[ DG_PRIMARY_HEATER ].dutycycle * 100.0; + data.trimmerHeaterDC = heatersStatus[ DG_TRIMMER_HEATER ].dutycycle * 100.0; + data.primaryTargetTemp = heatersStatus[ DG_PRIMARY_HEATER ].targetTemp; + 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.primaryCalcTargetTemp = heatersStatus[ DG_PRIMARY_HEATER ].calculatedTemperature; + data.trimmerCalcCurrentTemp = heatersStatus[ DG_TRIMMER_HEATER ].calculatedTemperature; - data.dialysateTargetLPM = getTargetDialysateFlowLPM(); - data.interimTargetTemp = heatersStatus[ DG_PRIMARY_HEATER ].temporaryInterimTemperature; - data.targetHeaterFlowLPM = heatersStatus[ DG_PRIMARY_HEATER ].targetROFlow; - broadcastData( MSG_ID_DG_HEATERS_DATA, COMM_BUFFER_OUT_CAN_DG_BROADCAST, (U08*)&data, sizeof( HEATERS_DATA_T ) ); dataPublicationTimerCounter = 0; @@ -866,16 +842,9 @@ BOOL isSmallPriOut = ( fabs( ( HEATERS_MAX_OPERATING_VOLTAGE_V * smallPri ) - smallPriVoltage ) > smallPriVoltageTol ? TRUE : FALSE ); BOOL isTrimmerOut = ( fabs( ( HEATERS_MAX_OPERATING_VOLTAGE_V * trimmer ) - trimmerVoltage ) > trimmerVoltageTol ? TRUE : FALSE ); - checkPersistentAlarm( ALARM_ID_DG_MAIN_PRIMARY_HEATER_VOLTAGE_OUT_OF_RANGE, isMainPriOut, mainPri, mainPriVoltageTol ); - checkPersistentAlarm( ALARM_ID_DG_SMALL_PRIMARY_HEATER_VOLTAGE_OUT_OF_RANGE, isSmallPriOut, smallPri, smallPriVoltageTol ); - //checkPersistentAlarm( ALARM_ID_DG_TRIMMER_HEATER_VOLTAGE_OUT_OF_RANGE, isTrimmerOut, trimmer, trimmerVoltageTol ); // TODO check this voltage - - // TODO test code remove - if ( TRUE == isAlarmActive(ALARM_ID_DG_TRIMMER_HEATER_VOLTAGE_OUT_OF_RANGE)) - { - BOOL test = FALSE; - } - // TODO test code remove + //checkPersistentAlarm( ALARM_ID_DG_MAIN_PRIMARY_HEATER_VOLTAGE_OUT_OF_RANGE, isMainPriOut, mainPri, mainPriVoltageTol ); + //checkPersistentAlarm( ALARM_ID_DG_SMALL_PRIMARY_HEATER_VOLTAGE_OUT_OF_RANGE, isSmallPriOut, smallPri, smallPriVoltageTol ); + //checkPersistentAlarm( ALARM_ID_DG_TRIMMER_HEATER_VOLTAGE_OUT_OF_RANGE, isTrimmerOut, trimmer, trimmerVoltageTol ); }