Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CNCULT.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,8 @@ CULT( "wsUse", DAT, DHWSYS_HWUSE, 0, 0, VHRLY, TYFL, 0, 0.f, N
CULT( "wsTUse", DAT, DHWSYS_TUSE, 0, 0, VHRLY, TYFL, 0, 120.f, N, N),
CULT( "wsTSetpoint", DAT, DHWSYS_TSETPOINT,0, 0, VHRLY, TYFL, 0, 120.f, N, N),
CULT( "wsTSetpointLH",DAT, DHWSYS_TSETPOINTLH,0, 0, VHRLY, TYFL, 0, 120.f, N, N),
CULT( "wsDRMethod", DAT, DHWSYS_DRMETHOD, 0, 0, VEOI, TYCH, 0, C_DHWDRMETH_NONE, N, N),
CULT( "wsDRSignal", DAT, DHWSYS_DRSIGNAL, 0, 0, VHRLY, TYCH, 0, nc( C_DHWDRSIG_ON), 0.f, N, N),
CULT( "wsDayUse", DAT, DHWSYS_DAYUSENAME,0, 0, VDAILY, TYSTR, 0, N, N, N),
CULT( "wsWHhwMtr", DAT, DHWSYS_WHHWMTRI, 0, 0, VEOI, TYREF, &WMtriB,N, N, N),
CULT( "wsFXhwMtr", DAT, DHWSYS_FXHWMTRI, 0, 0, VEOI, TYREF, &WMtriB,N, N, N),
Expand Down
13 changes: 13 additions & 0 deletions src/CNDTYPES.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ PIPESEGP -- "class PIPESEG*" 4 none
}

// DHW choices

*choicb WSCALCMODECH {
PRERUN "PreRun"
SIM "Simulate"
Expand Down Expand Up @@ -472,6 +473,7 @@ PIPESEGP -- "class PIPESEG*" 4 none
}
*choicb DHWLSEGTYCH { RET "return" SUP "supply" }
*choicb DWHRTYCH { HORIZ "horizontal" VERT "vertical" SETEF "SetEF" }
*choicb DHWDRMETH { NONE "none" SCHED "schedule" /* TDV */ }

// PV choices
*choicb PVMODCH {
Expand Down Expand Up @@ -738,6 +740,17 @@ PIPESEGP -- "class PIPESEG*" 4 none
TDVPEAKSAVE "TDVPeakSave"
}

*choicn DHWDRSIG {
ON "On"
TOO "TOO"
TXO "TXO"
TOT "TOT"
TXT "TXT"
LOC "LOC"
LOR "LOR"
LOX "LOX"
COUNT "*Count" // hidden
}

/**********************************************************************************************************************
** === CHOICN types: can hold these choices (as NAN), or float number
Expand Down
4 changes: 3 additions & 1 deletion src/CNFIELDS.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,16 @@ RSYSMODECTRLCH RSYSMODECTRLCH LMNONE UNNONE
RSYSTYCH RSYSTYCH LMNONE UNNONE
RSYSOAVTYCH RSYSOAVTYCH LMNONE UNNONE
RSYSDEFROSTMODELCH RSYSDEFROSTMODELCH LMNONE UNNONE
WHTYPECH WHTYPECH LMNONE UNNONE
WHHEATSRCCH WHHEATSRCCH LMNONE UNNONE
WSCALCMODECH WSCALCMODECH LMNONE UNNONE
WHTYPECH WHTYPECH LMNONE UNNONE
WHASHPTYCH WHASHPTYCH LMNONE UNNONE
DHWEUCH DHWEUCH LMNONE UNNONE
DHWEUXCH DHWEUXCH LMNONE UNNONE
DHWBRANCHMODELCH DHWBRANCHMODELCH LMNONE UNNONE
DHWLSEGTYCH DHWLSEGTYCH LMNONE UNNONE
DWHRTYCH DWHRTYCH LMNONE UNNONE
DHWDRMETH DHWDRMETH LMNONE UNNONE // DHW demand response control method
PVMODCH PVMODCH LMNONE UNNONE
PVARRCH PVARRCH LMNONE UNNONE
MOUNTCH MOUNTCH LMNONE UNNONE
Expand Down Expand Up @@ -221,6 +222,7 @@ NOYESVC NOYESVC LMNONE UNNONE
OFFAVAILONVC OFFAVAILONVC LMNONE UNNONE
VENTAVAILVC VENTAVAILVC LMNONE UNNONE
BATCTRLALGVC BATCTRLALGVC LMNONE UNNONE
DHWDRSIG DHWDRSIG LMNONE UNNONE

// number/choice (NC choicn) types
TEMP_TSCM TSCMNC LMNONE UNTEMP
Expand Down
37 changes: 1 addition & 36 deletions src/CNGUTS.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,6 @@ RC FC cgRddInit( // Perform initialization common to main simulation run and eac
RLUP( AhB, ah)
rc |= ah->rddInit( isAusz); // do run-or-design-day init for each air handler

#if 1
// allocate results records paired with run records
// do for both autoSize and run
// no accum for autoSize, but code does incidental stores into xxRES
Expand All @@ -1003,40 +1002,6 @@ RC FC cgRddInit( // Perform initialization common to main simulation run and eac

EF(AhresB.AllocResultsRecs(AhB)); // AHRES <-> AH

#else
int i = ZrB.n + 1; // need a results record for each zone, and one for sum of zones
EF( ZnresB.al( i, WRN) ) // alloc ZNRES recs, at once for less fragmentation. destroys old.
do // (Note: may be no results accumulation during autoSize,
{ // but alloc anyway cuz code several places stores into records)
ZNRES *zp;
ZnresB.add( &zp, ABT, i); // init (to 0) each zone results record, 1 thru i. ancrec.cpp.
strcpy( zp->name, i <= ZrB.n ? ZrB.p[i].name : "sum_of_zones"); // results name for rpts: name of zone or "sum_of_zones"
zp->zr_InitPrior(); // provide plausible ZNRES.prior values for use in
// possible expressions that are evaluated at step beg
}
while (--i > 0);

i = RsR.n + 1; // need a results record for each RSYS, and one for sum of RSYSs
EF( RsResR.al( i, WRN) ) // alloc RSYSRES recs, at once for less fragmentation. destroys old.
do // (Note: may be no results accumulation during autoSize,
{ // but alloc anyway cuz code several places stores into records)
RSYSRES* pRSR;
RsResR.add( &pRSR, ABT, i); // init (to 0) each zone results record, 1 thru i.
strcpy( pRSR->name, i <= RsR.n ? RsR.p[i].name : "sum_of_RSYS"); // results name for rpts
}
while (--i > 0);

i = AhB.n + 1; // need a results record for each ah, and one for sum of ahs
EF( AhresB.al( i, WRN) ) // alloc AHRES recs, all at once for less mem frag. destroys any old.
do
{
AHRES *ahr;
AhresB.add( &ahr, ABT, i); // initialize each ah results record, 1 thru i. ancrec.cpp.
strcpy( ahr->name, i <= AhB.n ? AhB.p[i].name : "sum_of_ahs"); // ah results name for rpts: name of ah or "sum_of_ahs"
}
while (--i > 0);
#endif

#ifdef BINRES
// Init re binary results output files
// move call to cgInit (and review code) if file is to persist (stay open) thru autosize and main sim run.
Expand Down Expand Up @@ -1768,7 +1733,7 @@ LOCAL void FC NEAR doIvlAccum()
RLUP( RsResR, pRSR) // loop RSYS simulation results incl sum_of.
pRSR->curr.Y.rsr_Accum( &pRSR->curr.M, Top.isFirstMon, Top.isLastDay); // accumulate year from month
RLUP(WsResR, pWSR) // loop DHWSYSRES results incl sum_of.
pWSR->Y.wsr_Accum(&pWSR->D, Top.isFirstMon, Top.isLastDay);
pWSR->Y.wsr_Accum(&pWSR->M, Top.isFirstMon, Top.isLastDay);
mtrsAccum( C_IVLCH_Y, Top.isFirstMon, Top.isLastDay); // accumulate metered energy use: month to year
#ifdef BINRES
if (brf) // if outputting any binary results this run
Expand Down
2 changes: 1 addition & 1 deletion src/CNLOADS.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -3790,7 +3790,7 @@ void RSYS::rs_EnteringAirState( // RSYS entering air state
// rsMode determines assumed air source
// rsmOAV: outdoor air (as modified via rs_OAVTdbInlet)
// else: mixes air from zones plus return duct leakage
// then addes return duct conduction and leakage
// then adds return duct conduction and leakage

// returns
// rs_asIn = state of air entering RSYS (after return ducts)
Expand Down
56 changes: 31 additions & 25 deletions src/CNRECS.DEF
Original file line number Diff line number Diff line change
Expand Up @@ -3507,14 +3507,15 @@ RECORD DHWSYSRES_IVL "DHWSYSRES interval sub" *SUBSTRUCT // interval substruct
*declare "void wsr_AccumTick( const struct DHWTICK& tk);"
*declare "static const size_t wsr_NFLOAT;"

// water heating energy (not fuel)
// water heating energy (not fuel), Btu
// values are for associated DHWSYS (wh_mult include, ws_mult not included)
*e FLOAT total //
*e FLOAT qDWHR // drain water heat recovery
*e FLOAT qSSF // implied energy contribution from ws_SSF
*e FLOAT qSolar // DHWSOLARSYS
*e FLOAT qWaterHeater // DHWHEATER
*e FLOAT qLoopHeater
*e FLOAT qXBU
*e FLOAT qWH // DHWHEATER primary (compressor, burner, )
*e FLOAT qLH // Loop heater primary
*e FLOAT qXBU // add'l backup heat

*END // DHWSYSRES_IVL
//=============================================================================
Expand Down Expand Up @@ -3610,7 +3611,7 @@ RECORD DHWSYS "DHWSys" *RAT // input / runtime DHW system

*h *e FLOAT ws_tInlet; // current hour cold water inlet temp, F for this DHWSYS
// user expression or default Wthr.d.wd_tMains
// Not modified by DWHR or Solar
// Not modified by solar and/or DHWHEATREC
*h *e FLOAT ws_tInletX; // hour average adjusted cold water temp, F
// reflects solar and/or DHWHEATREC
*h FLOAT ws_hwUse; // current hour hot water use (at fixtures), gal
Expand Down Expand Up @@ -3660,6 +3661,12 @@ RECORD DHWSYS "DHWSys" *RAT // input / runtime DHW system
// default = ws_tUse
*h FLOAT ws_tSetpointLH; // DHWLOOPHEATER set point (for all child DHWLOOPHEATERs using HPWH model), F
// default = ws_tUse
*r DHWDRMETH ws_drMethod // DHW demand response control method
// C_DHWDRMETH_NONE, C_DHWDRMETH_SCHED,
*h DHWDRSIG ws_drSignal; // DHW demand response control signal
*h *e INT ws_drModeHPWH; // DHW demand response HPWHsim base mode for hour
// may be modified at subhour or tick ivl

*s *hide DBL ws_tOutPrimSum; // working var re ws_tOutPrimLT
*s *e FLOAT ws_tOutPrimLT; // primary water heater outlet temp, F
// for HPWH only, re DHWLOOPHEATER entering temp
Expand Down Expand Up @@ -3789,11 +3796,6 @@ RECORD DHWSYS "DHWSys" *RAT // input / runtime DHW system
*h *e FLOAT ws_HARL; // hour total adjusted recovery load, Btu
*h *e FLOAT ws_HARLtk; // hour total adjusted recovery load, Btu
// check figure derived from ticks

#if 0
*s *e *nest DHWSYSRES ws_res // results
#endif

*END // DHWSYS

//=============================================================================
Expand Down Expand Up @@ -3828,9 +3830,9 @@ RECORD HPWHLINK "HPWHLink" *SUBSTRUCT // Ecotope's HPWH tank and heater
*declare "void hw_SetQTX( float qTX);"
*declare "RC hw_DoHour( float& tSetpoint);"
*declare "RC hw_DoSubhrStart( float tEx, float tASHPSrc=-999.f);"
*declare "RC hw_DoSubhrTick( DHWTICK& tk, float tInlet, float scaleWH=1.f, float tMix=-1., float tMains=-1.f, float* pTOutNoMix=NULL);"
*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);"
*declare "RC hw_DoSubhrTick( int iTk, float draw, float tInlet, float* pTOut, float scaleWH=1.f);"
*declare "RC hw_DoSubhrEnd( float mult, ZNR* pZn, ZNR* pZnASHPSrc, double& totOut);"
*declare "RC hw_DoSubhrEnd( float mult, ZNR* pZn, ZNR* pZnASHPSrc);"

*declare "record* hw_pOwner;" // owner (DHWHEATER, DHWSOLARSYS, ...)
*declare "class HPWH* hw_pHPWH;" // pointer HPWH object
Expand All @@ -3855,7 +3857,7 @@ RECORD HPWHLINK "HPWHLink" *SUBSTRUCT // Ecotope's HPWH tank and heater
// Loop return flow is reduced to balance load at ws_tUse.

*s *e *array 2 DBL hw_inElec; // current subhr HPWH electricity use, kWh
// [0]=resistance backup (iff HP) (not including wh_HPWHxBU)
// [0]=resistance backup (iff HP) (not including hw_HPWHxBU)
// [1]=primary(=compressor or non-HP resistance) + misc
*r FLOAT hw_HPWHxBU; // current subhr HPWH add'l backup resistance heat, Btu
// output water heated to ws_tUse iff HPWH output temp < ws_tUse
Expand All @@ -3865,7 +3867,7 @@ RECORD HPWHLINK "HPWHLink" *SUBSTRUCT // Ecotope's HPWH tank and heater
// for 1 DHWHEATER (no wh_mult)
*s *e DBL hw_qHW; // current subhr HPWHtotal hot water heating, kWh. always >= 0
// for 1 DHWHEATER (no wh_mult)
// includes heat to DHWLOOP, does not include wh_HPWHxBU
// includes heat to DHWLOOP, does not include hw_HPWHxBU
*s *e DBL hw_qTX; // current subhr extra heat tank heat, kWh (not Btu)

*h *e INT hw_tankTempSet; // nz iff HPWH tank temp has been initialized
Expand Down Expand Up @@ -3912,13 +3914,15 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
*declare "RC wh_DoSubhrTick( struct DHWTICK& tk, float scaleWH);"
*declare "RC wh_InstUEFInit();"
*declare "RC wh_InstUEFDoSubhrTick( double draw, float tInletWH, float scaleWH, float tUse);"
*declare "RC wh_DoSubhrEnd();"
*declare "RC wh_DoSubhrEnd( bool bIsLH);"
*declare "RC wh_DoEndPreRun();"
*declare "RC wh_EndIvl( IVLCH ivl, float HARL, float wsMult);"
*declare "static WStr wh_GetHPWHVersion();"
*declare "int wh_ReportBalErrorsIf() const;"
*declare "virtual void ReceiveRuntimeMessage( const char* msg);"
*declare "RC wh_HPWHInit();"
*declare "static void wh_DRMapValidate();"
*declare "static int wh_DRMapSigToDRMode( DHWDRSIG drSig);"

*r FLOAT_GEZ wh_mult; // count of identical water heaters (default 1)
// models as if repeated identical input
Expand All @@ -3931,7 +3935,7 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
// _ELRESX: electric resistance (Ecotope HPWH)
*i WHTYPECH wh_type; // heater type
// C_WHTYPECH_STRGSML, _STRGLRG, _INSTSML, _INSTLRG,
// _INSTUEF
// _INSTUEF, _BUILTUP
*i ANAME wh_desc; // probe-able description text
*declare "virtual const char* GetDescription( int options=0) { options; return wh_desc; }"
*r INT wh_fcn; // function of this DHWHEATER per whfcnXXX enum
Expand Down Expand Up @@ -4003,7 +4007,7 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
// load that is unmet on 1 min basis
// default = 1; only for C_WHTYPECH_INSTUEF
*i DBL wh_loadCFwdMax; // max load carry-forward energy (from wh_loadCFwdF), Btu
// any excess load met via wh_HPWHxBU
// any excess load met via wh_qXBU
*s DBL wh_loadCFwd; // current load carry forward, Btu
// see wh_InstUEFDoSubhr()
*s *e FLOAT wh_nTickFullLoad; // INSTUEF: current subhour equiv full load ticks (fractional)
Expand All @@ -4028,15 +4032,15 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
*s *e *nest HPWHLINK wh_HPWH; // interface to Ecotope HPWH detailed heat pump model
// also used for resistance electric heaters

*s *e FLOAT wh_HPWHxBU; // current step HPWH add'l backup resistance heat, Btu
*s *e FLOAT wh_qXBU; // current step HPWH add'l backup resistance heat, Btu
// output water heated to ws_tUse iff HPWH output temp < ws_tUse
*s *e DBL wh_qEnv; // current step heat removed by HPWH from environment, kWh
// + = to water heater; for 1 DHWHEATER (no wh_mult)
*s *e DBL wh_qLoss; // current step HPWH standby losses, kWh. + = to surround
// for 1 DHWHEATER (no wh_mult)
*s *e DBL wh_qHW; // current step HPWHtotal hot water heating, kWh. always >= 0
*s *e float wh_qHW; // current step hot water heating, kWh. always >= 0
// for 1 DHWHEATER (no wh_mult)
// includes heat to DHWLOOP, does not include wh_HPWHxBU
// includes heat to DHWLOOP, does not include wh_qXBU
*s *e INT wh_nzDrawCount; // current substep # of draws > 0

*h *e INT wh_bWriteCSV; // write HPWH debugging CSV iff nz
Expand All @@ -4050,7 +4054,7 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
*h *e INT wh_hrCount; // # of hourly values included in wh_totHARL
// re calc of avg
*h *e DBL wh_totOut; // cumulative (year to date) total heat delivered to hot water, Btu
// includes wh_HPWHxBU
// includes wh_qXBU


// energy inputs for current subhour, Btu
Expand All @@ -4059,8 +4063,8 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
*s *e FLOAT wh_inElecSh; // primary electricity (including wh_parElec) (note not kWh)
// for HPWH, includes compressor + misc (not resistance)
*s *e FLOAT wh_inElecBUSh; // backup electricity (>0 only for HPWH resistance heat)
// (includes wh_HPWHxBU)
*s *e FLOAT wh_inElecXBUSh; // "extra" backup (reheating to maintain ws_tUse)
// (does not include wh_inElecXBUSh)
*s *e FLOAT wh_inElecXBUSh; // XBU "extra" backup (reheating to maintain ws_tUse)
*s *e FLOAT wh_inFuelSh; // fuel (including wh_pilotPwr)


Expand All @@ -4070,8 +4074,8 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
*h *e FLOAT wh_inElec; // primary electricity (including wh_parElec) (note not kWh)
// for HPWH, includes compressor + misc (not resistance)
*h *e FLOAT wh_inElecBU; // backup electricity (>0 only for HPWH resistance heat)
// (includes wh_HPWHxBU)
*h *e FLOAT wh_inElecXBU; // "extra" backup (reheating to maintain ws_tUse)
// (does not include wh_inElecXBU)
*h *e FLOAT wh_inElecXBU; // XBU "extra" backup (reheating to maintain ws_tUse)
*h *e FLOAT wh_inFuel; // fuel (including wh_pilotPwr)

// annual total energy inputs, Btu (check figures)
Expand All @@ -4084,6 +4088,8 @@ RECORD DHWHEATER "DHWHeater" *RAT // input / runtime DHW heater
// default = none (include wh_HPWHxBU in end use dhwBU)
*declare "MTR* wh_pMtrElec; MTR* wh_pMtrFuel;"
// runtime pointers to meters, NULL if not accum'ing
*declare "DHWSYSRES_IVL* wh_pResSh;" // pointer to DHWSYSRES subhour record
// re heat output accounting

*h *e INT wh_unMetSh; // count of subhrs in this hour
// when wh_tHWOut < wh_tUse
Expand Down
Loading