Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r60db0506b1a90ed00b0e83159f6e7510ab6e4b7b -rd31e9b40e9d56df8fa3551bbba63f6bec3a72811 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 60db0506b1a90ed00b0e83159f6e7510ab6e4b7b) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision d31e9b40e9d56df8fa3551bbba63f6bec3a72811) @@ -616,6 +616,35 @@ /*********************************************************************//** * @brief + * The calculateUpdatedD28TargetDialysateTemp function calculate the delta temperature + * required for dialysate temperature to meet the set temperature at dialyzer. + * @details \b Inputs: Qd and target temperature. + * @details \b Outputs: Adjusted D28 Target temperature + * @return none. + *************************************************************************/ +F32 calculateUpdatedD28TargetDialysateTemp( void ) +{ + // Get the dialysate flow rate from TD + F32 dialFlowrate = getTDDialysateFlowrate(); + F32 deltaTemp = 0.0F; + F32 heatDissipation_b3 = 0.0F; + F32 targetTemp = getTDTargetDialysateTemperature(); + F32 initialTempAtD28 = 0.0F; + + // Heat loss model predicts the heat loss ( B3) in the DD flow path and + // finds the delta temperature to be added with the target temperature + // to maintain the target temperature at dialyzer. + //Lets calculate B3 heat dissipation factor + heatDissipation_b3 = calculateHeatDissipationB3(); + + // Reverse calculation of Initial temp at D28 to get the target dialyzer temperature + initialTempAtD28 = calculateInitialTemp( targetTemp, heatDissipation_b3 ); + + return initialTempAtD28; +} + +/*********************************************************************//** + * @brief * The monitorChamberLevelStatus function checks the spent chamber and bicarb * chamber level status and updates the corrosponding flags. * @details \b Inputs: Spent and bicarb chamber levels.