Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, 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 PlantManager_hh_INCLUDED
49 : #define PlantManager_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGlobals.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/Plant/DataPlant.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace PlantManager {
66 :
67 : void ManagePlantLoops(EnergyPlusData &state,
68 : bool FirstHVACIteration,
69 : bool &SimAirLoops, // True when the air loops need to be (re)simulated
70 : bool &SimZoneEquipment, // True when zone equipment components need to be (re)simulated
71 : bool &SimNonZoneEquipment, // True when non-zone equipment components need to be (re)simulated
72 : bool &SimPlantLoops, // True when some part of Plant needs to be (re)simulated
73 : bool &SimElecCircuits // True when electric circuits need to be (re)simulated
74 : );
75 :
76 : void GetPlantLoopData(EnergyPlusData &state);
77 :
78 : void GetPlantInput(EnergyPlusData &state);
79 :
80 : void SetupReports(EnergyPlusData &state);
81 :
82 : void InitializeLoops(EnergyPlusData &state, bool FirstHVACIteration); // true if first iteration of the simulation
83 :
84 : void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state);
85 :
86 : void UpdateNodeThermalHistory(EnergyPlusData &state);
87 :
88 : void CheckPlantOnAbort(EnergyPlusData &state);
89 :
90 : void InitOneTimePlantSizingInfo(EnergyPlusData &state, int LoopNum); // loop being initialized for sizing
91 :
92 : void SizePlantLoop(EnergyPlusData &state,
93 : int LoopNum, // Supply side loop being simulated
94 : bool OkayToFinish);
95 :
96 : void ResizePlantLoopLevelSizes(EnergyPlusData &state, int LoopNum);
97 :
98 : void SetupInitialPlantCallingOrder(EnergyPlusData &state);
99 :
100 : void RevisePlantCallingOrder(EnergyPlusData &state);
101 :
102 : int FindLoopSideInCallingOrder(EnergyPlusData &state, int LoopNum, DataPlant::LoopSideLocation LoopSide);
103 :
104 : void SetupBranchControlTypes(EnergyPlusData &state);
105 :
106 : void CheckIfAnyPlant(EnergyPlusData &state);
107 :
108 : void CheckOngoingPlantWarnings(EnergyPlusData &state);
109 :
110 771 : struct EmptyPlantComponent : PlantComponent
111 : {
112 : // this is for purely air side equipment or similar that dont need anything at all done on plant for now
113 : // this could be a placeholder until those components are more integrated with plant side calcs.
114 136582094 : void simulate([[maybe_unused]] EnergyPlusData &state,
115 : [[maybe_unused]] const PlantLocation &calledFromLocation,
116 : [[maybe_unused]] bool FirstHVACIteration,
117 : [[maybe_unused]] Real64 &CurLoad,
118 : [[maybe_unused]] bool RunFlag) override
119 : {
120 : // this is empty on purpose
121 136582094 : }
122 :
123 : void oneTimeInit(EnergyPlusData &state) override;
124 :
125 : void oneTimeInit_new(EnergyPlusData &state) override;
126 : };
127 :
128 : } // namespace PlantManager
129 :
130 1542 : struct PlantMgrData : BaseGlobalStruct
131 : {
132 :
133 : bool GetCompSizFac = true;
134 : bool SupplyEnvrnFlag = true;
135 : bool MySetPointCheckFlag = true;
136 : Array1D_bool PlantLoopSetPointInitFlag;
137 : bool MyEnvrnFlag = true;
138 : int OtherLoopCallingIndex = 0;
139 : int OtherLoopDemandSideCallingIndex = 0;
140 : int NewOtherDemandSideCallingIndex = 0;
141 : int newCallingIndex = 0;
142 : PlantManager::EmptyPlantComponent dummyPlantComponent;
143 :
144 0 : void clear_state() override
145 : {
146 0 : this->GetCompSizFac = true;
147 0 : this->SupplyEnvrnFlag = true;
148 0 : this->MySetPointCheckFlag = true;
149 0 : this->PlantLoopSetPointInitFlag.clear();
150 0 : this->MyEnvrnFlag = true;
151 0 : this->OtherLoopCallingIndex = 0;
152 0 : this->OtherLoopDemandSideCallingIndex = 0;
153 0 : this->NewOtherDemandSideCallingIndex = 0;
154 0 : this->newCallingIndex = 0;
155 0 : this->dummyPlantComponent = {};
156 0 : }
157 : };
158 :
159 : } // namespace EnergyPlus
160 :
161 : #endif
|