Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : #ifndef PlantOperationEquipAndOperations_hh_INCLUDED
49 : #define PlantOperationEquipAndOperations_hh_INCLUDED
50 :
51 : #include <EnergyPlus/Plant/Enums.hh>
52 : #include <EnergyPlus/Plant/PlantLocation.hh>
53 : #include <EnergyPlus/PlantComponent.hh>
54 : #include <EnergyPlus/PlantLoopHeatPumpEIR.hh>
55 : #include <ObjexxFCL/Array1D.hh>
56 :
57 : namespace EnergyPlus::DataPlant {
58 :
59 : struct EquipListPtrData
60 : {
61 : // Members
62 : int ListPtr; // points to List on OpScheme on plant loop:
63 : int CompPtr; // points to this component on List on OpScheme on plant loop:
64 :
65 : // Default Constructor
66 1633 : EquipListPtrData() : ListPtr(0), CompPtr(0)
67 : {
68 1633 : }
69 : };
70 :
71 : struct OpSchemePtrData
72 : {
73 : // Members
74 : int OpSchemePtr; // points to OpScheme on plant loop:
75 : int NumEquipLists; // ALLOCATABLE to the schedule (for valid schedules)
76 : Array1D<EquipListPtrData> EquipList; // Component list
77 :
78 : // Default Constructor
79 1569 : OpSchemePtrData() : OpSchemePtr(0), NumEquipLists(0)
80 : {
81 1569 : }
82 : };
83 :
84 : struct EquipListCompData
85 : {
86 : // Members
87 : std::string Name; // The name of each item in the list
88 : std::string TypeOf; // The name of each item in the list
89 : DataPlant::CtrlType CtrlType; // CoolingOp, HeatingOp, DualOp
90 : int LoopNumPtr; // pointer to the comp location in the data structure
91 : DataPlant::LoopSideLocation LoopSideNumPtr; // pointer to the comp location in the data structure
92 : int BranchNumPtr; // pointer to the comp location in the data structure
93 : int CompNumPtr; // pointer to the comp location in the data structure
94 : Real64 SetPointFlowRate; // COMP SETPOINT CTRL ONLY--load calculation comp flow rate
95 : bool SetPointFlowRateWasAutosized; // true if comp setpoint control flow rate was autosize on input (not used)
96 : std::string DemandNodeName; // COMP SETPOINT CTRL ONLY--The name of each item in the list
97 : int DemandNodeNum; // COMP SETPOINT CTRL ONLY--The 'keyWord' identifying each item in list
98 : std::string SetPointNodeName; // COMP SETPOINT CTRL ONLY--The name of each item in the list
99 : int SetPointNodeNum; // COMP SETPOINT CTRL ONLY--The 'keyWord' identifying each item in list
100 : Real64 EMSIntVarRemainingLoadValue; // EMS internal variable remaining load, neg cooling [W]
101 : Real64 EMSActuatorDispatchedLoadValue; // EMS actuator for dispatched load, neg= cooling [W]
102 :
103 : // Default Constructor
104 1429 : EquipListCompData()
105 2858 : : CtrlType(DataPlant::CtrlType::Invalid), LoopNumPtr(0), LoopSideNumPtr(DataPlant::LoopSideLocation::Invalid), BranchNumPtr(0), CompNumPtr(0),
106 4287 : SetPointFlowRate(0.0), SetPointFlowRateWasAutosized(false), DemandNodeNum(0), SetPointNodeNum(0), EMSIntVarRemainingLoadValue(0.0),
107 1429 : EMSActuatorDispatchedLoadValue(0.0)
108 : {
109 1429 : }
110 : };
111 :
112 : struct EquipOpList
113 : {
114 : // Members
115 : std::string Name; // The name of each item in the list
116 : Real64 RangeUpperLimit; // for range based controls
117 : Real64 RangeLowerLimit; // for range based controls
118 : int NumComps; // ALLOCATABLE to the schedule (for valid schedules)
119 : Array1D<EquipListCompData> Comp; // Component type list
120 :
121 : // Default Constructor
122 1269 : EquipOpList() : RangeUpperLimit(0.0), RangeLowerLimit(0.0), NumComps(0)
123 : {
124 1269 : }
125 : };
126 :
127 : struct TempSetpoint
128 : {
129 : Real64 PrimCW = 0.0; // Chilled water setpoint for primary plant loop
130 : Real64 SecCW = 0.0; // Chilled water setpoint for secondary/distribution plant loop
131 : Real64 PrimHW_High = 0.0; // Hot water primary plant setpoint at High Outdoor Air Temperature, or higher, Deg. C
132 : Real64 PrimHW_Low = 0.0; // Hot water primary plant setpoint at Low Outdoor Air Temperature, or Lower, Deg. C
133 : Real64 SecHW = 0.0; // hot water setpoint for secondary/distribution plant loop
134 : Real64 PrimHW_BackupLow = -999.0; // optional hot water setpoint at Backup Low Outdoor Air Temperature, or lower, Deg. C
135 : };
136 :
137 : struct TempResetData
138 : {
139 : Real64 HighOutdoorTemp = 0.0;
140 : Real64 LowOutdoorTemp = 0.0;
141 : Real64 BackupLowOutdoorTemp = -999.0; // optional back up low outdoor air temperature, Deg.C
142 : Real64 BoilerTemperatureOffset = 0.0;
143 : };
144 :
145 : struct PlantOpsData
146 : {
147 : int NumOfZones = 0; // Number of zones in the list
148 : int NumOfAirLoops = 0; // number of air loops
149 : int numPlantLoadProfiles = 0; // number of load profiles
150 : int numBoilers = 0; // number of boilers
151 : int numPlantHXs = 0; // number of fluid to fluid heat exchangers
152 : int NumHeatingOnlyEquipLists = 0;
153 : int NumCoolingOnlyEquipLists = 0;
154 : int NumSimultHeatCoolHeatingEquipLists = 0;
155 : int NumSimultHeatCoolCoolingEquipLists = 0;
156 : int EquipListNumForLastCoolingOnlyStage = 0;
157 : int EquipListNumForLastHeatingOnlyStage = 0;
158 : int EquipListNumForLastSimultHeatCoolCoolingStage = 0;
159 : int EquipListNumForLastSimultHeatCoolHeatingStage = 0;
160 : bool SimultHeatCoolOpAvailable = false;
161 : bool SimultHeatCoolHeatingOpInput = false;
162 : bool SimulHeatCoolCoolingOpInput = false;
163 : bool DedicatedHR_ChWRetControl_Input = false;
164 : bool DedicatedHR_HWRetControl_Input = false;
165 : bool DedicatedHR_Present = false;
166 : Real64 DedicatedHR_SecChW_DesignCapacity = 0.0; // design (sizing) capacity for cooling side of dedicated heat recovery WWHP, Watts
167 : Real64 DedicatedHR_SecChW_CurrentCapacity = 0.0; // current capacity for cooling side of dedicated heat recovery WWHP, Watts
168 : Real64 DedicatedHR_SecHW_DesignCapacity = 0.0; // design (sizing) capacity for heating side of dedicated heat recovery WWHP, Watts
169 : Real64 DedicatedHR_SecHW_CurrentCapacity = 0.0; // current capacity for heating side of dedicated heat recovery WWHP, Watts
170 : // Real64 DedicatedHR_CapacityControlFactor = 0.0;
171 : bool AirSourcePlantHeatingOnly = false; // operation mode, if true primary plant appears to only need heating
172 : bool AirSourcePlantCoolingOnly = false; // operation mode, if true primary plant appears to only need cooling
173 : bool AirSourcePlantSimultaneousHeatingAndCooling = false; // operation mode, if true primary plant appears to need both heating and cooling
174 : bool SimultaneousHeatingCoolingWithCoolingDominant = false; //
175 : bool SimultaneousHeatingCoolingWithHeatingDominant = false;
176 : int PrimaryHWLoopIndex = 0;
177 : int PrimaryHWLoopSupInletNode = 0;
178 : int PrimaryChWLoopIndex = 0;
179 : int PrimaryChWLoopSupInletNode = 0;
180 : int SecondaryHWLoopIndex = 0;
181 : int SecondaryChWLoopIndex = 0;
182 : };
183 :
184 : struct ReportData
185 : {
186 : int AirSourcePlant_OpMode = 0; // heating only = 1, cooling only = 2, simult heat cool = 3
187 : int DedicHR_OpMode = 0; // not dispatched = 0, heating led = 1, cooling led = 2
188 : int BoilerAux_OpMode = 0; // not Dispatched = 0, Boiler(s) On = 1
189 : Real64 BuildingPolledHeatingLoad = 0.0; // current building heating loads from predicted sensible zone loads, air system ventilation loads, and
190 : // any plant load profile process laods
191 : Real64 BuildingPolledCoolingLoad = 0.0; // current building Cooling loads from predicted sensible zone loads, air system ventilation loads, and
192 : // any plant load profile process laods
193 : Real64 PrimaryPlantHeatingLoad = 0.0; // current apparent plant load on primary hot water plant served by heatpumps
194 : Real64 PrimaryPlantCoolingLoad = 0.0; // current apparent plant load on primary chilled water plant served by heatpumps
195 : Real64 SecondaryPlantHeatingLoad = 0.0; // current apparent plant load on secondary hot water plant served by heatpumps
196 : Real64 SecondaryPlantCoolingLoad = 0.0; // current apparent plant load on secondary chilled water plant served by heatpumps
197 : };
198 :
199 : struct ChillerHeaterSupervisoryOperationData
200 : // Custom supervisory plant operation scheme, control dispatch across a set of related set of plant loops
201 : // For two-pipe chiller heater. 1..N chiller heater, 1..M chiller only.
202 : // poll zone list to decide mode between chiller only, heater only, or simultaneous
203 :
204 : {
205 : // get rid of these strings if possible
206 : std::string Name;
207 : std::string TypeOf;
208 : std::string ZoneListName;
209 : std::string DedicatedHR_ChWRetControl_Name;
210 : std::string DedicatedHR_HWRetControl_Name;
211 :
212 : bool oneTimeSetupComplete = false;
213 : bool needsSimulation = false;
214 : DataPlant::OpScheme Type = DataPlant::OpScheme::Invalid; // Op scheme type (from keyword)
215 :
216 : TempSetpoint Setpoint;
217 : TempResetData TempReset;
218 : PlantOpsData PlantOps;
219 : Array1D_int ZonePtrs;
220 : Array1D_int AirLoopPtrs;
221 : Array1D<EquipOpList> HeatingOnlyEquipList;
222 : Array1D<EquipOpList> CoolingOnlyEquipList;
223 : Array1D<EquipOpList> SimultHeatCoolHeatingEquipList;
224 : Array1D<EquipOpList> SimultHeatCoolCoolingEquipList;
225 : EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump DedicatedHR_CoolingPLHP; // real pointer to the cooling side of dedicated heat recovery WWHP
226 : EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump DedicatedHR_HeatingPLHP; // real pointer to the heating side of dedicated heat recory WWHP
227 : Array1D<int> PlantLoopIndicesBeingSupervised; // if non zero then points to index of a plant loop that has this supervisory scheme as its
228 : // operation scheme
229 : Array1D<int> SecondaryPlantLoopIndicesBeingSupervised; // if not zero then points to index of a plant loop that is treated as being a
230 : // seconday loop, as in primary secondary distribution plant configurations.
231 : Array1D<PlantLocation> PlantLoadProfileComps; // LoadProfile:Plant objects that may be loading loop
232 : Array1D<PlantLocation> PlantBoilerComps; // Boilers that may need to be managed.
233 : Array1D<PlantLocation>
234 : PlantHXComps; // fluid to fluid heat exchangers that may need to be managed, these are HX connection on a supply side of a loop.
235 : ReportData Report;
236 :
237 : void OneTimeInitChillerHeaterChangeoverOpScheme(EnergyPlusData &state);
238 :
239 : void EvaluateChillerHeaterChangeoverOpScheme(EnergyPlusData &state);
240 :
241 : void DetermineCurrentBuildingLoads(EnergyPlusData &state);
242 :
243 : void DetermineCurrentPlantLoads(EnergyPlusData &state);
244 :
245 : void ProcessSupervisoryControlLogicForAirSourcePlants(EnergyPlusData &state);
246 :
247 : void InitAirSourcePlantEquipmentOff(EnergyPlusData &state);
248 :
249 : void ProcessAndSetAirSourcePlantEquipLists(EnergyPlusData &state);
250 :
251 : void ProcessAndSetDedicatedHeatRecovWWHP(EnergyPlusData &state);
252 :
253 : void ProcessAndSetAuxilBoiler(EnergyPlusData &state);
254 :
255 : Real64 DetermineHWSetpointOARest(EnergyPlusData &state);
256 : };
257 :
258 : struct OperationData
259 : {
260 : // Members
261 : std::string Name; // The name of each item in the list
262 : std::string TypeOf; // The 'keyWord' identifying each item in the list
263 : DataPlant::OpScheme Type; // Op scheme type (from keyword)
264 : std::string Sched; // The name of the schedule associated with the list
265 : int SchedPtr; // ALLOCATABLE to the schedule (for valid schedules)
266 : bool Available; // TRUE = designated component or operation scheme available
267 : int NumEquipLists; // number of equipment lists
268 : int CurListPtr; // points to the current equipment list
269 : Array1D<EquipOpList> EquipList; // Component type list
270 : int EquipListNumForLastStage; // points to the equipment list with the highest upper limit
271 : std::string ReferenceNodeName; // DELTA CTRL ONLY--for calculation of delta Temp
272 : int ReferenceNodeNumber; // DELTA CTRL ONLY--for calculation of delta Temp
273 : int ErlSimProgramMngr; // EMS:ProgramManager to always run when this model is called
274 : int ErlInitProgramMngr; // EMS:ProgramManager to run when this model is initialized and setup
275 : int initPluginLocation; // If Python Plugins are used to init this, this defines the location in the plugin structure
276 : int simPluginLocation; // If Python Plugins are used to simulate this, this defines the location in the plugin structure
277 : Real64 EMSIntVarLoopDemandRate; // EMS internal variable for loop-level demand rate, neg cooling [W]
278 : bool MyEnvrnFlag;
279 : ChillerHeaterSupervisoryOperationData *ChillerHeaterSupervisoryOperation = nullptr;
280 :
281 : // Default Constructor
282 1147 : OperationData()
283 4588 : : Type(DataPlant::OpScheme::Invalid), SchedPtr(0), Available(false), NumEquipLists(0), CurListPtr(0), EquipListNumForLastStage(0),
284 1147 : ReferenceNodeNumber(0), ErlSimProgramMngr(0), ErlInitProgramMngr(0), initPluginLocation(-1), simPluginLocation(-1),
285 1147 : EMSIntVarLoopDemandRate(0.0), MyEnvrnFlag(true)
286 : {
287 1147 : }
288 : };
289 : } // namespace EnergyPlus::DataPlant
290 :
291 : #endif
|