Skip to content

Commit dccffff

Browse files
authored
Merge pull request #88 from cse-sim/tdvRank
Tdv rank / Colmac
2 parents c1e00b7 + 2d8c946 commit dccffff

File tree

10 files changed

+107
-120
lines changed

10 files changed

+107
-120
lines changed

src/CGWTHR.CPP

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,9 @@ void WDHR::wd_FillFromDESCOND( // overwrite/adjust hourly data for design condi
469469
else
470470
wd_glrad = wd_bmrad = wd_dfrad = 0.f;
471471

472-
// Remaining items: use weather file values
473-
// wd_tGrnd, wd_tMains, wd_tdvElec, wd_tdvFuel, wd_tdvElecPk, wd_tdvElecAvg,
474-
// wd_tdvElecPvPk, wd_tdvElecAvg01
472+
// Remaining items: use weather/tdv file values
473+
// wd_tGrnd, wd_tMains, wd_tdvElec, wd_tdvFuel, wd_tdvElecPk, wd_tdvElecPkRank,
474+
// wd_tdvElecAvg, wd_tdvElecPvPk, wd_tdvElecAvg01
475475

476476
} // WDHR::wd_FillFromDESCOND
477477
//===========================================================================

src/CNCULT.CPP

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,10 @@ RC SFI::sf_CkfWINDOW(
580580
options;
581581
RC rc = RCOK;
582582
sfClass = sfcWINDOW;
583+
FixUp();
584+
#if defined( _DEBUG)
585+
Validate();
586+
#endif
583587
x.xs_modelr = C_SFMODELCH_QUICK;
584588
return rc;
585589
} // SFI::sf_ChkWINDOW
@@ -647,6 +651,11 @@ RC SFI::sf_CkfDOOR(
647651
{
648652
options;
649653
sfClass = sfcDOOR; // assign class
654+
FixUp();
655+
#if defined( _DEBUG)
656+
Validate(0x100);
657+
#endif
658+
650659
RC rc = RCOK;
651660

652661
// sf_Ckf: require construction or u value, not both
@@ -716,9 +725,13 @@ RC SFI::sf_CkfSURF( // surface checker
716725
{
717726
BOOL bRunCheck = (options&1) != 0;
718727
sfClass = sfcSURF;
728+
if (options & 1)
729+
{
730+
FixUp();
719731
#if defined( _DEBUG)
720-
Validate();
732+
Validate(0x100);
721733
#endif
734+
}
722735

723736
RC rc = RCOK;
724737
BOO xcSet = IsSet( SFX( SFEXCND)); // nz if sfExCnd given by user (a choice type: no exprs
@@ -1045,14 +1058,27 @@ CULT()
10451058

10461059

10471060
/*------------------------ PERIM command (for zone) ------------------------
1061+
Any number allowed.
1062+
Input now to PRI; later XSURFs are chained to ZNR record. */
1063+
//-----------------------------------------------------------------------------
1064+
RC prStarCkf(CULT *c, /*SFI* */ void *p, void *p2, void *p3) /*ARGSUSED*/
10481065

1049-
Any number allowed.
1050-
Input now to PRI; later XSURFs are chained to ZNR record. */
1066+
// called at end of surface object entry.
1067+
// ALSO called from sf_topSf1() at RUN, to issue msgs otherwise lost
1068+
// if surface is part of DEFTYPE ZONE and not ALTERed at TYPE use
1069+
// (suppress msgs here during deftype if correctible at TYPE use).
10511070

1052-
static CULT perT[] = //------------------------------------ PERIM command table
1071+
// ONLY argument 'p' is used.
1072+
{
1073+
int options = c == NULL; // sf_topSf1 call has no CULT
1074+
return ((PRI*)p)->pr_Ckf(options);
1075+
} // sfStarCkf
1076+
//-----------------------------------------------------------------------------
1077+
static CULT perT[] =
10531078
{
10541079
// id cs fn f uc evf ty b dfls p2 ckf
10551080
//-------- ---- ------------------- ------------- -- ------ ----- ------ -------------------- --- ----
1081+
CULT( "*", STAR, 0, 0, 0, 0, 0, 0, 0.f, N, prStarCkf),
10561082
CULT( "*", STAR, 0, 0, 0, 0, 0, 0, 0.f, N, N),
10571083
CULT( "prZone", DAT, PRI_OWNTI, NO_INP|RDFLIN, 0, 0, TYREF, &ZiB, 0.f, N, N), //TYIREF-->TYREF 10-9-92
10581084
CULT( "prXtype", DAT, PRI_X+XSURF_TY, NO_INP, 0, 0, TYSI, 0, v CTPERIM,0.f, N, N), //CTPERIM: cnguts.h.

src/CNCULT3.CPP

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,6 +2101,17 @@ PRI::PRI( basAnc* b, TI i, SI noZ /*=0*/)
21012101
// called from basAnc::reAl() and this c'tor, Copy()
21022102
{ x.xs_Init( this);
21032103
} // PRI::FixUp
2104+
//-----------------------------------------------------------------------------
2105+
RC PRI::pr_Ckf(
2106+
int options) // 1
2107+
{
2108+
RC rc = RCOK;
2109+
FixUp();
2110+
2111+
return rc;
2112+
} // PRI::pr_Ckf
2113+
///////////////////////////////////////////////////////////////////////////////
2114+
21042115
//=============================================================================
21052116
XSRAT::XSRAT( basAnc* b, TI i, SI noZ /*=0*/)
21062117
: record( b, i, noZ)
@@ -2133,7 +2144,7 @@ XSRAT::XSRAT( basAnc* b, TI i, SI noZ /*=0*/)
21332144
rc |= errCrit( WRN, "XSRAT::Validate: Bad XSURF pParent");
21342145
}
21352146
if (rc == RCOK)
2136-
RC rc = x.xs_Validate( options);
2147+
rc = x.xs_Validate( options);
21372148
return rc;
21382149
} // XSRAT::Validate
21392150
//=============================================================================
@@ -2239,8 +2250,6 @@ RC XSURF::xs_Validate(
22392250
{ if (xs_msi)
22402251
rc |= errCrit( WRN, "XSURF '%s': Unexpected mass %d for non-CTMXWALL", xs_Name(), xs_msi);
22412252
}
2242-
2243-
22442253
}
22452254
// ASHWAT back pointer should always be good if present
22462255
for (int iFA=0; iFA<2; iFA++)
@@ -2407,8 +2416,10 @@ void XSURF::xs_SetRunConstants()
24072416
}
24082417
#endif
24092418

2410-
xs_sbcI.sb_SetRunConstants( dbPrint);
2411-
xs_sbcO.sb_SetRunConstants( dbPrint);
2419+
if (!xs_IsPerim())
2420+
{ xs_sbcI.sb_SetRunConstants(dbPrint);
2421+
xs_sbcO.sb_SetRunConstants(dbPrint);
2422+
}
24122423

24132424
xs_DeleteFENAW(); // insurance
24142425
if (xs_IsASHWAT())
@@ -2661,15 +2672,16 @@ void SBC::sb_SetCoeffs( // set convective and radiant coefficients
26612672

26622673
// NOTE: Some values pre-set in sb_SetRunConstants for some cases.
26632674
// Do not add general inits here w/o review
2664-
2665-
if (sb_zi) // if exposed to zone
2675+
if (sb_pXS->xs_IsPerim())
2676+
sb_qrAbs = 0.;
2677+
else if (sb_zi) // if exposed to zone
26662678
{ // boundary is adjacent to zone
26672679
// sb_txa, sb_txr set at end of prior step
2668-
if (sb_pXS->xs_ty != CTKIVA)
2680+
if (!sb_pXS->xs_IsKiva())
26692681
{
26702682
sb_HCZone(); // convection
26712683
sb_hxa = sb_hcMult * (sb_hcNat + sb_hcFrc);
2672-
sb_hxr = sb_frRad*pow3(DegFtoR(0.5*(sb_tSrf + sb_txr)));
2684+
sb_hxr = sb_frRad * pow3(DegFtoR(0.5*(sb_tSrf + sb_txr)));
26732685
}
26742686
sb_qrAbs = area > 0. ? sb_sgTarg.st_tot / area : 0.;
26752687
}
@@ -2693,7 +2705,7 @@ void SBC::sb_SetCoeffs( // set convective and radiant coefficients
26932705
+ sb_cTGrnd * Wthr.d.wd_tGrnd) * sb_rGrnd;
26942706
sb_txr = sb_txa; // no radiation, set sb_txr as insurance
26952707
}
2696-
else if (sb_pXS->sfExCnd==C_EXCNDCH_ADIABATIC)
2708+
else if (sb_pXS->sfExCnd==C_EXCNDCH_ADIABATIC || sb_pXS->xs_IsPerim())
26972709
{ sb_hcNat = sb_hcFrc = sb_hxr = sb_hxa = 0.;
26982710
}
26992711
else
@@ -2980,16 +2992,13 @@ x printf( "Hit\n");
29802992
}
29812993

29822994
case C_CONVMODELCH_TARP:
2983-
{
2984-
2985-
sb_hcNat = sb_hcConst[TD>0.] * pow(fabs(TD), 1. / 3.);
2995+
{ sb_hcNat = sb_hcConst[TD>0.] * pow(fabs(TD), 1. / 3.);
29862996
sb_hcFrc = 0.f;
29872997
break;
29882998
}
29892999

29903000
case C_CONVMODELCH_MILLS:
29913001
{
2992-
29933002
// get nat conv h for underside of roof construction:
29943003
// Ref: A.F. Mills, "Heat Transfer", '92; Eq 4.85 & 4.86.
29953004
// applied to hot all roofs facing downward, and to cold roof facing downward if Theta < 60 deg.
@@ -3043,7 +3052,6 @@ x printf( "Hit\n");
30433052
break;
30443053
}
30453054

3046-
30473055
case C_CONVMODELCH_INPUT:
30483056
sb_hcNat = 1.f;
30493057
sb_hcFrc = 0.f;
@@ -3246,6 +3254,16 @@ TI XSURF::xs_GetZi( // get zone idx
32463254
return zi;
32473255
} // XSURF::xs_GetZi
32483256
//-----------------------------------------------------------------------------
3257+
int XSURF::xs_IsPerim() const // nz iff this is a PERIMETER
3258+
{
3259+
return xs_ty == CTPERIM;
3260+
} // XSURF::xs_IsPerim
3261+
//-----------------------------------------------------------------------------
3262+
int XSURF::xs_IsKiva() const // nz iff surface uses Kiva ground conduction
3263+
{
3264+
return xs_ty == CTKIVA;
3265+
} // XSURF::xs_IsKiva
3266+
//-----------------------------------------------------------------------------
32493267
int XSURF::xs_IsASHWAT() const // nz iff this is an ASHWAT window
32503268
{
32513269
return xs_fenModel == C_FENMODELCH_ASHWAT;

src/CNDTYPES.DEF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ PIPESEGP -- "class PIPESEG*" 4 none
405405
AOSMITHSHPT50 "AOSmithSHPT50" // AOSmith add'l models (added 3-24-2017)
406406
AOSMITHSHPT66 "AOSmithSHPT66"
407407
AOSMITHSHPT80 "AOSmithSHPT80"
408+
COLMACCXA20 "ColmacCxA20" // Colmac CxA-20 modular HPWH
408409
}
409410

410411
*choicb DHWEUCH { // hot end uses

src/CNLOADS.CPP

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4418,17 +4418,12 @@ static RC loadsSurfaces( // surface runtime simulation
44184418

44194419
TMRSTART( TMR_AWTOT); // total ASHWAT time (incl setup)
44204420
// see also TMR_AWCALC
4421-
RLUP (XsB, xr)
4422-
{ if (xr->x.xs_IsASHWAT())
4423-
rc |= xr->x.xs_ASHWAT();
4424-
}
4421+
RLUPC(XsB, xr, xr->x.xs_IsASHWAT())
4422+
rc |= xr->x.xs_ASHWAT();
44254423
TMRSTOP( TMR_AWTOT);
44264424

4427-
RLUP(XsB, xr)
4428-
{ if (xr->x.xs_ty != CTMXWALL)
4429-
{ rc |= xr->x.xs_SubhrQS();
4430-
}
4431-
}
4425+
RLUPC(XsB, xr, xr->x.xs_ty != CTMXWALL)
4426+
rc |= xr->x.xs_SubhrQS();
44324427
}
44334428

44344429
float dur, tDbO;
@@ -4444,16 +4439,11 @@ static RC loadsSurfaces( // surface runtime simulation
44444439
// masses
44454440
TMRSTART( TMR_COND);
44464441
MSRAT* mse;
4447-
RLUP( MsR, mse) // for mse = MSRAT record 1 to n (cnglob.h)
4448-
{
4449-
if (subhrly != mse->isSubhrly)
4450-
continue; // skip masses for wrong interval
4451-
4452-
if (mse->ms_isFD)
4442+
RLUPC( MsR, mse, subhrly == mse->isSubhrly) // do matching interval
4443+
{ if (mse->ms_isFD)
44534444
mse->ms_StepFD(); // FD (forward_difference) model is only subhourly
44544445
else
44554446
mse->ms_StepMX( dur, tDbO);
4456-
44574447
} // mass loop
44584448
TMRSTOP( TMR_COND);
44594449

src/CNRECS.DEF

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,9 +821,11 @@ RECORD WDHR "wfdata sub" *SUBSTRUCT // hourly data substructure for WFDATA
821821

822822
// derived (computed) electricity TDV values
823823
// values updated at standard time day beg / same all day
824-
// *except* wd_tdvElecPk is updated at hr=23 iff DST
824+
// *except* at hr=23 iff DST
825825
*h float wd_tdvElecPk // current day peak TDVelec (includes future hours)
826826
// updated at hr=23 iff DST
827+
*h SI wd_tdvElecPkRank // current day wd_tdvElecPk rank within year (1-365/366)
828+
// (largest wd_tdvElecPk=1, next=2, etc.)
827829
*h float wd_tdvElecAvg // current day avg TDVelec (includes future hours)
828830
*h float wd_tdvElecPvPk // previous-day peak TDVelec
829831
*h float wd_tdvElecAvg01 // previous-day avg TDVelec (not including current day)
@@ -1177,6 +1179,7 @@ RECORD XSURF "xsurf sub" *SUBSTRUCT // for PRI, SFI, XSRAT.
11771179
*declare "int xs_HasControlledShade() const;"
11781180
*declare "int xs_IsDelayed() const { return xs_msi != 0; }"
11791181
*declare "int xs_IsKiva() const;"
1182+
*declare "int xs_IsPerim() const;"
11801183
*declare "int xs_CanBeSGTarget() const;"
11811184
*declare "int xs_Class() const;"
11821185
*declare "int xs_TyFromTilt() const;"
@@ -1267,6 +1270,7 @@ RECORD PRI "perimeter" *RAT // perimeter input RAT
12671270

12681271
*excon
12691272
*ovrcopy
1273+
*declare "RC pr_Ckf( int options);"
12701274
*declare "void FixUp();" // virtual fixup after basAnc reAl
12711275
// .ownTi (base class) is zone subscript
12721276
*r *hide *noname *nest XSURF x // hs info (struct above).

src/DHWCalc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,6 +2159,7 @@ RC HPWHLINK::hw_InitPreset( // set up HPWH from model type choice
21592159
: ashpTy == C_WHASHPTYCH_AOSMITHHPTU80DR ? HPWH::MODELS_AOSmithHPTU80_DR
21602160
: ashpTy == C_WHASHPTYCH_SANDEN40 ? HPWH::MODELS_Sanden40
21612161
: ashpTy == C_WHASHPTYCH_SANDEN80 ? HPWH::MODELS_Sanden80
2162+
: ashpTy == C_WHASHPTYCH_COLMACCXA20 ? HPWH::MODELS_CxA_20
21622163
: ashpTy == C_WHASHPTYCH_GE2012 ? HPWH::MODELS_GE2012
21632164
: ashpTy == C_WHASHPTYCH_GE2014 ? HPWH::MODELS_GE2014
21642165
: ashpTy == C_WHASHPTYCH_GE2014_80 ? HPWH::MODELS_GE2014_80

src/Foundation.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,9 @@ ZNR* KIVA::kv_GetZone() const
163163
{
164164
return ZrB.GetAt(XsB.GetAt(kv_floor)->x.xs_sbcI.sb_zi); // Zone at inside surface
165165
}
166-
167-
int XSURF::xs_IsKiva() const
168-
{
169-
return xs_ty == CTKIVA;
170-
}
171-
172166
RC XSRAT::xr_ApplyKivaResults()
173167
{
174-
if (x.xs_ty == CTKIVA)
168+
if (x.xs_IsKiva())
175169
{
176170
auto& sbc = x.xs_sbcI;
177171

@@ -192,7 +186,7 @@ RC XSRAT::xr_ApplyKivaResults()
192186

193187
RC XSRAT::xr_KivaZoneAccum()
194188
{
195-
if (x.xs_ty == CTKIVA)
189+
if (x.xs_IsKiva())
196190
{
197191
auto& sbc = x.xs_sbcI;
198192
ZNR& z = ZrB[sbc.sb_zi];

0 commit comments

Comments
 (0)