LCOV - code coverage report
Current view: top level - EnergyPlus - Boilers.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 4 7 57.1 %
Date: 2023-01-17 19:17:23 Functions: 5 8 62.5 %

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

Generated by: LCOV version 1.13