LCOV - code coverage report
Current view: top level - EnergyPlus - DataGenerators.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 9 66.7 %
Date: 2023-01-17 19:17:23 Functions: 11 16 68.8 %

          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 DataGenerators_hh_INCLUDED
      49             : #define DataGenerators_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             : 
      59             : namespace EnergyPlus {
      60             : 
      61             : namespace DataGenerators {
      62             : 
      63             :     // MODULE PARAMETER DEFINITIONS:
      64             :     enum class CurveMode
      65             :     {
      66             :         Invalid = -1,
      67             :         Normalized, // mode where efficiency curves are modifier curves
      68             :         Direct,     // mode where efficiency curves are direct
      69             :         Num
      70             :     };
      71             : 
      72             :     enum class SkinLoss
      73             :     {
      74             :         Invalid = -1,
      75             :         ConstantRate,
      76             :         UADT,              // UAdelta T mode for skin losses
      77             :         QuadraticFuelNdot, // Quadratic function of fuel flow for skin losses
      78             :         Num
      79             :     };
      80             : 
      81             :     enum class AirSupRateMode
      82             :     {
      83             :         Invalid = -1,
      84             :         QuadraticFuncofNdot,  // function of fuel rate mode for air flow
      85             :         ConstantStoicsAirRat, // Constant air ratio in stoics with fuel constituents
      86             :         QuadraticFuncofPel,   // function of electric power mode
      87             :         Num
      88             :     };
      89             : 
      90             :     enum class RecoverMode
      91             :     {
      92             :         Invalid = -1,
      93             :         NoRecoveryOnAirIntake,  // mode for controlling intake air heat recovery
      94             :         RecoverBurnInvertBatt,  // mode for controlling intake air heat recovery
      95             :         RecoverAuxiliaryBurner, // mode for controlling intake air heat recovery
      96             :         RecoverInverterBatt,    // mode for controlling intake air heat recovery
      97             :         RecoverInverter,        // mode for controlling intake air heat recovery
      98             :         RecoverBattery,         // mode for controlling intake air heat recovery
      99             :         Num
     100             :     };
     101             : 
     102             :     enum class ConstituentMode
     103             :     {
     104             :         Invalid = -1,
     105             :         RegularAir,
     106             :         UserDefinedConstituents,
     107             :         Num
     108             :     };
     109             : 
     110             :     enum class FuelTemperatureMode
     111             :     {
     112             :         Invalid = -1,
     113             :         FuelInTempFromNode,
     114             :         FuelInTempSchedule,
     115             :         Num
     116             :     };
     117             : 
     118             :     enum class WaterTemperatureMode
     119             :     {
     120             :         Invalid = -1,
     121             :         WaterInReformMains,
     122             :         WaterInReformAirNode,
     123             :         WaterInReformWaterNode,
     124             :         WaterInReformSchedule,
     125             :         Num
     126             :     };
     127             : 
     128             :     enum class InverterEfficiencyMode
     129             :     {
     130             :         Invalid = -1,
     131             :         Constant,
     132             :         Quadratic,
     133             :         Num
     134             :     };
     135             : 
     136             :     enum class ExhaustGasHX
     137             :     {
     138             :         Invalid = -1,
     139             :         FixedEffectiveness,   // exhaust gas HX modeling mode
     140             :         LMTDempiricalUAeff,   // exhaust gas HX modeling mode
     141             :         LMTDfundementalUAeff, // exhaust gas HX modeling mode
     142             :         Condensing,           // exhaust gas HX modeling mode
     143             :         Num
     144             :     };
     145             : 
     146             :     enum class ElectricalStorage
     147             :     {
     148             :         Invalid = -1,
     149             :         SimpleEffConstraints,         // electrical storage modeling mode
     150             :         LeadAcidBatterySaupe,         // electrical storage modeling mode
     151             :         LeadAcidBatterManwellMcGowan, // electrical storage modeling mode
     152             :         Num
     153             :     };
     154             : 
     155             :     enum class LossDestination
     156             :     {
     157             :         Invalid = -1,
     158             :         SurroundingZone,
     159             :         AirInletForFC,
     160             :         Num
     161             :     };
     162             : 
     163             :     enum class OperatingMode
     164             :     {
     165             :         Invalid = -1,
     166             :         Off,      // CHP operating mode OFF
     167             :         Standby,  // CHP operating mode Stand By
     168             :         WarmUp,   // CHP operating mode Warm Up or start up
     169             :         Normal,   // CHP operating mode Normal
     170             :         CoolDown, // CHP operating mode Cool down or shut down
     171             :         Num
     172             :     };
     173             : 
     174             :     enum class FuelMode
     175             :     {
     176             :         Invalid = -1,
     177             :         GaseousConstituents,
     178             :         GenericLiquid,
     179             :         Num
     180             :     };
     181             : 
     182             :     Real64 constexpr MinProductGasTemp(-100.0); // Minimum bound on search for product gas temps
     183             :     Real64 constexpr MaxProductGasTemp(2000.0); // Maximum bound on search for product gas temps
     184             : 
     185             :     enum class ThermodynamicMode
     186             :     {
     187             :         Invalid = -1,
     188             :         NISTShomate,
     189             :         NASAPolynomial,
     190             :         Num
     191             :     };
     192             : 
     193             :     Real64 constexpr RinKJperMolpK(0.0083145); // R is ideal gas constant (kJ/mol-K)
     194             :     Real64 constexpr InitHRTemp(50.0);         // Initialization temperature for heat recovery water
     195             :     Real64 constexpr ImBalanceTol(0.00001);    // used as fraction of electrical power at power module
     196             : 
     197          11 :     struct GeneratorFuelSupplyDataStruct
     198             :     {
     199             :         // Members
     200             :         // user input data
     201             :         std::string Name;                                                                                // name of this fuel supply module
     202             :         DataGenerators::FuelTemperatureMode FuelTempMode = DataGenerators::FuelTemperatureMode::Invalid; // temperature of fuel node
     203             :         DataGenerators::FuelMode FuelTypeMode = DataGenerators::FuelMode::Invalid;                       // type of fuel, gasous or liquid
     204             :         std::string NodeName;                                                                            // node name for temperature at input
     205             :         int NodeNum = 0;                                                                                 // node number for temperature at input
     206             :         int SchedNum = 0;                                                                                // fuel temperature at input
     207             :         int CompPowerCurveID = 0;                                                                        // "pointer" to compressor power cubic curve
     208             :         Real64 CompPowerLossFactor = 0.0;
     209             :         int NumConstituents = 0; // number of constituents in fue supply
     210             :         Array1D_string ConstitName;
     211             :         Array1D<Real64> ConstitMolalFract;
     212             :         // calculated data (except some for generic liquid)
     213             :         Array1D_int GasLibID;              // lookup ID in Gas Phase ThermoChemistry Structure Array
     214             :         Real64 LHV = 0.0;                  // lower heating value of gaseous fuel (kJ/mol)
     215             :         Real64 LHVJperkg = 0.0;            // lower heating value of gaseous fuel (J/kg)
     216             :         Real64 LHVliquid = 0.0;            // userdefined lhv for generic liquid (J/kg)
     217             :         Real64 HHV = 0.0;                  // higher heating value of fuel (J/kg)
     218             :         Real64 MW = 0.0;                   // molecular weight g/mol
     219             :         Real64 eCO2 = 0.0;                 // mass flow based CO2 emmissions factor for complete combustion (-)
     220             :         Real64 KmolPerSecToKgPerSec = 0.0; // conversion from moles to kilograms for this fuel. (
     221             :         Real64 StoicOxygenRate = 0.0;
     222             :         Real64 TfuelIntoCompress = 0.0; // inlet fuel temperature
     223             :         Real64 TfuelIntoFCPM = 0.0;     // compressed fuel temp
     224             :         Real64 PfuelCompEl = 0.0;       // fuel compressor power
     225             :         Real64 QskinLoss = 0.0;         // pumping losses for zone
     226             :         Real64 CO2ProductGasCoef = 0.0; // molar multiplier for stoic products of this fuel
     227             :         Real64 H2OProductGasCoef = 0.0; // molar multiplier for stoic products of this fuel
     228             : 
     229             :         // Default Constructor
     230           3 :         GeneratorFuelSupplyDataStruct() : ConstitName(14), ConstitMolalFract(14, 0.0), GasLibID(14, 0)
     231             :         {
     232           3 :         }
     233             :     };
     234             : 
     235          90 :     struct GasPropertyDataStruct
     236             :     {
     237             :         // Members
     238             :         std::string ConstituentName;
     239             :         std::string ConstituentFormula;
     240             :         Real64 StdRefMolarEnthOfForm = 0.0;
     241             :         DataGenerators::ThermodynamicMode ThermoMode = DataGenerators::ThermodynamicMode::Invalid; // method of calculation for thermodynamics
     242             :         Real64 ShomateA = 0.0;
     243             :         Real64 ShomateB = 0.0;
     244             :         Real64 ShomateC = 0.0;
     245             :         Real64 ShomateD = 0.0;
     246             :         Real64 ShomateE = 0.0;
     247             :         Real64 ShomateF = 0.0;
     248             :         Real64 ShomateG = 0.0;
     249             :         Real64 ShomateH = 0.0;
     250             :         Real64 NumCarbons = 0.0;
     251             :         Real64 NumHydrogens = 0.0;
     252             :         Real64 NumOxygens = 0.0;
     253             :         Real64 MolecularWeight = 0.0;
     254             :         Real64 NASA_A1 = 0.0;
     255             :         Real64 NASA_A2 = 0.0;
     256             :         Real64 NASA_A3 = 0.0;
     257             :         Real64 NASA_A4 = 0.0;
     258             :         Real64 NASA_A5 = 0.0;
     259             :         Real64 NASA_A6 = 0.0;
     260             :         Real64 NASA_A7 = 0.0;
     261             :     };
     262             : 
     263           8 :     struct GeneratorDynamicsManagerStruct
     264             :     {
     265             :         // Members
     266             :         // user input data
     267             :         std::string Name;
     268             :         Real64 PelMin = 0.0;              // minimum operating point for electrical power Pel
     269             :         Real64 PelMax = 0.0;              // maximum operating point for electrical power Pel
     270             :         Real64 UpTranLimit = 0.0;         // power up transient limit W/s
     271             :         Real64 DownTranLimit = 0.0;       // power down tran limit  W/s
     272             :         Real64 UpTranLimitFuel = 0.0;     // fuel up transient limit kg/s
     273             :         Real64 DownTranLimitFuel = 0.0;   // fuel down transient limit kg/s
     274             :         bool WarmUpByTimeDelay = false;   // Warm up mode control
     275             :         bool WarmUpByEngineTemp = true;   // Warm up mode control
     276             :         Real64 StartUpTimeDelay = 0.0;    // time for start up [hours]
     277             :         Real64 WarmUpDelay = 0.0;         // time for warm up delay [s]
     278             :         Real64 StartUpFuel = 0.0;         // fuel use during start up
     279             :         Real64 StartUpElectConsum = 0.0;  // electricity used during start up
     280             :         Real64 StartUpElectProd = 0.0;    // electricity produced during start up
     281             :         Real64 ShutDownFuel = 0.0;        // fuel consumed during shut down
     282             :         Real64 ShutDownElectConsum = 0.0; // Elect consumed during shut down
     283             :         Real64 PcoolDown = 0.0;           // power during cool down
     284             :         Real64 CoolDownDelay = 0.0;       // time for cool down delay [hours]
     285             :         int NumCyclesInit = 0;            // number of start stop cycles at beginning
     286             :         Real64 NumRunHoursInit = 0.0;     // number of hours of operation beginning
     287             :         Real64 Pstandby = 0.0;            // standby power [w]
     288             :         Real64 MCeng = 0.0;               // aggregated thermal mass of engine [  ]
     289             :         Real64 MCcw = 0.0;                // aggregated thermal mass of heat recovery [   ]
     290             :         Real64 kf = 0.0;                  // coefficient k_f for warmup fuel flow rate
     291             :         Real64 TnomEngOp = 0.0;           // nominal engine operating temperature [C]
     292             :         Real64 kp = 0.0;                  // coefficient k_p for warmup power
     293             :         bool MandatoryFullCoolDown = false;
     294             :         bool WarmRestartOkay = true;
     295             :         int AvailabilitySchedID = 0;
     296             :         // Calculated values and input from elsewhere
     297             :         DataGenerators::OperatingMode CurrentOpMode = DataGenerators::OperatingMode::Off; // current operating mode, uses params like OpModeNormal
     298             :         DataGenerators::OperatingMode LastOpMode = DataGenerators::OperatingMode::Off;
     299             :         Real64 FractionalDayofLastShutDown = 0.0;
     300             :         Real64 FractionalDayofLastStartUp = 0.0;
     301             :         bool HasBeenOn = false;
     302             :         bool DuringStartUp = false;
     303             :         bool DuringShutDown = false;
     304             :         Real64 FuelMdotLastTimestep = 0.0;
     305             :         Real64 PelLastTimeStep = 0.0;
     306             :         int NumCycles = 0;
     307             :         Real64 PLRforSubtimestepStartUp = 0.0;
     308             :         Real64 PLRforSubtimestepShutDown = 0.0; // part load for not in shut down, shut down part is (1 - PLR)
     309             :         Real64 ElectEffNom = 0.0;               // efficiency to use for control decisions
     310             :         Real64 ThermEffNom = 0.0;               // thermal efficiency to use fo control decisions
     311             :         Real64 QdotHXMax = 0.0;                 // Thermal power max
     312             :         Real64 QdotHXMin = 0.0;                 // thermal power min
     313             :         Real64 QdotHXOpt = 0.0;                 // thermal power nominal/optimal
     314             :     };
     315             : 
     316             : } // namespace DataGenerators
     317             : 
     318        1542 : struct GeneratorsData : BaseGlobalStruct
     319             : {
     320             :     Array1D<DataGenerators::GasPropertyDataStruct> GasPhaseThermoChemistryData;
     321             :     Array1D<DataGenerators::GeneratorFuelSupplyDataStruct> FuelSupply; // fuel supply (reused across various)
     322             :     Array1D<DataGenerators::GeneratorDynamicsManagerStruct> GeneratorDynamics;
     323             : 
     324             :     int InletCWnode = 0; // cooling water inlet node ID
     325             :     bool InternalFlowControl = false;
     326             :     Real64 TcwIn = 0.0;          // inlet cooling water temperature (C)
     327             :     Real64 TrialMdotcw = 0.0;    // test or estimate of what the plant flows are going to be (kg/s)
     328             :     Real64 LimitMinMdotcw = 0.0; // lower limit for cooling water flow for generatior operation (kg/s)
     329             : 
     330           0 :     void clear_state() override
     331             :     {
     332           0 :         *this = GeneratorsData();
     333           0 :     }
     334             : };
     335             : 
     336             : } // namespace EnergyPlus
     337             : 
     338             : #endif

Generated by: LCOV version 1.13