Skip to content

Commit

Permalink
Streamline sizing peak timestamps plus etc
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwitte committed Jun 28, 2024
1 parent e14f948 commit 1c11d89
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 27 deletions.
62 changes: 37 additions & 25 deletions src/EnergyPlus/ZoneEquipmentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,7 @@ void fillZoneSizingFromInput(EnergyPlusData &state,
zoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
zoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
zoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
zoneSizing.spaceConcurrence = zoneSizingInput.spaceConcurrence;
zoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
zoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
zoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
Expand Down Expand Up @@ -1210,6 +1211,7 @@ void fillZoneSizingFromInput(EnergyPlusData &state,
calcZoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
calcZoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
calcZoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
calcZoneSizing.spaceConcurrence = zoneSizingInput.spaceConcurrence;
calcZoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
calcZoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
calcZoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
Expand Down Expand Up @@ -1262,6 +1264,7 @@ void fillZoneSizingFromInput(EnergyPlusData &state,
zsFinalSizing.ZoneADEffHeating = zoneSizingInput.ZoneADEffHeating;
zsFinalSizing.ZoneSecondaryRecirculation = zoneSizingInput.ZoneSecondaryRecirculation;
zsFinalSizing.ZoneVentilationEff = zoneSizingInput.ZoneVentilationEff;
zsFinalSizing.spaceConcurrence = zoneSizingInput.spaceConcurrence;
zsFinalSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
zsFinalSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
zsFinalSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
Expand Down Expand Up @@ -1302,6 +1305,7 @@ void fillZoneSizingFromInput(EnergyPlusData &state,
zsCalcFinalSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
zsCalcFinalSizing.ZoneADEffCooling = zoneSizingInput.ZoneADEffCooling;
zsCalcFinalSizing.ZoneADEffHeating = zoneSizingInput.ZoneADEffHeating;
zsCalcFinalSizing.spaceConcurrence = zoneSizingInput.spaceConcurrence;
zsCalcFinalSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
zsCalcFinalSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
zsCalcFinalSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
Expand Down Expand Up @@ -1958,21 +1962,27 @@ void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, DataSizing::ZoneS
}
}

void updateZoneSizingEndZoneSizingCalc2(DataSizing::ZoneSizingData &zsCalcSizing, int const timeStepIndex, int const hourPrint, int const minutes)
void updateZoneSizingEndZoneSizingCalc2(EnergyPlusData &state, DataSizing::ZoneSizingData &zsCalcSizing)
{
// SpaceSizing TODO: There's gotta be a better place to set these timestamps
if (timeStepIndex == zsCalcSizing.TimeStepNumAtHeatMax) {
zsCalcSizing.HeatPeakDateHrMin = zsCalcSizing.cHeatDDDate + ' ' + format(PeakHrMinFmt, hourPrint, minutes);
}
if (timeStepIndex == zsCalcSizing.TimeStepNumAtCoolMax) {
zsCalcSizing.CoolPeakDateHrMin = zsCalcSizing.cCoolDDDate + ' ' + format(PeakHrMinFmt, hourPrint, minutes);
}
if (timeStepIndex == zsCalcSizing.TimeStepNumAtLatentHeatMax) {
zsCalcSizing.LatHeatPeakDateHrMin = zsCalcSizing.cLatentHeatDDDate + ' ' + format(PeakHrMinFmt, hourPrint, minutes);
}
if (timeStepIndex == zsCalcSizing.TimeStepNumAtLatentCoolMax) {
zsCalcSizing.LatCoolPeakDateHrMin = zsCalcSizing.cLatentCoolDDDate + ' ' + format(PeakHrMinFmt, hourPrint, minutes);
}
zsCalcSizing.HeatPeakDateHrMin = zsCalcSizing.cHeatDDDate + ' ' + sizingPeakTimeStamp(state, zsCalcSizing.TimeStepNumAtHeatMax);

zsCalcSizing.CoolPeakDateHrMin = zsCalcSizing.cCoolDDDate + ' ' + sizingPeakTimeStamp(state, zsCalcSizing.TimeStepNumAtCoolMax);

zsCalcSizing.LatHeatPeakDateHrMin = zsCalcSizing.cLatentHeatDDDate + ' ' + sizingPeakTimeStamp(state, zsCalcSizing.TimeStepNumAtLatentHeatMax);

zsCalcSizing.LatCoolPeakDateHrMin = zsCalcSizing.cLatentCoolDDDate + ' ' + sizingPeakTimeStamp(state, zsCalcSizing.TimeStepNumAtLatentCoolMax);
}

std::string sizingPeakTimeStamp(EnergyPlusData &state, int timeStepIndex)
{
int constexpr minToSec = 60;
int hour = 0;
int minute = 0;
Real64 second = 0;

Real64 timeInSeconds = timeStepIndex * state.dataGlobal->MinutesPerTimeStep * minToSec;
General::ParseTime(timeInSeconds, hour, minute, second);
return format(PeakHrMinFmt, hour, minute);
}

void updateZoneSizingEndZoneSizingCalc3(DataSizing::ZoneSizingData &zsCalcFinalSizing,
Expand Down Expand Up @@ -2096,6 +2106,7 @@ void updateZoneSizingEndZoneSizingCalc3(DataSizing::ZoneSizingData &zsCalcFinalS
}
void updateZoneSizingEndZoneSizingCalc4(DataSizing::ZoneSizingData &zsSizing, DataSizing::ZoneSizingData const &zsCalcSizing)
{
// Move data from Calc arrays to user modified arrays
zsSizing.CoolDesDay = zsCalcSizing.CoolDesDay;
zsSizing.HeatDesDay = zsCalcSizing.HeatDesDay;
zsSizing.DesHeatDens = zsCalcSizing.DesHeatDens;
Expand Down Expand Up @@ -2131,6 +2142,7 @@ void updateZoneSizingEndZoneSizingCalc4(DataSizing::ZoneSizingData &zsSizing, Da

void updateZoneSizingEndZoneSizingCalc5(DataSizing::ZoneSizingData &zsFinalSizing, DataSizing::ZoneSizingData const &zsCalcFinalSizing)
{
// Move data from CalcFinal arrays to user modified final arrays
// SpaceSizing TODO: This is essentially the same as updateZoneSizingEndZoneSizingCalc4, except there are two extra fields copied here
zsFinalSizing.CoolDesDay = zsCalcFinalSizing.CoolDesDay;
zsFinalSizing.HeatDesDay = zsCalcFinalSizing.HeatDesDay;
Expand Down Expand Up @@ -2765,6 +2777,16 @@ void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator const CallI
":Cooling Zone Relative Humidity [%]");
}

for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
updateZoneSizingEndZoneSizingCalc2(state, state.dataSize->CalcFinalZoneSizing(CtrlZoneNum));
if (state.dataHeatBal->doSpaceHeatBalanceSizing) {
for (int spaceNum : state.dataHeatBal->Zone(CtrlZoneNum).spaceIndexes) {
updateZoneSizingEndZoneSizingCalc2(state, state.dataSize->CalcFinalSpaceSizing(spaceNum));
}
}
}

print(state.files.zsz, "\n");
// HourFrac = 0.0
int Minutes = 0;
Expand All @@ -2778,16 +2800,6 @@ void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator const CallI
Minutes = 0;
HourPrint = HourCounter;
}
for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
updateZoneSizingEndZoneSizingCalc2(state.dataSize->CalcFinalZoneSizing(CtrlZoneNum), TimeStepIndex, HourPrint, Minutes);
if (state.dataHeatBal->doSpaceHeatBalanceSizing) {
for (int spaceNum : state.dataHeatBal->Zone(CtrlZoneNum).spaceIndexes) {
updateZoneSizingEndZoneSizingCalc2(state.dataSize->CalcFinalSpaceSizing(spaceNum), TimeStepIndex, HourPrint, Minutes);
}
}
}

static constexpr std::string_view ZSizeFmt20("{:02}:{:02}:00");
print(state.files.zsz, ZSizeFmt20, HourPrint, Minutes);
for (int I = 1; I <= state.dataGlobal->NumOfZones; ++I) {
Expand Down Expand Up @@ -2986,7 +2998,7 @@ void UpdateZoneSizing(EnergyPlusData &state, Constant::CallIndicator const CallI

for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
// Yes, call updateZoneSizingEndZoneSizingCalc6 again here to copyd the same fields
// Yes, call updateZoneSizingEndZoneSizingCalc6 again here to copy the same fields
updateZoneSizingEndZoneSizingCalc6(state.dataSize->FinalZoneSizing(CtrlZoneNum),
state.dataSize->CalcFinalZoneSizing(CtrlZoneNum),
state.dataZoneEquipmentManager->NumOfTimeStepInDay);
Expand Down
5 changes: 3 additions & 2 deletions src/EnergyPlus/ZoneEquipmentManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ namespace ZoneEquipmentManager {

void updateZoneSizingEndZoneSizingCalc1(EnergyPlusData &state, DataSizing::ZoneSizingData const &zsCalcSizing);

void
updateZoneSizingEndZoneSizingCalc2(DataSizing::ZoneSizingData &zsCalcSizing, int const timeStepIndex, int const hourPrint, int const minutes);
void updateZoneSizingEndZoneSizingCalc2(EnergyPlusData &state, DataSizing::ZoneSizingData &zsCalcSizing);

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

void updateZoneSizingEndZoneSizingCalc3(DataSizing::ZoneSizingData &zsCalcFinalSizing,
Array2D<DataSizing::ZoneSizingData> &zsCalcSizing,
Expand Down

5 comments on commit 1c11d89

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

SpaceSizingHVACPart4 (mjwitte) - Win64-Windows-10-VisualStudio-16: OK (2838 of 2838 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

SpaceSizingHVACPart4 (mjwitte) - x86_64-MacOS-10.18-clang-15.0.0: OK (3286 of 3628 tests passed, 5 test warnings)

Messages:\n

  • 342 tests had: Table big diffs.
  • 5 tests had: Table small diffs.
  • 2 tests had: Table string diffs.

Failures:\n

regression Test Summary

  • Passed: 447
  • Failed: 342

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

SpaceSizingHVACPart4 (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3326 of 3669 tests passed, 5 test warnings)

Messages:\n

  • 343 tests had: Table big diffs.
  • 5 tests had: Table small diffs.
  • 2 tests had: Table string diffs.

Failures:\n

regression Test Summary

  • Passed: 466
  • Failed: 343

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

SpaceSizingHVACPart4 (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (2048 of 2048 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

SpaceSizingHVACPart4 (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (793 of 793 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.