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