Skip to content

Commit ae0d482

Browse files
authored
Merge pull request #114 from cse-sim/hpwhdr
DR tweaks; HPWH csv report in I-P units
2 parents 04bcbec + 8aa6e62 commit ae0d482

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

src/CNRECS.DEF

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3664,7 +3664,7 @@ RECORD DHWSYS "DHWSys" *RAT // input / runtime DHW system
36643664
*r DHWDRMETH ws_drMethod // DHW demand response control method
36653665
// C_DHWDRMETH_NONE, C_DHWDRMETH_SCHED,
36663666
*h DHWDRSIG ws_drSignal; // DHW demand response control signal
3667-
*h *e INT ws_drModeHPWH; // DHW demand response HPWHsim base mode for hour
3667+
*h *e INT ws_drStatusHPWH;// DHW demand response HPWHsim base drStatus for hour
36683668
// may be modified at subhour or tick ivl
36693669

36703670
*s *hide DBL ws_tOutPrimSum; // working var re ws_tOutPrimLT
@@ -3830,7 +3830,7 @@ RECORD HPWHLINK "HPWHLink" *SUBSTRUCT // Ecotope's HPWH tank and heater
38303830
*declare "void hw_SetQTX( float qTX);"
38313831
*declare "RC hw_DoHour( float& tSetpoint);"
38323832
*declare "RC hw_DoSubhrStart( float tEx, float tASHPSrc=-999.f);"
3833-
*declare "RC hw_DoSubhrTick( DHWTICK& tk, float tInlet, float scaleWH=1.f, float tMix=-1., float tMains=-1.f, float* pTOutNoMix=NULL, int drMode=0);"
3833+
*declare "RC hw_DoSubhrTick( DHWTICK& tk, float tInlet, float scaleWH=1.f, float tMix=-1., float tMains=-1.f, float* pTOutNoMix=NULL, int drStatus=0);"
38343834
*declare "RC hw_DoSubhrTick( int iTk, float draw, float tInlet, float* pTOut, float scaleWH=1.f);"
38353835
*declare "RC hw_DoSubhrEnd( float mult, ZNR* pZn, ZNR* pZnASHPSrc);"
38363836

@@ -3922,7 +3922,7 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
39223922
*declare "virtual void ReceiveRuntimeMessage( const char* msg);"
39233923
*declare "RC wh_HPWHInit();"
39243924
*declare "static void wh_DRMapValidate();"
3925-
*declare "static int wh_DRMapSigToDRMode( DHWDRSIG drSig);"
3925+
*declare "static int wh_DRMapSigToDRStatus( DHWDRSIG drSig);"
39263926

39273927
*r FLOAT_GEZ wh_mult; // count of identical water heaters (default 1)
39283928
// models as if repeated identical input

src/DHWCalc.cpp

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,15 +1203,15 @@ RC DHWSYS::ws_DoHour( // hourly calcs
12031203
#endif
12041204

12051205
// Demand response (DR) hourly setup
1206-
ws_drModeHPWH = HPWH::DR_ALLOW;
1206+
ws_drStatusHPWH = HPWH::DR_ALLOW;
12071207
if (!ws_HasCentralDHWSYS())
12081208
{ int drSig = CHN(ws_drSignal); // decode variable choice
1209-
ws_drModeHPWH = ws_drMethod == C_DHWDRMETH_SCHED
1210-
? DHWHEATER::wh_DRMapSigToDRMode( drSig)
1209+
ws_drStatusHPWH = ws_drMethod == C_DHWDRMETH_SCHED
1210+
? DHWHEATER::wh_DRMapSigToDRStatus( drSig)
12111211
: HPWH::DR_ALLOW;
12121212
}
12131213
else
1214-
ws_drModeHPWH = HPWH::DR_ALLOW; // no DR for child DHWSYSs (no DHWHEATERs)
1214+
ws_drStatusHPWH = HPWH::DR_ALLOW; // no DR for child DHWSYSs (no DHWHEATERs)
12151215

12161216
if (ws_wpCount > 0) // if any child pumps
12171217
{ DHWPUMP* pWP;
@@ -2779,7 +2779,7 @@ RC HPWHLINK::hw_DoSubhrTick( // calcs for 1 tick
27792779
// needed iff tMix is specified
27802780
float* pTOutNoMix/*=NULL*/, // unmixed output temp accumulated here re DHWLOOPHEATER
27812781
// average inlet temp
2782-
int drMode /*=0*/) // demand response control signal
2782+
int drStatus /*=0*/) // demand response control signal
27832783
{
27842784
RC rc = RCOK;
27852785

@@ -2833,7 +2833,7 @@ RC HPWHLINK::hw_DoSubhrTick( // calcs for 1 tick
28332833
DegFtoC(hw_tEx), // ambient T (=tank surround), C
28342834
DegFtoC(hw_tASHPSrc), // heat source T, C
28352835
// aka HPWH "external temp"
2836-
HPWH::DRMODES( drMode), // DRstatus: demand response signal
2836+
HPWH::DRMODES( drStatus), // DRstatus: demand response signal
28372837
GAL_TO_L(drawRL), DegFtoC(tRL), // 2ndary draw for DHWLOOP
28382838
// note drawForTick includes drawRL
28392839
pNPX); // additional node power (re e.g. solar tanks)
@@ -2907,7 +2907,7 @@ RC HPWHLINK::hw_DoSubhrTick( // calcs for 1 tick
29072907
}
29082908
#if defined( HPWH_DUMP)
29092909
// tick level CSV report for testing
2910-
int dumpUx = UNSYSSI; // unit system for CSV values
2910+
int dumpUx = UNSYSIP; // unit system for CSV values
29112911
int hpwhOptions = dumpUx == UNSYSIP ? HPWH::CSVOPT_IPUNITS : HPWH::CSVOPT_NONE;
29122912
static const int nTCouples = 12; // # of storage layers reported by HPWH
29132913

@@ -2931,7 +2931,6 @@ RC HPWHLINK::hw_DoSubhrTick( // calcs for 1 tick
29312931
"vLoss", drawLoss, UNLVOLUME2, 5,
29322932
"vRL", drawRL, UNLVOLUME2, 5,
29332933
"vTot", drawForTick, UNLVOLUME2, 5,
2934-
"DR", double(drMode), UNNONE, 1,
29352934
"tMains", tMains > 0. ? tMains : CSVItem::ci_UNSET,
29362935
UNTEMP, 5,
29372936
"tDWHR", tk.wtk_tInletX, UNTEMP, 5,
@@ -2950,8 +2949,7 @@ RC HPWHLINK::hw_DoSubhrTick( // calcs for 1 tick
29502949
UNENERGY3, 5,
29512950
"qLoss", KWH_TO_BTU(hw_pHPWH->getStandbyLosses()),
29522951
UNENERGY3, 5,
2953-
"XBU", HPWHxBU, UNENERGY3, 5,
2954-
2952+
"XBU", HPWHxBU, UNENERGY3, 5,
29552953
NULL
29562954
};
29572955

@@ -3589,7 +3587,7 @@ RC DHWHEATER::wh_HPWHInit() // initialize HPWH model
35893587
pWS->ignore(fn,
35903588
strtprintf("-- HPWH '%s' has a fixed setpoint.", name));
35913589
}
3592-
wh_DRMapValidate(); // validate DRMODE mapping (ABT if bad)
3590+
wh_DRMapValidate(); // validate drStatus mapping (ABT if bad)
35933591
}
35943592
return rc;
35953593
} // DHWHEATER::wh_HPWHInit
@@ -3598,7 +3596,7 @@ RC DHWHEATER::wh_HPWHInit() // initialize HPWH model
35983596
// Demand reduction (DR) stuff
35993597
struct DRMAP
36003598
{ DHWDRSIG drSig; // CSE signal choice
3601-
int drModeHPWH; // corresponding HPWH drMode
3599+
int drStatusHPWH; // corresponding HPWH drStatus
36023600
};
36033601
static const DRMAP drMap[] =
36043602
{ C_DHWDRSIG_ON, HPWH::DR_ALLOW,
@@ -3630,18 +3628,18 @@ static const DRMAP drMap[] =
36303628

36313629
} // DHWHEATER::wh_DRMapValidate
36323630
//-----------------------------------------------------------------------------
3633-
/* static*/ int DHWHEATER::wh_DRMapSigToDRMode(
3631+
/* static*/ int DHWHEATER::wh_DRMapSigToDRStatus(
36343632
DHWDRSIG drSig) // CSE DR choice value
36353633
// -1: validate table
36363634
// returns HPWH-compatible DRMODES value corresponding to CSE choice
36373635
{
36383636
int ixDrSig = drSig - C_DHWDRSIG_ON; // choice values assigned sequencially
36393637

3640-
int drMode = drMap[ixDrSig].drModeHPWH;
3638+
int drStatus = drMap[ixDrSig].drStatusHPWH;
36413639

3642-
return drMode;
3640+
return drStatus;
36433641

3644-
} // DHWHEATER::wh_DRMapSigToDRMode
3642+
} // DHWHEATER::wh_DRMapSigToDRStatus
36453643
//-----------------------------------------------------------------------------
36463644
RC DHWHEATER::wh_DoSubhrStart()
36473645
{
@@ -3726,17 +3724,17 @@ RC DHWHEATER::wh_DoSubhrTick( // DHWHEATER energy use for 1 tick
37263724
{ // demand response (DR)
37273725
// use DHWSYS hourly base value
37283726
// turn off hour-start one-shot signals if not hour start
3729-
int drMode;
3727+
int drStatus;
37303728
if (whfcn == whfcnPRIMARY)
3731-
{ drMode = pWS->ws_drModeHPWH;
3729+
{ drStatus = pWS->ws_drStatusHPWH;
37323730
if (tk.wtk_startMin > 0.f)
3733-
drMode &= ~(HPWH::DR_TOO | HPWH::DR_TOT);
3731+
drStatus &= ~(HPWH::DR_TOO | HPWH::DR_TOT);
37343732
}
37353733
else
3736-
drMode = HPWH::DR_ALLOW;
3734+
drStatus = HPWH::DR_ALLOW;
37373735

37383736
rc |= wh_HPWH.hw_DoSubhrTick(tk, tInletWH, scaleWH, tMix, pWS->ws_tInlet,
3739-
&tOutNoMix, drMode);
3737+
&tOutNoMix, drStatus);
37403738

37413739
if (whfcn == whfcnPRIMARY)
37423740
pWS->ws_tOutPrimSum += tOutNoMix * scaleWH * wh_mult;

vendor/HPWHsim

0 commit comments

Comments
 (0)