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 ChillerReformulatedEIR_hh_INCLUDED
49 : #define ChillerReformulatedEIR_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGlobals.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/Plant/DataPlant.hh>
59 : #include <EnergyPlus/PlantComponent.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace ChillerReformulatedEIR {
67 :
68 : enum class PLR
69 : {
70 : Invalid = -1,
71 : LeavingCondenserWaterTemperature, // Type 1_LeavingCondenserWaterTemperature
72 : Lift, // Type 2_Lift
73 : Num
74 : };
75 :
76 : struct ReformulatedEIRChillerSpecs : PlantComponent
77 : {
78 : // Members
79 : std::string Name; // User identifier
80 : int TypeNum = 0; // plant loop type identifier
81 : std::string CAPFTName; // CAPFT curve name
82 : std::string EIRFTName; // EIRFT curve name
83 : std::string EIRFPLRName; // EIRPLR curve name
84 : DataPlant::CondenserType CondenserType =
85 : DataPlant::CondenserType::Invalid; // Type of Condenser. Water Cooled is the only available option for now
86 : PLR PartLoadCurveType = PLR::Invalid; // Part Load Ratio Curve Type: 1_LeavingCondenserWaterTemperature; 2_Lift
87 : Real64 RefCap = 0.0; // Reference capacity of the chiller [W]
88 : bool RefCapWasAutoSized = false; // reference capacity was autosized on input
89 : Real64 RefCOP = 0.0; // Reference coefficient of performance [W/W]
90 : DataPlant::FlowMode FlowMode = DataPlant::FlowMode::Invalid;
91 : DataPlant::CondenserFlowControl CondenserFlowControl = DataPlant::CondenserFlowControl::Invalid;
92 : bool ModulatedFlowSetToLoop = false; // True if the setpoint is missing at the outlet node
93 : bool ModulatedFlowErrDone = false; // true if setpoint warning issued
94 : Real64 EvapVolFlowRate = 0.0; // Reference water volumetric flow rate through the evaporator [m3/s]
95 : bool EvapVolFlowRateWasAutoSized = false; // true if previous was autosize input
96 : Real64 EvapMassFlowRateMax = 0.0; // Reference water mass flow rate through evaporator [kg/s]
97 : Real64 CondVolFlowRate = 0.0; // Reference water volumetric flow rate through the condenser [m3/s]
98 : bool CondVolFlowRateWasAutoSized = false; // true if previous was set to autosize on input
99 : Real64 CondMassFlowRateMax = 0.0; // Reference water mass flow rate through condenser [kg/s]
100 : Real64 CompPowerToCondenserFrac = 0.0; // Fraction of compressor electric power rejected by condenser [0 to 1]
101 : int EvapInletNodeNum = 0; // Node number on the inlet side of the plant (evaporator side)
102 : int EvapOutletNodeNum = 0; // Node number on the outlet side of the plant (evaporator side)
103 : int CondInletNodeNum = 0; // Node number on the inlet side of the condenser
104 : int CondOutletNodeNum = 0; // Node number on the outlet side of the condenser
105 : Real64 MinPartLoadRat = 0.0; // Minimum allowed operating fraction of full load
106 : Real64 MaxPartLoadRat = 0.0; // Maximum allowed operating fraction of full load
107 : Real64 OptPartLoadRat = 0.0; // Optimal operating fraction of full load
108 : Real64 MinUnloadRat = 0.0; // Minimum unloading ratio
109 : Real64 TempRefCondIn = 0.0; // The reference secondary loop fluid temperature at the
110 : // chiller condenser side inlet for the reformulated chiller [C]
111 : Real64 TempRefCondOut = 0.0; // The reference secondary loop fluid temperature at the
112 : // chiller condenser side outlet for the reformulated chiller [C]
113 : Real64 TempRefEvapOut = 0.0; // The reference primary loop fluid
114 : // temperature at the chiller evaporator side outlet [C]
115 : Real64 TempLowLimitEvapOut = 0.0; // Low temperature shut off [C]
116 : Real64 DesignHeatRecVolFlowRate = 0.0; // Design water volumetric flow rate through heat recovery loop [m3/s]
117 : bool DesignHeatRecVolFlowRateWasAutoSized = false; // true if previous input was autosize
118 : Real64 DesignHeatRecMassFlowRate = 0.0; // Design water mass flow rate through heat recovery loop [kg/s]
119 : Real64 SizFac = 0.0; // sizing factor
120 : bool HeatRecActive = false; // True when entered Heat Rec Vol Flow Rate > 0
121 : int HeatRecInletNodeNum = 0; // Node number for the heat recovery inlet side of the condenser
122 : int HeatRecOutletNodeNum = 0; // Node number for the heat recovery outlet side of the condenser
123 : Real64 HeatRecCapacityFraction = 0.0; // user input for heat recovery capacity fraction []
124 : Real64 HeatRecMaxCapacityLimit = 0.0; // Capacity limit for Heat recovery, one time calc [W]
125 : int HeatRecSetPointNodeNum = 0; // index for system node with the heat recover leaving setpoint
126 : Sched::Schedule *heatRecInletLimitSched = nullptr; // index for schedule for the inlet high limit for heat recovery operation
127 : int ChillerCapFTIndex = 0; // Index for the total cooling capacity modifier curve
128 : // (function of leaving evaporator and condenser water temperatures)
129 : int ChillerEIRFTIndex = 0; // Index for the energy input ratio modifier curve
130 : // (function of leaving evaporator and condenser water temperatures)
131 : int ChillerEIRFPLRIndex = 0; // Index for the energy input ratio vs part-load ratio curve
132 : // (function of leaving condenser water temperature and part-load ratio)
133 : int ChillerCapFTError = 0; // Used for negative capacity as a function of temp warnings
134 : int ChillerCapFTErrorIndex = 0; // Used for negative capacity as a function of temp warnings
135 : int ChillerEIRFTError = 0; // Used for negative EIR as a function of temp warnings
136 : int ChillerEIRFTErrorIndex = 0; // Used for negative EIR as a function of temp warnings
137 : int ChillerEIRFPLRError = 0; // Used for negative EIR as a function of PLR warnings
138 : int ChillerEIRFPLRErrorIndex = 0; // Used for negative EIR as a function of PLR warnings
139 : Real64 ChillerCAPFTXTempMin = 0.0; // Minimum value of CAPFT curve X variable [C]
140 : Real64 ChillerCAPFTXTempMax = 0.0; // Maximum value of CAPFT curve X variable [C]
141 : Real64 ChillerCAPFTYTempMin = 0.0; // Minimum value of CAPFT curve Y variable [C]
142 : Real64 ChillerCAPFTYTempMax = 0.0; // Maximum value of CAPFT curve Y variable [C]
143 : Real64 ChillerEIRFTXTempMin = 0.0; // Minimum value of EIRFT curve X variable [C]
144 : Real64 ChillerEIRFTXTempMax = 0.0; // Maximum value of EIRFT curve X variable [C]
145 : Real64 ChillerEIRFTYTempMin = 0.0; // Minimum value of EIRFT curve Y variable [C]
146 : Real64 ChillerEIRFTYTempMax = 0.0; // Maximum value of EIRFT curve Y variable [C]
147 : Real64 ChillerEIRFPLRTempMin = 0.0; // Minimum value of EIRFPLR curve condenser outlet temperature [C]
148 : Real64 ChillerEIRFPLRTempMax = 0.0; // Maximum value of EIRFPLR curve condenser outlet temperature [C]
149 : Real64 ChillerEIRFPLRPLRMin = 0.0; // Minimum value of EIRFPLR curve part-load ratio
150 : Real64 ChillerEIRFPLRPLRMax = 0.0; // Maximum value of EIRFPLR curve part-load ratio
151 : Real64 ChillerLiftNomMin = 0.0; // Minimum value of EIRFPLR curve Normalized Chiller lift
152 : Real64 ChillerLiftNomMax = 10.0; // Maximum value of EIRFPLR curve Normalized Chiller lift
153 : Real64 ChillerTdevNomMin = 0.0; // Minimum value of EIRFPLR curve Normalized Tdev
154 : Real64 ChillerTdevNomMax = 10.0; // Maximum value of EIRFPLR curve Normalized Tdev
155 : int CAPFTXIter = 0; // Iteration counter for evaporator outlet temperature CAPFT warning messages
156 : int CAPFTXIterIndex = 0; // Index for evaporator outlet temperature CAPFT warning messages
157 : int CAPFTYIter = 0; // Iteration counter for condenser outlet temperature CAPFT warning messages
158 : int CAPFTYIterIndex = 0; // Index for condenser outlet temperature CAPFT warning messages
159 : int EIRFTXIter = 0; // Iteration counter for evaporator outlet temperature EIRFT warning messages
160 : int EIRFTXIterIndex = 0; // Index for evaporator outlet temperature EIRFT warning messages
161 : int EIRFTYIter = 0; // Iteration counter for condenser outlet temperature EIRFT warning messages
162 : int EIRFTYIterIndex = 0; // Index for condenser outlet temperature EIRFT warning messages
163 : int EIRFPLRTIter = 0; // Iteration counter for condenser outlet temperature EIRFPLR warning messages
164 : int EIRFPLRTIterIndex = 0; // Index for condenser outlet temperature EIRFPLR warning messages
165 : int EIRFPLRPLRIter = 0; // Iteration counter for part-load ratio EIRFPLR warning messages
166 : int EIRFPLRPLRIterIndex = 0; // Index for part-load ratio EIRFPLR warning messages
167 : bool FaultyChillerSWTFlag = false; // True if the chiller has SWT sensor fault
168 : int FaultyChillerSWTIndex = 0; // Index of the fault object corresponding to the chiller
169 : Real64 FaultyChillerSWTOffset = 0.0; // Chiller SWT sensor offset
170 : int IterLimitExceededNum = 0; // Iteration limit exceeded for RegulaFalsi routine
171 : int IterLimitErrIndex = 0; // Index to iteration limit warning for RegulaFalsi routine
172 : int IterFailed = 0; // Iteration limit failed for RegulaFalsi routine
173 : int IterFailedIndex = 0; // Index to iteration limit failed for RegulaFalsi routine
174 : int DeltaTErrCount = 0; // Evaporator delta T equals 0 for variable flow chiller warning messages
175 : int DeltaTErrCountIndex = 0; // Index to evaporator delta T = 0 for variable flow chiller warning messages
176 : PlantLocation CWPlantLoc; // chilled water plant loop component index
177 : PlantLocation CDPlantLoc; // condenser water plant loop component index
178 : PlantLocation HRPlantLoc; // heat recovery water plant loop component index
179 : int CondMassFlowIndex = 0;
180 : bool PossibleSubcooling = false; // flag to indicate chiller is doing less cooling that requested
181 : // Operational fault parameters
182 : bool FaultyChillerFoulingFlag = false; // True if the chiller has fouling fault
183 : int FaultyChillerFoulingIndex = 0; // Index of the fault object corresponding to the chiller
184 : Real64 FaultyChillerFoulingFactor = 1.0; // Chiller fouling factor
185 : std::string EndUseSubcategory; // identifier use for the end use subcategory
186 : bool MyEnvrnFlag = true;
187 : bool MyInitFlag = true;
188 : bool MySizeFlag = true;
189 : Real64 ChillerCondAvgTemp = 0.0; // average condenser temp for curves with Heat recovery [C]
190 : Real64 ChillerFalseLoadRate = 0.0; // Chiller false load over and above water side load [J]
191 : Real64 ChillerCyclingRatio = 0.0; // Chiller cycling ratio (time on/time step)
192 : Real64 ChillerPartLoadRatio = 0.0; // Chiller PLR (Load/Capacity)
193 : Real64 ChillerEIRFPLR = 0.0; // Chiller EIRFPLR curve output value
194 : Real64 ChillerEIRFT = 0.0; // Chiller EIRFT curve output value
195 : Real64 ChillerCapFT = 0.0; // Chiller capacity curve output value
196 : Real64 HeatRecOutletTemp = 0.0;
197 : Real64 QHeatRecovery = 0.0; // Heat recovered from water-cooled condenser [W]
198 : Real64 QCondenser = 0.0;
199 : Real64 QEvaporator = 0.0; // Evaporator heat transfer rate [W]
200 : Real64 Power = 0.0; // Chiller power [W]
201 : Real64 EvapOutletTemp = 0.0; // Evaporator outlet temperature [C]
202 : Real64 CondOutletTemp = 0.0; // Condenser outlet temperature [C]
203 : Real64 EvapMassFlowRate = 0.0; // Evaporator mass flow rate [kg/s]
204 : Real64 CondMassFlowRate = 0.0; // Condenser mass flow rate [kg/s]
205 : Real64 ChillerFalseLoad = 0.0; // Chiller false load over and above water side load [W]
206 : Real64 Energy = 0.0; // Chiller electric consumption [J]
207 : Real64 EvapEnergy = 0.0; // Evaporator heat transfer energy [J]
208 : Real64 CondEnergy = 0.0; // Condenser heat transfer energy [J]
209 : Real64 CondInletTemp = 0.0; // Condenser inlet temperature [C]
210 : Real64 EvapInletTemp = 0.0; // Evaporator inlet temperature [C]
211 : Real64 ActualCOP = 0.0; // Coefficient of performance
212 : Real64 EnergyHeatRecovery = 0.0; // Energy recovered from water-cooled condenser [J]
213 : Real64 HeatRecInletTemp = 0.0; // Heat reclaim inlet temperature [C]
214 : Real64 HeatRecMassFlow = 0.0; // Heat reclaim mass flow rate [kg/s]
215 : int ChillerCondLoopFlowFLoopPLRIndex = 0; // Condenser loop flow rate fraction function of loop PLR
216 : int CondDT = 0; // Temperature difference across condenser
217 : Sched::Schedule *condDTSched = nullptr; // Temperature difference across condenser schedule
218 : Real64 MinCondFlowRatio = 0.2; // Minimum condenser flow fraction
219 : DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;
220 : Real64 VSBranchPumpMinLimitMassFlowCond = 0.0;
221 : bool VSBranchPumpFoundCond = false;
222 : bool VSLoopPumpFoundCond = false;
223 :
224 : // thermosiphon model
225 : int thermosiphonTempCurveIndex = 0;
226 : Real64 thermosiphonMinTempDiff = 0.0;
227 : int thermosiphonStatus = 0;
228 :
229 : static ReformulatedEIRChillerSpecs *factory(EnergyPlusData &state, std::string const &objectName);
230 :
231 : void simulate([[maybe_unused]] EnergyPlusData &state,
232 : const PlantLocation &calledFromLocation,
233 : bool FirstHVACIteration,
234 : Real64 &CurLoad,
235 : bool RunFlag) override;
236 :
237 : void getDesignCapacities(
238 : EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
239 :
240 : void getDesignTemperatures(Real64 &TempDesCondIn, Real64 &TempDesEvapOut) override;
241 :
242 : void getSizingFactor(Real64 &sizFac) override;
243 :
244 : void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
245 :
246 : void oneTimeInit(EnergyPlusData &state) override;
247 :
248 : void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad);
249 :
250 : void setupOutputVars(EnergyPlusData &state);
251 :
252 : void size(EnergyPlusData &state);
253 :
254 : void control(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag, bool FirstIteration);
255 :
256 : void calculate(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag, Real64 FalsiCondOutTemp);
257 :
258 : void calcHeatRecovery(EnergyPlusData &state, Real64 &QCond, Real64 CondMassFlow, Real64 condInletTemp, Real64 &QHeatRec);
259 :
260 : void update(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
261 :
262 : void checkMinMaxCurveBoundaries(EnergyPlusData &state, bool FirstIteration);
263 :
264 : bool thermosiphonDisabled(EnergyPlusData &state);
265 : };
266 :
267 : void GetElecReformEIRChillerInput(EnergyPlusData &state);
268 :
269 : } // namespace ChillerReformulatedEIR
270 :
271 : struct ChillerReformulatedEIRData : BaseGlobalStruct
272 : {
273 : bool GetInputREIR = true;
274 : Array1D<ChillerReformulatedEIR::ReformulatedEIRChillerSpecs> ElecReformEIRChiller;
275 :
276 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
277 : {
278 2126 : }
279 :
280 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
281 : {
282 1152 : }
283 :
284 2100 : void clear_state() override
285 : {
286 2100 : new (this) ChillerReformulatedEIRData();
287 2100 : }
288 : };
289 :
290 : } // namespace EnergyPlus
291 :
292 : #endif
|