Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,10 @@ \subsubsection{Inputs}\label{inputs-8-023}
Three choices are allowed to select which solution algorithm will be used. The \textbf{ThirdOrderBackwardDifference} selection is the default selection and uses the third order finite difference approximation to solve the zone air energy and moisture balance equations. The \textbf{AnalyticalSolution} selection uses the integration approach to solve the zone air energy and moisture balance equations. The \textbf{EulerMethod} selection uses the first order finite backward difference approximation to solve the zone air energy and moisture balance equations.

\paragraph{Field: Do Space Heat Balance for Sizing}\label{field-do-space-heat-balance-sizing}
If yes, space-level heat balance will be calculated and reported during sizing, and space sizing results will be reported along with zone sizing results. If no, then only zone-level heat balance will be calculated. This field defaults to No. For zones with more than one space, the zone sizing results are calculated for the whole zone and represent the coincident peak for the spaces in the zone. Note that space heat balance is not supported for \hyperref[inputs-hm]{HybridModel:Zone}, \hyperref[roomairmodeltype]{RoomAirModelType} other than Mixing, \hyperref[heatbalancealgorithm]{HeatBalanceAlgorithm} MoisturePenetrationDepthConductionTransferFunction and CombinedHeatAndMoistureFiniteElement.
If yes, the space-level heat balance will be calculated and reported during sizing for spaces that are in a controlled zone (i.e. the zone has a \hyperref[zonehvacequipmentconnections]{ZoneHVAC:EquipmentConnections} object). Space sizing results will be reported along with zone sizing results. If no, then only the zone-level heat balance will be calculated. This field defaults to No. For zones with more than one space, the zone sizing results are either the coincident (default) or non-coincident peak for the spaces in the zone (see \hyperref[field-type-of-space-sum-to-use]{Sizing:Zone}). Note that space heat balance is not supported for \hyperref[inputs-hm]{HybridModel:Zone}, \hyperref[roomairmodeltype]{RoomAirModelType} other than Mixing, \hyperref[heatbalancealgorithm]{HeatBalanceAlgorithm} MoisturePenetrationDepthConductionTransferFunction and CombinedHeatAndMoistureFiniteElement.

\paragraph{Field: Do Space Heat Balance for Simulation}\label{field-do-space-heat-balance-simulation}
If yes, space-level heat balance will be calculated and reported during the simulation. If no, then only zone-level heat balance will be calculated. This field defaults to No. When this field is Yes, optional SpaceHVAC objects may be used to distribute zone HVAC equipment output to the spaces in the zone. See \hyperref[spacehvacequipmentconnections]{SpaceHVAC:EquipmentConnections}, \hyperref[spacehvaczoneequipmentsplitter]{SpaceHVAC:ZoneEquipmentSplitter}, \hyperref[spacehvaczoneequipmentmixer]{SpaceHVAC:ZoneEquipmentMixer} and \hyperref[spacehvaczonereturnmixer]{SpaceHVAC:ZoneReturnMixer}.
If yes, the space-level heat balance will be calculated and reported during the simulation. If no, then only the zone-level heat balance will be calculated. This field defaults to No. When this field is Yes, optional SpaceHVAC objects may be used to distribute zone HVAC equipment output to the spaces in the zone. See \hyperref[spacehvacequipmentconnections]{SpaceHVAC:EquipmentConnections}, \hyperref[spacehvaczoneequipmentsplitter]{SpaceHVAC:ZoneEquipmentSplitter}, \hyperref[spacehvaczoneequipmentmixer]{SpaceHVAC:ZoneEquipmentMixer} and \hyperref[spacehvaczonereturnmixer]{SpaceHVAC:ZoneReturnMixer}.

And, a default IDF example is shown below:

Expand Down
51 changes: 32 additions & 19 deletions src/EnergyPlus/DataZoneEquipment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,38 +315,40 @@ void GetZoneEquipmentData(EnergyPlusData &state)
cAlphaFields,
cNumericFields); // Get Equipment | data for one zone

int zoneOrSpaceNum = Util::FindItemInList(AlphArray(1), state.dataHeatBal->Zone);
int zoneNum = Util::FindItemInList(AlphArray(1), state.dataHeatBal->Zone);
std::string_view zsString = "Zone";

if (zoneOrSpaceNum == 0) {
if (zoneNum == 0) {
ShowSevereError(state, format("{}{}: {}=\"{}\"", RoutineName, CurrentModuleObject, cAlphaFields(1), AlphArray(1)));
ShowContinueError(state,
format("..Requested Controlled {} not among {}s, remaining items for this object not processed.", zsString, zsString));
state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true;
continue;
}
bool isControlledAlready = state.dataHeatBal->Zone(zoneOrSpaceNum).IsControlled;
if (isControlledAlready) {
auto &thisZone = state.dataHeatBal->Zone(zoneNum);
// Is this a duplicate for the same zone?
if (thisZone.IsControlled) {
ShowSevereError(state, format("{}{}: {}=\"{}\"", RoutineName, CurrentModuleObject, cAlphaFields(1), AlphArray(1)));
ShowContinueError(state,
format("..Duplicate Controlled {} entered, only one {} per {} is allowed.", zsString, CurrentModuleObject, zsString));
state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true;
continue;
}
state.dataHeatBal->Zone(zoneOrSpaceNum).IsControlled = true;
thisZone.IsControlled = true;
bool isSpace = false;
auto &thisZoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum);
processZoneEquipmentInput(state,
CurrentModuleObject,
zoneOrSpaceNum,
zoneNum,
isSpace,
locTermUnitSizingCounter,
overallEquipCount,
state.dataZoneEquip->ZoneEquipConfig(zoneOrSpaceNum),
thisZoneEquipConfig,
AlphArray,
cAlphaFields,
lAlphaBlanks,
NodeNums);
state.dataHeatBal->Zone(zoneOrSpaceNum).SystemZoneNodeNumber = state.dataZoneEquip->ZoneEquipConfig(zoneOrSpaceNum).ZoneNode;
thisZone.SystemZoneNodeNumber = thisZoneEquipConfig.ZoneNode;
} // end loop over controlled zones
for (int controlledSpaceLoop = 1; controlledSpaceLoop <= numControlledSpaces; ++controlledSpaceLoop) {
CurrentModuleObject = "SpaceHVAC:EquipmentConnections";
Expand All @@ -363,38 +365,49 @@ void GetZoneEquipmentData(EnergyPlusData &state)
cAlphaFields,
cNumericFields); // Get Equipment | data for one zone

int zoneOrSpaceNum = Util::FindItemInList(AlphArray(1), state.dataHeatBal->space);
int spaceNum = Util::FindItemInList(AlphArray(1), state.dataHeatBal->space);
std::string_view zsString = "Space";

if (zoneOrSpaceNum == 0) {
if (spaceNum == 0) {
ShowSevereError(state, format("{}{}: {}=\"{}\"", RoutineName, CurrentModuleObject, cAlphaFields(1), AlphArray(1)));
ShowContinueError(state,
format("..Requested Controlled {} not among {}s, remaining items for this object not processed.", zsString, zsString));
state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true;
continue;
}
bool isControlledAlready = state.dataHeatBal->space(zoneOrSpaceNum).IsControlled;
if (isControlledAlready) {
auto &thisSpace = state.dataHeatBal->space(spaceNum);
int zoneNum = thisSpace.zoneNum;
if (!state.dataHeatBal->Zone(zoneNum).IsControlled) {
ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisSpace.Name));
ShowContinueError(state,
format("..Zone Name={} is not a controlled zone. A ZoneHVAC:EquipmentConnections object is required for this zone.",
Copy link
Contributor Author

@mjwitte mjwitte Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a modified version of 5ZoneAirCooledWithSpacesHVAC that has only SpaceHVAC:EquipmentConnections objects for the spaces in zone 5 (remove the ZoneHVAC:EquipmentConnections object and the other types of SpaceHVAC:* objects). This file crashes with develop, and fatals with this branch:

* Severe  ** GetZoneEquipmentData: SpaceHVAC:EquipmentConnections="SPACE 5 OFFICE"
   **   ~~~   ** ..Zone Name=ZONE 5 is not a controlled zone. A ZoneHVAC:EquipmentConnections object is required for this zone.
   ** Severe  ** GetZoneEquipmentData: SpaceHVAC:EquipmentConnections="SPACE 5 CONFERENCE"
   **   ~~~   ** ..Zone Name=ZONE 5 is not a controlled zone. A ZoneHVAC:EquipmentConnections object is required for this zone.
   ** Severe  ** GetZoneEquipmentData: SpaceHVAC:EquipmentConnections="ZONE 5-REMAINDER"
   **   ~~~   ** ..Zone Name=ZONE 5 is not a controlled zone. A ZoneHVAC:EquipmentConnections object is required for this zone.
   ** Warning ** GetZoneEquipmentData: SpaceHVAC:EquipmentConnections, duplicate items NOT CHECKED due to previous errors.
   **  Fatal  ** GetZoneEquipmentData: Errors found in getting Zone Equipment input.

5ZoneAirCooledWithSpacesHVAC-TestAZoneNotControlled2.idf.txt

state.dataHeatBal->Zone(zoneNum).Name));
state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true;
continue;
}
// Is this a duplicate for the same space?
if (thisSpace.IsControlled) {
ShowSevereError(state, format("{}{}: {}=\"{}\"", RoutineName, CurrentModuleObject, cAlphaFields(1), AlphArray(1)));
ShowContinueError(state,
format("..Duplicate Controlled {} entered, only one {} per {} is allowed.", zsString, CurrentModuleObject, zsString));
state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true;
continue;
}
state.dataHeatBal->space(zoneOrSpaceNum).IsControlled = true;
thisSpace.IsControlled = true;
bool isSpace = true;
auto &thisSpaceEquipConfig = state.dataZoneEquip->spaceEquipConfig(spaceNum);
processZoneEquipmentInput(state,
CurrentModuleObject,
zoneOrSpaceNum,
spaceNum,
isSpace,
locTermUnitSizingCounter,
overallEquipCount,
state.dataZoneEquip->spaceEquipConfig(zoneOrSpaceNum),
thisSpaceEquipConfig,
AlphArray,
cAlphaFields,
lAlphaBlanks,
NodeNums);
state.dataHeatBal->space(zoneOrSpaceNum).SystemZoneNodeNumber = state.dataZoneEquip->spaceEquipConfig(zoneOrSpaceNum).ZoneNode;
thisSpace.SystemZoneNodeNumber = thisSpaceEquipConfig.ZoneNode;
} // end loop over controlled spaces

if (state.dataHeatBal->doSpaceHeatBalanceSizing || state.dataHeatBal->doSpaceHeatBalanceSimulation) {
Expand Down Expand Up @@ -510,7 +523,7 @@ void GetZoneEquipmentData(EnergyPlusData &state)
ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisZeqSplitter.Name));
ShowContinueError(
state,
format("..Zone Name={} is not a controlled zone. A ZoneHVAC:EquipmentConfiguration object is required for this zone.", zoneName));
format("..Zone Name={} is not a controlled zone. A ZoneHVAC:EquipmentConnections object is required for this zone.", zoneName));
state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true;
continue;
}
Expand Down Expand Up @@ -547,7 +560,7 @@ void GetZoneEquipmentData(EnergyPlusData &state)
ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisZeqMixer.Name));
ShowContinueError(
state,
format("..Zone Name={} is not a controlled zone. A ZoneHVAC:EquipmentConfiguration object is required for this zone.", zoneName));
format("..Zone Name={} is not a controlled zone. A ZoneHVAC:EquipmentConnections object is required for this zone.", zoneName));
state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true;
continue;
}
Expand Down Expand Up @@ -584,7 +597,7 @@ void GetZoneEquipmentData(EnergyPlusData &state)
ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisZretMixer.Name));
ShowContinueError(
state,
format("..Zone Name={} is not a controlled zone. A ZoneHVAC:EquipmentConfiguration object is required for this zone.", zoneName));
format("..Zone Name={} is not a controlled zone. A ZoneHVAC:EquipmentConnections object is required for this zone.", zoneName));
state.dataZoneEquip->GetZoneEquipmentDataErrorsFound = true;
continue;
}
Expand Down
19 changes: 0 additions & 19 deletions src/EnergyPlus/SizingManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,25 +219,6 @@ void ManageSizing(EnergyPlusData &state)
state.dataGlobal->ZoneSizingCalc = true;
Available = true;

if (state.dataSize->SizingFileColSep == CharComma) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to ZoneEquipmentManager to avoid creating an empty spsz output file. Can't make that decision here yet, because the project data (with Do Space Heat Balance flags) has not been read yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

state.files.zsz.filePath = state.files.outputZszCsvFilePath;
} else if (state.dataSize->SizingFileColSep == CharTab) {
state.files.zsz.filePath = state.files.outputZszTabFilePath;
} else {
state.files.zsz.filePath = state.files.outputZszTxtFilePath;
}

if (state.dataSize->SizingFileColSep == CharComma) {
state.files.spsz.filePath = state.files.outputSpszCsvFilePath;
} else if (state.dataSize->SizingFileColSep == CharTab) {
state.files.spsz.filePath = state.files.outputSpszTabFilePath;
} else {
state.files.spsz.filePath = state.files.outputSpszTxtFilePath;
}

state.files.zsz.ensure_open(state, "ManageSizing", state.files.outputControl.zsz);
state.files.spsz.ensure_open(state, "ManageSizing", state.files.outputControl.spsz);

ShowMessage(state, "Beginning Zone Sizing Calculations");

Weather::ResetEnvironmentCounter(state);
Expand Down
50 changes: 36 additions & 14 deletions src/EnergyPlus/ZoneEquipmentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2346,14 +2346,15 @@ std::string sizingPeakTimeStamp(EnergyPlusData const &state, int timeStepIndex)
void writeZszSpsz(EnergyPlusData &state,
EnergyPlus::InputOutputFile &outputFile,
int const numSpacesOrZones,
Array1D<DataZoneEquipment::EquipConfiguration> const &zsEquipConfig,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed.

EPVector<DataSizing::ZoneSizingData> const &zsCalcFinalSizing,
Array2D<DataSizing::ZoneSizingData> const &zsCalcSizing)
Array2D<DataSizing::ZoneSizingData> const &zsCalcSizing,
bool const forSpaces)
{
char const colSep = state.dataSize->SizingFileColSep;
print(outputFile, "Time");
for (int i = 1; i <= numSpacesOrZones; ++i) {
if (!zsEquipConfig(i).IsControlled) continue;
int zoneNum = (forSpaces) ? state.dataHeatBal->space(i).zoneNum : i;
if (!state.dataHeatBal->Zone(zoneNum).IsControlled) continue;
Comment on lines -2356 to +2357
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sizing output, check if the parent zone is controlled instead of checking zsEquipConfig(i).IsControlled (which is only true if there are SpaceHVAC:* objects).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if there are SpaceHVAC objects, that implies that the parent zone IsControlled flag will be set to true, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it should be. SpaceHVAC objects don't work without corresponding ZoneHVAC objects for the parent zone. I see a check for that in some of the SpaceHVAC objects, but not for SpaceHVAC:EquipmentConnections. I'll add that and remove the IDD changes and stash them (somewhere) for later.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this code in SizeZoneEquipment know the space is controlled? and if this isn't working as expected for spaces then uncontrolled spaces will be held to the Tstat temp and not float?

    auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum);
    if (!zoneEquipConfig.IsControlled) continue;
    sizeZoneSpaceEquipmentPart2(
        state, zoneEquipConfig, state.dataSize->CalcZoneSizing(state.dataSize->CurOverallSimDay, ControlledZoneNum), ControlledZoneNum);
    if (state.dataHeatBal->doSpaceHeatBalance) {
        for (int spaceNum : state.dataHeatBal->Zone(ControlledZoneNum).spaceIndexes) {
            sizeZoneSpaceEquipmentPart2(
                state, zoneEquipConfig, state.dataSize->CalcSpaceSizing(state.dataSize->CurOverallSimDay, spaceNum), ControlledZoneNum, spaceNum);
        }
    }

Copy link
Collaborator

@rraustad rraustad Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked 5ZoneAirCooledWithSpacesHVAC and ZONE 5-REMAINDER has a heating and cooling load showing in eplusspsz.csv. This is a different issue than the original and is scope creeping.

UPDATE: ZONE 5-REMAINDER does have an equipment connections object so it should show loads. I suspect an uncontrolled space would also show loads but that's a different issue than this.

SpaceHVAC:EquipmentConnections,
  Zone 5-Remainder,        !- Space Name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sizing, the assumption is that all spaces in a zone are controlled to the zone thermostat setpoint. That's intentional, I'll have to check and see if the docs are clear (or cloudy, or dark as night) on that.

Copy link
Contributor Author

@mjwitte mjwitte Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Engineering Ref seems clear:

\subsection{Space Sizing}\label{space-sizing}
When ZoneAirHeatBalanceAlgorithm ``Do Space Heat Balance for Sizing'' is ``Yes'', the same sizing calculations 
described above will be performed for each space that is part of a controlled zone, using the same thermostat
 setpoints as the parent zone. The space sizing results will be reported the same as zone sizing results (eio, table,
 and spsz outputs).

\subsection{NonCoincident Zone Sizing}\label{noncoincident-zone-sizing}
Sizing:Zone has an option for  ``Type of Space Sum to Use'', ``Coincident'' or ``NonCoincident''. Coincident zone 
sizing (the default) is always calculated first, with all spaces in the zone lumped together. For ``NonCoincident'' zone 
sizing, if the zone contains more than one space, the zone sizing results will be overwritten using the sums and
 averages of the space sizing results. If all spaces for a given load type (heating or cooling) peak on the same design 
day, then that day will be reported as the zone peak day, otherwise the zone design day will be "N/A". The zone 
peak time will be determined by scanning the peak zone sequential loads which are calculated by summing the 
space peak day sequential loads.

But some I/O Ref changes are needed.

auto &thisCalcFS = zsCalcFinalSizing(i);

static constexpr std::string_view ZSizeFmt11("{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{"
Expand Down Expand Up @@ -2441,7 +2442,8 @@ void writeZszSpsz(EnergyPlusData &state,
static constexpr std::string_view ZSizeFmt20("{:02}:{:02}:00");
print(outputFile, ZSizeFmt20, HourPrint, Minutes);
for (int i = 1; i <= numSpacesOrZones; ++i) {
if (!zsEquipConfig(i).IsControlled) continue;
int zoneNum = (forSpaces) ? state.dataHeatBal->space(i).zoneNum : i;
if (!state.dataHeatBal->Zone(zoneNum).IsControlled) continue;
auto &thisCalcFS = zsCalcFinalSizing(i);
static constexpr std::string_view ZSizeFmt21("{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12."
"6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}");
Expand Down Expand Up @@ -2506,7 +2508,8 @@ void writeZszSpsz(EnergyPlusData &state,
print(outputFile, "Peak");

for (int i = 1; i <= numSpacesOrZones; ++i) {
if (!zsEquipConfig(i).IsControlled) continue;
int zoneNum = (forSpaces) ? state.dataHeatBal->space(i).zoneNum : i;
if (!state.dataHeatBal->Zone(zoneNum).IsControlled) continue;
auto &thisCalcFS = zsCalcFinalSizing(i);

static constexpr std::string_view ZSizeFmt31("{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12."
Expand Down Expand Up @@ -2546,7 +2549,8 @@ void writeZszSpsz(EnergyPlusData &state,

print(outputFile, "\nPeak Vol Flow (m3/s)");
for (int i = 1; i <= numSpacesOrZones; ++i) {
if (!zsEquipConfig(i).IsControlled) continue;
int zoneNum = (forSpaces) ? state.dataHeatBal->space(i).zoneNum : i;
if (!state.dataHeatBal->Zone(zoneNum).IsControlled) continue;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if you have any other changes.

int zoneNum = (forSpaces) ? state.dataHeatBal->space(i).zoneNum : i;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, of course. That construct still is not my first thought, or second, or ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add on, the parentheses around forSpaces is not needed unless you need it for order of operations. (Ternary has a very low operation precedence, so most things will be evaluated before it is applied.)

auto &thisCalcFS = zsCalcFinalSizing(i);
static constexpr std::string_view ZSizeFmt41("{}{}{}{:12.6E}{}{:12.6E}{}{}{}{:12.6E}{}{:12.6E}{}{}{}{}{}{}{}{}");
print(outputFile,
Expand Down Expand Up @@ -3302,19 +3306,37 @@ void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator const CallI
}
}

writeZszSpsz(state,
state.files.zsz,
state.dataGlobal->NumOfZones,
state.dataZoneEquip->ZoneEquipConfig,
state.dataSize->CalcFinalZoneSizing,
state.dataSize->CalcZoneSizing);
// Write zone sizing (zsz) and space sizing (spsz) outputs
if (state.dataSize->SizingFileColSep == DataStringGlobals::CharComma) {
state.files.zsz.filePath = state.files.outputZszCsvFilePath;
} else if (state.dataSize->SizingFileColSep == DataStringGlobals::CharTab) {
state.files.zsz.filePath = state.files.outputZszTabFilePath;
} else {
state.files.zsz.filePath = state.files.outputZszTxtFilePath;
}
state.files.zsz.ensure_open(state, "UpdateZoneSizing", state.files.outputControl.zsz);

bool forSpaces = false;
writeZszSpsz(
state, state.files.zsz, state.dataGlobal->NumOfZones, state.dataSize->CalcFinalZoneSizing, state.dataSize->CalcZoneSizing, forSpaces);

if (state.dataHeatBal->doSpaceHeatBalanceSizing) {
if (state.dataSize->SizingFileColSep == DataStringGlobals::CharComma) {
state.files.spsz.filePath = state.files.outputSpszCsvFilePath;
} else if (state.dataSize->SizingFileColSep == DataStringGlobals::CharTab) {
state.files.spsz.filePath = state.files.outputSpszTabFilePath;
} else {
state.files.spsz.filePath = state.files.outputSpszTxtFilePath;
}
state.files.spsz.ensure_open(state, "UpdateZoneSizing", state.files.outputControl.spsz);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait until here to open zsz and spsz files. At this point we know if doSpaceHeatBalanceSizing is active.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually glad you fixed this. I saw the 0 kB files but wasn't sure how to avoid that. This is a perfect fix.


forSpaces = true;
writeZszSpsz(state,
state.files.spsz,
state.dataGlobal->numSpaces,
state.dataZoneEquip->spaceEquipConfig,
state.dataSize->CalcFinalSpaceSizing,
state.dataSize->CalcSpaceSizing);
state.dataSize->CalcSpaceSizing,
forSpaces);
}

// Move sizing data into final sizing array according to sizing method
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/ZoneEquipmentManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ namespace ZoneEquipmentManager {
void writeZszSpsz(EnergyPlusData &state,
EnergyPlus::InputOutputFile &outputFile,
int const numSpacesOrZones,
Array1D<DataZoneEquipment::EquipConfiguration> const &zsEquipConfig,
EPVector<DataSizing::ZoneSizingData> const &zsCalcFinalSizing,
Array2D<DataSizing::ZoneSizingData> const &zsCalcSizing);
Array2D<DataSizing::ZoneSizingData> const &zsCalcSizing,
bool const forSpaces);

std::string sizingPeakTimeStamp(EnergyPlusData const &state, int timeStepIndex);

Expand Down