LCOV - code coverage report
Current view: top level - EnergyPlus - Boilers.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 2 5 40.0 %
Date: 2024-08-23 23:50:59 Functions: 1 2 50.0 %

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

Generated by: LCOV version 1.14