LCOV - code coverage report
Current view: top level - EnergyPlus - HVACCooledBeam.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 20 20
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 HVACCooledBeam_hh_INCLUDED
      49              : #define HVACCooledBeam_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/PlantLocation.hh>
      59              : #include <EnergyPlus/ScheduleManager.hh>
      60              : 
      61              : namespace EnergyPlus {
      62              : 
      63              : namespace HVACCooledBeam {
      64              : 
      65              :     enum class CooledBeamType
      66              :     {
      67              :         Invalid = -1,
      68              :         Passive,
      69              :         Active,
      70              :         Num
      71              :     };
      72              : 
      73              :     Real64 constexpr NomMassFlowPerBeam(0.07); // nominal water mass flow rate per beam [kg/s]
      74              :     Real64 constexpr MinWaterVel(0.2);         // minimum water velocity [m/s]
      75              :     Real64 constexpr Coeff2(10000.0);
      76              : 
      77              :     struct CoolBeamData
      78              :     {
      79              :         // Members
      80              :         // input data
      81              :         std::string Name;                      // name of unit
      82              :         std::string UnitType;                  // type of unit = AirTerminal:SingleDuct:ConstantVolume:CooledBeam
      83              :         int UnitType_Num;                      // index to type of unit = 1 (there's only 1 type so far)
      84              :         std::string CBTypeString;              // type of cooled beam: active | passive
      85              :         CooledBeamType CBType;                 // index to type of cooled beam
      86              :         Sched::Schedule *availSched = nullptr; // availability schedule
      87              :         Real64 MaxAirVolFlow;                  // m3/s (autosizable)
      88              :         Real64 MaxAirMassFlow;                 // kg/s
      89              :         Real64 MaxCoolWaterVolFlow;            // m3/s
      90              :         Real64 MaxCoolWaterMassFlow;           // kg/s
      91              :         int AirInNode;                         // unit air inlet node number
      92              :         int AirOutNode;                        // unit air outlet node number
      93              :         int CWInNode;                          // chilled water inlet node
      94              :         int CWOutNode;                         // chilled water outlet node
      95              :         int ADUNum;                            // index of corresponding air distribution unit
      96              :         Real64 NumBeams;                       // number of beams in the zone
      97              :         Real64 BeamLength;                     // length of individual beam [m]
      98              :         Real64 DesInletWaterTemp;              // design inlet water temperature [C]
      99              :         Real64 DesOutletWaterTemp;             // design outlet water Temperature [c]
     100              :         Real64 CoilArea;                       // coil surface area per coil length [m2/m]
     101              :         Real64 a;                              // model parameter a
     102              :         Real64 n1;                             // model parameter n0
     103              :         Real64 n2;                             // model parameter n1
     104              :         Real64 n3;                             // model parameter n2
     105              :         Real64 a0;                             // model parameter a0
     106              :         Real64 K1;                             // model parameter K1
     107              :         Real64 n;                              // model parameter n
     108              :         Real64 Kin;                            // Coefficient of Induction Kin
     109              :         Real64 InDiam;                         // Leaving Pipe Inside Diameter
     110              :         // time step variables
     111              :         Real64 TWIn;                // current inlet water temperature [C]
     112              :         Real64 TWOut;               // current outlet water temperature [C]
     113              :         Real64 EnthWaterOut;        // current outlet water enthalpy [J/kg]
     114              :         Real64 BeamFlow;            // supply air flow per beam [m3/s]
     115              :         Real64 CoolWaterMassFlow;   // chilled water mass flow rate [kg/s]
     116              :         Real64 BeamCoolingEnergy;   // Cooled beam cooling energy of all beams in the zone [J]
     117              :         Real64 BeamCoolingRate;     // Cooled beam cooling rate of all beams in the zone [W]
     118              :         Real64 SupAirCoolingEnergy; // Total cooling energy from supply air [J]
     119              :         Real64 SupAirCoolingRate;   // Total cooling rate from supply air [W]
     120              :         Real64 SupAirHeatingEnergy; // Total cooling energy from supply air [J]
     121              :         Real64 SupAirHeatingRate;   // Total cooling rate from supply air [W]
     122              :         PlantLocation CWPlantLoc;   // cooling water plant loop component index
     123              :         int CBLoadReSimIndex;
     124              :         int CBMassFlowReSimIndex;
     125              :         int CBWaterOutletTempReSimIndex;
     126              :         int CtrlZoneNum;           // control zone index
     127              :         int ctrlZoneInNodeIndex;   // which controlled zone inlet node number corresponds with this unit
     128              :         int AirLoopNum;            // air loop index that terminal is attached to
     129              :         Real64 OutdoorAirFlowRate; // zone outdoor air volume flow rate
     130              :         bool MyEnvrnFlag;
     131              :         bool MySizeFlag;
     132              :         bool PlantLoopScanFlag;
     133              : 
     134              :         // Default Constructor
     135            2 :         CoolBeamData()
     136            6 :             : UnitType_Num(0), CBType(CooledBeamType::Invalid), MaxAirVolFlow(0.0), MaxAirMassFlow(0.0), MaxCoolWaterVolFlow(0.0),
     137            2 :               MaxCoolWaterMassFlow(0.0), AirInNode(0), AirOutNode(0), CWInNode(0), CWOutNode(0), ADUNum(0), NumBeams(0.0), BeamLength(0.0),
     138            2 :               DesInletWaterTemp(0.0), DesOutletWaterTemp(0.0), CoilArea(0.0), a(0.0), n1(0.0), n2(0.0), n3(0.0), a0(0.0), K1(0.0), n(0.0), Kin(0.0),
     139            2 :               InDiam(0.0), TWIn(0.0), TWOut(0.0), EnthWaterOut(0.0), BeamFlow(0.0), CoolWaterMassFlow(0.0), BeamCoolingEnergy(0.0),
     140            2 :               BeamCoolingRate(0.0), SupAirCoolingEnergy(0.0), SupAirCoolingRate(0.0), SupAirHeatingEnergy(0.0), SupAirHeatingRate(0.0), CWPlantLoc{},
     141            2 :               CBLoadReSimIndex(0), CBMassFlowReSimIndex(0), CBWaterOutletTempReSimIndex(0), CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0),
     142            2 :               OutdoorAirFlowRate(0.0), MyEnvrnFlag(true), MySizeFlag(true), PlantLoopScanFlag(true)
     143              :         {
     144            2 :         }
     145              : 
     146              :         void CalcOutdoorAirVolumeFlowRate(EnergyPlusData &state);
     147              :         void reportTerminalUnit(EnergyPlusData &state);
     148              :     };
     149              : 
     150              :     void SimCoolBeam(EnergyPlusData &state,
     151              :                      std::string_view CompName, // name of the cooled beam unit
     152              :                      bool FirstHVACIteration,   // TRUE if first HVAC iteration in time step
     153              :                      int ZoneNum,               // index of zone served by the unit
     154              :                      int ZoneNodeNum,           // zone node number of zone served by the unit
     155              :                      int &CompIndex,            // which cooled beam unit in data structure
     156              :                      Real64 &NonAirSysOutput    // convective cooling by the beam system [W]
     157              :     );
     158              : 
     159              :     void GetCoolBeams(EnergyPlusData &state);
     160              : 
     161              :     void InitCoolBeam(EnergyPlusData &state,
     162              :                       int CBNum,              // number of the current cooled beam unit being simulated
     163              :                       bool FirstHVACIteration // TRUE if first air loop solution this HVAC step
     164              :     );
     165              : 
     166              :     void SizeCoolBeam(EnergyPlusData &state, int CBNum);
     167              : 
     168              :     void ControlCoolBeam(EnergyPlusData &state,
     169              :                          int CBNum,               // number of the current unit being simulated
     170              :                          int ZoneNum,             // number of zone being served
     171              :                          int ZoneNodeNum,         // zone node number
     172              :                          bool FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
     173              :                          Real64 &NonAirSysOutput  // convective cooling by the beam system [W]
     174              :     );
     175              : 
     176              :     void CalcCoolBeam(EnergyPlusData &state,
     177              :                       int CBNum,       // Unit index
     178              :                       int ZoneNode,    // zone node number
     179              :                       Real64 CWFlow,   // cold water flow [kg/s]
     180              :                       Real64 &LoadMet, // load met by unit [W]
     181              :                       Real64 &TWOut    // chilled water outlet temperature [C]
     182              :     );
     183              : 
     184              :     void UpdateCoolBeam(EnergyPlusData &state, int CBNum);
     185              : 
     186              :     void ReportCoolBeam(EnergyPlusData &state, int CBNum);
     187              : 
     188              : } // namespace HVACCooledBeam
     189              : 
     190              : struct HVACCooledBeamData : BaseGlobalStruct
     191              : {
     192              :     Array1D_bool CheckEquipName;
     193              :     int NumCB;
     194              :     Array1D<HVACCooledBeam::CoolBeamData> CoolBeam;
     195              :     bool GetInputFlag = true;              // First time, input is "gotten"
     196              :     bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items
     197              : 
     198         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     199              :     {
     200         2126 :     }
     201              : 
     202         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     203              :     {
     204         1152 :     }
     205              : 
     206         2100 :     void clear_state() override
     207              :     {
     208         2100 :         this->CheckEquipName.clear();
     209         2100 :         this->NumCB = 0;
     210         2100 :         this->CoolBeam.clear();
     211         2100 :         this->GetInputFlag = true;
     212         2100 :         this->ZoneEquipmentListChecked = false;
     213         2100 :     }
     214              : };
     215              : 
     216              : } // namespace EnergyPlus
     217              : 
     218              : #endif
        

Generated by: LCOV version 2.0-1