Skip to content

Commit b79cf38

Browse files
authored
Merge pull request #111 from cse-sim/reportinfil
IZ flow accounting bug fix
2 parents 04178d2 + 0be9341 commit b79cf38

File tree

3 files changed

+46
-30
lines changed

3 files changed

+46
-30
lines changed

src/CGCOMP.CPP

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ RC IZXRAT::iz_CkfIZXFER() // input checks
877877
}
878878

879879
if (!iz_CanHaveAFCat())
880-
ignore(IZXRAT_AFCAT, when);
880+
ignore(IZXRAT_AFCATI, when);
881881

882882
// horizontal opening
883883
// stairangle defaults
@@ -1048,16 +1048,13 @@ x }
10481048
//-------------------------------------------------------------------
10491049
void IZXRAT::iz_SetupAfMtrs()
10501050
{
1051-
// Air flow category
1052-
if (!iz_CanHaveAFCat())
1053-
iz_afCat = C_AFCAT_NONE;
1054-
else if (!IsSet(IZXRAT_AFCAT))
1055-
iz_afCat = iz_AfCatDefault(); // default category (may return -1)
1051+
// Air flow categories (set iz_afMtrCat1 and iz_afMtrCat2)
1052+
iz_AfMtrCats();
10561053

10571054
// AFMTR ptrs: NULL if no meter specified -> no air flow accounting
10581055
// one pointer for positive flows, one for negative
10591056
iz_pAfMtr1 = iz_pAfMtr2 = NULL; // insurance
1060-
if (iz_afCat != C_AFCAT_NONE)
1057+
if (iz_afMtrCat1 != C_AFCAT_NONE)
10611058
{ // set up ptrs to AFMTR(s)
10621059
const ZNR* zp;
10631060
if (iz_zi1 > 0)
@@ -1081,41 +1078,56 @@ void IZXRAT::iz_SetupAfMtrs()
10811078

10821079
} // IZXRAT::iz_SetupAfMtrs
10831080
//-----------------------------------------------------------------------------
1084-
BOOL IZXRAT::iz_IsIZUZ() const // true iff interzone connected to unconditioned
1081+
int IZXRAT::iz_IsCZ( // detect conditioned / unconditioned adjacent zones
1082+
int iZn) const // 1: check inside zone, else checkout outside
1083+
// returns -1 (does not exist), 0=unconditioned, 1=conditioned
10851084
{
1086-
const ZNR* zp = ZrB.GetAtSafe(iz_zi2);
1087-
return zp && zp->zn_IsUZ();
1085+
int zi = iZn==1 ? iz_zi1 : iz_zi2;
1086+
const ZNR* zp = ZrB.GetAtSafe( zi);
1087+
return !zp ? -1 : !zp->zn_IsUZ();
10881088

1089-
} // IZXRAT::iz_IsIZUZ
1089+
} // IZXRAT::iz_IsCZ
10901090
//-----------------------------------------------------------------------------
1091-
AFCAT IZXRAT::iz_AfCatDefault() const
1091+
void IZXRAT::iz_AfMtrCats() // finalize runtime air flow categories
1092+
// Tricky: interzone flow UZ/CZ categories differ depending on side of vent
10921093
{
1093-
AFCAT afCat;
1094+
iz_afMtrCat1 = iz_afMtrCat2 = -1; // flag as unset
10941095
if (!iz_CanHaveAFCat())
1095-
afCat = C_AFCAT_NONE; // not trackable
1096+
iz_afMtrCat1 = C_AFCAT_NONE; // not trackable
1097+
else if (IsSet(IZXRAT_AFCATI))
1098+
iz_afMtrCat1 = iz_afCatI; // use user input (not checked for consistency with IZXRAT type)
10961099
else if (iz_IsSysAir())
1097-
afCat = C_AFCAT_HVAC;
1100+
iz_afMtrCat1 = C_AFCAT_HVAC;
10981101
else if (iz_IsDuctLk())
1099-
afCat = C_AFCAT_DUCTLK;
1102+
iz_afMtrCat1 = C_AFCAT_DUCTLK;
11001103
else if (iz_IsHERV())
1101-
afCat = C_AFCAT_FANEX;
1104+
iz_afMtrCat1 = C_AFCAT_FANEX;
11021105
else
11031106
{ const static int afCats[3][3] =
1104-
{ { C_AFCAT_FANEX, C_AFCAT_VNTEX, C_AFCAT_INFEX },
1107+
{ { C_AFCAT_FANEX, C_AFCAT_VNTEX, C_AFCAT_INFEX },
11051108
{ C_AFCAT_FANUZ, C_AFCAT_VNTUZ, C_AFCAT_INFUZ },
11061109
{ C_AFCAT_FANCZ, C_AFCAT_VNTCZ, C_AFCAT_INFCZ }
11071110
};
1111+
11081112
// fan / vent / infil
11091113
// Note: vent guess is approx, explicit izAFCat input may be necessary
11101114
int izMode = iz_IsFixedFlow() ? 0 : iz_MightBeNatVent() ? 1 : 2;
1111-
// exterior / uncond zone / cond zone
1112-
int izLoc = iz_IsExterior() ? 0 : iz_IsIZUZ() ? 1 : 2;
1113-
afCat = afCats[izLoc][izMode];
1115+
if (iz_IsExterior())
1116+
iz_afMtrCat1 = afCats[0][izMode];
1117+
else
1118+
{ // interzone: set category per *other* side
1119+
// iz_IsCZ() returns -1 (no zone, not expected), 0 (uncond), 1 (cond)
1120+
int iCZ1 = iz_IsCZ(1); // inside
1121+
int iCZ2 = iz_IsCZ(2); // outside
1122+
iz_afMtrCat1 = afCats[iCZ2 + 1][izMode];
1123+
iz_afMtrCat2 = afCats[iCZ1 + 1][izMode];
1124+
}
11141125
}
11151126

1116-
return afCat;
1127+
if (iz_afMtrCat2 < 0)
1128+
iz_afMtrCat2 = iz_afMtrCat1;
11171129

1118-
} // IZXRAT::iz_AfcatDefault
1130+
} // IZXRAT::iz_AfMtrCats
11191131
//-----------------------------------------------------------------------------
11201132
RC IZXRAT::iz_SetupNonAirNet() // interzone transfer one-time initialization
11211133

@@ -1565,12 +1577,12 @@ RC IZXRAT::iz_EndSubhr() // end-of-subhour vent calcs
15651577
+= (1.f - fVent)*iz_ad[0].ad_mdotB + fVent * iz_ad[1].ad_mdotB;
15661578
if (iz_doingAfMtr && iz_amfNom != 0.f)
15671579
{ if (iz_pAfMtr1)
1568-
iz_pAfMtr1->amt_AccumCat(iz_afCat, iz_amfNom);
1580+
iz_pAfMtr1->amt_AccumCat(iz_afMtrCat1, iz_amfNom);
15691581
if (iz_pAfMtr2)
15701582
{ // flow is opposite direction from z2 POV
15711583
// HERV: iz_pAfMtr2 points to exhaust source zone (may be z1)
15721584
// HERV same for vent / no vent (use iz_ad[ 0] w/o fVent)
1573-
iz_pAfMtr2->amt_AccumCat(iz_afCat,
1585+
iz_pAfMtr2->amt_AccumCat(iz_afMtrCat2,
15741586
iz_IsHERV() ? -iz_ad[0].ad_mdotX : -iz_amfNom);
15751587
}
15761588
}

src/CNCULT.CPP

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ CULT( "izZn1", DAT, IZXRAT_ZI1, RQD, 0, VEOI, TYREF, &ZiB, 0.f,
15331533
CULT( "izZn2", DAT, IZXRAT_ZI2, 0, 0, VEOI, TYREF, &ZiB, 0.f, N, N),
15341534
CULT( "izHConst", DAT, IZXRAT_UA, 0, 0, VHRLY, TYFL, 0, 0.f, N, N),
15351535
CULT( "izNVType", DAT, IZXRAT_NVCNTRL,0, 0, VEOI, TYCH, 0, C_IZNVTYCH_NONE, N, N),
1536-
CULT( "izAFCat", DAT, IZXRAT_AFCAT, 0, 0, VEOI, TYCH, 0, 0, N, N),
1536+
CULT( "izAFCat", DAT, IZXRAT_AFCATI, 0, 0, VEOI, TYCH, 0, 0, N, N),
15371537
CULT( "izALo", DAT, IZXRAT_A1, 0, 0, VHRLY, TYFL, 0, 0.f, N, N),
15381538
CULT( "izAHi", DAT, IZXRAT_A2, 0, 0, VHRLY, TYFL, 0, 0.f, N, N),
15391539
CULT( "izL1", DAT, IZXRAT_L1, 0, 0, VEOI, TYFL, 0, 0.f, N, N),

src/CNRECS.DEF

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2771,7 +2771,7 @@ RECORD IZXRAT "izXfer" *RAT // interzone heat transfers: conductive and/or vent.
27712771
*declare "RC iz_CkfIZXFER();"
27722772
*declare "void iz_ClearResults( int iV);"
27732773
*declare "RC iz_Setup( IZXRAT* izie);"
2774-
*declare "AFCAT iz_AfCatDefault() const;"
2774+
*declare "void iz_AfMtrCats();"
27752775
*declare "void iz_SetupAfMtrs();"
27762776
*declare "RC iz_SetupNonAirNet();"
27772777
*declare "bool iz_HasVentEffect() const;"
@@ -2794,7 +2794,7 @@ RECORD IZXRAT "izXfer" *RAT // interzone heat transfers: conductive and/or vent.
27942794
*declare "BOOL iz_IsAirNetIZ() const { return iz_nvcntrl == C_IZNVTYCH_ANIZ || iz_nvcntrl == C_IZNVTYCH_ANIZFAN || iz_nvcntrl == C_IZNVTYCH_ANIZFLOW || iz_nvcntrl == C_IZNVTYCH_ANHORIZ || iz_IsHERVIZ(); }"
27952795
*declare "BOOL iz_IsHERV() const { return iz_nvcntrl == C_IZNVTYCH_ANHERV; }"
27962796
*declare "BOOL iz_IsHERVIZ() const { return iz_IsHERV() && iz_zi2 != 0 && iz_zi1 != iz_zi2; }"
2797-
*declare "BOOL iz_IsIZUZ() const;"
2797+
*declare "int iz_IsCZ( int iZn) const;"
27982798
*declare "BOOL iz_IsFan() const { return iz_nvcntrl == C_IZNVTYCH_ANIZFAN || iz_nvcntrl == C_IZNVTYCH_ANEXTFAN; }"
27992799
*declare "BOOL iz_HasFan() const { return iz_IsFan() || iz_IsHERV(); }"
28002800
*declare "BOOL iz_IsFlow() const { return iz_nvcntrl == C_IZNVTYCH_ANIZFLOW || iz_nvcntrl == C_IZNVTYCH_ANEXTFLOW; }"
@@ -2831,14 +2831,18 @@ RECORD IZXRAT "izXfer" *RAT // interzone heat transfers: conductive and/or vent.
28312831
// C_IZNVTYCH_ANSYSAIR: system air flow
28322832
// C_IZNVTYCH_ANOAVRLF: RSYS OAV relief air
28332833
// ( = interzone hole sized per flow)
2834-
*r AFCAT iz_afCat // air flow category (accounting only) C_AFCAT_xxx
2835-
// or 0 = unknown or -1 = not tracked
2834+
*r AFCAT iz_afCatI // air flow input category (accounting only) C_AFCAT_xxx
2835+
// or 0 = unknown
2836+
// resolved to iz_afMtrCat1 and iz_afMtrCat2 for runtime
28362837

28372838
// AFMTR pointers, derived from zone zn_afMtri
28382839
// NULL if not specified or same on both sides of IZ type
28392840
*declare "AFMTR* iz_pAfMtr1;" // for iz_zn1
28402841
*declare "AFMTR* iz_pAfMtr2;" // for iz_zn2
28412842
*declare "bool iz_doingAfMtr;" // true iff iz_pAfMtr1 or iz_pAfMtr2 != NULL
2843+
// runtime air flow categories re UZ/CZ distinction for IZ flow
2844+
*r SI iz_afMtrCat1 // ... for iz_pAfMtr1
2845+
*r SI iz_afMtrCat2 // ... for iz_pAfMtr2
28422846

28432847
*h AREA_GEZ iz_a1 // vent area 1, ft2
28442848
// _TWOWAY = low vent area

0 commit comments

Comments
 (0)