Index: firmware/App/Modes/ModeGenDialysate.c =================================================================== diff -u -r16c5398fed27670d52609b19ad870a5f99111534 -rb003e0e60487302c022714f168d9f5dffc09d226 --- firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision 16c5398fed27670d52609b19ad870a5f99111534) +++ firmware/App/Modes/ModeGenDialysate.c (.../ModeGenDialysate.c) (revision b003e0e60487302c022714f168d9f5dffc09d226) @@ -648,6 +648,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.