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 ICEngineElectricGenerator_hh_INCLUDED
49 : #define ICEngineElectricGenerator_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGlobalConstants.hh>
57 : #include <EnergyPlus/DataGlobals.hh>
58 : #include <EnergyPlus/ElectricPowerServiceManager.hh>
59 : #include <EnergyPlus/EnergyPlus.hh>
60 : #include <EnergyPlus/PlantComponent.hh>
61 : #include <EnergyPlus/UtilityRoutines.hh>
62 :
63 : namespace EnergyPlus {
64 :
65 : // Forward declarations
66 : struct EnergyPlusData;
67 :
68 : namespace ICEngineElectricGenerator {
69 :
70 : Real64 constexpr ReferenceTemp(25.0); // Reference temperature by which lower heating
71 : // value is reported. This should be subtracted
72 : // off of when calculated exhaust energies.
73 :
74 : struct ICEngineGeneratorSpecs : PlantComponent
75 : {
76 : // Members
77 : std::string Name; // user identifier
78 : std::string TypeOf; // Type of Generator
79 : GeneratorType CompType_Num;
80 : Constant::eFuel FuelType; // Type of Fuel - DIESEL, GASOLINE, GAS
81 : Real64 RatedPowerOutput; // W - design nominal capacity of Generator
82 : int ElectricCircuitNode; // Electric Circuit Node
83 : Real64 MinPartLoadRat; // (IC ENGINE MIN) min allowed operating frac full load
84 : Real64 MaxPartLoadRat; // (IC ENGINE MAX) max allowed operating frac full load
85 : Real64 OptPartLoadRat; // (IC ENGINE BEST) optimal operating frac full load
86 : Real64 ElecOutputFuelRat; // (RELDC) Ratio of Generator output to Fuel Energy Input
87 : int ElecOutputFuelCurve; // Curve Index for generator output to Fuel Energy Input Coeff Poly Fit
88 : Real64 RecJacHeattoFuelRat; // (RJACDC) Ratio of Recoverable Jacket Heat to Fuel Energy Input
89 : int RecJacHeattoFuelCurve; // Curve Index for Ratio of Recoverable Jacket Heat to
90 : // Fuel Energy Input Coeff Poly Fit
91 : Real64 RecLubeHeattoFuelRat; // (RLUBDC) Ratio of Recoverable Lube Oil Heat to Fuel Energy Input
92 : int RecLubeHeattoFuelCurve; // Curve Index for Ratio of Recoverable Lube Oil Heat to
93 : // Fuel Energy Input Coef Poly Fit
94 : Real64 TotExhausttoFuelRat; // (REXDC) Total Exhaust heat Input to Fuel Energy Input
95 : int TotExhausttoFuelCurve; // Curve Index for Total Exhaust heat Input to Fuel Energy Input
96 : // Coeffs Poly Fit
97 : Real64 ExhaustTemp; // (TEXDC) Exhaust Gas Temp to Fuel Energy Input
98 : int ExhaustTempCurve; // Curve Index for Exhaust Gas Temp to Fuel Energy Input Coeffs Poly Fit
99 : int ErrExhaustTempIndex; // error index for temp curve
100 : Real64 UA; // (UACDC) exhaust gas Heat Exchanger UA to Capacity
101 : Array1D<Real64> UACoef; // Heat Exchanger UA Coeffs Poly Fit
102 : Real64 MaxExhaustperPowerOutput; // MAX EXHAUST FLOW PER W DSL POWER OUTPUT COEFF
103 : Real64 DesignMinExitGasTemp; // Steam Saturation Temperature
104 : Real64 FuelHeatingValue; // Heating Value of Fuel in kJ/kg
105 : Real64 DesignHeatRecVolFlowRate; // m3/s, Design Water mass flow rate through heat recovery loop
106 : Real64 DesignHeatRecMassFlowRate; // kg/s, Design Water mass flow rate through heat recovery loop
107 : bool HeatRecActive; // True if Heat Rec Design Vol Flow Rate > 0
108 : int HeatRecInletNodeNum; // Node number on the heat recovery inlet side of the condenser
109 : int HeatRecOutletNodeNum; // Node number on the heat recovery outlet side of the condenser
110 : Real64 HeatRecInletTemp; // Inlet Temperature of the heat recovery fluid
111 : Real64 HeatRecOutletTemp; // Outlet Temperature of the heat recovery fluid
112 : Real64 HeatRecMdotDesign; // reporting: Heat Recovery Loop Mass flow rate
113 : Real64 HeatRecMdotActual;
114 : Real64 QTotalHeatRecovered; // total heat recovered (W)
115 : Real64 QJacketRecovered; // heat recovered from jacket (W)
116 : Real64 QLubeOilRecovered; // heat recovered from lube (W)
117 : Real64 QExhaustRecovered; // exhaust gas heat recovered (W)
118 : Real64 FuelEnergyUseRate; // Fuel Energy used (W)
119 : Real64 TotalHeatEnergyRec; // total heat recovered (J)
120 : Real64 JacketEnergyRec; // heat recovered from jacket (J)
121 : Real64 LubeOilEnergyRec; // heat recovered from lube (J)
122 : Real64 ExhaustEnergyRec; // exhaust gas heat recovered (J)
123 : Real64 FuelEnergy; // Fuel Energy used (J)
124 : Real64 FuelMdot; // Fuel Amount used (Kg/s)
125 : Real64 ExhaustStackTemp; // Exhaust Stack Temperature (C)
126 : Real64 ElecPowerGenerated; // Electric Power Generated (W)
127 : Real64 ElecEnergyGenerated; // Amount of Electric Energy Generated (J)
128 : Real64 HeatRecMaxTemp; // Max Temp that can be produced in heat recovery
129 : PlantLocation HRPlantLoc; // cooling water plant loop component index, for heat recovery
130 : bool MyEnvrnFlag;
131 : bool MyPlantScanFlag;
132 : bool MySizeAndNodeInitFlag;
133 : bool CheckEquipName;
134 : bool myFlag;
135 :
136 : // Default Constructor
137 5 : ICEngineGeneratorSpecs()
138 5 : : TypeOf("Generator:InternalCombustionEngine"), CompType_Num(GeneratorType::ICEngine), RatedPowerOutput(0.0), ElectricCircuitNode(0),
139 5 : MinPartLoadRat(0.0), MaxPartLoadRat(0.0), OptPartLoadRat(0.0), ElecOutputFuelRat(0.0), ElecOutputFuelCurve(0), RecJacHeattoFuelRat(0.0),
140 5 : RecJacHeattoFuelCurve(0), RecLubeHeattoFuelRat(0.0), RecLubeHeattoFuelCurve(0), TotExhausttoFuelRat(0.0), TotExhausttoFuelCurve(0),
141 5 : ExhaustTemp(0.0), ExhaustTempCurve(0), ErrExhaustTempIndex(0), UA(0.0), UACoef(2, 0.0), MaxExhaustperPowerOutput(0.0),
142 5 : DesignMinExitGasTemp(0.0), FuelHeatingValue(0.0), DesignHeatRecVolFlowRate(0.0), DesignHeatRecMassFlowRate(0.0), HeatRecActive(false),
143 5 : HeatRecInletNodeNum(0), HeatRecOutletNodeNum(0), HeatRecInletTemp(0.0), HeatRecOutletTemp(0.0), HeatRecMdotDesign(0.0),
144 5 : HeatRecMdotActual(0.0), QTotalHeatRecovered(0.0), QJacketRecovered(0.0), QLubeOilRecovered(0.0), QExhaustRecovered(0.0),
145 5 : FuelEnergyUseRate(0.0), TotalHeatEnergyRec(0.0), JacketEnergyRec(0.0), LubeOilEnergyRec(0.0), ExhaustEnergyRec(0.0), FuelEnergy(0.0),
146 5 : FuelMdot(0.0), ExhaustStackTemp(0.0), ElecPowerGenerated(0.0), ElecEnergyGenerated(0.0), HeatRecMaxTemp(0.0), HRPlantLoc{},
147 5 : MyEnvrnFlag(true), MyPlantScanFlag(true), MySizeAndNodeInitFlag(true), CheckEquipName(true), myFlag(true)
148 : {
149 5 : }
150 :
151 : void simulate([[maybe_unused]] EnergyPlusData &state,
152 : const PlantLocation &calledFromLocation,
153 : bool FirstHVACIteration,
154 : Real64 &CurLoad,
155 : bool RunFlag) override;
156 :
157 : void InitICEngineGenerators(EnergyPlusData &state, bool RunFlag, bool FirstHVACIteration);
158 :
159 : void CalcICEngineGeneratorModel(EnergyPlusData &state, bool RunFlag, Real64 MyLoad);
160 :
161 : void CalcICEngineGenHeatRecovery(EnergyPlusData &state, Real64 EnergyRecovered, Real64 HeatRecMdot, Real64 &HRecRatio);
162 :
163 : void update(EnergyPlusData &state);
164 :
165 : void setupOutputVars(EnergyPlusData &state);
166 :
167 : void getDesignCapacities(EnergyPlusData &state,
168 : [[maybe_unused]] const PlantLocation &calledFromLocation,
169 : Real64 &MaxLoad,
170 : Real64 &MinLoad,
171 : Real64 &OptLoad) override;
172 :
173 : static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
174 :
175 : void oneTimeInit(EnergyPlusData &state) override;
176 : };
177 :
178 : void GetICEngineGeneratorInput(EnergyPlusData &state);
179 :
180 : } // namespace ICEngineElectricGenerator
181 :
182 : struct ICEngineElectricGeneratorData : BaseGlobalStruct
183 : {
184 :
185 : int NumICEngineGenerators = 0; // number of IC ENGINE Generators specified in input
186 : bool getICEInput = true; // When TRUE, calls subroutine to read input file.
187 : Array1D<ICEngineElectricGenerator::ICEngineGeneratorSpecs> ICEngineGenerator; // dimension to number of machines
188 :
189 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
190 : {
191 796 : }
192 :
193 0 : void clear_state() override
194 : {
195 0 : this->getICEInput = true;
196 0 : this->NumICEngineGenerators = 0;
197 0 : this->ICEngineGenerator.deallocate();
198 0 : }
199 : };
200 :
201 : } // namespace EnergyPlus
202 :
203 : #endif
|