Skip to content

Commit 8fcd4a4

Browse files
authored
Merge pull request #119 from cse-sim/vsashp
Vsashp
2 parents d00d21e + eff89ef commit 8fcd4a4

File tree

2 files changed

+77
-36
lines changed

2 files changed

+77
-36
lines changed

src/CNLOADS.CPP

Lines changed: 70 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3134,12 +3134,12 @@ float RSYS::rs_PerfASHP( // ASHP performance (simplified call)
31343134
// else model defrost if available
31353135
float tdbOut, // outdoor dry bulb, F
31363136
float& COP, // returned: compressor-only full speed COP at tdbOut
3137-
float fanHAdj) // fan power adjustment, Btuh
3137+
float fanHAdj /*=0.f*/) // fan power adjustment, Btuh
31383138
// removed from capacity and input (before COP calc)
31393139
// returns total heating capacity (compressor + capDefrostHt), Btuh
31403140
{
31413141
float capHt, inpHt, capDfHt, capHtMin, inpHtMin, capDfHtMin;
3142-
float what = rs_PerfASHP2(ashpModel, tdbOut, fanHAdj,
3142+
COP = rs_PerfASHP2(ashpModel, tdbOut, fanHAdj,
31433143
capHt, inpHt, capDfHt, capHtMin, inpHtMin, capDfHtMin);
31443144

31453145
return capHt;
@@ -3167,7 +3167,7 @@ float RSYS::rs_PerfASHP2( // ASHP performance
31673167

31683168
float COPAdjF /*=1.f*/) // COP adjustment factor
31693169
// multiplies final COP result
3170-
// returns heating capacity (including defrost if any), Btuh
3170+
// returns compressor-only full-speed COP (as adjusted by COPAdjF)
31713171
{
31723172
capDfHt = 0.f;
31733173
BOOL bDoDefrost = (ashpModel & 0x100) == 0
@@ -3347,10 +3347,7 @@ RC RSYS::rs_SetupASHP() // set ASHP defaults and derived parameters
33473347
rs_cap17 = max( rs_Cap17RatioASHP()*rs_cap47, 1.f);
33483348

33493349
if (!IsSet(RSYS_CAP35))
3350-
{ rs_cap35 = rs_cap17 + 0.6f * (rs_cap47 - rs_cap17);
3351-
if (rs_HasDefrost())
3352-
rs_cap35 *= 0.9f; // capacity reduction for defrost
3353-
}
3350+
rs_cap35 = rs_Cap35Default(rs_cap47, rs_cap17);
33543351

33553352
#if ASHP_COPREG == 1
33563353
// "traditional" model
@@ -3387,11 +3384,11 @@ RC RSYS::rs_SetupASHP() // set ASHP defaults and derived parameters
33873384
rs_COP47 = 0.3225f * rs_HSPF + 0.9099f;
33883385
if (!IsSet( RSYS_COP17))
33893386
rs_COP17 = rs_HSPF < 8
3390-
? 0.5183f * rs_HSPF - 1.7244
3387+
? 0.5183f * rs_HSPF - 1.7244f
33913388
: 0.2186f * rs_HSPF + 0.6734f;
33923389
#elif ASHP_COPREG == 6
33933390
if (rs_IsPkgRoom())
3394-
{ rs_COP17 = 0.6870 * rs_COP47;
3391+
{ rs_COP17 = 0.6870f * rs_COP47;
33953392
// rs_cap17 set above
33963393
}
33973394
else if (!rs_IsASHPHydronic())
@@ -3401,13 +3398,19 @@ RC RSYS::rs_SetupASHP() // set ASHP defaults and derived parameters
34013398
rs_COP47 = 0.3225f * rs_HSPF + 0.9099f;
34023399
if (!IsSet( RSYS_COP17))
34033400
{ rs_COP17 = 0.2186f * rs_HSPF + 0.6734f;
3404-
RC rc1 = rs_HSPFMatchASHP(); // adjust COP17 to be
3405-
// consistent with rs_HSPF
3406-
if (rc1 != RCOK // if fail
3407-
|| (!rs_isAuszH && rs_COP17 > rs_COP47)) // or unreasonable
3408-
// (allow during ausz)
3409-
rc = err( "RSYS '%s': No reasonable value found for rsCOP17."
3410-
"\n Check rsHSPF and other heating inputs.", name);
3401+
int iTry;
3402+
RC rc1;
3403+
const int nTry = 40;
3404+
for (iTry=0; iTry<nTry; iTry++)
3405+
{ rc1 = rs_HSPFMatchASHP(); // adjust COP17 to be
3406+
// consistent with rs_HSPF
3407+
if (rc1 || rs_COP17 < rs_COP47 || IsSet( RSYS_COP47))
3408+
break; // accept rs_COP17 if < rs_COP47 or rs_COP47 is fixed
3409+
rs_COP47 += 0.1f; // try again with higher rs_COP47
3410+
}
3411+
if ((rc1 || iTry==nTry) && !rs_isAuszH)
3412+
rc |= err("RSYS '%s': No reasonable value found for rsCOP17 and/or rsCOP47."
3413+
"\n Check rsHSPF and other heating inputs.", name);
34113414
}
34123415
}
34133416

@@ -3418,9 +3421,10 @@ RC RSYS::rs_SetupASHP() // set ASHP defaults and derived parameters
34183421
rs_CalcInputsAndSlopesASHP();
34193422

34203423
#if 1 && defined( _DEBUG)
3424+
// back-calc checks
34213425
float COP;
3422-
float capHt = rs_PerfASHP(0, 47.f, COP, 0.f);
3423-
capHt = rs_PerfASHP(0, 17.f, COP, 0.f);
3426+
float capHt = rs_PerfASHP(0, 47.f, COP);
3427+
capHt = rs_PerfASHP(0, 17.f, COP);
34243428
#endif
34253429

34263430
return rc;
@@ -3450,6 +3454,29 @@ x float capRat = 0.6280951f;
34503454
return capRat;
34513455
} // RSYS::rs_Cap17RatioASHP
34523456
//-----------------------------------------------------------------------------
3457+
float RSYS::rs_Cap35Default( // default 35 F heating capacity
3458+
float cap47, // 47 F heating capacity, any power units
3459+
float cap17) const // 17 F heating capacity
3460+
// returns 35 F heating capacity, consistent units
3461+
{
3462+
float cap35 = cap17 + 0.6f * (cap47 - cap17);
3463+
if (rs_HasDefrost())
3464+
cap35 *= 0.9f; // capacity reduction for defrost
3465+
return cap35;
3466+
} // RSYS::rs_Cap35Default
3467+
//-----------------------------------------------------------------------------
3468+
float RSYS::rs_Inp35Default( // default 35 F input power
3469+
float inp47, // 47 F input power, any power units
3470+
float inp17) const // 17 F input power
3471+
// returns 35 F input power, consistent units
3472+
{
3473+
float inp35 = inp17 + 0.6f * (inp47 - inp17);
3474+
if (rs_HasDefrost())
3475+
inp35 *= 0.985f; // defrost power reduction
3476+
return inp35;
3477+
} // RSYS::rs_Inp35Default
3478+
//-----------------------------------------------------------------------------
3479+
#if 0
34533480
float RSYS::rs_RunFAdjustedEffHtASHP()
34543481
{
34553482
float effHt;
@@ -3467,6 +3494,7 @@ float RSYS::rs_RunFAdjustedEffHtASHP()
34673494
}
34683495
return effHt;
34693496
} // RSYS::rs_RunFAdjustedEffHtASHP
3497+
#endif
34703498
//-----------------------------------------------------------------------------
34713499
RC RSYS::rs_CalcInputsAndSlopesASHP()
34723500
// uses: rs_cap/COP 47/17
@@ -3476,9 +3504,7 @@ RC RSYS::rs_CalcInputsAndSlopesASHP()
34763504
rs_inp17 = rs_cap17 / max( rs_COP17, .1f);
34773505

34783506
if (!IsSet( RSYS_COP35))
3479-
{ rs_inp35 = rs_inp17 + 0.6f * (rs_inp47 - rs_inp17);
3480-
if (rs_HasDefrost())
3481-
rs_inp35 *= 0.985f; // defrost power reduction
3507+
{ rs_inp35 = rs_Inp35Default( rs_inp47, rs_inp17);
34823508
rs_COP35 = rs_cap35 / max( rs_inp35, .1f);
34833509
}
34843510
else
@@ -3492,21 +3518,31 @@ RC RSYS::rs_CalcInputsAndSlopesASHP()
34923518

34933519
// similar setup for variable capacity (ASHPVC)
34943520
// unused if not ASHPVC
3495-
if (rs_runFMin < 1.f)
3496-
{ if (!IsSet(RSYS_COPMIN47))
3521+
if (rs_IsASHPVC())
3522+
{ // min spd capacities
3523+
float capMin47 = rs_CapMin47();
3524+
float capMin17 = rs_CapMin17();
3525+
float capMin35 = rs_Cap35Default(capMin47, capMin17);
3526+
3527+
// min spd COP and input
3528+
if (!IsSet(RSYS_COPMIN47))
34973529
rs_COPMin47 = rs_COP47;
3498-
if (!IsSet(RSYS_COPMIN35))
3499-
rs_COPMin35 = rs_COP35;
35003530
if (!IsSet(RSYS_COPMIN17))
35013531
rs_COPMin17 = rs_COP17;
35023532

3503-
float inpMin47 = rs_cap47 * rs_runFMin / max(rs_COPMin47, .1f);
3504-
float inpMin35 = rs_cap35 * rs_runFMin / max(rs_COPMin35, .1f);
3505-
float inpMin17 = rs_cap17 * rs_runFMin / max(rs_COPMin17, .1f);
3533+
float inpMin47 = capMin47 / max(rs_COPMin47, .1f);
3534+
float inpMin17 = capMin17 / max(rs_COPMin17, .1f);
3535+
3536+
float inpMin35;
3537+
if (!IsSet(RSYS_COPMIN35))
3538+
{ inpMin35 = rs_Inp35Default(inpMin47, inpMin17);
3539+
rs_COPMin35 = capMin35 / max(inpMin35, .1f);
3540+
}
3541+
else
3542+
inpMin35 = capMin35 / max(rs_COPMin35, .1f);
35063543

35073544
rs_ASHPInpMinF[0] = (inpMin47 - inpMin17) / (47.f - 17.f);
3508-
rs_ASHPInpMinF[1] = (inpMin35 - inpMin17) / (35.f - 17.f);
3509-
3545+
rs_ASHPInpMinF[1] = (inpMin35 - inpMin17) / (35.f - 17.f);
35103546
}
35113547

35123548
return RCOK;
@@ -3874,7 +3910,7 @@ int RSYS::rs_IsModeAvailable(
38743910
// set mode-specific air flow
38753911
rs_amf = rsMode == rsmHEAT ? rs_amfH
38763912
: rsMode == rsmCOOL ? rs_amfC
3877-
: rsMode == rsmOAV ? rs_amfOAV
3913+
: rsMode == rsmOAV ? rs_amfOAV
38783914
: 0.;
38793915
if (rs_amf < .0001)
38803916
ret = -1; // no air available
@@ -3999,8 +4035,7 @@ int RSYS::rs_SupplyAirState( // current conditioning capabilities
39994035
else if (rs_mode == rsmHEAT)
40004036
{ rs_asOut = rs_asIn; // init to entering state
40014037
if (auszMode == rsmHEAT && Top.tp_pass1A)
4002-
{
4003-
// autosize warmup: assume fixed temp rise
4038+
{ // autosize warmup: assume fixed temp rise
40044039
rs_asOut.as_tdb = rs_asRet.as_tdb + rs_tdDesH;
40054040
rs_effHt = 1.; // need nz value, else ASHP assumes compressor off
40064041
}
@@ -4395,13 +4430,13 @@ RC RSYS::rs_FinalizeSh()
43954430
rs_PLF = 1.f - rs_CdH * (1.f - runFx);
43964431
rs_COPHtAdj = rs_inpHtMin <= 0.f
43974432
? 2.5f // rs_inpHtMin can be 0 during autosize
4398-
: rs_capHtMin * rs_PLF / rs_inpHtMin;
4433+
: rs_FEffH * rs_capHtMin * rs_PLF / rs_inpHtMin;
43994434
rs_inPrimary = rs_capHtMin / rs_COPHtAdj;
44004435
}
44014436
else
44024437
{ // variable capacity: intermediate speed
44034438
float runFx = (rs_runF - rs_runFMin) / (1.f - rs_runFMin);
4404-
rs_inPrimary = rs_inpHt * runFx + rs_inpHtMin * (1.f - runFx);
4439+
rs_inPrimary = (rs_inpHt * runFx + rs_inpHtMin * (1.f - runFx)) / rs_FEffH;
44054440
rs_COPHtAdj = rs_inPrimary <= 0.f
44064441
? 2.5f // rs_inPrimary can be 0 during autosize
44074442
: rs_outSen / rs_inPrimary;

src/CNRECS.DEF

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3089,7 +3089,7 @@ RECORD RSYS "RSYS" *RAT // residential HVAC system
30893089
*declare "RC rs_PerfMapAC();"
30903090
*declare "RC rs_PerfDataASHP();"
30913091
*declare "void rs_PerfDataASHP1( FILE* f, float tDbOut);"
3092-
*declare "float rs_PerfASHP( int ashpModel, float tDbOut, float& COP, float fanHAdj);"
3092+
*declare "float rs_PerfASHP( int ashpModel, float tDbOut, float& COP, float fanHAdj=0.f);"
30933093
*declare "float rs_PerfASHP2( int ashpModel, float tDbOut, float fanHAdj, float& capHt, float& inpHt, float& capDfHt, float& capHtMin, float& inpHtMin, float& capDfHtMin, float COPAdjF=1.f);"
30943094
*declare "int rs_IsASHP() const { return rs_type == C_RSYSTYCH_ASHP || rs_type == C_RSYSTYCH_ASHPPKGRM || rs_IsASHPHydronic() || rs_IsASHPVC(); }"
30953095
*declare "int rs_IsASHPHydronic() const { return rs_type == C_RSYSTYCH_ASHPHYD; }"
@@ -3112,6 +3112,8 @@ RECORD RSYS "RSYS" *RAT // residential HVAC system
31123112
*declare "static float rs_DHR( float capHt);"
31133113
*declare "RC rs_SetupASHP();"
31143114
*declare "float rs_Cap17RatioASHP() const;"
3115+
*declare "float rs_Cap35Default( float cap47, float cap17) const;"
3116+
*declare "float rs_Inp35Default( float inp47, float inp17) const;"
31153117
*declare "RC rs_CalcInputsAndSlopesASHP();"
31163118
*declare "void rs_AuszFinalASHP();"
31173119
*declare "float rs_CapEffASHP( float tdbout=-999.f, int ashpModel=0, float fanHRtd=-1.f, float fanHOpr=-1.f, float COPAdjF=-1.f);"
@@ -3216,6 +3218,8 @@ RECORD RSYS "RSYS" *RAT // residential HVAC system
32163218
// re ASHPVC (variable capacity)
32173219
*f *e FRAC_GZ rs_runFMin; // minimum run fraction fraction
32183220
// (cycles below this)
3221+
*declare "float rs_CapMin47() const { return rs_cap47*rs_runFMin; }"
3222+
*declare "float rs_CapMin17() const { return rs_cap17*rs_runFMin; }"
32193223
*f *e FLOAT_GZ rs_COPMin47 // COP at ODB=47 F, min speed
32203224
*f *e FLOAT_GZ rs_COPMin35 // ditto 35 F
32213225
*f *e FLOAT_GZ rs_COPMin17 // ditto 17 F
@@ -3303,7 +3307,9 @@ RECORD RSYS "RSYS" *RAT // residential HVAC system
33033307
*s *e FLOAT rs_SHR; // cooling sensible heat ratio (derived using coil model)
33043308

33053309
*f FRAC rs_fChg // refrigerant charge factor (default 1, 0.9 or 0.96 for CA compliance)
3310+
// multiplies cooling capacity (no effect on heating)
33063311
*f FRAC rs_fSize // compressor sizing factor (default 1, 0.95 or 1 for CA compliance)
3312+
// multiples cooling capacity (no effect on heating)
33073313
*f FLOAT rs_fanHRtdC // fan heat included in rated rs_cap95, Btuh
33083314
*f FLOAT rs_capnfX; // constant for rs_capCt calc
33093315
*f FLOAT rs_capAdjF;

0 commit comments

Comments
 (0)