LCOV - code coverage report
Current view: top level - EnergyPlus - HVACCooledBeam.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 13 46.2 %
Date: 2023-01-17 19:17:23 Functions: 5 7 71.4 %

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

Generated by: LCOV version 1.13