-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Space Sizing and HVAC Part 3 #10205
Space Sizing and HVAC Part 3 #10205
Changes from all commits
208abe7
dbc3788
c5c95f3
dd5e82b
d3b014b
7d80e78
9cb97fc
dc204b9
2d87d47
6f45e07
ce03c1b
1e922e0
c653a79
c5cb1de
055112f
4c20979
b5b90cc
7e58b2e
a7da5f0
6038695
1a65499
313ebc6
cde8ee5
6c25a00
8a88ca4
52d936e
83a1093
261354f
c7b5d57
9a30402
685faeb
190833a
6c4e433
bf96c6b
d1bdc21
6ed3628
3a596f0
650ec35
77fb542
c04c63c
ee658e2
2f24479
110349b
ce75bbd
6708113
36b76ca
c012e8c
3af26a9
06941cf
60fa04e
fd0a91f
96076f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,6 +280,7 @@ void InitIntConvCoeff(EnergyPlusData &state, | |
auto const &zone = state.dataHeatBal->Zone(ZoneNum); | ||
for (int spaceNum : zone.spaceIndexes) { | ||
auto const &thisSpace = state.dataHeatBal->space(spaceNum); | ||
Real64 spaceMAT = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; | ||
for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) { | ||
|
||
if (present(ZoneToResimulate)) { | ||
|
@@ -309,20 +310,17 @@ void InitIntConvCoeff(EnergyPlusData &state, | |
} break; | ||
|
||
case HcInt::ASHRAESimple: { | ||
CalcASHRAESimpleIntConvCoeff( | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT); | ||
CalcASHRAESimpleIntConvCoeff(state, SurfNum, SurfaceTemperatures(SurfNum), spaceMAT); | ||
// Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems) | ||
if (state.dataHeatBalSurf->SurfHConvInt(SurfNum) < state.dataHeatBal->LowHConvLimit) | ||
state.dataHeatBalSurf->SurfHConvInt(SurfNum) = state.dataHeatBal->LowHConvLimit; | ||
} break; | ||
|
||
case HcInt::ASHRAETARP: { | ||
if (!state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow) { | ||
CalcASHRAEDetailedIntConvCoeff( | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT); | ||
CalcASHRAEDetailedIntConvCoeff(state, SurfNum, SurfaceTemperatures(SurfNum), spaceMAT); | ||
} else { | ||
CalcISO15099WindowIntConvCoeff( | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT); | ||
CalcISO15099WindowIntConvCoeff(state, SurfNum, SurfaceTemperatures(SurfNum), spaceMAT); | ||
} | ||
|
||
// Establish some lower limit to avoid a zero convection coefficient (and potential divide by zero problems) | ||
|
@@ -340,8 +338,7 @@ void InitIntConvCoeff(EnergyPlusData &state, | |
} break; | ||
|
||
case HcInt::ASTMC1340: { | ||
CalcASTMC1340ConvCoeff( | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT); | ||
CalcASTMC1340ConvCoeff(state, SurfNum, SurfaceTemperatures(SurfNum), spaceMAT); | ||
} break; | ||
|
||
default: { | ||
|
@@ -2256,10 +2253,10 @@ void CalcCeilingDiffuserInletCorr(EnergyPlusData &state, | |
if (ACH <= 3.0) { // Use the other convection algorithm | ||
if (!state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).TypeIsWindow) { | ||
CalcASHRAEDetailedIntConvCoeff( | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT); | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT); | ||
} else { | ||
CalcISO15099WindowIntConvCoeff( | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT); | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT); | ||
} | ||
} else { // Use forced convection correlations | ||
Real64 Tilt = state.dataSurface->Surface(SurfNum).Tilt; | ||
|
@@ -2391,7 +2388,7 @@ void CalcTrombeWallIntConvCoeff(EnergyPlusData &state, | |
auto const &surface = state.dataSurface->Surface(SurfNum); | ||
// Use ASHRAESimple correlation to give values for all the minor surfaces | ||
CalcASHRAESimpleIntConvCoeff( | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT); | ||
state, SurfNum, SurfaceTemperatures(SurfNum), state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT); | ||
|
||
// assign the convection coefficent to the major surfaces and any subsurfaces on them | ||
if ((surface.BaseSurf == Surf1) || (surface.BaseSurf == Surf2)) { | ||
|
@@ -2726,7 +2723,7 @@ void CalcISO15099WindowIntConvCoeff(EnergyPlusData &state, | |
|
||
// Get humidity ratio | ||
Real64 AirHumRat = | ||
(surface.Zone > 0) ? state.dataZoneTempPredictorCorrector->zoneHeatBalance(surface.Zone).airHumRatAvg : state.dataEnvrn->OutHumRat; | ||
(surface.spaceNum > 0) ? state.dataZoneTempPredictorCorrector->spaceHeatBalance(surface.spaceNum).airHumRatAvg : state.dataEnvrn->OutHumRat; | ||
|
||
Real64 Height = surface.Height; | ||
Real64 TiltDeg = surface.Tilt; | ||
|
@@ -3152,8 +3149,9 @@ Real64 EvaluateIntHcModels(EnergyPlusData &state, int const SurfNum, HcInt const | |
auto const &surfIntConv = state.dataSurface->surfIntConv(SurfNum); | ||
|
||
int const ZoneNum = thisSurface.Zone; | ||
int const spaceNum = thisSurface.spaceNum; | ||
Real64 const Tsurface = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum); | ||
Real64 const Tzone = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MAT; | ||
Real64 const Tzone = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, got the zone temp from the space structure now...is that just a renamed struct or a different struct entirely? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Different struct entirely. |
||
|
||
auto &HnFn = state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in; | ||
// now call appropriate function to calculate Hc | ||
|
@@ -3977,6 +3975,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu | |
|
||
auto &surface = state.dataSurface->Surface(SurfNum); | ||
int zoneNum = surface.Zone; | ||
int spaceNum = surface.spaceNum; | ||
auto &zone = state.dataHeatBal->Zone(zoneNum); | ||
|
||
EquipOnCount = 0; | ||
|
@@ -4068,7 +4067,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu | |
if (surface.Class != SurfaceClass::Floor) continue; | ||
|
||
Real64 DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) - | ||
state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).MAT; | ||
state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; | ||
if (DeltaTemp > ActiveDelTempThreshold) { // assume heating with floor | ||
// system ON is not enough because floor surfaces can continue to heat because of thermal capacity | ||
EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx); | ||
|
@@ -4091,7 +4090,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu | |
if (surface.Class != SurfaceClass::Roof) continue; | ||
|
||
Real64 DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) - | ||
state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).MAT; | ||
state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; | ||
if (DeltaTemp < ActiveDelTempThreshold) { // assume cooling with ceiling | ||
// system ON is not enough because surfaces can continue to cool because of thermal capacity | ||
EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx); | ||
|
@@ -4114,7 +4113,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu | |
if (surface.Class != SurfaceClass::Wall && surface.Class != SurfaceClass::Door) continue; | ||
|
||
DeltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfLoop) - | ||
state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).MAT; | ||
state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; | ||
if (DeltaTemp > ActiveDelTempThreshold) { // assume heating with wall panel | ||
// system ON is not enough because surfaces can continue to heat because of thermal capacity | ||
EquipOnCount = min(EquipOnCount + 1, MaxZoneEquipmentIdx); | ||
|
@@ -4321,7 +4320,7 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu | |
// now finish out specific model eq for this surface | ||
|
||
int iDeltaTemp = | ||
DeltaTempLambda(state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum), state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).MAT); | ||
DeltaTempLambda(state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum), state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT); | ||
int iConvOrient = int(surface.convOrientation); | ||
|
||
auto &surfIntConv = state.dataSurface->surfIntConv(SurfNum); | ||
|
@@ -4499,7 +4498,8 @@ void DynamicIntConvSurfaceClassification(EnergyPlusData &state, int const SurfNu | |
} break; // D | ||
|
||
case InConvFlowRegime::E: { | ||
Real64 deltaTemp = state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum) - state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).MAT; | ||
Real64 deltaTemp = | ||
state.dataHeatBalSurf->SurfInsideTempHist(1)(SurfNum) - state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; | ||
|
||
switch (surface.Class) { | ||
case SurfaceClass::Wall: | ||
|
@@ -4657,6 +4657,7 @@ Real64 CalcUserDefinedIntHcModel(EnergyPlusData &state, int const SurfNum, int c | |
|
||
auto const &surface = state.dataSurface->Surface(SurfNum); | ||
int zoneNum = state.dataSurface->Surface(SurfNum).Zone; | ||
int spaceNum = state.dataSurface->Surface(SurfNum).spaceNum; | ||
auto const &zone = state.dataHeatBal->Zone(zoneNum); | ||
|
||
Real64 SumMdotTemp = 0.0; | ||
|
@@ -4692,7 +4693,7 @@ Real64 CalcUserDefinedIntHcModel(EnergyPlusData &state, int const SurfNum, int c | |
|
||
switch (userCurve.refTempType) { | ||
case RefTemp::MeanAirTemp: | ||
tmpAirTemp = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum).MAT; | ||
tmpAirTemp = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).MAT; | ||
state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::ZoneMeanAirTemp; | ||
break; | ||
case RefTemp::AdjacentAirTemp: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1325,40 +1325,8 @@ namespace DataHeatBalance { | |
|
||
struct SpaceZoneSimData // Calculated data by Space or Zone during each time step/hour | ||
{ | ||
// Members | ||
Real64 NOFOCC = 0.0; // Number of Occupants | ||
Real64 QOCTOT = 0.0; // Total Energy from Occupants | ||
Real64 QOCSEN = 0.0; // Sensible Energy from Occupants | ||
Real64 QOCCON = 0.0; // ENERGY CONVECTED FROM OCCUPANTS (WH) | ||
Real64 QOCRAD = 0.0; // ENERGY RADIATED FROM OCCUPANTS | ||
Real64 QOCLAT = 0.0; // LATENT ENERGY FROM OCCUPANTS | ||
Real64 QLTTOT = 0.0; // TOTAL ENERGY INTO LIGHTS (WH) | ||
Real64 QLTCON = 0.0; // ENERGY CONVECTED TO SPACE AIR FROM LIGHTS | ||
Real64 QLTRAD = 0.0; // ENERGY RADIATED TO SPACE FROM LIGHTS | ||
Real64 QLTCRA = 0.0; // ENERGY CONVECTED TO RETURN AIR FROM LIGHTS | ||
Real64 QLTSW = 0.0; // VISIBLE ENERGY FROM LIGHTS | ||
Real64 QEECON = 0.0; // ENERGY CONVECTED FROM ELECTRIC EQUIPMENT | ||
Real64 QEERAD = 0.0; // ENERGY RADIATED FROM ELECTRIC EQUIPMENT | ||
Real64 QEELost = 0.0; // Energy from Electric Equipment (lost) | ||
Real64 QEELAT = 0.0; // LATENT ENERGY FROM Electric Equipment | ||
Real64 QGECON = 0.0; // ENERGY CONVECTED FROM GAS EQUIPMENT | ||
Real64 QGERAD = 0.0; // ENERGY RADIATED FROM GAS EQUIPMENT | ||
Real64 QGELost = 0.0; // Energy from Gas Equipment (lost) | ||
Real64 QGELAT = 0.0; // LATENT ENERGY FROM Gas Equipment | ||
Real64 QOECON = 0.0; // ENERGY CONVECTED FROM OTHER EQUIPMENT | ||
Real64 QOERAD = 0.0; // ENERGY RADIATED FROM OTHER EQUIPMENT | ||
Real64 QOELost = 0.0; // Energy from Other Equipment (lost) | ||
Real64 QOELAT = 0.0; // LATENT ENERGY FROM Other Equipment | ||
Real64 QHWCON = 0.0; // ENERGY CONVECTED FROM Hot Water EQUIPMENT | ||
Real64 QHWRAD = 0.0; // ENERGY RADIATED FROM Hot Water EQUIPMENT | ||
Real64 QHWLost = 0.0; // Energy from Hot Water Equipment (lost) | ||
Real64 QHWLAT = 0.0; // LATENT ENERGY FROM Hot Water Equipment | ||
Real64 QSECON = 0.0; // ENERGY CONVECTED FROM Steam EQUIPMENT | ||
Real64 QSERAD = 0.0; // ENERGY RADIATED FROM Steam EQUIPMENT | ||
Real64 QSELost = 0.0; // Energy from Steam Equipment (lost) | ||
Real64 QSELAT = 0.0; // LATENT ENERGY FROM Steam Equipment | ||
Real64 QBBCON = 0.0; // ENERGY CONVECTED FROM BASEBOARD HEATING | ||
Real64 QBBRAD = 0.0; // ENERGY RADIATED FROM BASEBOARD HEATING | ||
Real64 NOFOCC = 0.0; // Number of Occupants | ||
Real64 QLTSW = 0.0; // VISIBLE ENERGY FROM LIGHTS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👀 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, so, none of these deleted variables were actually being used in the heat balance. I suspect they once were before the more general internal heat gains functions were added. |
||
}; | ||
|
||
struct SpaceIntGainDeviceData | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,10 +226,10 @@ Real64 SurfaceData::getInsideAirTemperature(EnergyPlusData &state, const int t_S | |
Real64 RefAirTemp = 0; | ||
|
||
// determine reference air temperature for this surface | ||
auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(this->Zone); | ||
auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(this->spaceNum); | ||
switch (state.dataSurface->SurfTAirRef(t_SurfNum)) { | ||
case RefAirTemp::ZoneMeanAirTemp: { | ||
RefAirTemp = thisZoneHB.MAT; | ||
RefAirTemp = thisSpaceHB.MAT; | ||
} break; | ||
case RefAirTemp::AdjacentAirTemp: { | ||
RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(t_SurfNum); | ||
|
@@ -248,24 +248,25 @@ Real64 SurfaceData::getInsideAirTemperature(EnergyPlusData &state, const int t_S | |
// determine supply air conditions | ||
Real64 SumSysMCp = 0; | ||
Real64 SumSysMCpT = 0; | ||
for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(Zone).NumInletNodes; ++NodeNum) { | ||
Real64 NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode(NodeNum)).Temp; | ||
Real64 MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode(NodeNum)).MassFlowRate; | ||
Real64 CpAir = PsyCpAirFnW(thisZoneHB.airHumRat); | ||
SumSysMCp += MassFlowRate * CpAir; | ||
SumSysMCpT += MassFlowRate * CpAir * NodeTemp; | ||
auto &inletNodes = (state.dataHeatBal->doSpaceHeatBalance) ? state.dataZoneEquip->spaceEquipConfig(this->spaceNum).InletNode | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see! I guess the ternary could be slightly more readable if you had a reference like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used this form because a normal if block restricts the scope of the reference. Is there a better way to do this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just mean before:
after:
No functional change, the ternary is just quite long and looks a little funny with the dangling indentation on the second line. Feel free to ignore this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, there is a unit test that covers this, and it blew up with the suggested change, because |
||
: state.dataZoneEquip->ZoneEquipConfig(Zone).InletNode; | ||
for (int nodeNum : inletNodes) { | ||
auto &inNode = state.dataLoopNodes->Node(nodeNum); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh dear, yeah, I missed that entirely. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the unit test that covers this, there just happens to be 4 inlet nodes, and the node numbers are 1-4, so it worked. I'll try to remember to improve that unit test (all of the inlet node conditions are the same currently, so it could be a better test). |
||
Real64 CpAir = PsyCpAirFnW(thisSpaceHB.airHumRat); | ||
SumSysMCp += inNode.MassFlowRate * CpAir; | ||
SumSysMCpT += inNode.MassFlowRate * CpAir * inNode.Temp; | ||
} | ||
// a weighted average of the inlet temperatures. | ||
if (SumSysMCp > 0.0) { | ||
// a weighted average of the inlet temperatures. | ||
RefAirTemp = SumSysMCpT / SumSysMCp; | ||
} else { | ||
RefAirTemp = thisZoneHB.MAT; | ||
RefAirTemp = thisSpaceHB.MAT; | ||
} | ||
} break; | ||
default: { | ||
// currently set to mean air temp but should add error warning here | ||
RefAirTemp = thisZoneHB.MAT; | ||
RefAirTemp = thisSpaceHB.MAT; | ||
} break; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small change to make this a bit more readable. It's not a functional change, is it? I can't tell from here if that argument is marked INTENT(INOUT) -- I mean as a reference :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Key thing here is changing from zone MAT to space MAT.