Skip to content

Commit 85ade1e

Browse files
committed
Comment polish; pass tInletWH to wh_DoSubhrTick()
1 parent d18b13c commit 85ade1e

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/CNRECS.DEF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4519,7 +4519,7 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
45194519
*declare "RC wh_SetupAsCHDHWSource();"
45204520
*declare "RC wh_DoHour();"
45214521
*declare "RC wh_DoSubhrStart();"
4522-
*declare "RC wh_DoSubhrTick( struct DHWTICK& tk, float scaleWH, float& tOutlet);"
4522+
*declare "RC wh_DoSubhrTick( struct DHWTICK& tk, float scaleWH, float tInlet, float& tOutlet);"
45234523
*declare "RC wh_InstUEFInit();"
45244524
*declare "RC wh_InstUEFDoSubhrTick( double draw, float tInletWH, float scaleWH, float tUse);"
45254525
*declare "RC wh_DoSubhrEnd( bool bIsLH);"

src/dhwcalc.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,9 +1883,13 @@ RC DHWSYS::ws_DoSubhrTick( int iTk)
18831883
float tOutlet{ 0 }; // unmixed heater outlet temp, F
18841884

18851885
// loop heaters if any
1886+
// Loop heaters are done before primary because
1887+
// draw is determined by mixing at loop heater outlet.
1888+
// Actual draw is returned in tk.wtk_volIn.
1889+
// Inlet temp is from prior tick via ws_tOutPrimLT.
18861890
if (ws_wlhCount > 0.f) RLUPC(WlhR, pWH, pWH->ownTi == ss)
18871891
{
1888-
rc |= pWH->wh_DoSubhrTick(tk, 1.f / ws_wlhCount, tOutlet);
1892+
rc |= pWH->wh_DoSubhrTick(tk, 1.f / ws_wlhCount, ws_tOutPrimLT, tOutlet);
18891893
// tOutlet unused
18901894
}
18911895

@@ -1894,11 +1898,14 @@ RC DHWSYS::ws_DoSubhrTick( int iTk)
18941898
// re next tick loop heater inlet
18951899
// outlet temp calc'd for HPWH types only
18961900
// other types estimate from e.g. setpoint or ws_tUse
1901+
float tInletWH = ws_pDHWSOLARSYS // water heater inlet temp (not mains temp)
1902+
? ws_pDHWSOLARSYS->sw_GetAvailableTemp()
1903+
: tk.wtk_tInletX;
18971904
float tOutletSum = 0.f;
18981905
float tOutletCount = 0.f;
18991906
if (ws_whCount > 0.f) RLUPC(WhR, pWH, pWH->ownTi == ss)
19001907
{
1901-
rc |= pWH->wh_DoSubhrTick(tk, 1.f / ws_whCount, tOutlet);
1908+
rc |= pWH->wh_DoSubhrTick(tk, 1.f / ws_whCount, tInletWH, tOutlet);
19021909
if (tOutlet > 0.f)
19031910
{
19041911
tOutletSum += tOutlet * pWH->wh_mult;
@@ -4273,7 +4280,6 @@ RC DHWHEATER::wh_DoHour() // DHWHEATER hour calcs
42734280

42744281
DHWSYS* pWS = wh_GetDHWSYS();
42754282

4276-
42774283
wh_hrCount++;
42784284

42794285
wh_inElec = 0.f;
@@ -4636,21 +4642,14 @@ RC DHWHEATER::wh_DoSubhrTick( // DHWHEATER energy use for 1 tick
46364642
float scaleWH, // draw scale factor = 1/ws_whCount or 1/ws_wlhCount
46374643
// re DHWSYSs with >1 DHWHEATER
46384644
// *not* including any mixdown factors (e.g. hw_fMixUse or hw_fMixRL)
4645+
float tInletWH, // water heater inlet temp, F (NOT mains temp)
46394646
float& tOutlet) // returned: unmixed outlet temp, F
46404647
// HPWH: from last draw or estimated from tank top if no draw
46414648
// other: = ws_tUse
46424649
{
46434650
RC rc = RCOK;
46444651

46454652
DHWSYS* pWS = wh_GetDHWSYS();
4646-
4647-
// inlet (supply water) temp for this heater w/o loop returns
4648-
// HPWH types: loop flow handled internally
4649-
// non-HPWH: adjusted below for any loop returns
4650-
float tInletWH =
4651-
wh_IsLoopHeater() ? pWS->ws_tOutPrimLT
4652-
: pWS->ws_pDHWSOLARSYS ? pWS->ws_pDHWSOLARSYS->sw_GetAvailableTemp()
4653-
: tk.wtk_tInletX;
46544653

46554654
#if 0 && defined( _DEBUG)
46564655
if (tInletWH > pWS->ws_tUse)
@@ -4685,7 +4684,7 @@ RC DHWHEATER::wh_DoSubhrTick( // DHWHEATER energy use for 1 tick
46854684

46864685
float tInletMix; // inlet temp: combine use and any DHWLOOP return
46874686
drawForTick = tk.wtk_DrawTot(pWS->ws_tUse, tInletWH, pWS->ws_tInlet, tInletMix)*scaleWH;
4688-
tInletWH = tInletMix;
4687+
tInletWH = tInletMix; // used below re wh_tInlet
46894688
tOutlet = pWS->ws_tUse;
46904689

46914690
if (wh_IsInstUEFModel())

0 commit comments

Comments
 (0)