Skip to content
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

Schedule API #10848

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2d1b4c3
Initial commit, pre develop merge.
amirroth Dec 5, 2024
6a339a8
Merge develop, resolve conflicts
amirroth Dec 6, 2024
d0b7ff9
First round of fixes
amirroth Dec 7, 2024
1272641
Fix EMS issues and several others
amirroth Dec 8, 2024
0a5be5d
Fix a few more issues
amirroth Dec 9, 2024
ed1b393
Doh, forgot to update some unit test files
amirroth Dec 9, 2024
aa645ef
One more
amirroth Dec 9, 2024
b8b9473
Fix some audit, rdd, and eio diffs
amirroth Dec 9, 2024
72066d1
Fix accumulation/averaging issue
amirroth Dec 10, 2024
5f69976
Changing to std::vector for debugging purposes
amirroth Dec 11, 2024
60706a3
Spell out std::find, std::fill, and std::accumulate so that we can us…
amirroth Dec 11, 2024
1c1ead8
Moving a few more std::find's to loops
amirroth Dec 11, 2024
7b4e5a4
I'm officially starting to lose it
amirroth Dec 12, 2024
98978bd
Fix a few more memory issues and crashes
amirroth Dec 13, 2024
bc4d001
This one was a doozy, lAlphaFieldBlanks is true if the field was left…
amirroth Dec 13, 2024
e4974ba
Two more fixes, thanks rraustad
amirroth Dec 14, 2024
3e020e2
This pump fix was pervasive
amirroth Dec 14, 2024
aaac698
Dag nabbit
amirroth Dec 14, 2024
aa9851e
Plugging away
amirroth Dec 14, 2024
aa03507
Fix EMS issue
amirroth Dec 16, 2024
04e1872
VRF fix
amirroth Dec 16, 2024
4f8a09e
More fixes from RRaustad
amirroth Dec 18, 2024
0fe2ff0
ZoneContaminant and format fixes
amirroth Dec 18, 2024
33b94a9
More fixes, or maybe just changes
amirroth Dec 18, 2024
dfc8545
One step back
amirroth Dec 20, 2024
13c52af
Address nullptr-based failures
amirroth Dec 20, 2024
4243a37
Fix more crashes and diffs
amirroth Dec 20, 2024
278e872
Merge remote-tracking branch 'origin/develop' into ScheduleAPI
amirroth Dec 21, 2024
c6833bb
WalkIn freezer fix
amirroth Dec 21, 2024
d26c66d
A few cases that didn't pass visual code inspection
amirroth Dec 23, 2024
7d637f2
Got a little too exuberant
amirroth Dec 23, 2024
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 @@ -248,7 +248,7 @@ namespace AirflowNetwork {
// Members
std::string ZoneName; // Name of Associated EnergyPlus Thermal Zone
std::string VentControl; // Ventilation Control Mode: "TEMPERATURE", "ENTHALPIC", "CONSTANT", or "NOVENT"
std::string VentSchName; // Name of ventilation temperature control schedule
std::string VentAvailSchName; // Ventilation availability schedule
Real64 Height; // Nodal height
Real64 OpenFactor; // Limit Value on Multiplier for Modulating Venting Open Factor,
// Not applicable if Vent Control Mode = CONSTANT or NOVENT
Expand All @@ -261,10 +261,10 @@ namespace AirflowNetwork {
Real64 UpValueEnth; // Upper Value on Inside/Outside Temperature Difference for
// Modulating the Venting Open Factor with Enthalpic control
int ZoneNum; // Zone number associated with ZoneName
Sched::Schedule *ventSched = nullptr; // Zone ventilation schedule number associated with ventilation schedule name
Sched::Schedule *ventTempControlSched = nullptr; // Ventilation temperature control schedule
int VentCtrNum; // Ventilation control mode number: 1 "Temperature", 2 "ENTHALPIC", 3 "CONSTANT", 4 "NOVENT"
std::string VentingSchName; // Name of ventilation temperature control schedule
Sched::Schedule *ventingSched = nullptr; // Ventilation schedule number
std::string VentTempControlSchName; // Name of ventilation temperature control schedule
Sched::Schedule *ventAvailSched = nullptr; // Ventilation availability schedule
std::string SingleSidedCpType; // Type of calculation method for single sided wind pressure coefficients
Real64 BuildWidth; // The width of the building along the facade that contains this zone.
int ASH55PeopleInd; // Index of people object with ASH55 comfort calcs for ventilation control
Expand Down Expand Up @@ -299,7 +299,6 @@ namespace AirflowNetwork {
Real64 Width; // Surface width
Real64 CHeight; // Surface central height in z direction
std::string VentControl; // Ventilation Control Mode: TEMPERATURE, ENTHALPIC, CONSTANT, ZONELEVEL or NOVENT
std::string VentSchName; // ! Name of ventilation temperature control schedule
Real64 ModulateFactor; // Limit Value on Multiplier for Modulating Venting Open Factor
Real64 LowValueTemp; // Lower Value on Inside/Outside Temperature Difference for
// Modulating the Venting Open Factor with temp control
Expand All @@ -309,10 +308,11 @@ namespace AirflowNetwork {
// Modulating the Venting Open Factor with Enthalpic control
Real64 UpValueEnth; // Upper Value on Inside/Outside Temperature Difference for
// Modulating the Venting Open Factor with Enthalpic control
std::string VentingSchName; // Name of ventilation temperature control schedule
Sched::Schedule *ventSched = nullptr; // Zone ventilation schedule number associated with ventilation schedule name
std::string VentTempControlSchName; // Name of ventilation temperature control schedule
Sched::Schedule *ventTempControlSched = nullptr; // Ventilation temperature control schedule
VentControlType VentSurfCtrNum; // Ventilation control mode number: 1 "Temperature", 2 "ENTHALPIC", 3 "CONSTANT", 4 "NOVENT"
Sched::Schedule *ventingSched = nullptr; // Ventilation schedule number
std::string VentAvailSchName; // Ventilation availability schedule
Sched::Schedule *ventAvailSched = nullptr; // Ventilation availability schedule
int ZonePtr; // Pointer to inside face zone
bool IndVentControl; // Individual surface venting control
int ExtLargeOpeningErrCount; // Exterior large opening error count during HVAC system operation
Expand Down
65 changes: 33 additions & 32 deletions src/EnergyPlus/AirflowNetwork/src/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2306,7 +2306,7 @@ namespace AirflowNetwork {
if (!lAlphaBlanks(2)) MultizoneZoneData(i).VentControl = Alphas(2); // Ventilation Control Mode: "Temperature", "Enthalpy",
// "ASHRAE55ADAPTIVE", "CEN15251AdaptiveComfort,
// "Constant", or "NoVent"
MultizoneZoneData(i).VentSchName = Alphas(3); // Name of ventilation temperature control schedule
MultizoneZoneData(i).VentTempControlSchName = Alphas(3); // Name of ventilation temperature control schedule
MultizoneZoneData(i).OpenFactor = Numbers(1); // Limit Value on Multiplier for Modulating Venting Open Factor,
// Not applicable if Vent Control Mode = CONSTANT or NOVENT
MultizoneZoneData(i).LowValueTemp = Numbers(2); // Lower Value on Inside/Outside Temperature Difference
Expand Down Expand Up @@ -2343,15 +2343,15 @@ namespace AirflowNetwork {

if (MultizoneZoneData(i).VentCtrNum < NumOfVentCtrTypes) {
if (NumAlphas >= 4 && (!lAlphaBlanks(4))) {
MultizoneZoneData(i).VentingSchName = Alphas(4);
if ((MultizoneZoneData(i).ventingSched = Sched::GetSchedule(m_state, MultizoneZoneData(i).VentingSchName)) == nullptr) {
MultizoneZoneData(i).VentAvailSchName = Alphas(4);
if ((MultizoneZoneData(i).ventAvailSched = Sched::GetSchedule(m_state, MultizoneZoneData(i).VentAvailSchName)) == nullptr) {
ShowSevereItemNotFound(m_state, eoh, cAlphaFields(4), Alphas(4));
ErrorsFound = true;
}
}
} else {
MultizoneZoneData(i).VentingSchName = std::string();
MultizoneZoneData(i).ventingSched = Sched::GetScheduleAlwaysOn(m_state);
MultizoneZoneData(i).VentAvailSchName = std::string();
MultizoneZoneData(i).ventAvailSched = Sched::GetScheduleAlwaysOn(m_state);
}
}
} else {
Expand Down Expand Up @@ -2389,18 +2389,18 @@ namespace AirflowNetwork {
// .or. &
// Util::SameString(MultizoneZoneData(i)%VentControl,'ASHRAE55Adaptive') .or. &
// Util::SameString(MultizoneZoneData(i)%VentControl,'CEN15251Adaptive')) then
if (MultizoneZoneData(i).VentSchName.empty()) {
if (MultizoneZoneData(i).VentTempControlSchName.empty()) {
ShowSevereEmptyField(m_state, eoh, cAlphaFields(3), cAlphaFields(2), Alphas(2));
ErrorsFound = true;
} else if ((MultizoneZoneData(i).ventSched = Sched::GetSchedule(m_state, MultizoneZoneData(i).VentSchName)) == nullptr) {
} else if ((MultizoneZoneData(i).ventTempControlSched = Sched::GetSchedule(m_state, MultizoneZoneData(i).VentTempControlSchName)) == nullptr) {
ShowSevereItemNotFound(m_state, eoh, cAlphaFields(3), Alphas(3));
ErrorsFound = true;
}
} else {
MultizoneZoneData(i).ventSched = Sched::GetScheduleAlwaysOff(m_state);
if (!MultizoneZoneData(i).VentSchName.empty()) {
MultizoneZoneData(i).ventTempControlSched = nullptr;
if (!MultizoneZoneData(i).VentTempControlSchName.empty()) {
ShowWarningNonEmptyField(m_state, eoh, cAlphaFields(3), cAlphaFields(2), Alphas(2));
MultizoneZoneData(i).VentSchName = std::string();
MultizoneZoneData(i).VentTempControlSchName = std::string();
}
}
if (MultizoneZoneData(i).OpenFactor > 1.0 || MultizoneZoneData(i).OpenFactor < 0.0) {
Expand Down Expand Up @@ -2677,7 +2677,7 @@ namespace AirflowNetwork {
// or "ADJACENTENTHALPY"
if (!lAlphaBlanks(4)) MultizoneSurfaceData(i).VentControl = Alphas(4);
// Name of ventilation temperature control schedule
if (!lAlphaBlanks(5)) MultizoneSurfaceData(i).VentSchName = Alphas(5);
if (!lAlphaBlanks(5)) MultizoneSurfaceData(i).VentTempControlSchName = Alphas(5);
{
// This SELECT_CASE_var will go on input refactor, no need to fix
auto const SELECT_CASE_var(Util::makeUPPER(MultizoneSurfaceData(i).VentControl));
Expand Down Expand Up @@ -2728,7 +2728,7 @@ namespace AirflowNetwork {
if (MultizoneSurfaceData(i).VentSurfCtrNum < 4 || MultizoneSurfaceData(i).VentSurfCtrNum == VentControlType::AdjTemp ||
MultizoneSurfaceData(i).VentSurfCtrNum == VentControlType::AdjEnth) {
if (!lAlphaBlanks(6)) {
MultizoneSurfaceData(i).VentingSchName = Alphas(6); // Name of ventilation availability schedule
MultizoneSurfaceData(i).VentAvailSchName = Alphas(6); // Name of ventilation availability schedule
}
}
if (!lAlphaBlanks(7)) {
Expand Down Expand Up @@ -3200,26 +3200,26 @@ namespace AirflowNetwork {
MultizoneSurfaceData(i).IndVentControl = true;
}

if (MultizoneSurfaceData(i).VentingSchName.empty()) {
MultizoneSurfaceData(i).ventingSched = Sched::GetScheduleAlwaysOn(m_state);
} else if ((MultizoneSurfaceData(i).ventingSched = Sched::GetSchedule(m_state, MultizoneSurfaceData(i).VentingSchName)) == nullptr) {
ShowSevereItemNotFound(m_state, eoh, "Venting Schedule", MultizoneSurfaceData(i).VentingSchName);
if (MultizoneSurfaceData(i).VentAvailSchName.empty()) {
MultizoneSurfaceData(i).ventAvailSched = Sched::GetScheduleAlwaysOn(m_state);
} else if ((MultizoneSurfaceData(i).ventAvailSched = Sched::GetSchedule(m_state, MultizoneSurfaceData(i).VentAvailSchName)) == nullptr) {
ShowSevereItemNotFound(m_state, eoh, "Venting Schedule", MultizoneSurfaceData(i).VentAvailSchName);
ErrorsFound = true;
} else if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).IsAirBoundarySurf) {
ShowWarningNonEmptyField(m_state, eoh, "Venting Availbility Schedule");
ShowContinueError(m_state, "Venting is always available for air-boundary surfaces.");
MultizoneSurfaceData(i).ventingSched = Sched::GetScheduleAlwaysOn(m_state);
MultizoneSurfaceData(i).VentingSchName = "";
MultizoneSurfaceData(i).ventAvailSched = Sched::GetScheduleAlwaysOn(m_state);
MultizoneSurfaceData(i).VentAvailSchName = "";
}

switch (MultizoneSurfaceData(i).VentSurfCtrNum) {
case VentControlType::Temp:
case VentControlType::AdjTemp: {
if (MultizoneSurfaceData(i).VentSchName.empty()) {
if (MultizoneSurfaceData(i).VentTempControlSchName.empty()) {
ShowSevereEmptyField(m_state, eoh, "Ventilation Schedule", "Ventinlation Control", "Temperature");
ErrorsFound = true;
} else if ((MultizoneSurfaceData(i).ventSched = Sched::GetSchedule(m_state, MultizoneSurfaceData(i).VentSchName)) == nullptr) {
ShowSevereItemNotFound(m_state, eoh, "Ventilation Schedule", MultizoneSurfaceData(i).VentSchName);
} else if ((MultizoneSurfaceData(i).ventTempControlSched = Sched::GetSchedule(m_state, MultizoneSurfaceData(i).VentTempControlSchName)) == nullptr) {
ShowSevereItemNotFound(m_state, eoh, "Ventilation Schedule", MultizoneSurfaceData(i).VentTempControlSchName);
ErrorsFound = true;
}
if (MultizoneSurfaceData(i).LowValueTemp < 0.0) {
Expand All @@ -3245,13 +3245,14 @@ namespace AirflowNetwork {
}

} break;

case VentControlType::Enth:
case VentControlType::AdjEnth: {
if (MultizoneSurfaceData(i).VentSchName.empty()) {
if (MultizoneSurfaceData(i).VentTempControlSchName.empty()) {
ShowSevereEmptyField(m_state, eoh, "Ventilation Schedule", "Ventilation Control", "Enthalpy");
ErrorsFound = true;
} else if ((MultizoneSurfaceData(i).ventSched = Sched::GetSchedule(m_state, MultizoneSurfaceData(i).VentSchName)) == nullptr) {
ShowSevereItemNotFound(m_state, eoh, "Ventilation Schedule", MultizoneSurfaceData(i).VentSchName);
} else if ((MultizoneSurfaceData(i).ventTempControlSched = Sched::GetSchedule(m_state, MultizoneSurfaceData(i).VentTempControlSchName)) == nullptr) {
ShowSevereItemNotFound(m_state, eoh, "Ventilation Schedule", MultizoneSurfaceData(i).VentTempControlSchName);
ErrorsFound = true;
}
if (MultizoneSurfaceData(i).LowValueEnth < 0.0) {
Expand Down Expand Up @@ -3283,8 +3284,8 @@ namespace AirflowNetwork {
case VentControlType::CEN15251:
case VentControlType::NoVent:
case VentControlType::ZoneLevel: {
MultizoneSurfaceData(i).ventSched = Sched::GetScheduleAlwaysOff(m_state);
MultizoneSurfaceData(i).VentSchName = "";
MultizoneSurfaceData(i).ventTempControlSched = nullptr;
MultizoneSurfaceData(i).VentTempControlSchName = "";
} break;
default:
break;
Expand Down Expand Up @@ -9879,21 +9880,21 @@ namespace AirflowNetwork {
// Note in the following that individual venting control for a window/door takes
// precedence over zone-level control
if (MultizoneSurfaceData(i).IndVentControl) {
VentTemp = MultizoneSurfaceData(i).ventSched->getCurrentVal();
VentTemp = MultizoneSurfaceData(i).ventTempControlSched->getCurrentVal();
VentCtrlNum = MultizoneSurfaceData(i).VentSurfCtrNum;
if (MultizoneSurfaceData(i).ventingSched != nullptr) {
VentingSchVal = MultizoneSurfaceData(i).ventingSched->getCurrentVal();
if (MultizoneSurfaceData(i).ventAvailSched != nullptr) {
VentingSchVal = MultizoneSurfaceData(i).ventAvailSched->getCurrentVal();
if (VentingSchVal <= 0.0) {
VentingAllowed = false;
m_state.dataSurface->SurfWinVentingAvailabilityRep(SurfNum) = 0.0;
}
}
} else {
// Zone level only by Gu on Nov. 8, 2005
VentTemp = MultizoneZoneData(IZ).ventSched->getCurrentVal();
VentTemp = MultizoneZoneData(IZ).ventTempControlSched ? MultizoneZoneData(IZ).ventTempControlSched->getCurrentVal() : 0.0;
VentCtrlNum = MultizoneZoneData(IZ).VentCtrNum;
if (MultizoneZoneData(IZ).ventingSched != nullptr) {
VentingSchVal = MultizoneZoneData(IZ).ventingSched->getCurrentVal();
if (MultizoneZoneData(IZ).ventAvailSched != nullptr) {
VentingSchVal = MultizoneZoneData(IZ).ventAvailSched->getCurrentVal();
if (VentingSchVal <= 0.0) {
VentingAllowed = false;
m_state.dataSurface->SurfWinVentingAvailabilityRep(SurfNum) = 0.0;
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/BaseboardElectric.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ namespace BaseboardElectric {
thisBaseboard.EquipType = Util::makeUPPER(cCurrentModuleObject); // the type of baseboard-rename change
thisBaseboard.Schedule = s_ipsc->cAlphaArgs(2);
if (s_ipsc->lAlphaFieldBlanks(2)) {
thisBaseboard.sched = Sched::GetScheduleAlwaysOn(state);
} else if ((thisBaseboard.sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) {
thisBaseboard.availSched = Sched::GetScheduleAlwaysOn(state);
} else if ((thisBaseboard.availSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) {
ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2));
ErrorsFound = true;
}
Expand Down Expand Up @@ -507,7 +507,7 @@ namespace BaseboardElectric {
// thermal loss that could be accounted for with this efficiency input.
Real64 Effic = baseboard.BaseboardEfficiency;

if (baseboard.sched->getCurrentVal() > 0.0 && LoadMet >= HVAC::SmallLoad) {
if (baseboard.availSched->getCurrentVal() > 0.0 && LoadMet >= HVAC::SmallLoad) {

// if the load exceeds the capacity than the capacity is set to the BB limit.
if (LoadMet > baseboard.NominalCapacity) {
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/BaseboardElectric.hh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace BaseboardElectric {
std::string EquipName;
std::string EquipType;
std::string Schedule;
Sched::Schedule *sched = nullptr;
Sched::Schedule *availSched = nullptr;
Real64 NominalCapacity = 0.0;
Real64 BaseboardEfficiency = 0.0;
Real64 AirInletTemp = 0.0;
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/BaseboardRadiator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ namespace BaseboardRadiator {
thisBaseboard.EquipType = DataPlant::PlantEquipmentType::Baseboard_Conv_Water;
thisBaseboard.Schedule = s_ipsc->cAlphaArgs(2);
if (s_ipsc->lAlphaFieldBlanks(2)) {
thisBaseboard.sched = Sched::GetScheduleAlwaysOn(state);
} else if ((thisBaseboard.sched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) {
thisBaseboard.availSched = Sched::GetScheduleAlwaysOn(state);
} else if ((thisBaseboard.availSched = Sched::GetSchedule(state, s_ipsc->cAlphaArgs(2))) == nullptr) {
ShowSevereItemNotFound(state, eoh, s_ipsc->cAlphaFieldNames(2), s_ipsc->cAlphaArgs(2));
ErrorsFound = true;
}
Expand Down Expand Up @@ -1024,7 +1024,7 @@ namespace BaseboardRadiator {
CapacitanceAir = CpAir * AirMassFlowRate;

if (QZnReq > SmallLoad && (!state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) || baseboard->baseboards(BaseboardNum).MySizeFlag) &&
(baseboard->baseboards(BaseboardNum).sched->getCurrentVal() > 0 || baseboard->baseboards(BaseboardNum).MySizeFlag) &&
(baseboard->baseboards(BaseboardNum).availSched->getCurrentVal() > 0 || baseboard->baseboards(BaseboardNum).MySizeFlag) &&
(WaterMassFlowRate > 0.0)) {
CapacitanceWater = CpWater * WaterMassFlowRate;
CapacitanceMax = max(CapacitanceAir, CapacitanceWater);
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/BaseboardRadiator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace BaseboardRadiator {
// Members
std::string EquipID;
std::string Schedule;
Sched::Schedule *sched = nullptr;
Sched::Schedule *availSched = nullptr;
DataPlant::PlantEquipmentType EquipType = DataPlant::PlantEquipmentType::Invalid;
int ZonePtr = 0;
int WaterInletNode = 0;
Expand Down
Loading
Loading