LCOV - code coverage report
Current view: top level - EnergyPlus - HWBaseboardRadiator.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 22 22
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 4 4

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

Generated by: LCOV version 2.0-1