Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2025, 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 WindowAC_hh_INCLUDED
49 : #define WindowAC_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 :
59 : namespace EnergyPlus {
60 :
61 : // Forward declarations
62 : struct EnergyPlusData;
63 :
64 : namespace WindowAC {
65 :
66 : struct WindACData
67 : {
68 : // Members
69 : // input data
70 : std::string Name; // name of unit
71 : int UnitType; // type of unit
72 :
73 : Sched::Schedule *availSched = nullptr; // availability schedule
74 : Sched::Schedule *fanOpModeSched = nullptr; // fan operating mode schedule
75 : Sched::Schedule *fanAvailSched = nullptr; // fan availability schedule
76 : Real64 MaxAirVolFlow; // m3/s
77 : Real64 MaxAirMassFlow; // kg/s
78 : Real64 OutAirVolFlow; // m3/s
79 : Real64 OutAirMassFlow; // kg/s
80 : int AirInNode; // inlet air node number
81 : int AirOutNode; // outlet air node number
82 : int OutsideAirNode; // outside air node number
83 : int AirReliefNode; // relief air node number
84 : int ReturnAirNode; // return air node number
85 : int MixedAirNode; // Mixed Air Node number
86 : std::string OAMixName; // name of outdoor air mixer
87 : std::string OAMixType; // type of outdoor air mixer
88 : int OAMixIndex;
89 : std::string FanName; // name of fan
90 : HVAC::FanType fanType; // index to fan type
91 : int FanIndex;
92 : std::string DXCoilName; // name of cooling coil
93 : std::string DXCoilType; // type of cooling coil,Coil:DX:CoolingBypassFactorEmpirical or
94 : // 'CoilSystem:Cooling:DX:HeatExchangerAssisted'
95 : int DXCoilType_Num; // Numeric Equivalent for DXCoil Type
96 : int DXCoilIndex; // Index to DX cooling coil
97 : int DXCoilNumOfSpeeds; // number of speed levels for variable speed DX coil
98 : int CoilOutletNodeNum; // Outlet node number of DX cooling coil
99 : HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // mode of operation; 1=cycling fan, cycling compressor,
100 : // 2=continuous fan, cycling compresor
101 : HVAC::FanPlace fanPlace; // fan placement; 1=blow through, 2=draw through
102 : int MaxIterIndex1;
103 : int MaxIterIndex2;
104 : Real64 ConvergenceTol; // Convergence tolerance, fraction (ZoneLoad - Equip Output)/ZoneLoad
105 : // Calc data
106 : Real64 PartLoadFrac; // part load fraction for the unit
107 : bool EMSOverridePartLoadFrac;
108 : Real64 EMSValueForPartLoadFrac;
109 : // Report data
110 : Real64 TotCoolEnergyRate; // total cooling output [W]
111 : Real64 TotCoolEnergy; // total cooling output [J]
112 : Real64 SensCoolEnergyRate; // sensible cooling output [W]
113 : Real64 SensCoolEnergy; // sensible cooling output [J]
114 : Real64 LatCoolEnergyRate; // sensible cooling output [W]
115 : Real64 LatCoolEnergy; // sensible cooling output [J]
116 : Real64 ElecPower; // electricity consumed [W]
117 : Real64 ElecConsumption; // electricity consumed [J]
118 : Real64 FanPartLoadRatio; // fan part-load ratio for time step
119 : Real64 CompPartLoadRatio; // compressor part-load ratio for time step
120 : std::string AvailManagerListName; // Name of an availability manager list object
121 : Avail::Status availStatus = Avail::Status::NoAction;
122 : int ZonePtr; // pointer to a zone served by a Window AC unit
123 : int HVACSizingIndex; // index of a HVACSizing object for a Window AC unit
124 : bool FirstPass; // detects first time through for resetting sizing data
125 :
126 : // Default Constructor
127 7 : WindACData()
128 14 : : UnitType(0), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), OutAirVolFlow(0.0), OutAirMassFlow(0.0), AirInNode(0), AirOutNode(0),
129 28 : OutsideAirNode(0), AirReliefNode(0), MixedAirNode(0), OAMixIndex(0), fanType(HVAC::FanType::Invalid), FanIndex(0), DXCoilType_Num(0),
130 7 : DXCoilIndex(0), DXCoilNumOfSpeeds(0), CoilOutletNodeNum(0), fanPlace(HVAC::FanPlace::Invalid), MaxIterIndex1(0), MaxIterIndex2(0),
131 7 : ConvergenceTol(0.0), PartLoadFrac(0.0), EMSOverridePartLoadFrac(false), EMSValueForPartLoadFrac(0.0), TotCoolEnergyRate(0.0),
132 7 : TotCoolEnergy(0.0), SensCoolEnergyRate(0.0), SensCoolEnergy(0.0), LatCoolEnergyRate(0.0), LatCoolEnergy(0.0), ElecPower(0.0),
133 7 : ElecConsumption(0.0), FanPartLoadRatio(0.0), CompPartLoadRatio(0.0), ZonePtr(0), HVACSizingIndex(0), FirstPass(true)
134 : {
135 7 : }
136 : };
137 :
138 : struct WindACNumericFieldData
139 : {
140 : // Members
141 : Array1D_string FieldNames;
142 :
143 : // Default Constructor
144 4 : WindACNumericFieldData()
145 4 : {
146 4 : }
147 : };
148 :
149 : // Functions
150 :
151 : void SimWindowAC(EnergyPlusData &state,
152 : std::string_view CompName, // name of the window AC unit
153 : int const ZoneNum, // number of zone being served
154 : bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
155 : Real64 &PowerMet, // Sensible power supplied by window AC (W)
156 : Real64 &LatOutputProvided, // Latent add/removal supplied by window AC (kg/s), dehumid = negative
157 : int &CompIndex // component index
158 : );
159 :
160 : void GetWindowAC(EnergyPlusData &state);
161 :
162 : void InitWindowAC(EnergyPlusData &state,
163 : int const WindACNum, // number of the current window AC unit being simulated
164 : Real64 &QZnReq, // zone load (modified as needed) (W)
165 : int const ZoneNum, // index to zone
166 : bool const FirstHVACIteration // TRUE when first HVAC iteration
167 : );
168 :
169 : void SizeWindowAC(EnergyPlusData &state, int const WindACNum);
170 :
171 : void SimCyclingWindowAC(EnergyPlusData &state,
172 : int const WindACNum, // number of the current window AC unit being simulated
173 : int const ZoneNum, // number of zone being served !unused1208
174 : bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
175 : Real64 &PowerMet, // Sensible power supplied (W)
176 : Real64 const QZnReq, // Sensible load to be met (W)
177 : Real64 &LatOutputProvided // Latent power supplied (kg/s), negative = dehumidification
178 : );
179 :
180 : void ReportWindowAC(EnergyPlusData &state, int const WindACNum); // number of the current AC unit being simulated
181 :
182 : void CalcWindowACOutput(EnergyPlusData &state,
183 : int const WindACNum, // Unit index in fan coil array
184 : bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step
185 : HVAC::FanOp const fanOp, // operating mode: FanOp::Cycling | FanOp::Continuous
186 : Real64 const PartLoadFrac, // unit part load fraction
187 : bool const HXUnitOn, // Flag to toggle HX heat recovery as needed
188 : Real64 &LoadMet // load met by unit (watts)
189 : );
190 :
191 : void ControlCycWindACOutput(EnergyPlusData &state,
192 : int const WindACNum, // Unit index in fan coil array
193 : bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step
194 : HVAC::FanOp const fanOp, // operating mode: FanOp::Cycling | FanOp::Continuous
195 : Real64 const QZnReq, // cooling output needed by zone [W]
196 : Real64 &PartLoadFrac, // unit part load fraction
197 : bool &HXUnitOn // Used to control HX heat recovery as needed
198 : );
199 :
200 : bool getWindowACNodeNumber(EnergyPlusData &state, int const WindACNum);
201 :
202 : int GetWindowACZoneInletAirNode(EnergyPlusData &state, int const WindACNum);
203 :
204 : int GetWindowACOutAirNode(EnergyPlusData &state, int const WindACNum);
205 :
206 : int GetWindowACReturnAirNode(EnergyPlusData &state, int const WindACNum);
207 :
208 : int GetWindowACMixedAirNode(EnergyPlusData &state, int const WindACNum);
209 :
210 : int getWindowACIndex(EnergyPlusData &state, std::string_view CompName);
211 :
212 : } // namespace WindowAC
213 :
214 : struct WindowACData : BaseGlobalStruct
215 : {
216 :
217 : // MODULE PARAMETER DEFINITIONS
218 : int const WindowAC_UnitType;
219 : std::string const cWindowAC_UnitType;
220 : Array1D_string const cWindowAC_UnitTypes;
221 :
222 : bool MyOneTimeFlag;
223 : bool ZoneEquipmentListChecked;
224 :
225 : int NumWindAC;
226 : int NumWindACCyc;
227 : Array1D_bool MySizeFlag;
228 : bool GetWindowACInputFlag; // First time, input is "gotten"
229 : bool CoolingLoad; // defines a cooling load
230 : Array1D_bool CheckEquipName;
231 : // Object Data
232 : Array1D<WindowAC::WindACData> WindAC;
233 : Array1D<WindowAC::WindACNumericFieldData> WindACNumericFields; // holds window AC numeric input fields character field name
234 :
235 : Array1D_bool MyEnvrnFlag; // one time initialization flag
236 : Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers
237 :
238 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
239 : {
240 2126 : }
241 :
242 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
243 : {
244 1152 : }
245 :
246 2100 : void clear_state() override
247 : {
248 2100 : this->NumWindAC = 0;
249 2100 : this->NumWindACCyc = 0;
250 2100 : this->GetWindowACInputFlag = true;
251 2100 : this->CoolingLoad = false;
252 2100 : this->MyOneTimeFlag = true;
253 2100 : this->ZoneEquipmentListChecked = false;
254 2100 : this->MySizeFlag.deallocate();
255 2100 : this->CheckEquipName.deallocate();
256 2100 : this->WindAC.deallocate();
257 2100 : this->WindACNumericFields.deallocate();
258 2100 : this->MyEnvrnFlag.deallocate();
259 2100 : this->MyZoneEqFlag.deallocate();
260 2100 : }
261 :
262 : // Default Constructor
263 2129 : WindowACData()
264 4258 : : WindowAC_UnitType(1), cWindowAC_UnitType("ZoneHVAC:WindowAirConditioner"), cWindowAC_UnitTypes(1, cWindowAC_UnitType), MyOneTimeFlag(true),
265 4258 : ZoneEquipmentListChecked(false), NumWindAC(0), NumWindACCyc(0), GetWindowACInputFlag(true), CoolingLoad(false)
266 : {
267 2129 : }
268 : };
269 :
270 : } // namespace EnergyPlus
271 :
272 : #endif
|