LCOV - code coverage report
Current view: top level - EnergyPlus - DualDuct.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 3 6 50.0 %
Date: 2023-01-17 19:17:23 Functions: 6 9 66.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 DualDuct_hh_INCLUDED
      49             : #define DualDuct_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : #include <ObjexxFCL/Optional.hh>
      54             : 
      55             : // EnergyPlus Headers
      56             : #include <EnergyPlus/Data/BaseData.hh>
      57             : #include <EnergyPlus/DataGlobals.hh>
      58             : #include <EnergyPlus/EnergyPlus.hh>
      59             : 
      60             : namespace EnergyPlus {
      61             : 
      62             : // Forward declarations
      63             : struct EnergyPlusData;
      64             : 
      65             : namespace DualDuct {
      66             : 
      67             :     enum class DualDuctDamper
      68             :     {
      69             :         Invalid = -1,
      70             :         ConstantVolume,
      71             :         VariableVolume,
      72             :         OutdoorAir,
      73             :         Num
      74             :     };
      75             : 
      76             :     enum class PerPersonMode
      77             :     {
      78             :         Invalid = -1,
      79             :         ModeNotSet,
      80             :         DCVByCurrentLevel,
      81             :         ByDesignLevel,
      82             :         Num
      83             :     };
      84             : 
      85          40 :     struct DualDuctAirTerminalFlowConditions
      86             :     {
      87             :         Real64 AirMassFlowRate = 0.0;         // MassFlow through the Damper being Simulated [kg/Sec]
      88             :         Real64 AirMassFlowRateMaxAvail = 0.0; // MassFlow through the Damper being Simulated [kg/Sec]
      89             :         Real64 AirMassFlowRateMinAvail = 0.0; // MassFlow through the Damper being Simulated [kg/Sec]
      90             :         Real64 AirMassFlowRateMax = 0.0;      // Max Mass Flow Rate or the Design Mass Flow Rate
      91             :         Real64 AirTemp = 0.0;
      92             :         Real64 AirHumRat = 0.0;
      93             :         Real64 AirEnthalpy = 0.0;
      94             :         Real64 AirMassFlowRateHist1 = 0.0; // flow history back 1 iteration kg/s
      95             :         Real64 AirMassFlowRateHist2 = 0.0; // flow history back 2 iteration kg/s
      96             :         Real64 AirMassFlowRateHist3 = 0.0; // flow history back 3 iteration kg/s
      97             :         Real64 AirMassFlowDiffMag = 0.0;   // flow difference scale, kg/s
      98             :     };
      99             : 
     100          84 :     struct DualDuctAirTerminal
     101             :     {
     102             :         std::string Name;                                    // Name of the Damper
     103             :         DualDuctDamper DamperType = DualDuctDamper::Invalid; // Type of Damper ie. VAV, Mixing, Inducing, etc.
     104             :         int SchedPtr = 0;                                    // Pointer to the correct schedule
     105             :         Real64 MaxAirVolFlowRate = 0.0;                      // Max Specified Volume Flow Rate of Damper [m3/sec]
     106             :         Real64 MaxAirMassFlowRate = 0.0;                     // Max Specified MAss Flow Rate of Damper [kg/s]
     107             :         int HotAirInletNodeNum = 0;
     108             :         int ColdAirInletNodeNum = 0;
     109             :         int OutletNodeNum = 0;
     110             :         Real64 ZoneMinAirFracDes = 0.0; // Fraction of supply air used as design minimum flow
     111             :         Real64 ZoneMinAirFrac = 0.0;    // Fraction of supply air used as current minimum flow
     112             :         Real64 ColdAirDamperPosition = 0.0;
     113             :         Real64 HotAirDamperPosition = 0.0;
     114             :         int OAInletNodeNum = 0;                                    // Alternate Node for VAV:OutdoorAir for Outdoor Air
     115             :         int RecircAirInletNodeNum = 0;                             // Alternate Node for VAV:OutdoorAir for Recirc Air
     116             :         bool RecircIsUsed = true;                                  // if true. then not using recirc duct, which is okay
     117             :         Real64 DesignOAFlowRate = 0.0;                             // Terminal Outdoor Air Design Flow Rate for VAV:OutdoorAir, m3/s
     118             :         Real64 DesignRecircFlowRate = 0.0;                         // Terminal Recirc Air Design Flow Rate for VAV:OutdoorAir, m3/s
     119             :         Real64 RecircAirDamperPosition = 0.0;                      // Alternate Damper Pos Output for VAV:OutdoorAir for Recirc Air
     120             :         Real64 OADamperPosition = 0.0;                             // Alternate Damper Pos Output for VAV:OutdoorAir for Recirc Air
     121             :         Real64 OAFraction = 0.0;                                   // Outdoor Air Fraction for VAV:OutdoorAir
     122             :         int ADUNum = 0;                                            // index of corresponding air distribution unit ZoneHVAC:AirdistributionUnit
     123             :         int CtrlZoneNum = 0;                                       // Pointer to CtrlZone data structure
     124             :         int CtrlZoneInNodeIndex = 0;                               // which controlled zone inlet node number corresponds with this unit
     125             :         Real64 OutdoorAirFlowRate = 0.0;                           // report variable for TU outdoor air flow rate
     126             :         bool NoOAFlowInputFromUser = true;                         // avoids OA calculation if no input specified by user
     127             :         int OARequirementsPtr = 0;                                 // - Index to DesignSpecification:OutdoorAir object
     128             :         PerPersonMode OAPerPersonMode = PerPersonMode::ModeNotSet; // mode for how per person rates are determined, DCV or design.
     129             :         int AirLoopNum = 0;                                        // index to airloop that this terminal unit is connected to
     130             :         int ZoneTurndownMinAirFracSchPtr = 0;                      // pointer to the schedule for turndown minimum airflow fraction
     131             :         Real64 ZoneTurndownMinAirFrac = 1.0;         // turndown minimum airflow fraction value, multiplier of zone design minimum air flow
     132             :         bool ZoneTurndownMinAirFracSchExist = false; // if true, if zone turndown min air frac schedule exist
     133             :         bool MyEnvrnFlag = true;                     // environment flag
     134             :         bool MySizeFlag = true;                      // sizing flag
     135             :         bool MyAirLoopFlag = true;                   // airloop flag
     136             :         bool CheckEquipName = true;
     137             :         DualDuctAirTerminalFlowConditions dd_airterminalHotAirInlet;
     138             :         DualDuctAirTerminalFlowConditions dd_airterminalColdAirInlet;
     139             :         DualDuctAirTerminalFlowConditions dd_airterminalOutlet;
     140             :         DualDuctAirTerminalFlowConditions dd_airterminalOAInlet;
     141             :         DualDuctAirTerminalFlowConditions dd_airterminalRecircAirInlet;
     142             : 
     143             :         void InitDualDuct(EnergyPlusData &state, bool FirstHVACIteration);
     144             : 
     145             :         void SizeDualDuct(EnergyPlusData &state);
     146             : 
     147             :         void SimDualDuctConstVol(EnergyPlusData &state, int ZoneNum, int ZoneNodeNum);
     148             : 
     149             :         void SimDualDuctVarVol(EnergyPlusData &state, int ZoneNum, int ZoneNodeNum);
     150             : 
     151             :         void SimDualDuctVAVOutdoorAir(EnergyPlusData &state, int ZoneNum, int ZoneNodeNum);
     152             : 
     153             :         void CalcOAMassFlow(EnergyPlusData &state,
     154             :                             Real64 &SAMassFlow,   // outside air based on optional user input
     155             :                             Real64 &AirLoopOAFrac // outside air based on optional user input
     156             :         );
     157             : 
     158             :         void CalcOAOnlyMassFlow(EnergyPlusData &state,
     159             :                                 Real64 &OAMassFlow,               // outside air flow from user input kg/s
     160             :                                 Optional<Real64> MaxOAVolFlow = _ // design level for outside air m3/s
     161             :         );
     162             : 
     163             :         void CalcOutdoorAirVolumeFlowRate(EnergyPlusData &state);
     164             : 
     165             :         void UpdateDualDuct(EnergyPlusData &state);
     166             :     };
     167             : 
     168             :     void SimulateDualDuct(EnergyPlusData &state, std::string_view CompName, bool FirstHVACIteration, int ZoneNum, int ZoneNodeNum, int &CompIndex);
     169             : 
     170             :     void GetDualDuctInput(EnergyPlusData &state);
     171             : 
     172             :     void ReportDualDuctConnections(EnergyPlusData &state);
     173             : 
     174             :     void GetDualDuctOutdoorAirRecircUse(EnergyPlusData &state, std::string const &CompTypeName, std::string_view CompName, bool &RecircIsUsed);
     175             : 
     176             : } // namespace DualDuct
     177             : 
     178        1542 : struct DualDuctData : BaseGlobalStruct
     179             : {
     180             :     int NumDDAirTerminal = 0; // The Number of Dampers found in the Input //Autodesk Poss used uninitialized in ReportDualDuctConnections
     181             :     int NumDualDuctVarVolOA = 0;
     182             :     bool GetDualDuctInputFlag = true; // Flag set to make sure you get input once
     183             :     Array1D<DualDuct::DualDuctAirTerminal> dd_airterminal;
     184             :     std::unordered_map<std::string, std::string> UniqueDualDuctAirTerminalNames;
     185             :     bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items
     186             :     bool GetDualDuctOutdoorAirRecircUseFirstTimeOnly = true;
     187             :     Array1D_bool RecircIsUsedARR;
     188             :     Array1D_string DamperNamesARR;
     189             : 
     190           0 :     void clear_state() override
     191             :     {
     192           0 :         *this = DualDuctData();
     193           0 :     }
     194             : };
     195             : 
     196             : } // namespace EnergyPlus
     197             : 
     198             : #endif

Generated by: LCOV version 1.13