LCOV - code coverage report
Current view: top level - EnergyPlus - DataAirSystems.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 9 15 60.0 %
Date: 2023-01-17 19:17:23 Functions: 25 33 75.8 %

          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 DataAirSystems_hh_INCLUDED
      49             : #define DataAirSystems_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/DataHVACGlobals.hh>
      58             : #include <EnergyPlus/DataHVACSystems.hh>
      59             : #include <EnergyPlus/EnergyPlus.hh>
      60             : #include <EnergyPlus/Plant/DataPlant.hh>
      61             : #include <EnergyPlus/SimAirServingZones.hh>
      62             : 
      63             : namespace EnergyPlus {
      64             : 
      65             : // Forward declarations
      66             : struct EnergyPlusData;
      67             : 
      68             : namespace DataAirSystems {
      69             : 
      70             :     // Using/Aliasing
      71             :     using DataPlant::MeterData;
      72             :     using DataPlant::SubcomponentData;
      73             : 
      74             :     // Data
      75             :     // MODULE PARAMETER DEFINITIONS:
      76             :     // DERIVED TYPE DEFINITIONS
      77             : 
      78             :     // DefinePrimaryAirSystem contains the data for a primary air HVAC system
      79             : 
      80             :     // The ConnectionPoint derived type is used to link quickly between loops at connection points
      81             :     // and avoids the need for repetitive searches.
      82             : 
      83             :     // INTERFACE BLOCK SPECIFICATIONS
      84             :     // None
      85             : 
      86             :     // MODULE VARIABLE DECLARATIONS
      87             :     // For each type of air path, define an array of DefineAirPaths
      88             : 
      89             :     // Temporary arrays
      90             : 
      91             :     // Types
      92     1454109 :     struct AirLoopCompData // data for an individual component
      93             :     {
      94             :         // Members
      95             :         std::string TypeOf;                                                                // The 'keyWord' identifying  component type
      96             :         std::string Name;                                                                  // Component name
      97             :         SimAirServingZones::CompType CompType_Num = SimAirServingZones::CompType::Invalid; // Numeric designator for CompType (TypeOf)
      98             :         int CompIndex = 0;                                                                 // Component Index in whatever is using this component
      99             :         HVACSystemData *compPointer = nullptr;                                             // pointer to HVAC system
     100             :         int FlowCtrl = 0;                                                                  // Component flow control (ACTIVE/PASSIVE)
     101             :         bool ON = true;          // When true, the designated component or operation scheme is available
     102             :         bool Parent = false;     // When true, the designated component is made up of sub-components
     103             :         std::string NodeNameIn;  // Component inlet node name
     104             :         std::string NodeNameOut; // Component outlet node name
     105             :         int NodeNumIn = 0;       // Component inlet node number
     106             :         int NodeNumOut = 0;      // Component outlet node number
     107             :         bool MeteredVarsFound = false;
     108             :         int NumMeteredVars = 0;
     109             :         int NumSubComps = 0;
     110             :         int EnergyTransComp = 0; // 1=EnergyTransfer, 0=No EnergyTransfer  Flag needed for reporting
     111             :         Real64 Capacity = 0.0;   // ventilation load factor
     112             :         int OpMode = 0;
     113             :         Real64 TotPlantSupplyElec = 0.0;
     114             :         Real64 PlantSupplyElecEff = 0.0;
     115             :         Real64 PeakPlantSupplyElecEff = 0.0;
     116             :         Real64 TotPlantSupplyGas = 0.0;
     117             :         Real64 PlantSupplyGasEff = 0.0;
     118             :         Real64 PeakPlantSupplyGasEff = 0.0;
     119             :         Real64 TotPlantSupplyPurch = 0.0;
     120             :         Real64 PlantSupplyPurchEff = 0.0;
     121             :         Real64 PeakPlantSupplyPurchEff = 0.0;
     122             :         Real64 TotPlantSupplyOther = 0.0;
     123             :         Real64 PlantSupplyOtherEff = 0.0;
     124             :         Real64 PeakPlantSupplyOtherEff = 0.0;
     125             :         int AirSysToPlantPtr = 0;          // =0 No plant loop connection, >0 index to AirSysToPlant array
     126             :         Array1D<MeterData> MeteredVar;     // Index of energy output report data
     127             :         Array1D<SubcomponentData> SubComp; // Component list
     128             :     };
     129             : 
     130      390505 :     struct AirLoopBranchData // a branch is a sequence of components
     131             :     {
     132             :         // Members
     133             :         std::string Name;           // Name of the branch
     134             :         std::string ControlType;    // Control type for the branch (not used)
     135             :         int TotalComponents = 0;    // Total number of high level components on the branch
     136             :         Array1D_int FirstCompIndex; // Gives the component index in AllComp that corresponds to Comp
     137             :         Array1D_int LastCompIndex;  // Gives comp index in AllComp that corresponds to last subcomponent
     138             :         int NodeNumIn = 0;          // Branch inlet node number
     139             :         int NodeNumOut = 0;         // Branch outlet node number
     140             :         DataHVACGlobals::AirDuctType DuctType = DataHVACGlobals::AirDuctType::Invalid; // 1=main, 2=cooling, 3=heating, 4=other
     141             :         Array1D<AirLoopCompData> Comp;                                                 // Component list--high level components
     142             :         //  This list would include children, grandchildren, etc.
     143             :         int TotalNodes = 0;  // total number of nodes on branch
     144             :         Array1D_int NodeNum; // node list (numbers)
     145             :     };
     146             : 
     147      388562 :     struct AirLoopSplitterData // a splitter joins 1 inlet branch to multiple outlet branches
     148             :     {
     149             :         // Members
     150             :         bool Exists = false;        // True if there is a splitter (only 1 allowed per loop)
     151             :         std::string Name;           // Name of the Splitter
     152             :         int NodeNumIn = 0;          // Node number for the inlet to the splitter
     153             :         int BranchNumIn = 0;        // Reference number for branch connected to splitter inlet
     154             :         std::string NodeNameIn;     // Node name for the inlet to the splitter
     155             :         int TotalOutletNodes = 0;   // Number of outlet nodes for the splitter
     156             :         Array1D_int NodeNumOut;     // Node numbers for the outlets to the splitter
     157             :         Array1D_int BranchNumOut;   // Reference numbers for branches connected to splitter outlet
     158             :         Array1D_string NodeNameOut; // Node names for the outlets to the splitter
     159             :     };
     160             : 
     161      388562 :     struct AirLoopMixerData // a mixer joins multiple inlet branches to a single outlet branch
     162             :     {
     163             :         // Members
     164             :         bool Exists = false;       // True if there is a Mixer (only 1 allowed per loop)
     165             :         std::string Name;          // Name of the Mixer
     166             :         int NodeNumOut = 0;        // Node number for the outlet to the mixer
     167             :         int BranchNumOut = 0;      // Reference number for branch connected to mixer outlet
     168             :         std::string NodeNameOut;   // Node name for the outlet to the mixer
     169             :         int TotalInletNodes = 0;   // Number of inlet nodes for the mixer
     170             :         Array1D_int NodeNumIn;     // Node numbers for the inlets to the mixer
     171             :         Array1D_int BranchNumIn;   // Reference numbers for branches connected to mixer inlet
     172             :         Array1D_string NodeNameIn; // Node names for the inlets to the mixer
     173             :     };
     174             : 
     175             :     enum FanModelType
     176             :     {
     177             :         Invalid = -1,
     178             :         StructArrayLegacyFanModels,
     179             :         ObjectVectorOOFanSystemModel,
     180             :         Num
     181             :     };
     182             : 
     183             :     enum class FanPlacement
     184             :     {
     185             :         Invalid = -1,
     186             :         BlowThru,
     187             :         DrawThru,
     188             :         Num
     189             :     };
     190             : 
     191      388562 :     struct DefinePrimaryAirSystem // There is an array of these for each primary air system
     192             :     {
     193             :         // Members
     194             :         std::string Name;                      // name of the system
     195             :         Real64 DesignVolFlowRate;              // the design total supply air flow rate (m3/s)
     196             :         Real64 DesignReturnFlowFraction = 1.0; // the design return flow rate as a fraction of supply flow assuming no exhaust (0 to 1)
     197             :         int NumControllers = 0;                // number of controllers on this air path
     198             :         Array1D_string ControllerName;         // name of each controller on this system
     199             :         Array1D_string ControllerType;         // type of each controller on this system
     200             :         Array1D_int ControllerIndex;
     201             :         Array1D_bool CanBeLockedOutByEcono; // true if controller inactive
     202             :         // when the economizer is active
     203             :         int NumBranches = 0;               // number of branches making up this system
     204             :         Array1D<AirLoopBranchData> Branch; // data for each branch
     205             :         AirLoopSplitterData Splitter;      // Data for splitter (if any)
     206             :         AirLoopMixerData Mixer;            // Data for mixer (if any)
     207             :         Array1D_bool ControlConverged;     // Convergence Parameter for controllers
     208             :         int NumOutletBranches = 0;
     209             :         std::array<int, 3> OutletBranchNum = {0}; // branch numbers of system outlets
     210             :         int NumInletBranches = 0;
     211             :         std::array<int, 3> InletBranchNum = {0}; // branch number of system inlets
     212             :         bool CentralHeatCoilExists = true;       // true if there are central heating coils
     213             :         bool CentralCoolCoilExists = true;       // true if there are central cooling coils
     214             :         bool OASysExists = false;                // true if there is an Outside Air Sys
     215             :         bool isAllOA = false;                    // true if there is no return path and the main branch inlet is an outdoor air node
     216             :         int OASysInletNodeNum = 0;               // node number of return air inlet to OA sys
     217             :         int OASysOutletNodeNum = 0;              // node number of mixed air outlet of OA sys
     218             :         int OAMixOAInNodeNum = 0;                // node number of the OA stream inlet to the
     219             :         // OA mixer component.
     220             :         bool RABExists = false;                               // true if there is a RAB
     221             :         int RABMixInNode = 0;                                 // node num of RAB mixer inlet
     222             :         int SupMixInNode = 0;                                 // node num of supply air inlet to mixer
     223             :         int MixOutNode = 0;                                   // outlet node of mixer
     224             :         int RABSplitOutNode = 0;                              // node num of RAB splitter outlet
     225             :         int OtherSplitOutNode = 0;                            // node num of nonRAB splitter outlet
     226             :         int NumOACoolCoils = 0;                               // number of cooling coils in the outside air system
     227             :         int NumOAHeatCoils = 0;                               // number of heating coils in the outside air system
     228             :         int NumOAHXs = 0;                                     // number of heat exchangers in the outside air system
     229             :         bool SizeAirloopCoil = true;                          // simulates air loop coils before calling controllers
     230             :         FanModelType supFanModelType = FanModelType::Invalid; // indicates which type of fan model to call for supply fan, legacy or new OO
     231             :         int SupFanNum = 0;       // index of the supply fan in the Fan data structure when model type is StructArrayLegacyFanModels
     232             :         int supFanVecIndex = -1; // index in fan object vector for supply fan when model type is ObjectVectorOOFanSystemModel, zero-based index
     233             :         FanPlacement supFanLocation = FanPlacement::Invalid;  // location of fan relative to coil
     234             :         FanModelType retFanModelType = FanModelType::Invalid; // indicates which type of fan model to call for return fan, legacy or new OO
     235             :         int RetFanNum = 0;           // index of the return fan in the Fan data structure when model type is StructArrayLegacyFanModels
     236             :         int retFanVecIndex = -1;     // index in fan object vector for return fan when model type is ObjectVectorOOFanSystemModel, zero-based index
     237             :         Real64 FanDesCoolLoad = 0.0; // design fan heat gain for the air loop [W]
     238             :     };
     239             : 
     240             :     struct ConnectionPoint
     241             :     {
     242             :         // Members
     243             :         int LoopType = 0;
     244             :         int LoopNum = 0;
     245             :         int BranchNum = 0;
     246             :         int CompNum = 0;
     247             :     };
     248             : 
     249           0 :     struct ConnectZoneComp
     250             :     {
     251             :         // Members
     252             :         int ZoneEqListNum = 0;
     253             :         int ZoneEqCompNum = 0;
     254             :         int PlantLoopType = 0;
     255             :         int PlantLoopNum = 0;
     256             :         int PlantLoopBranch = 0;
     257             :         int PlantLoopComp = 0;
     258             :         int FirstDemandSidePtr = 0;
     259             :         int LastDemandSidePtr = 0;
     260             :     };
     261             : 
     262           2 :     struct ConnectZoneSubComp
     263             :     {
     264             :         // Members
     265             :         int ZoneEqListNum = 0;
     266             :         int ZoneEqCompNum = 0;
     267             :         int ZoneEqSubCompNum = 0;
     268             :         int PlantLoopType = 0;
     269             :         int PlantLoopNum = 0;
     270             :         int PlantLoopBranch = 0;
     271             :         int PlantLoopComp = 0;
     272             :         int FirstDemandSidePtr = 0;
     273             :         int LastDemandSidePtr = 0;
     274             :     };
     275             : 
     276         260 :     struct ConnectZoneSubSubComp
     277             :     {
     278             :         // Members
     279             :         int ZoneEqListNum = 0;
     280             :         int ZoneEqCompNum = 0;
     281             :         int ZoneEqSubCompNum = 0;
     282             :         int ZoneEqSubSubCompNum = 0;
     283             :         int PlantLoopType = 0;
     284             :         int PlantLoopNum = 0;
     285             :         int PlantLoopBranch = 0;
     286             :         int PlantLoopComp = 0;
     287             :         int FirstDemandSidePtr = 0;
     288             :         int LastDemandSidePtr = 0;
     289             :     };
     290             : 
     291         290 :     struct ConnectAirSysComp
     292             :     {
     293             :         // Members
     294             :         int AirLoopNum = 0;
     295             :         int AirLoopBranch = 0;
     296             :         int AirLoopComp = 0;
     297             :         int PlantLoopType = 0;
     298             :         int PlantLoopNum = 0;
     299             :         int PlantLoopBranch = 0;
     300             :         int PlantLoopComp = 0;
     301             :         int FirstDemandSidePtr = 0;
     302             :         int LastDemandSidePtr = 0;
     303             :     };
     304             : 
     305           0 :     struct ConnectAirSysSubComp
     306             :     {
     307             :         // Members
     308             :         int AirLoopNum = 0;
     309             :         int AirLoopBranch = 0;
     310             :         int AirLoopComp = 0;
     311             :         int AirLoopSubComp = 0;
     312             :         int PlantLoopType = 0;
     313             :         int PlantLoopNum = 0;
     314             :         int PlantLoopBranch = 0;
     315             :         int PlantLoopComp = 0;
     316             :         int FirstDemandSidePtr = 0;
     317             :         int LastDemandSidePtr = 0;
     318             :     };
     319             : 
     320           0 :     struct ConnectAirSysSubSubComp
     321             :     {
     322             :         // Members
     323             :         int AirLoopNum = 0;
     324             :         int AirLoopBranch = 0;
     325             :         int AirLoopComp = 0;
     326             :         int AirLoopSubComp = 0;
     327             :         int AirLoopSubSubComp = 0;
     328             :         int PlantLoopType = 0;
     329             :         int PlantLoopNum = 0;
     330             :         int PlantLoopBranch = 0;
     331             :         int PlantLoopComp = 0;
     332             :         int FirstDemandSidePtr = 0;
     333             :         int LastDemandSidePtr = 0;
     334             :     };
     335             : 
     336             :     Real64 calcFanDesignHeatGain(EnergyPlusData &state, int dataFanEnumType, int dataFanIndex, Real64 desVolFlow);
     337             : 
     338             : } // namespace DataAirSystems
     339             : 
     340        1542 : struct AirSystemsData : BaseGlobalStruct
     341             : {
     342             : 
     343             :     EPVector<DataAirSystems::DefinePrimaryAirSystem> PrimaryAirSystems;
     344             :     Array1D<DataAirSystems::ConnectionPoint> DemandSideConnect;               // Connections between loops
     345             :     Array1D<DataAirSystems::ConnectZoneComp> ZoneCompToPlant;                 // Connections between loops
     346             :     Array1D<DataAirSystems::ConnectZoneSubComp> ZoneSubCompToPlant;           // Connections between loops
     347             :     Array1D<DataAirSystems::ConnectZoneSubSubComp> ZoneSubSubCompToPlant;     // Connections between loops
     348             :     Array1D<DataAirSystems::ConnectAirSysComp> AirSysCompToPlant;             // Connections between loops
     349             :     Array1D<DataAirSystems::ConnectAirSysSubComp> AirSysSubCompToPlant;       // Connections between loops
     350             :     Array1D<DataAirSystems::ConnectAirSysSubSubComp> AirSysSubSubCompToPlant; // Connections between loops
     351             : 
     352           0 :     void clear_state() override
     353             :     {
     354           0 :         *this = AirSystemsData();
     355           0 :     }
     356             : };
     357             : 
     358             : } // namespace EnergyPlus
     359             : 
     360             : #endif

Generated by: LCOV version 1.13