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 IntegratedHeatPump_hh_INCLUDED
49 : #define IntegratedHeatPump_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.fwd.hh>
53 : #include <ObjexxFCL/Optional.hh>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/DataHVACGlobals.hh>
58 : #include <EnergyPlus/DataLoopNode.hh>
59 : #include <EnergyPlus/EPVector.hh>
60 : #include <EnergyPlus/EnergyPlus.hh>
61 : #include <EnergyPlus/Plant/Enums.hh>
62 :
63 : namespace EnergyPlus {
64 :
65 : // Forward declarations
66 : struct EnergyPlusData;
67 :
68 : namespace IntegratedHeatPump {
69 :
70 : // operation mode
71 : enum class IHPOperationMode : int
72 : {
73 : Invalid = -1,
74 : Idle,
75 : SpaceClg, // Space Cooling
76 : SpaceHtg, // Space Heating
77 : DedicatedWaterHtg, // Dedicated Water Heating
78 : SCWHMatchSC, // Space Cooling Water Heating
79 : SCWHMatchWH,
80 : SpaceClgDedicatedWaterHtg,
81 : SHDWHElecHeatOff,
82 : SHDWHElecHeatOn,
83 : Num
84 : };
85 :
86 : struct IntegratedHeatPumpData // variable speed coil
87 : {
88 : // Members
89 : std::string Name; // Name of the Coil
90 : std::string IHPtype; // type of coil
91 :
92 : std::string SCCoilType; // Numeric Equivalent for SC Coil Type
93 : std::string SCCoilName;
94 : int SCCoilIndex; // Index to SC coil
95 : DataLoopNode::ConnectionObjectType SCCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
96 :
97 : std::string SHCoilType; // Numeric Equivalent for SH Coil Type
98 : std::string SHCoilName;
99 : int SHCoilIndex; // Index to SH coil
100 : DataLoopNode::ConnectionObjectType SHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
101 :
102 : std::string SCWHCoilType; // Numeric Equivalent for SCWH Coil Type
103 : std::string SCWHCoilName;
104 : int SCWHCoilIndex; // Index to SCWH coil
105 : DataLoopNode::ConnectionObjectType SCWHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
106 :
107 : std::string DWHCoilType; // Numeric Equivalent for DWH Coil Type
108 : std::string DWHCoilName;
109 : int DWHCoilIndex; // Index to DWH coil
110 : DataLoopNode::ConnectionObjectType DWHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
111 :
112 : std::string SCDWHCoolCoilType; // Numeric Equivalent for SCDWH Coil Type, cooling part
113 : std::string SCDWHCoolCoilName;
114 : int SCDWHCoolCoilIndex; // Index to SCDWH coil, cooling part
115 : DataLoopNode::ConnectionObjectType SCDWHCoolCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
116 :
117 : std::string SCDWHWHCoilType; // Numeric Equivalent for SCDWH Coil Type, water heating part
118 : std::string SCDWHWHCoilName;
119 : int SCDWHWHCoilIndex; // Index to SCDWH coil, water heating part
120 : DataLoopNode::ConnectionObjectType SCDWHWHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
121 :
122 : std::string SHDWHHeatCoilType; // Numeric Equivalent for SHDWH Coil Type, heating part
123 : std::string SHDWHHeatCoilName;
124 : int SHDWHHeatCoilIndex; // Index to SHDWH coil, heating part
125 : DataLoopNode::ConnectionObjectType SHDWHHeatCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
126 :
127 : std::string SHDWHWHCoilType; // Numeric Equivalent for SHDWH Coil Type, water heating part
128 : std::string SHDWHWHCoilName;
129 : int SHDWHWHCoilIndex; // Index to SHDWH coil, water heating part
130 : DataLoopNode::ConnectionObjectType SHDWHWHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
131 :
132 : int AirCoolInletNodeNum; // Node Number of the Air cooling coil Inlet
133 : int AirHeatInletNodeNum; // Node Number of the Air cooling coil Inlet
134 : int AirOutletNodeNum; // Node Number of the Air Outlet
135 : int WaterInletNodeNum; // Node Number of the Water Onlet
136 : int WaterOutletNodeNum; // Node Number of the Water Outlet
137 : int WaterTankoutNod; // water node to monitor the supply water flow amount
138 :
139 : int ModeMatchSCWH;
140 : //- 0: match cooling load, 1 : match water heating load in SCWH mode
141 : int MinSpedSCWH; //-minimum speed level for SCWH mode
142 : int MinSpedSCDWH; //- minimum speed level for SCDWH mode
143 : int MinSpedSHDWH;
144 : //- minimum speed level for SHDWH mode
145 : Real64 TindoorOverCoolAllow; //- [C], indoor temperature above which indoor overcooling is allowed
146 : Real64 TambientOverCoolAllow; //- [C], ambient temperature above which indoor overcooling is allowed
147 : Real64 TindoorWHHighPriority; //- [C], indoor temperature above which water heating has the higher priority
148 : Real64 TambientWHHighPriority; // ambient temperature above which water heating has the higher priority
149 :
150 : Real64 WaterVolSCDWH;
151 : // limit of water volume before switching from SCDWH to SCWH
152 : Real64 TimeLimitSHDWH; // time limit before turning from SHDWH to electric heating
153 :
154 : DataPlant::PlantEquipmentType WHtankType;
155 : std::string WHtankName;
156 : int WHtankID;
157 : int LoopNum;
158 : int LoopSideNum;
159 : bool IsWHCallAvail;
160 : // whether water heating call available
161 : bool CheckWHCall;
162 : IHPOperationMode CurMode; // current working mode
163 : Real64 ControlledZoneTemp;
164 : Real64 WaterFlowAccumVol;
165 : // water flow accumulated volume
166 : Real64 SHDWHRunTime;
167 : Real64 CoolVolFlowScale;
168 : // max fan cooling volumetric flow rate
169 : Real64 HeatVolFlowScale;
170 : // max fan heating volumetric flow rate
171 : Real64 MaxHeatAirMassFlow;
172 : // maximum air mass flow rate for heating mode
173 : Real64 MaxHeatAirVolFlow;
174 : // maximum air volume flow rate for heating mode
175 : Real64 MaxCoolAirMassFlow;
176 : // maximum air mass flow rate for heating mode
177 : Real64 MaxCoolAirVolFlow;
178 : // maximum air volume flow rate for heating mode
179 : bool IHPCoilsSized; // whether IHP coils have been sized
180 :
181 : std::string IDFanName;
182 : // IHP indoor fan name
183 : int IDFanID;
184 : // IHP indoor fan index
185 : HVAC::FanPlace fanPlace; // indoor fan placement
186 :
187 : int ODAirInletNodeNum; // oudoor coil inlet Nod
188 : int ODAirOutletNodeNum; // oudoor coil outlet Nod
189 : Real64 TankSourceWaterMassFlowRate;
190 : // tank source water flow rate
191 : Real64 AirFlowSavInWaterLoop; // air flow saving for SCWH mode
192 : Real64 AirFlowSavInAirLoop; // air flow saving for SCWH mode
193 :
194 : // new output variables
195 : Real64 AirLoopFlowRate;
196 : // air loop mass flow rate [kg/s]
197 : Real64 TotalCoolingRate;
198 : // total cooling rate [w]
199 : Real64 TotalWaterHeatingRate;
200 : // total water heating rate [w]
201 : Real64 TotalSpaceHeatingRate;
202 : // total space heating rate [w]
203 : Real64 TotalPower;
204 : // total power consumption [w]
205 : Real64 TotalLatentLoad;
206 : // total latent cooling rate [w]
207 : Real64 Qsource;
208 : // source energy rate, [w]
209 : Real64 Energy;
210 : // total electric energy consumption [J]
211 : Real64 EnergyLoadTotalCooling;
212 : // total cooling energy [J]
213 : Real64 EnergyLoadTotalHeating;
214 : // total heating energy [J]
215 : Real64 EnergyLoadTotalWaterHeating;
216 : // total heating energy [J]
217 : Real64 EnergyLatent; // total latent energy [J]
218 : Real64 EnergySource;
219 : // total source energy
220 : Real64 TotalCOP; // total COP
221 :
222 : // Default Constructor
223 2 : IntegratedHeatPumpData()
224 16 : : SCCoilIndex(0), SHCoilIndex(0), SCWHCoilIndex(0), DWHCoilIndex(0), SCDWHCoolCoilIndex(0), SCDWHWHCoilIndex(0), SHDWHHeatCoilIndex(0),
225 2 : SHDWHWHCoilIndex(0), AirCoolInletNodeNum(0), AirHeatInletNodeNum(0), AirOutletNodeNum(0), WaterInletNodeNum(0), WaterOutletNodeNum(0),
226 2 : WaterTankoutNod(0), ModeMatchSCWH(0), MinSpedSCWH(1), MinSpedSCDWH(1), MinSpedSHDWH(1), TindoorOverCoolAllow(0.0),
227 2 : TambientOverCoolAllow(0.0), TindoorWHHighPriority(0.0), TambientWHHighPriority(0.0), WaterVolSCDWH(0.0), TimeLimitSHDWH(0.0),
228 4 : WHtankType(DataPlant::PlantEquipmentType::Invalid), WHtankID(0), LoopNum(0), LoopSideNum(0), IsWHCallAvail(false), CheckWHCall(false),
229 2 : CurMode(IHPOperationMode::Idle), ControlledZoneTemp(0), WaterFlowAccumVol(0), SHDWHRunTime(0), CoolVolFlowScale(0), HeatVolFlowScale(0),
230 4 : MaxHeatAirMassFlow(0), MaxHeatAirVolFlow(0), MaxCoolAirMassFlow(0), MaxCoolAirVolFlow(0), IHPCoilsSized(false), IDFanID(0),
231 2 : fanPlace(HVAC::FanPlace::Invalid), ODAirInletNodeNum(0), // oudoor coil inlet Nod
232 2 : ODAirOutletNodeNum(0), // oudoor coil outlet Nod
233 2 : TankSourceWaterMassFlowRate(0), AirFlowSavInWaterLoop(0), AirFlowSavInAirLoop(0), AirLoopFlowRate(0.0), // air loop mass flow rate
234 2 : TotalCoolingRate(0.0), // total cooling rate [w]
235 2 : TotalWaterHeatingRate(0.0), // total water heating rate [w]
236 2 : TotalSpaceHeatingRate(0.0), // total space heating rate [w]
237 2 : TotalPower(0.0), // total power consumption [w]
238 2 : TotalLatentLoad(0), // total latent cooling rate [w]
239 2 : Qsource(0.0), // source energy rate, [w]
240 2 : Energy(0.0), // total electric energy consumption [J]
241 2 : EnergyLoadTotalCooling(0.0), // total cooling energy [J]
242 2 : EnergyLoadTotalHeating(0.0), // total heating energy [J]
243 2 : EnergyLoadTotalWaterHeating(0.0), // total heating energy [J]
244 2 : EnergyLatent(0.0), // total latent energy [J]
245 2 : EnergySource(0.0), // total source energy
246 2 : TotalCOP(0.0) // total COP
247 : {
248 2 : }
249 : };
250 :
251 : void SimIHP(EnergyPlusData &state,
252 : std::string_view CompName, // Coil Name
253 : int &CompIndex, // Index for Component name
254 : HVAC::FanOp const fanOp, // Continuous fan OR cycling compressor
255 : HVAC::CompressorOp compressorOp, // compressor on/off. 0 = off; 1= on
256 : Real64 const PartLoadFrac,
257 : int const SpeedNum, // compressor speed number
258 : Real64 const SpeedRatio, // compressor speed ratio
259 : Real64 const SensLoad, // Sensible demand load [W]
260 : Real64 const LatentLoad, // Latent demand load [W]
261 : bool const IsCallbyWH, // whether the call from the water heating loop or air loop, true = from water heating loop
262 : bool const FirstHVACIteration, // TRUE if First iteration of simulation
263 : ObjexxFCL::Optional<Real64 const> OnOffAirFlowRat = _ // ratio of comp on to comp off air flow rate
264 : );
265 :
266 : void GetIHPInput(EnergyPlusData &state);
267 :
268 : void SizeIHP(EnergyPlusData &state, int const CoilNum);
269 :
270 : void InitializeIHP(EnergyPlusData &state, int const DXCoilNum);
271 :
272 : void UpdateIHP(EnergyPlusData &state, int const DXCoilNum);
273 :
274 : void DecideWorkMode(EnergyPlusData &state,
275 : int const DXCoilNum,
276 : Real64 const SensLoad, // Sensible demand load [W]
277 : Real64 const LatentLoad // Latent demand load [W]
278 : );
279 :
280 : IHPOperationMode GetCurWorkMode(EnergyPlusData &state, int const DXCoilNum);
281 :
282 : int GetLowSpeedNumIHP(EnergyPlusData &state, int const DXCoilNum);
283 :
284 : int GetMaxSpeedNumIHP(EnergyPlusData &state, int const DXCoilNum);
285 :
286 : Real64 GetAirVolFlowRateIHP(EnergyPlusData &state,
287 : int const DXCoilNum,
288 : int const SpeedNum,
289 : Real64 const SpeedRatio,
290 : bool const IsCallbyWH // whether the call from the water heating loop or air loop, true = from water heating loop
291 : );
292 :
293 : Real64 GetWaterVolFlowRateIHP(EnergyPlusData &state, int const DXCoilNum, int const SpeedNum, Real64 const SpeedRatio);
294 :
295 : Real64 GetAirMassFlowRateIHP(EnergyPlusData &state,
296 : int const DXCoilNum,
297 : int const SpeedNum,
298 : Real64 const SpeedRatio,
299 : bool const IsCallbyWH // whether the call from the water heating loop or air loop, true = from water heating loop
300 : );
301 :
302 : bool IHPInModel(EnergyPlusData &state);
303 :
304 : int GetCoilIndexIHP(EnergyPlusData &state,
305 : std::string const &CoilType, // must match coil types in this module
306 : std::string const &CoilName, // must match coil names for the coil type
307 : bool &ErrorsFound // set to true if problem
308 : );
309 :
310 : int GetCoilInletNodeIHP(EnergyPlusData &state,
311 : std::string const &CoilType, // must match coil types in this module
312 : std::string const &CoilName, // must match coil names for the coil type
313 : bool &ErrorsFound // set to true if problem
314 : );
315 :
316 : int GetDWHCoilInletNodeIHP(EnergyPlusData &state,
317 : std::string const &CoilType, // must match coil types in this module
318 : std::string const &CoilName, // must match coil names for the coil type
319 : bool &ErrorsFound // set to true if problem
320 : );
321 :
322 : int GetDWHCoilOutletNodeIHP(EnergyPlusData &state,
323 : std::string const &CoilType, // must match coil types in this module
324 : std::string const &CoilName, // must match coil names for the coil type
325 : bool &ErrorsFound // set to true if problem
326 : );
327 :
328 : Real64 GetDWHCoilCapacityIHP(EnergyPlusData &state,
329 : std::string const &CoilType, // must match coil types in this module
330 : std::string const &CoilName, // must match coil names for the coil type
331 : IHPOperationMode const Mode, // mode coil type
332 : bool &ErrorsFound // set to true if problem
333 : );
334 :
335 : int GetIHPDWHCoilPLFFPLR(EnergyPlusData &state,
336 : std::string const &CoilType, // must match coil types in this module
337 : std::string const &CoilName, // must match coil names for the coil type
338 : IHPOperationMode const Mode, // mode coil type
339 : bool &ErrorsFound // set to true if problem
340 : );
341 :
342 : void ClearCoils(EnergyPlusData &state, int const DXCoilNum // coil ID
343 : );
344 :
345 : } // namespace IntegratedHeatPump
346 :
347 : struct IntegratedHeatPumpGlobalData : BaseGlobalStruct
348 : {
349 :
350 : bool GetCoilsInputFlag = true;
351 : EPVector<IntegratedHeatPump::IntegratedHeatPumpData> IntegratedHeatPumps;
352 :
353 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
354 : {
355 796 : }
356 :
357 0 : void clear_state() override
358 : {
359 0 : this->GetCoilsInputFlag = true;
360 0 : this->IntegratedHeatPumps.deallocate();
361 0 : }
362 : };
363 :
364 : } // namespace EnergyPlus
365 :
366 : #endif
|