LCOV - code coverage report
Current view: top level - EnergyPlus - HWBaseboardRadiator.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 17 40 42.5 %
Date: 2023-01-17 19:17:23 Functions: 14 19 73.7 %

          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 HWBaseboardRadiator_hh_INCLUDED
      49             : #define HWBaseboardRadiator_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             : #include <EnergyPlus/Plant/Enums.hh>
      59             : #include <EnergyPlus/Plant/PlantLocation.hh>
      60             : 
      61             : namespace EnergyPlus {
      62             : 
      63             : // Forward declarations
      64             : struct EnergyPlusData;
      65             : 
      66             : namespace HWBaseboardRadiator {
      67             : 
      68             :     extern std::string const cCMO_BBRadiator_Water;
      69             : 
      70      717474 :     struct HWBaseboardParams
      71             :     {
      72             :         // Members
      73             :         std::string EquipID;
      74             :         DataPlant::PlantEquipmentType EquipType;
      75             :         std::string designObjectName; // Design Object
      76             :         int DesignObjectPtr;
      77             :         std::string Schedule;
      78             :         Array1D_string SurfaceName;
      79             :         Array1D_int SurfacePtr;
      80             :         int ZonePtr;
      81             :         int SchedPtr;
      82             :         int WaterInletNode;
      83             :         int WaterOutletNode;
      84             :         int TotSurfToDistrib;
      85             :         int ControlCompTypeNum;
      86             :         int CompErrIndex;
      87             :         Real64 AirMassFlowRate;
      88             :         Real64 AirMassFlowRateStd;
      89             :         Real64 WaterTempAvg;
      90             :         Real64 RatedCapacity;
      91             :         Real64 UA;
      92             :         Real64 WaterMassFlowRate;
      93             :         Real64 WaterMassFlowRateMax;
      94             :         Real64 WaterMassFlowRateStd;
      95             :         Real64 WaterVolFlowRateMax;
      96             :         Real64 WaterInletTempStd;
      97             :         Real64 WaterInletTemp;
      98             :         Real64 WaterInletEnthalpy;
      99             :         Real64 WaterOutletTempStd;
     100             :         Real64 WaterOutletTemp;
     101             :         Real64 WaterOutletEnthalpy;
     102             :         Real64 AirInletTempStd;
     103             :         Real64 AirInletTemp;
     104             :         Real64 AirOutletTemp;
     105             :         Real64 AirInletHumRat;
     106             :         Real64 AirOutletTempStd;
     107             :         Real64 FracConvect;
     108             :         Array1D<Real64> FracDistribToSurf;
     109             :         Real64 TotPower;
     110             :         Real64 Power;
     111             :         Real64 ConvPower;
     112             :         Real64 RadPower;
     113             :         Real64 TotEnergy;
     114             :         Real64 Energy;
     115             :         Real64 ConvEnergy;
     116             :         Real64 RadEnergy;
     117             :         PlantLocation plantLoc;
     118             :         int BBLoadReSimIndex;
     119             :         int BBMassFlowReSimIndex;
     120             :         int BBInletTempFlowReSimIndex;
     121             :         int HeatingCapMethod;         // - Method for heating capacity scaled sizing calculation (HeatingDesignCapacity, CapacityPerFloorArea,
     122             :                                       // FracOfAutosizedHeatingCapacity)
     123             :         Real64 ScaledHeatingCapacity; // - scaled maximum heating capacity {W} or scalable variable of zone HVAC equipment, {-}, or {W/m2}
     124             : 
     125             :         // Default Constructor
     126          14 :         HWBaseboardParams()
     127          14 :             : EquipType(DataPlant::PlantEquipmentType::Invalid), DesignObjectPtr(0), ZonePtr(0), SchedPtr(0), WaterInletNode(0), WaterOutletNode(0),
     128             :               TotSurfToDistrib(0), ControlCompTypeNum(0), CompErrIndex(0), AirMassFlowRate(0.0), AirMassFlowRateStd(0.0), WaterTempAvg(0.0),
     129             :               RatedCapacity(0.0), UA(0.0), WaterMassFlowRate(0.0), WaterMassFlowRateMax(0.0), WaterMassFlowRateStd(0.0), WaterVolFlowRateMax(0.0),
     130             :               WaterInletTempStd(0.0), WaterInletTemp(0.0), WaterInletEnthalpy(0.0), WaterOutletTempStd(0.0), WaterOutletTemp(0.0),
     131             :               WaterOutletEnthalpy(0.0), AirInletTempStd(0.0), AirInletTemp(0.0), AirOutletTemp(0.0), AirInletHumRat(0.0), AirOutletTempStd(0.0),
     132             :               FracConvect(0.0), TotPower(0.0), Power(0.0), ConvPower(0.0), RadPower(0.0), TotEnergy(0.0), Energy(0.0), ConvEnergy(0.0),
     133             :               RadEnergy(0.0), plantLoc{}, BBLoadReSimIndex(0), BBMassFlowReSimIndex(0), BBInletTempFlowReSimIndex(0), HeatingCapMethod(0),
     134          14 :               ScaledHeatingCapacity(0.0)
     135             :         {
     136          14 :         }
     137             :     };
     138             : 
     139      717433 :     struct HWBaseboardDesignData : HWBaseboardParams
     140             :     {
     141             :         // Members
     142             :         std::string designName;
     143             :         int HeatingCapMethod;         // - Method for heating capacity scaledsizing calculation (HeatingDesignCapacity, CapacityPerFloorArea,
     144             :                                       // FracOfAutosizedHeatingCapacity)
     145             :         Real64 ScaledHeatingCapacity; // - scaled maximum heating capacity {W} or scalable variable of zone HVAC equipment, {-}, or {W/m2}
     146             :         Real64 Offset;
     147             :         Real64 FracRadiant;
     148             :         Real64 FracDistribPerson;
     149             : 
     150             :         // Default Constructor
     151           7 :         HWBaseboardDesignData() : HeatingCapMethod(0), ScaledHeatingCapacity(0.0), Offset(0.0), FracRadiant(0.0), FracDistribPerson(0.0)
     152             :         {
     153           7 :         }
     154             :     };
     155             : 
     156          41 :     struct HWBaseboardNumericFieldData
     157             :     {
     158             :         // Members
     159             :         Array1D_string FieldNames;
     160             : 
     161             :         // Default Constructor
     162           7 :         HWBaseboardNumericFieldData()
     163           7 :         {
     164           7 :         }
     165             :     };
     166             : 
     167          29 :     struct HWBaseboardDesignNumericFieldData
     168             :     {
     169             :         // Members
     170             :         Array1D_string FieldNames;
     171             : 
     172             :         // Default Constructor
     173           7 :         HWBaseboardDesignNumericFieldData()
     174           7 :         {
     175           7 :         }
     176             :     };
     177             : 
     178             :     void SimHWBaseboard(EnergyPlusData &state,
     179             :                         std::string const &EquipName,
     180             :                         int const ControlledZoneNum,
     181             :                         bool const FirstHVACIteration,
     182             :                         Real64 &PowerMet,
     183             :                         int &CompIndex);
     184             : 
     185             :     void GetHWBaseboardInput(EnergyPlusData &state);
     186             : 
     187             :     void InitHWBaseboard(EnergyPlusData &state, int const BaseboardNum, int const ControlledZoneNum, bool const FirstHVACIteration);
     188             : 
     189             :     void SizeHWBaseboard(EnergyPlusData &state, int const BaseboardNum);
     190             : 
     191             :     void CalcHWBaseboard(EnergyPlusData &state, int &BaseboardNum, Real64 &LoadMet);
     192             : 
     193             :     void UpdateHWBaseboard(EnergyPlusData &state, int const BaseboardNum);
     194             : 
     195             :     void UpdateBBRadSourceValAvg(EnergyPlusData &state, bool &HWBaseboardSysOn); // .TRUE. if the radiant system has run this zone time step
     196             : 
     197             :     void DistributeBBRadGains(EnergyPlusData &state);
     198             : 
     199             :     void ReportHWBaseboard(EnergyPlusData &state, int const BaseboardNum);
     200             : 
     201             :     void UpdateHWBaseboardPlantConnection(EnergyPlusData &state,
     202             :                                           int const BaseboardTypeNum,                 // type index
     203             :                                           std::string const &BaseboardName,           // component name
     204             :                                           int const EquipFlowCtrl,                    // Flow control mode for the equipment
     205             :                                           int const LoopNum,                          // Plant loop index for where called from
     206             :                                           const DataPlant::LoopSideLocation LoopSide, // Plant loop side index for where called from
     207             :                                           int &CompIndex,                             // Chiller number pointer
     208             :                                           bool const FirstHVACIteration,
     209             :                                           bool &InitLoopEquip // If not zero, calculate the max load for operating conditions
     210             :     );
     211             : 
     212             :     //*****************************************************************************************
     213             : 
     214             : } // namespace HWBaseboardRadiator
     215             : 
     216        1542 : struct HWBaseboardRadiatorData : BaseGlobalStruct
     217             : {
     218             : 
     219             :     Array1D<Real64> QBBRadSource;         // Need to keep the last value in case we are still iterating
     220             :     Array1D<Real64> QBBRadSrcAvg;         // Need to keep the last value in case we are still iterating
     221             :     Array1D<Real64> ZeroSourceSumHATsurf; // Equal to the SumHATsurf for all the walls in a zone with no source
     222             :     // Record keeping variables used to calculate QBBRadSrcAvg locally
     223             :     Array1D<Real64> LastQBBRadSrc;      // Need to keep the last value in case we are still iterating
     224             :     Array1D<Real64> LastSysTimeElapsed; // Need to keep the last value in case we are still iterating
     225             :     Array1D<Real64> LastTimeStepSys;    // Need to keep the last value in case we are still iterating
     226             :     Array1D_bool MySizeFlag;
     227             :     Array1D_bool CheckEquipName;
     228             :     Array1D_bool SetLoopIndexFlag; // get loop number flag
     229             :     Array1D_string HWBaseboardDesignNames;
     230             :     int NumHWBaseboards = 0;
     231             :     int NumHWBaseboardDesignObjs = 0; // Number of HW Baseboard systems design objects
     232             :     // Object Data
     233             :     Array1D<HWBaseboardRadiator::HWBaseboardParams> HWBaseboard;
     234             :     Array1D<HWBaseboardRadiator::HWBaseboardDesignData> HWBaseboardDesignObject;
     235             :     Array1D<HWBaseboardRadiator::HWBaseboardNumericFieldData> HWBaseboardNumericFields;
     236             :     Array1D<HWBaseboardRadiator::HWBaseboardDesignNumericFieldData> HWBaseboardDesignNumericFields;
     237             :     bool GetInputFlag = true; // One time get input flag
     238             :     bool MyOneTimeFlag = true;
     239             :     int Iter = 0;
     240             :     bool MyEnvrnFlag2 = true;
     241             :     Array1D_bool MyEnvrnFlag;
     242             : 
     243           0 :     void clear_state() override
     244             :     {
     245           0 :         this->QBBRadSource.clear();
     246           0 :         this->QBBRadSrcAvg.clear();
     247           0 :         this->ZeroSourceSumHATsurf.clear();
     248           0 :         this->LastQBBRadSrc.clear();
     249           0 :         this->LastSysTimeElapsed.clear();
     250           0 :         this->LastTimeStepSys.clear();
     251           0 :         this->MySizeFlag.clear();
     252           0 :         this->CheckEquipName.clear();
     253           0 :         this->SetLoopIndexFlag.clear();
     254           0 :         this->HWBaseboardDesignNames.clear();
     255           0 :         this->NumHWBaseboards = 0;
     256           0 :         this->NumHWBaseboardDesignObjs = 0;
     257           0 :         this->HWBaseboard.clear();
     258           0 :         this->HWBaseboardDesignObject.clear();
     259           0 :         this->HWBaseboardNumericFields.clear();
     260           0 :         this->HWBaseboardDesignNumericFields.clear();
     261           0 :         this->GetInputFlag = true;
     262           0 :         this->MyOneTimeFlag = true;
     263           0 :         this->MyEnvrnFlag.clear();
     264           0 :         this->Iter = 0;
     265           0 :         this->MyEnvrnFlag2 = true;
     266           0 :     }
     267             : };
     268             : 
     269             : } // namespace EnergyPlus
     270             : 
     271             : #endif

Generated by: LCOV version 1.13