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 HybridEvapCoolingModel_hh_INCLUDED
49 : #define HybridEvapCoolingModel_hh_INCLUDED
50 :
51 : // C++ Headers
52 : #include <iostream>
53 : #include <list>
54 : #include <map>
55 : #include <string>
56 : #include <vector>
57 :
58 : // ObjexxFCL Headers
59 : #include <ObjexxFCL/Array.functions.hh>
60 : #include <ObjexxFCL/Fmath.hh>
61 :
62 : #define MINIMUM_LOAD_TO_ACTIVATE 0.5 // (kw) sets a minimum load to avoid the system fluttering on and off.
63 : #define IMPLAUSIBLE_POWER 10000000
64 :
65 : // EnergyPlus Headers
66 : #include <EnergyPlus/DataGlobals.hh>
67 : #include <EnergyPlus/EnergyPlus.hh>
68 :
69 : namespace EnergyPlus {
70 :
71 : // Forward declarations
72 : struct EnergyPlusData;
73 :
74 : namespace HybridEvapCoolingModel {
75 :
76 : enum class SYSTEMOUTPUTS
77 : {
78 : Invalid = -1,
79 : VENTILATION_AIR_V,
80 : SUPPLY_MASS_FLOW,
81 : SYSTEM_FUEL_USE,
82 : SUPPLY_AIR_TEMP,
83 : MIXED_AIR_TEMP,
84 : SUPPLY_AIR_HR,
85 : MIXED_AIR_HR,
86 : OSUPPLY_FAN_POWER,
87 : OSECOND_FUEL_USE,
88 : OTHIRD_FUEL_USE,
89 : OWATER_USE,
90 : OEXTERNAL_STATIC_PRESSURE,
91 : Num
92 : };
93 :
94 1081570 : class CModeSolutionSpace
95 : {
96 : public:
97 : std::vector<Real64> MassFlowRatio;
98 : std::vector<Real64> OutdoorAirFraction;
99 : };
100 :
101 969880 : class CMode
102 : {
103 : public:
104 : CMode();
105 :
106 : // finish init above
107 : int ModeID;
108 : CModeSolutionSpace sol;
109 : std::string ModeName;
110 : int Tsa_curve_pointer;
111 : int HRsa_curve_pointer;
112 : int Psa_curve_pointer;
113 : int SFPsa_curve_pointer;
114 : int ESPsa_curve_pointer;
115 : int SFUsa_curve_pointer;
116 : int TFUsa_curve_pointer;
117 : int WUsa_curve_pointer;
118 :
119 : Real64 Max_Msa;
120 : Real64 Min_Msa;
121 : Real64 Min_OAF;
122 : Real64 Max_OAF;
123 : Real64 Minimum_Outdoor_Air_Temperature;
124 : Real64 Maximum_Outdoor_Air_Temperature;
125 : Real64 Minimum_Outdoor_Air_Humidity_Ratio;
126 : Real64 Maximum_Outdoor_Air_Humidity_Ratio;
127 : Real64 Minimum_Outdoor_Air_Relative_Humidity;
128 : Real64 Maximum_Outdoor_Air_Relative_Humidity;
129 : Real64 Minimum_Return_Air_Temperature;
130 : Real64 Maximum_Return_Air_Temperature;
131 : Real64 Minimum_Return_Air_Humidity_Ratio;
132 : Real64 Maximum_Return_Air_Humidity_Ratio;
133 : Real64 Minimum_Return_Air_Relative_Humidity;
134 : Real64 Maximum_Return_Air_Relative_Humidity;
135 : Real64 ModelScalingFactor;
136 : int MODE_BLOCK_OFFSET_Alpha;
137 : int BLOCK_HEADER_OFFSET_Alpha;
138 : int MODE1_BLOCK_OFFSET_Number;
139 : int MODE_BLOCK_OFFSET_Number;
140 : int BLOCK_HEADER_OFFSET_Number;
141 : bool ValidPointer(int curve_pointer);
142 : bool ParseMode(EnergyPlusData &state,
143 : int ModeCounter,
144 : std::vector<CMode> *OperatingModes,
145 : Real64 ScalingFactor,
146 : Array1D_string Alphas,
147 : Array1D_string cAlphaFields,
148 : Array1D<Real64> Numbers,
149 : Array1D_string cNumericFields,
150 : Array1D<bool> lAlphaBlanks,
151 : std::string cCurrentModuleObject);
152 : void InitializeCurve(int curveType, int CurveID);
153 : Real64 CalculateCurveVal(EnergyPlusData &state, Real64 Tosa, Real64 Wosa, Real64 Tra, Real64 Wra, Real64 Msa, Real64 OSAF, int curveType);
154 : bool InitializeOSAFConstraints(Real64 minOSAF, Real64 maxOSAF);
155 : bool InitializeMsaRatioConstraints(Real64 minMsa, Real64 maxMsa);
156 : bool InitializeOutdoorAirTemperatureConstraints(Real64 min, Real64 max);
157 : bool InitializeOutdoorAirHumidityRatioConstraints(Real64 min, Real64 max);
158 : bool InitializeOutdoorAirRelativeHumidityConstraints(Real64 min, Real64 max);
159 : bool InitializeReturnAirTemperatureConstraints(Real64 min, Real64 max);
160 : bool InitializeReturnAirHumidityRatioConstraints(Real64 min, Real64 max);
161 : bool InitializeReturnAirRelativeHumidityConstraints(Real64 min, Real64 max);
162 : void GenerateSolutionSpace();
163 : bool MeetsOAEnvConstraints(Real64 Tosa, Real64 Wosa, Real64 RHos);
164 :
165 : private:
166 : };
167 :
168 692397 : class CSetting
169 : {
170 : public:
171 111684 : CSetting()
172 111684 : : Runtime_Fraction(0), Mode(0), Outdoor_Air_Fraction(0), Unscaled_Supply_Air_Mass_Flow_Rate(0), ScaledSupply_Air_Mass_Flow_Rate(0),
173 : Supply_Air_Ventilation_Volume(0), ScaledSupply_Air_Ventilation_Volume(0), Supply_Air_Mass_Flow_Rate_Ratio(0), SupplyAirTemperature(0),
174 : Mixed_Air_Temperature(0), SupplyAirW(0), Mixed_Air_W(0), TotalSystem(0), SensibleSystem(0), LatentSystem(0), TotalZone(0),
175 : SensibleZone(0), LatentZone(0), ElectricalPower(IMPLAUSIBLE_POWER), SupplyFanElectricPower(0), SecondaryFuelConsumptionRate(0),
176 111684 : ThirdFuelConsumptionRate(0), WaterConsumptionRate(0), ExternalStaticPressure(0)
177 : {
178 111684 : }
179 : Real64 Runtime_Fraction;
180 : Real64 Mode;
181 : Real64 Outdoor_Air_Fraction;
182 : Real64 Unscaled_Supply_Air_Mass_Flow_Rate;
183 : Real64 ScaledSupply_Air_Mass_Flow_Rate;
184 : Real64 Supply_Air_Ventilation_Volume;
185 : Real64 ScaledSupply_Air_Ventilation_Volume;
186 : Real64 Supply_Air_Mass_Flow_Rate_Ratio;
187 : Real64 SupplyAirTemperature;
188 : Real64 Mixed_Air_Temperature;
189 : Real64 SupplyAirW;
190 : Real64 Mixed_Air_W;
191 : Real64 TotalSystem;
192 : Real64 SensibleSystem;
193 : Real64 LatentSystem;
194 : Real64 TotalZone; // W
195 : Real64 SensibleZone; // W
196 : Real64 LatentZone; // W
197 : Real64 ElectricalPower;
198 : Real64 SupplyFanElectricPower;
199 : Real64 SecondaryFuelConsumptionRate;
200 : Real64 ThirdFuelConsumptionRate;
201 : Real64 WaterConsumptionRate;
202 : Real64 ExternalStaticPressure;
203 :
204 : CMode oMode;
205 : };
206 :
207 : class CStepInputs
208 : {
209 : public:
210 12797 : CStepInputs()
211 12797 : : Tosa(0), Tra(0), RHosa(0), RHra(0), RequestedCoolingLoad(0), RequestedHeatingLoad(0), ZoneMoistureLoad(0), ZoneDehumidificationLoad(0),
212 12797 : MinimumOA(0)
213 : {
214 12797 : }
215 : Real64 Tosa;
216 : Real64 Tra;
217 : Real64 RHosa;
218 : Real64 RHra;
219 : Real64 RequestedCoolingLoad;
220 : Real64 RequestedHeatingLoad;
221 : Real64 ZoneMoistureLoad;
222 : Real64 ZoneDehumidificationLoad;
223 : Real64 MinimumOA;
224 : };
225 :
226 3 : class Model // begin declaration of the class
227 : {
228 : public: // begin public section
229 : Model();
230 :
231 : // Default Constructor
232 : std::string Name; // user identifier
233 : std::string Schedule; // Availability Schedule Name
234 : bool Initialized; // initialization flag ensures the system object is initialized only once.
235 : int ZoneNum; // stores the current zone associated with the system, this is currently not used but is expected to be used in the next set of
236 : // functionality additions.
237 : int SchedPtr; // Pointer to the correct schedule
238 : int ZoneNodeNum; // index of zone air node in node structure
239 : std::string AvailManagerListName; // Name of an availability manager list object
240 : int AvailStatus;
241 :
242 : Real64 SystemMaximumSupplyAirFlowRate; // taken from IDF N1, the system max supply flow rate in m3/s.
243 : bool FanHeatGain; // .TRUE. = fan heat gain is accounted for in the lookup tables
244 : std::string FanHeatGainLocation; // Fan heat gain location
245 : Real64 FanHeatInAirFrac; // the fraction of fan heat in air stream to calculate fan heat gain if not in lookup tables
246 : Real64 ScalingFactor; // taken from IDF N3, linear scaling factor.
247 : Real64 ScaledSystemMaximumSupplyAirMassFlowRate; // the scaled system max supply mass flow rate in m3/s.
248 : Real64 ScaledSystemMaximumSupplyAirVolumeFlowRate; // the scaled system max supply volume flow rate in m3/s.
249 : std::string FirstFuelType; // First fuel type, currently electricity is only option
250 : std::string SecondFuelType; // Second fuel type
251 : std::string ThirdFuelType; // Third fuel type
252 :
253 : int UnitOn; // feels like it should be a bool but its an output and I couldn't get it to work as a bool
254 : Real64 UnitTotalCoolingRate; // unit output to zone, total cooling rate [W]
255 : Real64 UnitTotalCoolingEnergy; // unit output to zone, total cooling energy [J]
256 : Real64 UnitSensibleCoolingRate; // unit sensible cooling rate [W]
257 : Real64 UnitSensibleCoolingEnergy; // unit sensible cooling energy [J]
258 : Real64 UnitLatentCoolingRate; // unit latent cooling rate [W]
259 : Real64 UnitLatentCoolingEnergy; // unit latent cooling energy [J]
260 : Real64 SystemTotalCoolingRate; // system output to zone, total cooling rate [W]
261 : Real64 SystemTotalCoolingEnergy; // system output to zone, total cooling energy [J]
262 : Real64 SystemSensibleCoolingRate; // system sensible cooling rate [W]
263 : Real64 SystemSensibleCoolingEnergy; // system sensible cooling energy [J]
264 : Real64 SystemLatentCoolingRate; // system latent cooling rate [W]
265 : Real64 SystemLatentCoolingEnergy; // system latent cooling energy [J]
266 : Real64 UnitTotalHeatingRate; // unit output to zone, total heating rate [W]
267 : Real64 UnitTotalHeatingEnergy; // unit output to zone, total heating energy [J]
268 : Real64 UnitSensibleHeatingRate; // unit sensible heating rate [W]
269 : Real64 UnitSensibleHeatingEnergy; // unit sensible heating energy [J]
270 : Real64 UnitLatentHeatingRate; // unit latent heating rate [W]
271 : Real64 UnitLatentHeatingEnergy; // unit latent heating energy [J]
272 : Real64 SystemTotalHeatingRate; // system output to zone, total heating rate [W]
273 : Real64 SystemTotalHeatingEnergy; // system output to zone, total heating energy [J]
274 : Real64 SystemSensibleHeatingRate; // system sensible heating rate [W]
275 : Real64 SystemSensibleHeatingEnergy; // system sensible heating energy [J]
276 : Real64 SystemLatentHeatingRate; // system latent heating rate [W]
277 : Real64 SystemLatentHeatingEnergy; // system latent heating energy [J]
278 : Real64 SupplyFanElectricPower; //
279 : Real64 SupplyFanElectricEnergy; //
280 : Real64 SecondaryFuelConsumptionRate; //
281 : Real64 SecondaryFuelConsumption; //
282 : Real64 ThirdFuelConsumptionRate; //
283 : Real64 ThirdFuelConsumption; //
284 : Real64 WaterConsumptionRate; //
285 : Real64 WaterConsumption; //
286 : Real64 QSensZoneOut; // W
287 : Real64 QLatentZoneOut; // W
288 : Real64 QLatentZoneOutMass; // kg/s
289 : Real64 ExternalStaticPressure; //
290 : Real64 RequestedHumdificationMass;
291 : Real64 RequestedHumdificationLoad;
292 : Real64 RequestedHumdificationEnergy;
293 : Real64 RequestedDeHumdificationMass;
294 : Real64 RequestedDeHumdificationLoad;
295 : Real64 RequestedDeHumdificationEnergy;
296 : Real64 RequestedLoadToHeatingSetpoint;
297 : Real64 RequestedLoadToCoolingSetpoint;
298 : int TsaMin_schedule_pointer;
299 : int TsaMax_schedule_pointer;
300 : int RHsaMin_schedule_pointer;
301 : int RHsaMax_schedule_pointer;
302 : int PrimaryMode;
303 : Real64 PrimaryModeRuntimeFraction;
304 : Real64 averageOSAF;
305 : int ErrorCode;
306 : bool StandBy;
307 : int InletNode;
308 : int OutletNode;
309 : int SecondaryInletNode; // This is usually OA node feeding into the purge/secondary side
310 : int SecondaryOutletNode; // This outlet node of the secondary side and inlet to the secondary fan
311 : Real64 FinalElectricalPower; // Output fuel use in W
312 : Real64 FinalElectricalEnergy; // Output fuel energy use in J
313 : Real64 InletMassFlowRate; // Inlet is primary process air node at inlet to cooler
314 : Real64 InletVolumetricFlowRate; // Inlet is primary process air node at inlet to cooler
315 : Real64 InletTemp;
316 : Real64 InletWetBulbTemp;
317 : Real64 InletHumRat;
318 : Real64 InletEnthalpy;
319 : Real64 InletPressure;
320 : Real64 InletRH;
321 : Real64 OutletVolumetricFlowRate;
322 : Real64 OutletMassFlowRate; // Inlet is primary process air node at inlet to cooler
323 : Real64 PowerLossToAir;
324 : Real64 FanHeatTemp;
325 : Real64 OutletTemp;
326 : Real64 OutletWetBulbTemp;
327 : Real64 OutletHumRat;
328 : Real64 OutletEnthalpy;
329 : Real64 OutletPressure;
330 : Real64 OutletRH;
331 : Real64 SecInletMassFlowRate; // Inlet is primary process air node at inlet to cooler
332 : Real64 SecInletTemp;
333 : Real64 SecInletWetBulbTemp;
334 : Real64 SecInletHumRat;
335 : Real64 SecInletEnthalpy;
336 : Real64 SecInletPressure;
337 : Real64 SecInletRH;
338 : Real64 SecOutletVolumetricFlowRate;
339 : Real64 SecOutletMassFlowRate; // Inlet is primary process air node at inlet to cooler
340 : Real64 SecOutletTemp;
341 : Real64 SecOutletWetBulbTemp;
342 : Real64 SecOutletHumRat;
343 : Real64 SecOutletEnthalpy;
344 : Real64 SecOutletPressure;
345 : Real64 SecOutletRH;
346 : Real64 Wsa;
347 : Real64 SupplyVentilationAir;
348 : Real64 SupplyVentilationVolume;
349 :
350 : bool OutdoorAir;
351 : Real64 MinOA_Msa;
352 : int OARequirementsPtr; // Index to DesignSpecification:OutdoorAir object
353 :
354 : Real64 Tsa;
355 : int ModeCounter;
356 : bool CoolingRequested;
357 : bool HeatingRequested;
358 : bool VentilationRequested;
359 : bool DehumidificationRequested;
360 : bool HumidificationRequested;
361 : // non-initializer
362 : std::vector<int> Tsa_curve_pointer;
363 : std::vector<int> HRsa_curve_pointer;
364 : std::vector<int> Psa_curve_pointer;
365 : std::vector<CMode> OperatingModes;
366 : std::vector<CSetting> CurrentOperatingSettings;
367 :
368 : CSetting OptimalSetting;
369 : CSetting oStandBy;
370 :
371 : std::vector<CSetting> Settings;
372 : // methods
373 : int CurrentPrimaryMode();
374 : Real64 CurrentPrimaryRuntimeFraction();
375 : Real64 CalculatePartRuntimeFraction(Real64 MinOA_Msa,
376 : Real64 Mvent,
377 : Real64 RequestedCoolingLoad,
378 : Real64 RequestedHeatingLoad,
379 : Real64 SensibleRoomORZone,
380 : Real64 RequestedDehumidificationLoad,
381 : Real64 RequestedMoistureLoad,
382 : Real64 LatentRoomORZone);
383 : bool ParseMode(EnergyPlusData &state,
384 : Array1D_string Alphas,
385 : Array1D_string cAlphaFields,
386 : Array1D<Real64> Numbers,
387 : Array1D_string cNumericFields,
388 : Array1D<bool> lAlphaBlanks,
389 : std::string cCurrentModuleObject);
390 : void doStep(EnergyPlusData &state,
391 : Real64 RequestedLoad,
392 : Real64 ZoneHeatingLoad,
393 : Real64 OutputRequiredToHumidify,
394 : Real64 OutputRequiredToDehumidify,
395 : Real64 DesignMinVR);
396 : void Initialize(int ZoneNumber);
397 : void InitializeModelParams();
398 : void ResetOutputs();
399 : bool MeetsSupplyAirTOC(EnergyPlusData &state, Real64 Tosa);
400 : bool MeetsSupplyAirRHOC(EnergyPlusData &state, Real64 Wosa);
401 : Real64 CheckVal_T(EnergyPlusData &state, Real64 T);
402 : Real64 CheckVal_W(EnergyPlusData &state, Real64 W, Real64 T, Real64 P); // pascals
403 : bool SetStandByMode(EnergyPlusData &state, CMode Mode0, Real64 Tosa, Real64 Wosa, Real64 Tra, Real64 Wra);
404 : Real64 CalculateTimeStepAverage(SYSTEMOUTPUTS val);
405 : int SetOperatingSetting(EnergyPlusData &state, CStepInputs StepIns);
406 : void DetermineCoolingVentilationOrHumidificationNeeds(CStepInputs &StepIns);
407 :
408 : private: // begin private section
409 : // number of times in a day it failed resulting in a warning.
410 : std::vector<int> SAT_OC_MetinMode_v;
411 : std::vector<int> SAHR_OC_MetinMode_v;
412 : bool WarnOnceFlag;
413 :
414 : int count_EnvironmentConditionsNotMet;
415 : int count_EnvironmentConditionsMetOnce;
416 : int count_SAHR_OC_MetOnce;
417 : int count_SAT_OC_MetOnce;
418 : int count_DidWeMeetLoad;
419 : int count_DidWeNotMeetLoad;
420 :
421 : bool optimal_EnvCondMet;
422 : bool RunningPeakCapacity_EnvCondMet;
423 :
424 : std::vector<Real64> PolygonXs;
425 : std::vector<Real64> PolygonYs;
426 : };
427 : } // namespace HybridEvapCoolingModel
428 : } // namespace EnergyPlus
429 :
430 : #endif
|