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 HVACStandAloneERV_hh_INCLUDED
49 : #define HVACStandAloneERV_hh_INCLUDED
50 :
51 : // C++ Headers
52 : #include <unordered_set>
53 :
54 : // ObjexxFCL Headers
55 : #include <ObjexxFCL/Array1D.hh>
56 :
57 : // EnergyPlus Headers
58 : #include <EnergyPlus/Data/BaseData.hh>
59 : #include <EnergyPlus/DataGlobals.hh>
60 : #include <EnergyPlus/EnergyPlus.hh>
61 :
62 : namespace EnergyPlus {
63 :
64 : // Forward declarations
65 : struct EnergyPlusData;
66 :
67 : namespace HVACStandAloneERV {
68 :
69 : struct StandAloneERVData
70 : {
71 : // Members
72 : // input data
73 : std::string Name; // name of the stand alone ERV unit
74 : std::string UnitType; // ZoneHVAC:EnergyRecoveryVentilator
75 : Sched::Schedule *availSched = nullptr; // availability schedule
76 : std::string HeatExchangerName; // name of the heat exchanger within the ERV unit
77 : int HeatExchangerIndex; // Pointer to heat exchanger
78 : HVAC::HXType hxType = HVAC::HXType::Invalid; // Parameter equivalent of HX object type
79 : int SupplyAirInletNode; // supply air inlet node for the stand alone ERV
80 : int SupplyAirOutletNode; // supply air outlet node for the stand alone ERV
81 : std::string SupplyAirFanName; // fan name in the supply air stream of the ERV
82 : int SupplyAirFanIndex; // index to supply air fan
83 : Sched::Schedule *supplyAirFanSched = nullptr; // supply air fan schedule
84 : HVAC::FanType supplyAirFanType; // parameter equivalent of fan type
85 : int ExhaustAirInletNode; // exhaust air inlet node for the stand alone ERV
86 : int ExhaustAirOutletNode; // exhaust air outlet node for the stand alone ERV
87 : std::string ExhaustAirFanName; // fan name in exhaust air stream of the ERV
88 : int ExhaustAirFanIndex; // index to exhaust air fan
89 : Sched::Schedule *exhaustAirFanSched = nullptr; // exhaust air fan schedule
90 : HVAC::FanType exhaustAirFanType; // paramter equivalent of fan type
91 : Real64 SupplyAirVolFlow; // volumetric flow rate through the supply side of the ERV
92 : Real64 ExhaustAirVolFlow; // volumetric flow rate through the exhaust side of the ERV
93 : std::string ControllerName; // name of the controller for the stand alone ERV
94 : bool ControllerNameDefined; // controller for the stand alone ERV is defined
95 : int ControlledZoneNum; // index to controlled zone for stand alone ERV
96 : int ControllerIndex; // Pointer for updates by routines this module calls.
97 : Real64 MaxSupAirMassFlow; // air mass flow rate through the supply side of the ERV
98 : Real64 MaxExhAirMassFlow; // air mass flow rate through the exhaust side of the ERV
99 : Real64 HighRHOAFlowRatio; // ratio of outside air flow to max outside air flow
100 : Real64 DesignSAFanVolFlowRate; // SA fan volumetric flow rate
101 : Real64 DesignEAFanVolFlowRate; // EA fan volumetric flow rate
102 : Real64 DesignHXVolFlowRate; // HX (heat exchanger) volumetric flow rate
103 : Real64 DesignSAFanMassFlowRate; // SA fan mass flow rate
104 : Real64 DesignEAFanMassFlowRate; // EA fan mass flow rate
105 : Real64 AirVolFlowPerFloorArea; // Air flow rate per unit floor area, used for autosizing
106 : Real64 AirVolFlowPerOccupant; // Air flow rate per occupant, used for autosizing
107 : Sched::Schedule *economizerOASched = nullptr; // schedule to modify outdoor air
108 : bool FlowError; // used for one-time warning message for flow imbalance (Init)
109 : Avail::Status availStatus = Avail::Status::NoAction;
110 : std::string AvailManagerListName; // Name of an availability manager list object
111 : // report variables
112 : Real64 ElecUseRate; // total electric use rate (power) for supply/exhaust fans & generic HX parasitics [W]
113 : Real64 ElecUseEnergy; // electric energy use for supply fan, exhaust fan, and generic HX parasitics [J]
114 : Real64 SensCoolingEnergy; // sensible cooling energy delivered by the ERV supply air to the zone [J]
115 : Real64 SensCoolingRate; // rate of sensible cooling delivered to the zone [W]
116 : Real64 LatCoolingEnergy; // latent cooling energy delivered by the ERV supply air to the zone [J]
117 : Real64 LatCoolingRate; // rate of latent cooling delivered to the zone [W]
118 : Real64 TotCoolingEnergy; // total cooling energy delivered by the ERV supply air to the zone [J]
119 : Real64 TotCoolingRate; // rate of total cooling delivered to the zone [W]
120 : Real64 SensHeatingEnergy; // sensible heating energy delivered by the ERV supply air to the zone [J]
121 : Real64 SensHeatingRate; // rate of sensible heating delivered to the zone [W]
122 : Real64 LatHeatingEnergy; // latent heating energy delivered by the ERV supply air to the zone [J]
123 : Real64 LatHeatingRate; // rate of latent heating delivered to the zone [W]
124 : Real64 TotHeatingEnergy; // total heating energy delivered by the ERV supply air to the zone [J]
125 : Real64 TotHeatingRate; // rate of total heating delivered to the zone [W]
126 : bool FirstPass; // detects first time through for resetting sizing data
127 :
128 : // Default Constructor
129 20 : StandAloneERVData()
130 60 : : HeatExchangerIndex(0), SupplyAirInletNode(0), SupplyAirOutletNode(0), SupplyAirFanIndex(0), supplyAirFanType(HVAC::FanType::Invalid),
131 40 : ExhaustAirInletNode(0), ExhaustAirOutletNode(0), ExhaustAirFanIndex(0), exhaustAirFanType(HVAC::FanType::Invalid),
132 40 : SupplyAirVolFlow(0.0), ExhaustAirVolFlow(0.0), ControllerNameDefined(false), ControlledZoneNum(0), ControllerIndex(0),
133 20 : MaxSupAirMassFlow(0.0), MaxExhAirMassFlow(0.0), HighRHOAFlowRatio(1.0), DesignSAFanVolFlowRate(0.0), DesignEAFanVolFlowRate(0.0),
134 20 : DesignHXVolFlowRate(0.0), DesignSAFanMassFlowRate(0.0), DesignEAFanMassFlowRate(0.0), AirVolFlowPerFloorArea(0.0),
135 40 : AirVolFlowPerOccupant(0.0), FlowError(true), ElecUseRate(0.0), ElecUseEnergy(0.0), SensCoolingEnergy(0.0), SensCoolingRate(0.0),
136 20 : LatCoolingEnergy(0.0), LatCoolingRate(0.0), TotCoolingEnergy(0.0), TotCoolingRate(0.0), SensHeatingEnergy(0.0), SensHeatingRate(0.0),
137 20 : LatHeatingEnergy(0.0), LatHeatingRate(0.0), TotHeatingEnergy(0.0), TotHeatingRate(0.0), FirstPass(true)
138 : {
139 20 : }
140 : };
141 :
142 : void SimStandAloneERV(EnergyPlusData &state,
143 : std::string_view CompName, // name of the Stand Alone ERV unit
144 : int ZoneNum, // number of zone being served unused1208
145 : bool FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
146 : Real64 &SensLoadMet, // net sensible load supplied by the ERV unit to the zone (W)
147 : Real64 &LatLoadMet, // net latent load supplied by ERV unit to the zone (kg/s),
148 : int &CompIndex // pointer to correct component
149 : );
150 :
151 : void GetStandAloneERV(EnergyPlusData &state);
152 :
153 : void InitStandAloneERV(EnergyPlusData &state,
154 : int StandAloneERVNum, // number of the current Stand Alone ERV unit being simulated
155 : int ZoneNum, // number of zone being served unused1208
156 : bool FirstHVACIteration // TRUE if first HVAC iteration
157 : );
158 :
159 : void SizeStandAloneERV(EnergyPlusData &state, int StandAloneERVNum);
160 :
161 : void CalcStandAloneERV(EnergyPlusData &state,
162 : int StandAloneERVNum, // Unit index in ERV data structure
163 : bool FirstHVACIteration, // flag for 1st HVAC iteration in the time step
164 : Real64 &SensLoadMet, // sensible zone load met by unit (W)
165 : Real64 &LatentMassLoadMet // latent zone load met by unit (kg/s), dehumid = negative
166 : );
167 :
168 : void ReportStandAloneERV(EnergyPlusData &state, int StandAloneERVNum); // number of the current Stand Alone ERV being simulated
169 :
170 : // End of Reporting subroutines for the Module
171 :
172 : // Utility subroutines/functions for the HeatingCoil Module
173 :
174 : Real64 GetSupplyAirFlowRate(EnergyPlusData &state,
175 : std::string const &ERVType, // must be "ZoneHVAC:EnergyRecoveryVentilator"
176 : std::string const &ERVCtrlName, // must match a controller name in the ERV data structure
177 : bool &ErrorsFound // set to true if problem
178 : );
179 :
180 : int GetStandAloneERVOutAirNode(EnergyPlusData &state, int StandAloneERVNum);
181 :
182 : int GetStandAloneERVZoneInletAirNode(EnergyPlusData &state, int StandAloneERVNum);
183 :
184 : int GetStandAloneERVReturnAirNode(EnergyPlusData &state, int StandAloneERVNum);
185 :
186 : bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int NodeNumber);
187 :
188 : int getEqIndex(EnergyPlusData &state, std::string_view CompName);
189 :
190 : } // namespace HVACStandAloneERV
191 :
192 : struct HVACStandAloneERVData : BaseGlobalStruct
193 : {
194 :
195 : int NumStandAloneERVs = 0;
196 : Array1D_bool MySizeFlag;
197 : Array1D_bool CheckEquipName;
198 : bool GetERVInputFlag = true;
199 : EPVector<HVACStandAloneERV::StandAloneERVData> StandAloneERV;
200 : std::unordered_set<std::string> HeatExchangerUniqueNames;
201 : std::unordered_set<std::string> SupplyAirFanUniqueNames;
202 : std::unordered_set<std::string> ExhaustAirFanUniqueNames;
203 : std::unordered_set<std::string> ControllerUniqueNames;
204 : Array1D_bool MySizeFlag_InitStandAloneERV;
205 : bool MyOneTimeFlag = true;
206 : Array1D_bool MyEnvrnFlag;
207 : Array1D_bool MyZoneEqFlag; // used to set up zone equipment availability managers
208 : bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items
209 :
210 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
211 : {
212 2126 : }
213 :
214 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
215 : {
216 1152 : }
217 :
218 2100 : void clear_state() override
219 : {
220 2100 : NumStandAloneERVs = 0;
221 2100 : GetERVInputFlag = true;
222 2100 : MySizeFlag.deallocate();
223 2100 : CheckEquipName.deallocate();
224 2100 : StandAloneERV.deallocate();
225 2100 : HeatExchangerUniqueNames.clear();
226 2100 : SupplyAirFanUniqueNames.clear();
227 2100 : ExhaustAirFanUniqueNames.clear();
228 2100 : ControllerUniqueNames.clear();
229 2100 : MySizeFlag_InitStandAloneERV.deallocate();
230 2100 : MyOneTimeFlag = true;
231 2100 : MyEnvrnFlag.deallocate();
232 2100 : MyZoneEqFlag.deallocate();
233 2100 : ZoneEquipmentListChecked = false;
234 2100 : }
235 : };
236 :
237 : } // namespace EnergyPlus
238 :
239 : #endif
|