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 Boilers_hh_INCLUDED
49 : #define Boilers_hh_INCLUDED
50 :
51 : #include <array>
52 :
53 : // ObjexxFCL Headers
54 : #include <ObjexxFCL/Array1D.hh>
55 :
56 : // EnergyPlus Headers
57 : #include <EnergyPlus/Data/BaseData.hh>
58 : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
59 : #include <EnergyPlus/DataGlobalConstants.hh>
60 : #include <EnergyPlus/DataGlobals.hh>
61 : #include <EnergyPlus/EnergyPlus.hh>
62 : #include <EnergyPlus/Plant/DataPlant.hh>
63 : #include <EnergyPlus/PlantComponent.hh>
64 : #include <EnergyPlus/UtilityRoutines.hh>
65 :
66 : namespace EnergyPlus {
67 :
68 : // Forward declarations
69 : struct EnergyPlusData;
70 :
71 : namespace Curve {
72 : struct Curve;
73 : }
74 :
75 : namespace Boilers {
76 :
77 : // water temperature evaluation method
78 : enum class TempMode
79 : {
80 : Invalid = -1,
81 : NOTSET,
82 : ENTERINGBOILERTEMP,
83 : LEAVINGBOILERTEMP,
84 : Num
85 : };
86 :
87 : struct BoilerSpecs : PlantComponent
88 : {
89 : // Members
90 : std::string Name; // user identifier
91 : Constant::eFuel FuelType = Constant::eFuel::Invalid; // resource type assignment
92 : DataPlant::PlantEquipmentType Type = DataPlant::PlantEquipmentType::Invalid; // plant loop type identifier
93 : PlantLocation plantLoc{};
94 : bool Available = false; // TRUE if machine available in current time step
95 : bool ON = false; // TRUE: simulate the machine at it's operating part load ratio
96 : Real64 NomCap = 0.0; // W - design nominal capacity of Boiler
97 : bool NomCapWasAutoSized = false; // true if previous was set to autosize input
98 : Real64 NomEffic = 0.0; // boiler efficiency at design conditions
99 : Real64 TempDesBoilerOut = 0.0; // C - Boiler design outlet temperature
100 : DataPlant::FlowMode FlowMode = DataPlant::FlowMode::Invalid; // one of 3 modes for component flow during operation
101 : bool ModulatedFlowSetToLoop = false; // True if the setpoint is missing at the outlet node
102 : bool ModulatedFlowErrDone = false; // true if setpoint warning issued
103 : Real64 VolFlowRate = 0.0; // m3/s - Boiler water design volumetric flow rate
104 : bool VolFlowRateWasAutoSized = false; // true if previous was set to autosize input
105 : Real64 DesMassFlowRate = 0.0; // kg/s - Boiler water design mass flow rate
106 : Real64 MassFlowRate = 0.0; // kg/s - Boiler water mass flow rate
107 : Real64 SizFac = 0.0; // sizing factor
108 : int BoilerInletNodeNum = 0; // Node number at the boiler inlet
109 : int BoilerOutletNodeNum = 0; // Node number at the boiler outlet
110 : Real64 MinPartLoadRat = 0.0; // Minimum allowed operating part load ratio
111 : Real64 MaxPartLoadRat = 0.0; // Maximum allowed operating part load ratio
112 : Real64 OptPartLoadRat = 0.0; // Optimal operating part load ratio
113 : Real64 OperPartLoadRat = 0.0; // Actual operating part load ratio
114 : TempMode CurveTempMode = TempMode::NOTSET; // water temp to use in curve, switch between entering and leaving
115 : Curve::Curve *EfficiencyCurve = nullptr; // Efficiency curve
116 : Real64 TempUpLimitBoilerOut = 0.0; // C - Boiler outlet maximum temperature limit
117 : Real64 ParasiticElecLoad = 0.0; // W - Parasitic electric power (e.g. forced draft fan)
118 : Real64 ParasiticFuelConsumption = 0.0; // parasitic fuel consumption associated with the boiler (standing pilot light) [J]
119 : Real64 ParasiticFuelRate = 0.0; // avg. parasitic fuel consumption rate with the gas boiler (standing pilot light) [W]
120 : Real64 ParasiticFuelCapacity = 0.0; // capacity of parasitic fuel consumption rate, input by user [W]
121 : int EffCurveOutputError = 0; // efficiency curve output <=0 recurring warning error counter
122 : int EffCurveOutputIndex = 0; // efficiency curve output <=0 recurring warning error message index
123 : int CalculatedEffError = 0; // calculated efficiency >1.1 recurring warning error counter
124 : int CalculatedEffIndex = 0; // calculated efficiency >1.1 recurring warning error message index
125 : bool IsThisSized = false; // TRUE if sizing is done
126 : // Operational fault parameters
127 : bool FaultyBoilerFoulingFlag = false; // True if the boiler has fouling fault
128 : int FaultyBoilerFoulingIndex = 0; // Index of the fault object corresponding to the boiler
129 : Real64 FaultyBoilerFoulingFactor = 1.0; // Boiler fouling factor
130 : std::string EndUseSubcategory; // identifier use for the end use subcategory
131 : bool MyEnvrnFlag = true;
132 : bool MyFlag = true;
133 :
134 : Real64 FuelUsed = 0.0; // W - Boiler fuel used
135 : Real64 ParasiticElecPower = 0.0; // W - Parasitic electrical power (e.g. forced draft fan)
136 : Real64 BoilerLoad = 0.0; // W - Boiler Load
137 : Real64 BoilerMassFlowRate = 0.0; // kg/s - Boiler mass flow rate
138 : Real64 BoilerOutletTemp = 0.0; // W - Boiler outlet temperature
139 : Real64 BoilerPLR = 0.0; // Boiler operating part-load ratio
140 : Real64 BoilerEff = 0.0; // Boiler operating efficiency
141 :
142 : Real64 BoilerEnergy = 0.0; // J - Boiler energy integrated over time
143 : Real64 FuelConsumed = 0.0; // J - Boiler Fuel consumed integrated over time
144 : Real64 BoilerInletTemp = 0.0; // C - Boiler inlet temperature
145 : Real64 ParasiticElecConsumption = 0.0; // J - Parasitic Electrical Consumption (e.g. forced draft fan)
146 :
147 : void simulate([[maybe_unused]] EnergyPlusData &state,
148 : const PlantLocation &calledFromLocation,
149 : bool FirstHVACIteration,
150 : Real64 &CurLoad,
151 : bool RunFlag) override;
152 :
153 : void getDesignCapacities(EnergyPlusData &state,
154 : [[maybe_unused]] const PlantLocation &calledFromLocation,
155 : Real64 &MaxLoad,
156 : Real64 &MinLoad,
157 : Real64 &OptLoad) override;
158 :
159 : void getSizingFactor(Real64 &SizFac) override;
160 :
161 : void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
162 :
163 : void SetupOutputVars(EnergyPlusData &state);
164 :
165 : void oneTimeInit(EnergyPlusData &state) override;
166 :
167 : void initEachEnvironment(EnergyPlusData &state);
168 :
169 : void InitBoiler(EnergyPlusData &state); // number of the current boiler being simulated
170 :
171 : void SizeBoiler(EnergyPlusData &state);
172 :
173 : void CalcBoilerModel(EnergyPlusData &state,
174 : Real64 MyLoad, // W - hot water demand to be met by boiler
175 : bool RunFlag, // TRUE if boiler operating
176 : DataBranchAirLoopPlant::ControlType EquipFlowCtrl // Flow control mode for the equipment
177 : );
178 :
179 : void UpdateBoilerRecords(EnergyPlusData &state,
180 : Real64 MyLoad, // boiler operating load
181 : bool RunFlag // boiler on when TRUE
182 : );
183 :
184 : static BoilerSpecs *factory(EnergyPlusData &state, std::string const &objectName);
185 : };
186 :
187 : void GetBoilerInput(EnergyPlusData &state);
188 :
189 : } // namespace Boilers
190 :
191 : struct BoilersData : BaseGlobalStruct
192 : {
193 : bool getBoilerInputFlag = true;
194 : Array1D<Boilers::BoilerSpecs> Boiler;
195 :
196 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
197 : {
198 2126 : }
199 :
200 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
201 : {
202 1152 : }
203 :
204 2100 : void clear_state() override
205 : {
206 2100 : new (this) BoilersData();
207 2100 : }
208 : };
209 :
210 : } // namespace EnergyPlus
211 :
212 : #endif
|