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 HVACHXAssistedCoolingCoil_hh_INCLUDED
49 : #define HVACHXAssistedCoolingCoil_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Optional.hh>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/DataGlobals.hh>
58 : #include <EnergyPlus/EnergyPlus.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace HVACHXAssistedCoolingCoil {
66 :
67 : struct HXAssistedCoilParameters
68 : {
69 : // Members
70 : std::string HXAssistedCoilType; // Type of HXAssistedCoolingCoil
71 : int HXAssistedCoilType_Num; // Numeric equivalent for hx assisted coil
72 : std::string Name; // Name of the HXAssistedCoolingCoil
73 : std::string CoolingCoilType; // Cooling coil type must be DetailedFlatCooling
74 : // or Coil:DX:CoolingBypassFactorEmpirical
75 : int CoolingCoilType_Num; // Numeric Equivalent for cooling coil
76 : std::string CoolingCoilName; // Cooling coil name
77 : int CoolingCoilIndex;
78 : int DXCoilNumOfSpeeds; // number of speed levels for variable speed DX coil
79 : // Heat Exchanger type must be HeatExchanger:AirToAir:FlatPlate,
80 : // HeatExchanger:AirToAir:SensibleAndLatent or
81 : // HeatExchanger:Desiccant:BalancedFlow
82 : HVAC::HXType hxType = HVAC::HXType::Invalid; // Numeric Equivalent for heat exchanger
83 : std::string HeatExchangerName; // Heat Exchanger name
84 : int HeatExchangerIndex; // Heat Exchanger index
85 : int HXAssistedCoilInletNodeNum; // Inlet node to HXAssistedCoolingCoil compound object
86 : int HXAssistedCoilOutletNodeNum; // Outlet node to HXAssistedCoolingCoil compound object
87 : int HXExhaustAirInletNodeNum; // Inlet node number for air-to-air heat exchanger
88 : Real64 MassFlowRate; // Mass flow rate through HXAssistedCoolingCoil compound object
89 : int MaxIterCounter; // used in warning messages
90 : int MaxIterIndex; // used in warning messages
91 : int ControllerIndex; // index to water coil controller
92 : std::string ControllerName; // name of water coil controller
93 :
94 : // Default Constructor
95 4 : HXAssistedCoilParameters()
96 20 : : HXAssistedCoilType_Num(0), CoolingCoilType_Num(0), CoolingCoilIndex(0), DXCoilNumOfSpeeds(0), HeatExchangerIndex(0),
97 4 : HXAssistedCoilInletNodeNum(0), HXAssistedCoilOutletNodeNum(0), HXExhaustAirInletNodeNum(0), MassFlowRate(0.0), MaxIterCounter(0),
98 4 : MaxIterIndex(0), ControllerIndex(0)
99 : {
100 4 : }
101 : };
102 :
103 : void
104 : SimHXAssistedCoolingCoil(EnergyPlusData &state,
105 : std::string_view HXAssistedCoilName, // Name of HXAssistedCoolingCoil
106 : bool const FirstHVACIteration, // FirstHVACIteration flag
107 : HVAC::CompressorOp compressorOp, // compressor operation; 1=on, 0=off
108 : Real64 const PartLoadRatio, // Part load ratio of Coil:DX:CoolingBypassFactorEmpirical
109 : int &CompIndex,
110 : HVAC::FanOp const fanOp, // Allows the parent object to control fan operation
111 : ObjexxFCL::Optional_bool_const HXUnitEnable = _, // flag to enable heat exchanger heat recovery
112 : ObjexxFCL::Optional<Real64 const> OnOffAFR = _, // Ratio of compressor ON air mass flow rate to AVERAGE over time step
113 : ObjexxFCL::Optional_bool_const EconomizerFlag = _, // OA sys or air loop economizer status
114 : ObjexxFCL::Optional<Real64> QTotOut = _, // the total cooling output of unit
115 : ObjexxFCL::Optional<HVAC::CoilMode const> DehumidificationMode = _, // Optional dehumbidication mode
116 : ObjexxFCL::Optional<Real64 const> LoadSHR = _ // Optional coil SHR pass over
117 : );
118 :
119 : void GetHXAssistedCoolingCoilInput(EnergyPlusData &state);
120 :
121 : void InitHXAssistedCoolingCoil(EnergyPlusData &state, int const HXAssistedCoilNum); // index for HXAssistedCoolingCoil
122 :
123 : void
124 : CalcHXAssistedCoolingCoil(EnergyPlusData &state,
125 : int const HXAssistedCoilNum, // Index number for HXAssistedCoolingCoil
126 : bool const FirstHVACIteration, // FirstHVACIteration flag
127 : HVAC::CompressorOp compressorOp, // compressor operation; 1=on, 0=off
128 : Real64 const PartLoadRatio, // Cooling coil part load ratio
129 : bool const HXUnitOn, // Flag to enable heat exchanger
130 : HVAC::FanOp const fanOp, // Allows parent object to control fan operation
131 : ObjexxFCL::Optional<Real64 const> OnOffAirFlow = _, // Ratio of compressor ON air mass flow to AVERAGE over time step
132 : ObjexxFCL::Optional_bool_const EconomizerFlag = _, // OA (or airloop) econommizer status
133 : ObjexxFCL::Optional<HVAC::CoilMode const> DehumidificationMode = _, // Optional dehumbidication mode
134 : [[maybe_unused]] ObjexxFCL::Optional<Real64 const> LoadSHR = _ // Optional coil SHR pass over
135 : );
136 :
137 : void GetHXDXCoilIndex(EnergyPlusData &state,
138 : std::string const &HXDXCoilName,
139 : int &HXDXCoilIndex,
140 : bool &ErrorsFound,
141 : std::string_view const CurrentModuleObject = {});
142 :
143 : void CheckHXAssistedCoolingCoilSchedule(EnergyPlusData &state,
144 : std::string const &CompType, // unused1208
145 : std::string_view CompName,
146 : Real64 &Value,
147 : int &CompIndex);
148 :
149 : Real64 GetCoilCapacity(EnergyPlusData &state,
150 : std::string const &CoilType, // must match coil types in this module
151 : std::string const &CoilName, // must match coil names for the coil type
152 : bool &ErrorsFound // set to true if problem
153 : );
154 :
155 : int GetCoilGroupTypeNum(EnergyPlusData &state,
156 : std::string const &CoilType, // must match coil types in this module
157 : std::string const &CoilName, // must match coil names for the coil type
158 : bool &ErrorsFound, // set to true if problem
159 : bool const PrintWarning = true // prints warning message if true
160 : );
161 :
162 : int GetCoilObjectTypeNum(EnergyPlusData &state,
163 : std::string const &CoilType, // must match coil types in this module
164 : std::string const &CoilName, // must match coil names for the coil type
165 : bool &ErrorsFound, // set to true if problem
166 : bool const PrintWarning = true // prints warning message if true
167 : );
168 :
169 : int GetCoilInletNode(EnergyPlusData &state,
170 : std::string_view CoilType, // must match coil types in this module
171 : std::string const &CoilName, // must match coil names for the coil type
172 : bool &ErrorsFound // set to true if problem
173 : );
174 :
175 : int GetCoilWaterInletNode(EnergyPlusData &state,
176 : std::string const &CoilType, // must match coil types in this module
177 : std::string const &CoilName, // must match coil names for the coil type
178 : bool &ErrorsFound // set to true if problem
179 : );
180 :
181 : int GetCoilOutletNode(EnergyPlusData &state,
182 : std::string_view CoilType, // must match coil types in this module
183 : std::string const &CoilName, // must match coil names for the coil type
184 : bool &ErrorsFound // set to true if problem
185 : );
186 :
187 : std::string GetHXDXCoilType(EnergyPlusData &state,
188 : std::string const &CoilType, // must match coil types in this module
189 : std::string const &CoilName, // must match coil names for the coil type
190 : bool &ErrorsFound // set to true if problem
191 : );
192 :
193 : std::string GetHXDXCoilName(EnergyPlusData &state,
194 : std::string_view CoilType, // must match coil types in this module
195 : std::string const &CoilName, // must match coil names for the coil type
196 : bool &ErrorsFound // set to true if problem
197 : );
198 :
199 : int GetActualDXCoilIndex(EnergyPlusData &state,
200 : std::string const &CoilType, // must match coil types in this module
201 : std::string const &CoilName, // must match coil names for the coil type
202 : bool &ErrorsFound // set to true if problem
203 : );
204 :
205 : std::string GetHXCoilType(EnergyPlusData &state,
206 : std::string const &CoilType, // must match coil types in this module
207 : std::string const &CoilName, // must match coil names for the coil type
208 : bool &ErrorsFound // set to true if problem
209 : );
210 :
211 : void GetHXCoilTypeAndName(EnergyPlusData &state,
212 : std::string const &CoilType, // must match coil types in this module
213 : std::string const &CoilName, // must match coil names for the coil type
214 : bool &ErrorsFound, // set to true if problem
215 : std::string &CoolingCoilType, // returned type of cooling coil
216 : std::string &CoolingCoilName // returned name of cooling coil
217 : );
218 :
219 : Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state,
220 : std::string_view CoilType, // must match coil types in this module
221 : std::string const &CoilName, // must match coil names for the coil type
222 : bool &ErrorsFound // set to true if problem
223 : );
224 :
225 : Real64 GetHXCoilAirFlowRate(EnergyPlusData &state,
226 : std::string const &CoilType, // must match coil types in this module
227 : std::string const &CoilName, // must match coil names for the coil type
228 : bool &ErrorsFound // set to true if problem
229 : );
230 :
231 : bool VerifyHeatExchangerParent(EnergyPlusData &state,
232 : std::string const &HXType, // must match coil types in this module
233 : std::string const &HXName // must match coil names for the coil type
234 : );
235 :
236 : } // namespace HVACHXAssistedCoolingCoil
237 :
238 : struct HVACHXAssistedCoolingCoilData : BaseGlobalStruct
239 : {
240 : int TotalNumHXAssistedCoils = 0; // The total number of HXAssistedCoolingCoil compound objects
241 : Array1D<Real64> HXAssistedCoilOutletTemp; // Outlet temperature from this compound object
242 : Array1D<Real64> HXAssistedCoilOutletHumRat; // Outlet humidity ratio from this compound object
243 : bool GetCoilsInputFlag = true; // Flag to allow input data to be retrieved from idf on first call to this subroutine
244 : Array1D_bool CheckEquipName;
245 : Array1D<HVACHXAssistedCoolingCoil::HXAssistedCoilParameters> HXAssistedCoil;
246 : std::unordered_map<std::string, std::string> UniqueHXAssistedCoilNames;
247 : Real64 CoilOutputTempLast; // Exiting cooling coil temperature from last iteration
248 : int ErrCount = 0;
249 : int ErrCount2 = 0;
250 :
251 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
252 : {
253 2126 : }
254 :
255 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
256 : {
257 1152 : }
258 :
259 2100 : void clear_state() override
260 : {
261 2100 : this->TotalNumHXAssistedCoils = 0;
262 2100 : this->HXAssistedCoilOutletTemp.clear();
263 2100 : this->HXAssistedCoilOutletHumRat.clear();
264 2100 : this->GetCoilsInputFlag = true;
265 2100 : this->CheckEquipName.clear();
266 2100 : this->HXAssistedCoil.clear();
267 2100 : this->UniqueHXAssistedCoilNames.clear();
268 2100 : this->ErrCount = 0;
269 2100 : this->ErrCount2 = 0;
270 2100 : }
271 : };
272 :
273 : } // namespace EnergyPlus
274 :
275 : #endif
|