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 ENERGYPLUS_AIRLOOPHVACDOAS_HH
49 : #define ENERGYPLUS_AIRLOOPHVACDOAS_HH
50 :
51 : // C++ Headers
52 : #include <string>
53 : #include <vector>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/EPVector.hh>
58 : #include <EnergyPlus/EnergyPlus.hh>
59 : #include <EnergyPlus/Plant/Enums.hh>
60 : #include <EnergyPlus/Plant/PlantLocation.hh>
61 : #include <EnergyPlus/SimAirServingZones.hh>
62 :
63 : namespace EnergyPlus {
64 :
65 : // Forward declarations
66 : struct EnergyPlusData;
67 :
68 : namespace AirLoopHVACDOAS {
69 :
70 : void CheckConvergence(EnergyPlusData &state);
71 :
72 6 : struct AirLoopMixer
73 : {
74 : std::string name;
75 : static AirLoopMixer *factory(EnergyPlusData &state, int object_type_of_num, std::string const &objectName);
76 : int numOfInletNodes = 0;
77 : int m_AirLoopMixer_Num = 0;
78 : int OutletNodeNum = 0;
79 : std::string OutletNodeName;
80 : std::vector<std::string> InletNodeName;
81 : std::vector<int> InletNodeNum;
82 : Real64 OutletTemp = 0.0;
83 :
84 : static void getAirLoopMixer(EnergyPlusData &state);
85 : void CalcAirLoopMixer(EnergyPlusData &state);
86 : };
87 :
88 6 : struct AirLoopSplitter
89 : {
90 : std::string name;
91 : static AirLoopSplitter *factory(EnergyPlusData &state, int object_type_of_num, std::string const &objectName);
92 : int numOfOutletNodes = 0;
93 : int m_AirLoopSplitter_Num = 0;
94 : std::string InletNodeName;
95 : std::vector<std::string> OutletNodeName;
96 : std::vector<int> OutletNodeNum;
97 : Real64 InletTemp = 0.0;
98 :
99 : static void getAirLoopSplitter(EnergyPlusData &state);
100 : void CalcAirLoopSplitter(EnergyPlusData &state, Real64 Temp, Real64 Humrat);
101 : };
102 :
103 146 : struct AirLoopDOAS
104 : {
105 : // friend class AirLoopMixer and AirLoopSplitter;
106 : Real64 SumMassFlowRate = 0.0;
107 : Real64 PreheatTemp = -999.0;
108 : Real64 PrecoolTemp = -999.0;
109 : Real64 PreheatHumRat = -999.0;
110 : Real64 PrecoolHumRat = -999.0;
111 : Real64 SizingMassFlow = 0.0;
112 : Real64 SizingCoolOATemp = -999.0;
113 : Real64 SizingCoolOAHumRat = -999.0;
114 : Real64 HeatOutTemp = 999.0; // outdoor air temperature for heating sizing calculation
115 : Real64 HeatOutHumRat = 999.0; // outdoor air humidity ratio for heating sizing calculation
116 :
117 : int m_AirLoopDOASNum = 0;
118 : int m_OASystemNum = 0;
119 : int m_AvailManagerSchedPtr = 0;
120 : int m_AirLoopMixerIndex = -1;
121 : int m_AirLoopSplitterIndex = -1;
122 : int NumOfAirLoops = 0;
123 : int m_InletNodeNum = 0;
124 : int m_OutletNodeNum = 0;
125 : int m_FanIndex = -1;
126 : int m_FanInletNodeNum = 0;
127 : int m_FanOutletNodeNum = 0;
128 : SimAirServingZones::CompType m_FanTypeNum = SimAirServingZones::CompType::Invalid;
129 : int m_HeatCoilNum = 0;
130 : int m_CoolCoilNum = 0;
131 : int ConveCount = 0;
132 : int ConveIndex = 0;
133 :
134 : bool m_HeatExchangerFlag = false;
135 : bool SizingOnceFlag = true;
136 : bool FanBeforeCoolingCoilFlag = false;
137 :
138 : AirLoopMixer *m_CompPointerAirLoopMixer = nullptr;
139 : AirLoopSplitter *m_CompPointerAirLoopSplitter = nullptr;
140 :
141 : std::string Name;
142 : std::string AvailManagerSchedName;
143 : std::string OASystemName;
144 : std::string AirLoopMixerName;
145 : std::string AirLoopSplitterName;
146 : std::string FanName;
147 :
148 : std::vector<int> m_AirLoopNum; // array of AirLoop number
149 : std::vector<std::string> AirLoopName;
150 : std::vector<int> m_OACtrlNum; // array of OA controller number
151 :
152 : PlantLocation HWPlantLoc;
153 : int HWCtrlNodeNum = 0;
154 : PlantLocation CWPlantLoc;
155 : int CWCtrlNodeNum = 0;
156 : bool MyEnvrnFlag = true;
157 :
158 : static void getAirLoopDOASInput(EnergyPlusData &state);
159 :
160 : void SimAirLoopHVACDOAS(EnergyPlusData &state, bool firstHVACIteration, int &CompIndex);
161 :
162 : void initAirLoopDOAS(EnergyPlusData &state, bool FirstHVACIteration);
163 :
164 : void CalcAirLoopDOAS(EnergyPlusData &state, bool FirstHVACIteration);
165 :
166 : void SizingAirLoopDOAS(EnergyPlusData &state);
167 :
168 : void GetDesignDayConditions(EnergyPlusData &state);
169 : };
170 :
171 : int getAirLoopMixerIndex(EnergyPlusData &state, std::string const &objectName);
172 : int getAirLoopSplitterIndex(EnergyPlusData &state, std::string const &objectName);
173 : void getAirLoopHVACDOASInput(EnergyPlusData &state);
174 :
175 : } // namespace AirLoopHVACDOAS
176 :
177 1542 : struct AirLoopHVACDOASData : BaseGlobalStruct
178 : {
179 : bool GetInputOnceFlag = true;
180 : bool getAirLoopMixerInputOnceFlag = true;
181 : bool getAirLoopSplitterInputOnceFlag = true;
182 : std::vector<AirLoopHVACDOAS::AirLoopDOAS> airloopDOAS;
183 : std::vector<AirLoopHVACDOAS::AirLoopMixer> airloopMixer;
184 : std::vector<AirLoopHVACDOAS::AirLoopSplitter> airloopSplitter;
185 0 : void clear_state() override
186 : {
187 0 : *this = AirLoopHVACDOASData();
188 0 : }
189 : };
190 :
191 : } // namespace EnergyPlus
192 : #endif // ENERGYPLUS_AIRLOOPHVACDOAS_HH
|