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 33 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
33 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
1d11ff5
Merge develop
Jan 8, 2025
fd772e2
Merge develop; resolve conflicts
Jan 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 7 additions & 8 deletions src/EnergyPlus/AirLoopHVACDOAS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ namespace AirLoopHVACDOAS {

void AirLoopDOAS::getAirLoopDOASInput(EnergyPlusData &state)
{

constexpr std::string_view routineName = "AirLoopDOAS::getAirLoopDOASInput";
std::string const cCurrentModuleObject = "AirLoopHVAC:DedicatedOutdoorAirSystem";

auto const instances = state.dataInputProcessing->inputProcessor->epJSON.find(cCurrentModuleObject);
Expand All @@ -457,6 +457,8 @@ namespace AirLoopHVACDOAS {
++AirLoopDOASNum;
AirLoopDOAS thisDOAS;

ErrorObjectHeader eoh{routineName, cCurrentModuleObject, thisObjectName};
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're going to see a lot of this as all of the new schedule handling code uses this error reporting pattern.


thisDOAS.Name = Util::makeUPPER(thisObjectName);
// get OA and avail num
thisDOAS.OASystemName = Util::makeUPPER(fields.at("airloophvac_outdoorairsystem_name").get<std::string>());
Expand Down Expand Up @@ -758,12 +760,9 @@ namespace AirLoopHVACDOAS {
}

thisDOAS.AvailManagerSchedName = Util::makeUPPER(fields.at("availability_schedule_name").get<std::string>());
thisDOAS.m_AvailManagerSchedPtr = ScheduleManager::GetScheduleIndex(state, thisDOAS.AvailManagerSchedName);
if (thisDOAS.m_AvailManagerSchedPtr == 0) {
cFieldName = "Availability Schedule Name";
ShowSevereError(
state,
format("{}, \"{}\" {} not found: {}", cCurrentModuleObject, thisDOAS.Name, cFieldName, thisDOAS.AvailManagerSchedName));

if ((thisDOAS.m_AvailManagerSched = Sched::GetSchedule(state, thisDOAS.AvailManagerSchedName)) == nullptr) {
ShowSevereItemNotFound(state, eoh, "Availability Schedule Name", thisDOAS.AvailManagerSchedName);
errorsFound = true;
}

Expand Down Expand Up @@ -948,7 +947,7 @@ namespace AirLoopHVACDOAS {
this->SumMassFlowRate += state.dataLoopNodes->Node(NodeNum).MassFlowRate;
}

SchAvailValue = ScheduleManager::GetCurrentScheduleValue(state, this->m_AvailManagerSchedPtr);
SchAvailValue = this->m_AvailManagerSched->getCurrentVal();
if (SchAvailValue < 1.0) {
this->SumMassFlowRate = 0.0;
}
Expand Down
6 changes: 5 additions & 1 deletion src/EnergyPlus/AirLoopHVACDOAS.hh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ namespace AirLoopHVACDOAS {

int m_AirLoopDOASNum = 0;
int m_OASystemNum = 0;
int m_AvailManagerSchedPtr = 0;
Sched::Schedule *m_AvailManagerSched = nullptr;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh the irony. No more int SchedPtr, int SchedIndex, int SchedPtrIdx, int Sch, only Sched::Schedule *xSched = nullptr;

int m_AirLoopMixerIndex = -1;
int m_AirLoopSplitterIndex = -1;
int NumOfAirLoops = 0;
Expand Down Expand Up @@ -184,6 +184,10 @@ struct AirLoopHVACDOASData : BaseGlobalStruct
std::vector<AirLoopHVACDOAS::AirLoopMixer> airloopMixer;
std::vector<AirLoopHVACDOAS::AirLoopSplitter> airloopSplitter;

void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This hook initializes builtin state, which for schedules includes the AlwaysOn and AlwaysOff schedule objects.

{
}

void init_state([[maybe_unused]] EnergyPlusData &state) override
{
}
Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/AirTerminalUnit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/EnergyPlus.hh>
#include <EnergyPlus/ScheduleManager.hh>

namespace EnergyPlus {

Expand Down Expand Up @@ -108,7 +109,7 @@ protected: // Data
std::string name; // name of unit
std::string unitType; // type of unit = e.g. AirTerminal:SingleDuct:ConstantVolume:FourPipeBeam
int aDUNum = 0; // index of this unit in the corresponding air distribution unit structure
int airAvailSchedNum = 0; // index to schedule for pimary air availability
Sched::Schedule *airAvailSched = nullptr; // schedule for pimary air availability
bool airAvailable = false; // true if primary air is available
Real64 vDotDesignPrimAir = 0.0; // Design primary air volume flow rate m3/s (autosizable)
bool vDotDesignPrimAirWasAutosized = false; // true if user input for design air flow was autsized on input
Expand Down
35 changes: 18 additions & 17 deletions src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "AirflowNetwork/Properties.hpp"
#include <EnergyPlus/DataHVACGlobals.hh>
#include <EnergyPlus/EPVector.hh>
#include <EnergyPlus/ScheduleManager.hh>

namespace EnergyPlus {

Expand Down Expand Up @@ -247,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 @@ -260,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
int VentSchNum; // 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
int VentingSchNum; // 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 All @@ -275,7 +276,7 @@ namespace AirflowNetwork {
// Default Constructor
MultizoneZoneProp()
: VentControl("NoVent"), Height(0.0), OpenFactor(1.0), LowValueTemp(0.0), UpValueTemp(100.0), LowValueEnth(0.0), UpValueEnth(300000.0),
ZoneNum(0), VentSchNum(0), VentCtrNum(VentControlType::None), VentingSchNum(0), SingleSidedCpType("STANDARD"), BuildWidth(10.0),
ZoneNum(0), VentCtrNum(VentControlType::None), SingleSidedCpType("STANDARD"), BuildWidth(10.0),
ASH55PeopleInd(0), CEN15251PeopleInd(0), OccupantVentilationControlNum(0), RAFNNodeNum(0)
{
}
Expand All @@ -298,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 @@ -308,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
int VentSchNum; // 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"
int VentingSchNum; // 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 Expand Up @@ -340,7 +341,7 @@ namespace AirflowNetwork {
MultizoneSurfaceProp()
: Factor(0.0), SurfNum(0), NodeNums{{0, 0}}, OpenFactor(0.0), OpenFactorLast(0.0), EMSOpenFactorActuated(false), EMSOpenFactor(0.0),
Height(0.0), Width(0.0), CHeight(0.0), VentControl("ZONELEVEL"), ModulateFactor(0.0), LowValueTemp(0.0), UpValueTemp(100.0),
LowValueEnth(0.0), UpValueEnth(300000.0), VentSchNum(0), VentSurfCtrNum(VentControlType::None), VentingSchNum(0), ZonePtr(0),
LowValueEnth(0.0), UpValueEnth(300000.0), VentSurfCtrNum(VentControlType::None), ZonePtr(0),
IndVentControl(false), ExtLargeOpeningErrCount(0), ExtLargeOpeningErrIndex(0), OpenFactorErrCount(0), OpenFactorErrIndex(0),
Multiplier(1.0), HybridVentClose(false), HybridCtrlGlobal(false), HybridCtrlMaster(false), WindModifier(1.0),
OccupantVentilationControlNum(0), OpeningStatus(OpenStatus::FreeOperation), PrevOpeningstatus(OpenStatus::FreeOperation),
Expand Down Expand Up @@ -753,7 +754,7 @@ namespace AirflowNetwork {
{
// Members
Real64 FlowRate; // mass flow rate
int SchedPtr; // Schedule pointer
Sched::Schedule *sched = nullptr; // Schedule pointer
Real64 FlowCoef; // Air Mass Flow Coefficient [kg/s at 1Pa]
Real64 FlowExpo; // Air Mass Flow exponent [dimensionless]
Real64 StandardT; // Standard temperature for crack data
Expand All @@ -766,7 +767,7 @@ namespace AirflowNetwork {

// Default Constructor
ZoneExhaustFan()
: FlowRate(0.0), SchedPtr(0), FlowCoef(0.0), FlowExpo(0.0), StandardT(0.0), StandardP(0.0), StandardW(0.0), InletNode(0), OutletNode(0),
: FlowRate(0.0), FlowCoef(0.0), FlowExpo(0.0), StandardT(0.0), StandardP(0.0), StandardW(0.0), InletNode(0), OutletNode(0),
EPlusZoneNum(0), PressCtrlNum(0)
{
}
Expand Down Expand Up @@ -1397,16 +1398,16 @@ namespace AirflowNetwork {
std::string ControlObjectType; // The control type to be used for pressure control
std::string ControlObjectName; // Corresponding control type name
int ControlTypeSet; // Control type set to be used for pressure control
int AvailSchedPtr; // Availability schedule pointer
int PresSetpointSchedPtr; // Pressure setpoint schedule pointer
Sched::Schedule *availSched = nullptr; // Availability schedule pointer
Sched::Schedule *presSetpointSched = nullptr; // Pressure setpoint schedule pointer
int AirLoopNum; // Air loop number
int OANodeNum; // outdoor air node number
bool bypass; // Can not perform pressure control as true
Real64 PresCtrlMassRate;

// Default Constructor
PressureControllerProp()
: ZoneNum(0), AFNNodeNum(0), ControlTypeSet(0), AvailSchedPtr(0), PresSetpointSchedPtr(0), AirLoopNum(0), OANodeNum(0), bypass(false),
: ZoneNum(0), AFNNodeNum(0), ControlTypeSet(0), AirLoopNum(0), OANodeNum(0), bypass(false),
PresCtrlMassRate(0.0)
{
}
Expand All @@ -1415,7 +1416,7 @@ namespace AirflowNetwork {
struct OutdoorAirFan : public AirflowElement // OA fan component
{
// Members
int SchedPtr; // Schedule pointer
Sched::Schedule *sched = nullptr; // Schedule pointer
Real64 FlowCoef; // Air Mass Flow Coefficient [kg/s at 1Pa]
Real64 FlowExpo; // Air Mass Flow exponent [dimensionless]
Real64 StandardT; // Standard temperature for crack data [C]
Expand All @@ -1428,7 +1429,7 @@ namespace AirflowNetwork {

// Default Constructor
OutdoorAirFan()
: SchedPtr(0), FlowCoef(0.0), FlowExpo(0.0), StandardT(0.0), StandardP(0.0), StandardW(0.0), InletNode(0), OutletNode(0), OAMixerNum(0),
: FlowCoef(0.0), FlowExpo(0.0), StandardT(0.0), StandardP(0.0), StandardW(0.0), InletNode(0), OutletNode(0), OAMixerNum(0),
PressCtrlNum(0)
{
}
Expand Down
12 changes: 8 additions & 4 deletions src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ namespace AirflowNetwork {
std::string ComfortHighTempCurveName; // Thermal Comfort High Temperature Curve Name
int ComfortLowTempCurveNum; // Thermal Comfort Low Temperature Curve number
int ComfortHighTempCurveNum; // Thermal Comfort high Temperature Curve number
int OpeningProbSchNum; // Opening probability schedule pointer
int ClosingProbSchNum; // Closing probability schedule pointer
Sched::Schedule *openingProbSched = nullptr; // Opening probability schedule pointer
Sched::Schedule *closingProbSched = nullptr; // Closing probability schedule pointer
Real64 ComfortBouPoint; // Thermal Comfort Temperature Boundary Point
bool OccupancyCheck; // Occupancy check
std::string OpeningProbSchName; // Opening probability schedule name
Expand All @@ -147,8 +147,8 @@ namespace AirflowNetwork {

// Default Constructor
OccupantVentilationControlProp()
: MinOpeningTime(0.0), MinClosingTime(0.0), ComfortLowTempCurveNum(0), ComfortHighTempCurveNum(0), OpeningProbSchNum(0),
ClosingProbSchNum(0), ComfortBouPoint(10.0), OccupancyCheck(false), MaxPPD(10.0), MinTimeControlOnly(false)
: MinOpeningTime(0.0), MinClosingTime(0.0), ComfortLowTempCurveNum(0), ComfortHighTempCurveNum(0),
ComfortBouPoint(10.0), OccupancyCheck(false), MaxPPD(10.0), MinTimeControlOnly(false)
{
}

Expand Down Expand Up @@ -539,6 +539,10 @@ namespace AirflowNetwork {
Array1D<AirflowNetwork::ReliefFlow> DisSysCompReliefAirData;
Array1D<AirflowNetwork::AirflowNetworkLinkageViewFactorProp> AirflowNetworkLinkageViewFactorData;

void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
{
}

void init_state([[maybe_unused]] EnergyPlusData &state) override
{
}
Expand Down
Loading
Loading