Skip to content

Commit 5638bab

Browse files
authored
Merge pull request #93 from cse-sim/nylefix
Add (again) Nyle large HPWHs (inadvertently omitted)
2 parents 47a747d + c546518 commit 5638bab

File tree

4 files changed

+84
-54
lines changed

4 files changed

+84
-54
lines changed

src/CNDTYPES.DEF

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ PIPESEGP -- "class PIPESEG*" 4 none
387387
GE2014_80DR "GE2014_80DR" // 2014 80 gal GE model run in the efficiency mode (demand reduction variant)
388388
GE2014STDMODE "GE2014StdMode" // 2014 50 gal GE run in standard mode
389389
GE2014STDMODE_80 "GE2014StdMode80" // 2014 80 gal GE run in standard mode
390-
391390
RHEEMHB50 "RheemHB50" // newish Rheem (2014 model?)
392391
RHEEMHBDR2250 "RheemHBDR2250" // 50 gallon, 2250 W resistance Rheem HB Duct Ready
393392
RHEEMHBDR4550 "RheemHBDR4550" // 50 gallon, 4500 W resistance Rheem HB Duct Ready
@@ -405,7 +404,9 @@ PIPESEGP -- "class PIPESEG*" 4 none
405404
AOSMITHSHPT50 "AOSmithSHPT50" // AOSmith add'l models (added 3-24-2017)
406405
AOSMITHSHPT66 "AOSmithSHPT66"
407406
AOSMITHSHPT80 "AOSmithSHPT80"
408-
COLMACCXA20 "ColmacCxA20" // Colmac CxA-20 modular HPWH
407+
COLMACCXA20 "ColmacCxA20" // Colmac CxA-20 modular HPWH
408+
NYLEC185A "NyleC185A" // Nyle C185A external
409+
NYLEC250A "NyleC250A" // Nyle C250A external
409410
}
410411

411412
*choicb DHWEUCH { // hot end uses

src/DHWCalc.cpp

Lines changed: 64 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "ancrec.h" // record: base class for rccn.h classes
1313
#include "rccn.h"
1414
#include "irats.h"
15+
#include "lookup.h"
1516
#include "cuparse.h"
1617
#include "cueval.h"
1718
#include "cvpak.h"
@@ -478,16 +479,19 @@ RC DHWSYS::ws_CkF() // water heating system input check / default
478479
if (IsSet( DHWSYS_CENTRALDHWSYSI))
479480
{ // if served by central DHWSYS, msg disallowed inputs
480481
// can't use ws_HasCentral(), ref may not be resolved yet
481-
rc = disallowN( "when wsCentralDHWSYS is given",
482+
rc |= disallowN( "when wsCentralDHWSYS is given",
482483
DHWSYS_SSF, DHWSYS_CALCMODE, DHWSYS_TSETPOINT, DHWSYS_TSETPOINTLH,
483484
DHWSYS_TUSE, DHWSYS_TINLET, DHWSYS_LOADSHAREDHWSYSI, 0);
484485
}
485486
else if (IsSet( DHWSYS_LOADSHAREDHWSYSI))
486487
{ // if DHWSYS shares load, msg disallowed inputs
487-
rc = disallowN( "when wsLoadShareDHWSYS is given",
488+
rc |= disallowN( "when wsLoadShareDHWSYS is given",
488489
DHWSYS_CENTRALDHWSYSI, DHWSYS_DAYUSENAME, DHWSYS_HWUSE, 0);
489490
}
490491

492+
if (IsSet(DHWSYS_SWTI))
493+
rc |= disallow( DHWSYS_SSF, "when wsDHWSOLARSYS is given");
494+
491495
// ws_tSetpoint defaults to tUse, handled during simulation
492496
// due to interaction with fixed setpoints in some HPWH models
493497

@@ -503,6 +507,8 @@ RC DHWSYS::ws_CkF() // water heating system input check / default
503507
//-----------------------------------------------------------------------------
504508
RC DHWSYS::ws_CheckVals( // check value ranges
505509
int erOp)
510+
// used during input and at runtime (re expressions)
511+
// returns RCOK iff simulation should continue
506512
{
507513
RC rc = RCOK;
508514

@@ -1193,7 +1199,8 @@ RC DHWSYS::ws_DoHourDrawAccounting( // water use accounting
11931199
{
11941200
RC rc = RCOK;
11951201

1196-
#define ALTDRAWCSV
1202+
#undef ALTDRAWCSV // define to enable alternative draw export format
1203+
// (re PRERUN testing, not generally useful)
11971204

11981205
#if !defined( ALTDRAWCSV)
11991206
// write ws_ticks draw info to CSV file
@@ -1221,6 +1228,8 @@ RC DHWSYS::ws_DoHourDrawAccounting( // water use accounting
12211228
float whLoad = ws_whUse.total*(ws_tUse - ws_tInletX)*waterRhoCp;
12221229
float loadSum = ws_loadMaxMS.vm_Sum( whLoad, &ws_loadMax);
12231230
#if defined( ALTDRAWCSV)
1231+
// alternative format draw export
1232+
// supports testing of ws_drawMaxDur and ws_loadMaxDur
12241233
if (ws_drawCSV == C_NOYESCH_YES && !Top.isWarmup)
12251234
{
12261235
if (ws_pFDrawCSV == NULL)
@@ -1570,8 +1579,8 @@ RC DHWSYS::ws_WriteDrawCSV()// write this hour draw info to CSV
15701579
const DHWTICK& tk = ws_ticks[iTk];
15711580
// write to CSV w/o trailing 0s (many draws are 0, don't write 0.0000)
15721581
fprintf(ws_pFDrawCSV, "%s,%s,%s,%s\n",
1573-
WStrFmtFloatDTZ( tk.wtk_tInletX,2).c_str(),
15741582
WStrFmtFloatDTZ( ws_tInlet, 2).c_str(),
1583+
WStrFmtFloatDTZ( tk.wtk_tInletX,2).c_str(),
15751584
WStrFmtFloatDTZ( ws_tUse, 2).c_str(),
15761585
WStrFmtFloatDTZ( tk.wtk_whUse, 4).c_str());
15771586
}
@@ -2147,39 +2156,44 @@ RC HPWHLINK::hw_InitPreset( // set up HPWH from model type choice
21472156
}
21482157
else
21492158
{ // known heat pump type
2150-
preset =
2151-
ashpTy == C_WHASHPTYCH_BASICINT ? HPWH::MODELS_basicIntegrated
2152-
: ashpTy == C_WHASHPTYCH_RESTANK ? HPWH::MODELS_restankRealistic
2153-
: ashpTy == C_WHASHPTYCH_RESTANKNOUA ? HPWH::MODELS_restankNoUA
2154-
: ashpTy == C_WHASHPTYCH_AOSMITHPHPT60 ? HPWH::MODELS_AOSmithPHPT60
2155-
: ashpTy == C_WHASHPTYCH_AOSMITHPHPT80 ? HPWH::MODELS_AOSmithPHPT80
2156-
: ashpTy == C_WHASHPTYCH_AOSMITHHPTU50 ? HPWH::MODELS_AOSmithHPTU50
2157-
: ashpTy == C_WHASHPTYCH_AOSMITHHPTU66 ? HPWH::MODELS_AOSmithHPTU66
2158-
: ashpTy == C_WHASHPTYCH_AOSMITHHPTU80 ? HPWH::MODELS_AOSmithHPTU80
2159-
: ashpTy == C_WHASHPTYCH_AOSMITHHPTU80DR ? HPWH::MODELS_AOSmithHPTU80_DR
2160-
: ashpTy == C_WHASHPTYCH_SANDEN40 ? HPWH::MODELS_Sanden40
2161-
: ashpTy == C_WHASHPTYCH_SANDEN80 ? HPWH::MODELS_Sanden80
2162-
: ashpTy == C_WHASHPTYCH_COLMACCXA20 ? HPWH::MODELS_CxA_20
2163-
: ashpTy == C_WHASHPTYCH_GE2012 ? HPWH::MODELS_GE2012
2164-
: ashpTy == C_WHASHPTYCH_GE2014 ? HPWH::MODELS_GE2014
2165-
: ashpTy == C_WHASHPTYCH_GE2014_80 ? HPWH::MODELS_GE2014_80
2166-
: ashpTy == C_WHASHPTYCH_GE2014_80DR ? HPWH::MODELS_GE2014_80DR
2167-
: ashpTy == C_WHASHPTYCH_GE2014STDMODE ? HPWH::MODELS_GE2014STDMode
2168-
: ashpTy == C_WHASHPTYCH_GE2014STDMODE_80 ? HPWH::MODELS_GE2014STDMode_80
2169-
: ashpTy == C_WHASHPTYCH_RHEEMHB50 ? HPWH::MODELS_RheemHB50
2170-
: ashpTy == C_WHASHPTYCH_RHEEMHBDR2250 ? HPWH::MODELS_RheemHBDR2250
2171-
: ashpTy == C_WHASHPTYCH_RHEEMHBDR4550 ? HPWH::MODELS_RheemHBDR4550
2172-
: ashpTy == C_WHASHPTYCH_RHEEMHBDR2265 ? HPWH::MODELS_RheemHBDR2265
2173-
: ashpTy == C_WHASHPTYCH_RHEEMHBDR4565 ? HPWH::MODELS_RheemHBDR4565
2174-
: ashpTy == C_WHASHPTYCH_RHEEMHBDR2280 ? HPWH::MODELS_RheemHBDR2280
2175-
: ashpTy == C_WHASHPTYCH_RHEEMHBDR4580 ? HPWH::MODELS_RheemHBDR4580
2176-
: ashpTy == C_WHASHPTYCH_STIEBEL220E ? HPWH::MODELS_Stiebel220E
2177-
: ashpTy == C_WHASHPTYCH_GENERIC1 ? HPWH::MODELS_Generic1
2178-
: ashpTy == C_WHASHPTYCH_GENERIC2 ? HPWH::MODELS_Generic2
2179-
: ashpTy == C_WHASHPTYCH_GENERIC3 ? HPWH::MODELS_Generic3
2180-
: ashpTy == C_WHASHPTYCH_UEF2GENERIC ? HPWH::MODELS_UEF2generic
2181-
: ashpTy == C_WHASHPTYCH_WORSTCASEMEDIUM ? HPWH::MODELS_UEF2generic // alias (testing aid)
2182-
: HPWH::MODELS(-1); // HPWHInit_presets will reject
2159+
static const WWTABLE /* { SI key, value; } */ presetTbl[] = {
2160+
{ C_WHASHPTYCH_BASICINT, HPWH::MODELS_basicIntegrated },
2161+
{ C_WHASHPTYCH_RESTANK, HPWH::MODELS_restankRealistic },
2162+
{ C_WHASHPTYCH_RESTANKNOUA, HPWH::MODELS_restankNoUA },
2163+
{ C_WHASHPTYCH_AOSMITHPHPT60, HPWH::MODELS_AOSmithPHPT60 },
2164+
{ C_WHASHPTYCH_AOSMITHPHPT80, HPWH::MODELS_AOSmithPHPT80 },
2165+
{ C_WHASHPTYCH_AOSMITHHPTU50, HPWH::MODELS_AOSmithHPTU50 },
2166+
{ C_WHASHPTYCH_AOSMITHHPTU66, HPWH::MODELS_AOSmithHPTU66 },
2167+
{ C_WHASHPTYCH_AOSMITHHPTU80, HPWH::MODELS_AOSmithHPTU80 },
2168+
{ C_WHASHPTYCH_AOSMITHHPTU80DR, HPWH::MODELS_AOSmithHPTU80_DR },
2169+
{ C_WHASHPTYCH_SANDEN40, HPWH::MODELS_Sanden40 },
2170+
{ C_WHASHPTYCH_SANDEN80, HPWH::MODELS_Sanden80 },
2171+
{ C_WHASHPTYCH_COLMACCXA20, HPWH::MODELS_CxA_20 },
2172+
{ C_WHASHPTYCH_NYLEC185A, HPWH::MODELS_NG1 },
2173+
{ C_WHASHPTYCH_NYLEC250A, HPWH::MODELS_NG2 },
2174+
{ C_WHASHPTYCH_GE2012, HPWH::MODELS_GE2012 },
2175+
{ C_WHASHPTYCH_GE2014, HPWH::MODELS_GE2014 },
2176+
{ C_WHASHPTYCH_GE2014_80, HPWH::MODELS_GE2014_80 },
2177+
{ C_WHASHPTYCH_GE2014_80DR, HPWH::MODELS_GE2014_80DR },
2178+
{ C_WHASHPTYCH_GE2014STDMODE, HPWH::MODELS_GE2014STDMode },
2179+
{ C_WHASHPTYCH_GE2014STDMODE_80, HPWH::MODELS_GE2014STDMode_80 },
2180+
{ C_WHASHPTYCH_RHEEMHB50, HPWH::MODELS_RheemHB50 },
2181+
{ C_WHASHPTYCH_RHEEMHBDR2250, HPWH::MODELS_RheemHBDR2250 },
2182+
{ C_WHASHPTYCH_RHEEMHBDR4550, HPWH::MODELS_RheemHBDR4550 },
2183+
{ C_WHASHPTYCH_RHEEMHBDR2265, HPWH::MODELS_RheemHBDR2265 },
2184+
{ C_WHASHPTYCH_RHEEMHBDR4565, HPWH::MODELS_RheemHBDR4565 },
2185+
{ C_WHASHPTYCH_RHEEMHBDR2280, HPWH::MODELS_RheemHBDR2280 },
2186+
{ C_WHASHPTYCH_RHEEMHBDR4580, HPWH::MODELS_RheemHBDR4580 },
2187+
{ C_WHASHPTYCH_STIEBEL220E, HPWH::MODELS_Stiebel220E },
2188+
{ C_WHASHPTYCH_GENERIC1, HPWH::MODELS_Generic1 },
2189+
{ C_WHASHPTYCH_GENERIC2, HPWH::MODELS_Generic2 },
2190+
{ C_WHASHPTYCH_GENERIC3, HPWH::MODELS_Generic3 },
2191+
{ C_WHASHPTYCH_UEF2GENERIC, HPWH::MODELS_UEF2generic },
2192+
{ C_WHASHPTYCH_WORSTCASEMEDIUM, HPWH::MODELS_UEF2generic }, // alias (testing aid)
2193+
{ 32767, HPWH::MODELS(-1) } // HPWHInit_presets will reject
2194+
};
2195+
2196+
preset = HPWH::MODELS(presetTbl->lookup(ashpTy));
21832197
}
21842198
if (hw_pHPWH->HPWHinit_presets(preset) != 0)
21852199
rc |= RCBAD;
@@ -2620,7 +2634,8 @@ RC HPWHLINK::hw_DoSubhrTick(
26202634
"tOut", tOut > 0. ? DegCtoF(tOut) : CSVItem::ci_UNSET,
26212635
UNTEMP, 5,
26222636
"XBU", HPWHxBU, UNENERGY3, 5,
2623-
"tUse", tMix, UNTEMP, 5,
2637+
"tUse", tMix > 0.f ? tMix : CSVItem::ci_UNSET,
2638+
UNTEMP, 5,
26242639
"qEnv", KWH_TO_BTU(hw_pHPWH->getEnergyRemovedFromEnvironment()),
26252640
UNENERGY3, 5,
26262641
"qLoss", KWH_TO_BTU(hw_pHPWH->getStandbyLosses()),
@@ -3021,6 +3036,13 @@ void DHWHEATER::wh_InitRunTotals()
30213036
DHWSYS* DHWHEATER::wh_GetDHWSYS() const
30223037
{
30233038
DHWSYS* pWS = (b == &WhR || b == &WlhR ? WsR : WSiB).GetAtSafe(ownTi);
3039+
#if 0
3040+
// ToDo: OwnB not set for loopheater?
3041+
record* pWSX = b->ownB->GetAtSafe(ownTi);
3042+
if (pWS != pWSX)
3043+
printf("\nMismatch");
3044+
#endif
3045+
30243046
return pWS;
30253047
} // DHWHEATER::wh_GetDHWSYS
30263048
//----------------------------------------------------------------------------
@@ -3428,8 +3450,10 @@ RC DHWHEATER::wh_DoSubhrEnd() // end-of-subhour
34283450
double stbyElec = wh_stbyElec * (Top.tp_nSubhrTicks - wh_nzDrawCount) * Top.tp_tickDurHr;
34293451

34303452
// output accounting = heat delivered to water
3453+
#if 0
34313454
double qHW = wh_nTickFullLoad * wh_maxFlowX / 67.;
3432-
wh_totOut += qHW + wh_HPWHxBU;
3455+
#endif
3456+
wh_totOut += wh_qHW + wh_HPWHxBU;
34333457

34343458
// energy use accounting, Btu
34353459
wh_inElecSh += rcovElec /*+ startElec*/ + (stbyElec + wh_parElec * Top.tp_tickDurHr) * BtuperWh;
@@ -3514,7 +3538,7 @@ static const UEFPARAMS UEFParams[] = {
35143538
* Top.tp_tickDurMin; // scale to actual tick duration
35153539

35163540
// no electricity use pending model development
3517-
wh_operElec = Pe * BtuperWh; // electrical power during opration, Btuh
3541+
wh_operElec = Pe * BtuperWh; // electrical power during operation, Btuh
35183542
// wh_cycLossElec = 0.f; // electricity use per start, Btu
35193543
// unused in revised model 5-24-2017
35203544

src/LOOKUP.CPP

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ SI FC lookw( // word table searcher
3434
SI FC lookww( // word-word table searcher -- general use routine
3535

3636
SI key,
37-
WWTABLE *table ) // table is key, value pairs, ended by 32767, default
37+
const WWTABLE *table ) // table is key, value pairs, ended by 32767, default
3838

3939
// fcn value is table value for key, or default (last entry) if not found
4040
{
@@ -46,10 +46,10 @@ SI FC lookww( // word-word table searcher -- general use routine
4646
}
4747
} // lookww
4848
//===========================================================================
49-
char * FC lookws( // word-string table searcher
49+
const char* FC lookws( // word-string table searcher
5050

5151
SI key,
52-
WSTABLE *table ) // key, string pairs, ended by 32767, default
52+
const WSTABLE *table ) // key, string pairs, ended by 32767, default
5353

5454
// fcn value is table value for key, or default (last entry) if not found
5555
{
@@ -62,7 +62,7 @@ char * FC lookws( // word-string table searcher
6262
} // lookws
6363

6464
//===========================================================================
65-
SI FC lookswl( SI index, SWLTAB* table)
65+
SI FC lookswl( SI index, const SWLTAB* table)
6666

6767
// retrieve member from subscripted word with limits table (lookup.h)
6868

@@ -79,8 +79,8 @@ SI FC lookswl( SI index, SWLTAB* table)
7979
//=========================================================================
8080
SI FC looksw( // string/word table lookup
8181

82-
char *string, // String sought
83-
SWTABLE *swtab ) // Table in which to look, terminated with NULL
82+
const char *string, // String sought
83+
const SWTABLE *swtab ) // Table in which to look, terminated with NULL
8484

8585
/* Returns value in table corresponding to name. If not found,
8686
returns entry corresponding to NULL in table */

src/LOOKUP.H

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,23 @@
44

55
// lookup.h -- declarations associated with table lookup functions in lookup.c
66

7+
/* ---------------------------- FUNCTIONS -------------------------------- */
8+
extern SI FC lookw(SI, SI *); // word table searcher
9+
extern SI FC lookww(SI, const struct WWTABLE *); // word-word table lookup
10+
extern const char* FC lookws(SI, const struct WSTABLE *); // word-string table lookup
11+
extern SI FC lookswl(SI index, const struct SWLTAB* table); // subscript-word-limits table lookup
12+
extern SI FC looksw(const char *, const struct SWTABLE *); // string-word table lookup
13+
714
/*-------------------------------- TYPES ----------------------------------*/
815

916
// word key, word value table struct for lookww
1017
struct WWTABLE // terminate w/ last array entry of 32767, default/not found indicator
1118
{
1219
SI key, value;
20+
SI lookup( SI key) const
21+
{
22+
return lookww(key, this);
23+
}
1324

1425
};
1526

@@ -40,11 +51,5 @@ struct SWTABLE // terminate w/ last array entry of NULL, default/not found indic
4051
};
4152

4253

43-
/* ---------------------------- FUNCTIONS -------------------------------- */
44-
extern SI FC lookw( SI, SI *); // word table searcher
45-
extern SI FC lookww( SI, WWTABLE *); // word-word table lookup
46-
extern char * FC lookws( SI, WSTABLE *); // word-string table lookup
47-
extern SI FC lookswl( SI index, SWLTAB* table); // subscript-word-limits table lookup
48-
extern SI FC looksw(char *, SWTABLE *); // string-word table lookup
4954

5055
// end of lookup.h

0 commit comments

Comments
 (0)