LCOV - code coverage report
Current view: top level - EnergyPlus - DataContaminantBalance.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 11 14 78.6 %
Date: 2023-01-17 19:17:23 Functions: 28 38 73.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 DataContaminantBalance_hh_INCLUDED
      49             : #define DataContaminantBalance_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             : // Forward declarations
      62             : struct EnergyPlusData;
      63             : 
      64             : namespace DataContaminantBalance {
      65             : 
      66         771 :     struct ContaminantData
      67             :     {
      68             :         // Members
      69             :         bool SimulateContaminants = false;    // A logical flag to determine whether any contaminants are simulated or not
      70             :         bool CO2Simulation = false;           // CO2 simulation flag
      71             :         int CO2OutdoorSchedPtr = 0;           // CO2 outdoor level schedule pointer
      72             :         bool GenericContamSimulation = false; // Generic contaminant simulation flag
      73             :         int GenericContamOutdoorSchedPtr = 0; // Generic contaminant outdoor level schedule pointer
      74             :     };
      75             : 
      76          44 :     struct ZoneContControls
      77             :     {
      78             :         // Members
      79             :         std::string Name;     // Name of the contaminant controller
      80             :         std::string ZoneName; // Name of the zone
      81             :         int ActualZoneNum = 0;
      82             :         std::string AvaiSchedule;                 // Availability Schedule name
      83             :         int AvaiSchedPtr = 0;                     // Pointer to the correct schedule
      84             :         std::string SetPointSchedName;            // Name of the schedule which determines the CO2 setpoint
      85             :         int SPSchedIndex = 0;                     // Index for this schedule
      86             :         bool EMSOverrideCO2SetPointOn = false;    // EMS is calling to override CO2 setpoint
      87             :         Real64 EMSOverrideCO2SetPointValue = 0.0; // value EMS is directing to use for CO2 setpoint
      88             :         int NumOfZones = 0;                       // Number of controlled zones in the same airloop
      89             :         Array1D_int ControlZoneNum;               // Controlled zone number
      90             :         std::string ZoneMinCO2SchedName;          // Name of the schedule which determines minimum CO2 concentration
      91             :         int ZoneMinCO2SchedIndex = 0;             // Index for this schedule
      92             :         std::string ZoneMaxCO2SchedName;          // Name of the schedule which determines maximum CO2 concentration
      93             :         int ZoneMaxCO2SchedIndex = 0;             // Index for this schedule
      94             :         int ZoneContamControllerSchedIndex = 0;   // Index for this schedule
      95             :         std::string GCAvaiSchedule;               // Availability Schedule name for generic contamiant
      96             :         int GCAvaiSchedPtr = 0;                   // Pointer to the correct generic contaminant availability schedule
      97             :         std::string GCSetPointSchedName;          // Name of the schedule which determines the generic contaminant setpoint
      98             :         int GCSPSchedIndex = 0;                   // Index for this schedule
      99             :         bool EMSOverrideGCSetPointOn = false;     // EMS is calling to override generic contaminant setpoint
     100             :         Real64 EMSOverrideGCSetPointValue = 0.0;  // value EMS is directing to use for generic contaminant setpoint
     101             :     };
     102             : 
     103          15 :     struct ZoneSystemContaminantDemandData // Contaminent loads to be met (kg air per second)
     104             :     {
     105             :         // Members
     106             :         Real64 OutputRequiredToCO2SP = 0.0;     // Load required to meet CO2 setpoint
     107             :         Real64 RemainingOutputReqToCO2SP = 0.0; // Remaining load required to meet CO2 setpoint
     108             :         Real64 OutputRequiredToGCSP = 0.0;      // Load required to meet generic contaminant setpoint
     109             :         Real64 RemainingOutputReqToGCSP = 0.0;  // Remaining load required to meet generic contaminant setpoint
     110             :     };
     111             : 
     112          18 :     struct ZoneContamGenericDataConstant
     113             :     {
     114             :         // Members
     115             :         std::string Name;               // Name of the constant generic contaminant source and sink
     116             :         std::string ZoneName;           // Name of the zone
     117             :         int ActualZoneNum = 0;          // Zone number
     118             :         Real64 GCGenerateRate = 0.0;    // Generic contaminant design generation rate [m3/s]
     119             :         int GCGenerateRateSchedPtr = 0; // Generic contaminant design generation rate schedule pointer
     120             :         Real64 GCRemovalCoef = 0.0;     // Generic contaminant design removal coefficient [m3/s]
     121             :         int GCRemovalCoefSchedPtr = 0;  // Generic contaminant design removal coefficient schedule pointer
     122             :         Real64 GCGenRate = 0.0;         // Generic contaminant design generation rate [m3/s] for reporting
     123             :     };
     124             : 
     125           8 :     struct ZoneContamGenericDataPDriven
     126             :     {
     127             :         // Members
     128             :         std::string Name;              // Name of the pressure driven generic contaminant source and sink
     129             :         std::string SurfName;          // Name of the surface
     130             :         int SurfNum = 0;               // Surface number
     131             :         Real64 GCGenRateCoef = 0.0;    // Generic contaminant design generation rate coefficeint [m3/s]
     132             :         int GCGenRateCoefSchedPtr = 0; // Generic contaminant design generation rate schedule pointer
     133             :         Real64 GCExpo = 0.0;           // Generic contaminant exponent []
     134             :         Real64 GCGenRate = 0.0;        // Generic contaminant design generation rate [m3/s] for reporting
     135             :     };
     136             : 
     137          10 :     struct ZoneContamGenericDataCutoff
     138             :     {
     139             :         // Members
     140             :         std::string Name;               // Name of the cutoff generic contaminant source and sink
     141             :         std::string ZoneName;           // Name of the zone
     142             :         int ActualZoneNum = 0;          // Zone number
     143             :         Real64 GCGenerateRate = 0.0;    // Generic contaminant design generation rate [m3/s]
     144             :         int GCGenerateRateSchedPtr = 0; // Generic contaminant design generation rate schedule pointer
     145             :         Real64 GCCutoffValue = 0.0;     // Cutoff value [ppm]
     146             :         Real64 GCGenRate = 0.0;         // Generic contaminant design generation rate [m3/s] for reporting
     147             :     };
     148             : 
     149           8 :     struct ZoneContamGenericDataDecay
     150             :     {
     151             :         // Members
     152             :         std::string Name;           // Name of the decay generic contaminant source and sink
     153             :         std::string ZoneName;       // Name of the zone
     154             :         int ActualZoneNum = 0;      // Zone number
     155             :         Real64 GCInitEmiRate = 0.0; // Generic contaminant design generation rate [m3/s]
     156             :         int GCEmiRateSchedPtr = 0;  // Generic contaminant emission rate schedule pointer
     157             :         Real64 GCTime = 0.0;        // Time since the styart of emission [s]
     158             :         Real64 GCDelayTime = 0.0;   // Delay time constant [s]
     159             :         Real64 GCGenRate = 0.0;     // Generic contaminant design generation rate [m3/s] for reporting
     160             :     };
     161             : 
     162           8 :     struct ZoneContamGenericDataBLDiff
     163             :     {
     164             :         // Members
     165             :         std::string Name; // Name of the boundary layer diffusion generic contaminant source
     166             :         // and sink
     167             :         std::string SurfName;       // Name of the surface
     168             :         int SurfNum = 0;            // Surface number
     169             :         Real64 GCTranCoef = 0.0;    // Generic contaminant mass transfer coefficeint [m/s]
     170             :         int GCTranCoefSchedPtr = 0; // Generic contaminant mass transfer coefficeint schedule pointer
     171             :         Real64 GCHenryCoef = 0.0;   // Generic contaminant Henry adsorption constant or
     172             :         // partition coefficient []
     173             :         Real64 GCGenRate = 0.0; // Generic contaminant design generation rate [m3/s] for reporting
     174             :     };
     175             : 
     176           8 :     struct ZoneContamGenericDataDVS
     177             :     {
     178             :         // Members
     179             :         std::string Name;        // Name of the deposition velocity generic contaminant sink
     180             :         std::string SurfName;    // Name of the surface
     181             :         int SurfNum = 0;         // Surface number
     182             :         Real64 GCDepoVelo = 0.0; // Generic contaminant deposition velocity [m/s]
     183             :         int GCDepoVeloPtr = 0;   // Generic contaminant deposition velocity sink schedule pointer
     184             :         Real64 GCGenRate = 0.0;  // Generic contaminant design generation rate [m3/s] for reporting
     185             :     };
     186             : 
     187           8 :     struct ZoneContamGenericDataDRS
     188             :     {
     189             :         // Members
     190             :         std::string Name;        // Name of the deposition rate generic contaminant sink
     191             :         std::string ZoneName;    // Name of the zone
     192             :         int ActualZoneNum = 0;   // Zone number
     193             :         Real64 GCDepoRate = 0.0; // Generic contaminant deposition rate [m/s]
     194             :         int GCDepoRatePtr = 0;   // Generic contaminant deposition rate sink schedule pointer
     195             :         Real64 GCGenRate = 0.0;  // Generic contaminant design generation rate [m3/s] for reporting
     196             :     };
     197             : 
     198             : } // namespace DataContaminantBalance
     199             : 
     200        1542 : struct ContaminantBalanceData : BaseGlobalStruct
     201             : {
     202             : 
     203             :     Array1D<Real64> ZoneCO2SetPoint;
     204             :     Array1D<Real64> CO2PredictedRate;
     205             : 
     206             :     Array1D<Real64> ZoneCO2Gain;             // CO2 gain from each Zone (People, equipment)
     207             :     Array1D<Real64> ZoneCO2GainFromPeople;   // CO2 gain from each Zone (From People only)
     208             :     Array1D<Real64> ZoneCO2GainExceptPeople; // Added for hybrid model, CO2 gain from each Zone (except People)
     209             : 
     210             :     // Zone Air Contaminant conditions variables
     211             :     Array1D<Real64> ZoneAirCO2Avg;       // AIR CO2 averaged over the zone time step
     212             :     Array1D<Real64> ZoneAirCO2;          // AIR CO2
     213             :     Array1D<Real64> CO2ZoneTimeMinus1;   // CO2 history terms for 3rd order derivative
     214             :     Array1D<Real64> CO2ZoneTimeMinus2;   // Time Minus 2 Zone Time Steps Term
     215             :     Array1D<Real64> CO2ZoneTimeMinus3;   // Time Minus 3 Zone Time Steps Term
     216             :     Array1D<Real64> CO2ZoneTimeMinus4;   // Time Minus 4 Zone Time Steps Term
     217             :     Array1D<Real64> DSCO2ZoneTimeMinus1; // DownStepped CO2 history terms for 3rd order derivative
     218             :     Array1D<Real64> DSCO2ZoneTimeMinus2; // DownStepped Time Minus 2 Zone Time Steps Term
     219             :     Array1D<Real64> DSCO2ZoneTimeMinus3; // DownStepped Time Minus 3 Zone Time Steps Term
     220             :     Array1D<Real64> DSCO2ZoneTimeMinus4; // DownStepped Time Minus 4 Zone Time Steps Term
     221             : 
     222             :     Array1D<Real64> ZoneAirCO2Temp;        // Temp zone air CO2 at time plus 1
     223             :     Array1D<Real64> CO2ZoneTimeMinus1Temp; // Zone air CO2 at previous timestep
     224             :     Array1D<Real64> CO2ZoneTimeMinus2Temp; // Zone air CO2 at timestep T-2
     225             :     Array1D<Real64> CO2ZoneTimeMinus3Temp; // Zone air CO2 at timestep T-3
     226             :     Array1D<Real64> ZoneAirCO2Old;         // Last Time Steps Zone AIR Humidity Ratio
     227             : 
     228             :     Array1D<Real64> ZoneCO2MX; // TEMPORARY ZONE CO2 TO TEST CONVERGENCE in Exact and Euler method
     229             :     Array1D<Real64> ZoneCO2M2; // TEMPORARY ZONE CO2 at timestep t-2 in Exact and Euler method
     230             :     Array1D<Real64> ZoneCO21;  // Zone CO2 at the previous time step used in Exact and Euler method
     231             : 
     232             :     Array1D<Real64> CONTRAT;           // Zone CO2 at the previous time step used in Exact and Euler method
     233             :     Array1D<Real64> MixingMassFlowCO2; // Mixing MASS FLOW * CO2
     234             :     Real64 OutdoorCO2 = 0.0;           // Outdoor CO2 level
     235             : 
     236             :     Array1D<Real64> ZoneAirDensityCO; // Mixing MASS FLOW * CO2
     237             :     Array1D<Real64> AZ;
     238             :     Array1D<Real64> BZ;
     239             :     Array1D<Real64> CZ;
     240             : 
     241             :     Array1D<Real64> ZoneGCSetPoint;
     242             :     Array1D<Real64> GCPredictedRate;
     243             : 
     244             :     Array1D<Real64> ZoneGCGain; // Generic contaminant gain from each Zone (People, equipment)
     245             : 
     246             :     // Zone Air Contaminant conditions variables
     247             :     Array1D<Real64> ZoneAirGCAvg;       // AIR generic contaminant averaged over the zone time step
     248             :     Array1D<Real64> ZoneAirGC;          // AIR generic contaminant
     249             :     Array1D<Real64> GCZoneTimeMinus1;   // Generic contaminant history terms for 3rd order derivative
     250             :     Array1D<Real64> GCZoneTimeMinus2;   // Time Minus 2 Zone Time Steps Term
     251             :     Array1D<Real64> GCZoneTimeMinus3;   // Time Minus 3 Zone Time Steps Term
     252             :     Array1D<Real64> GCZoneTimeMinus4;   // Time Minus 4 Zone Time Steps Term
     253             :     Array1D<Real64> DSGCZoneTimeMinus1; // DownStepped generic contaminant history terms for 3rd order
     254             :     // derivative
     255             :     Array1D<Real64> DSGCZoneTimeMinus2; // DownStepped Time Minus 2 Zone Time Steps Term
     256             :     Array1D<Real64> DSGCZoneTimeMinus3; // DownStepped Time Minus 3 Zone Time Steps Term
     257             :     Array1D<Real64> DSGCZoneTimeMinus4; // DownStepped Time Minus 4 Zone Time Steps Term
     258             : 
     259             :     Array1D<Real64> ZoneAirGCTemp;        // Temp zone air generic contaminant at time plus 1
     260             :     Array1D<Real64> GCZoneTimeMinus1Temp; // Zone air generic contaminant at previous timestep
     261             :     Array1D<Real64> GCZoneTimeMinus2Temp; // Zone air generic contaminant at timestep T-2
     262             :     Array1D<Real64> GCZoneTimeMinus3Temp; // Zone air generic contaminant at timestep T-3
     263             :     Array1D<Real64> ZoneAirGCOld;         // Last Time Steps Zone AIR generic contaminant
     264             : 
     265             :     Array1D<Real64> ZoneGCMX; // TEMPORARY ZONE CO2 TO TEST CONVERGENCE in Exact and Euler method
     266             :     Array1D<Real64> ZoneGCM2; // TEMPORARY ZONE CO2 at timestep t-2 in Exact and Euler method
     267             :     Array1D<Real64> ZoneGC1;  // Zone CO2 at the previous time step used in Exact and Euler method
     268             : 
     269             :     Array1D<Real64> CONTRATGC; // Zone generic contaminant at the previous time step used in
     270             :     // Exact and Euler method
     271             : 
     272             :     Array1D<Real64> MixingMassFlowGC; // Mixing MASS FLOW * generic contaminant
     273             : 
     274             :     Real64 OutdoorGC = 0.0; // Outdoor generic contaminant level
     275             : 
     276             :     Array1D<Real64> ZoneAirDensityGC; // Mixing MASS FLOW * generic contaminant
     277             :     Array1D<Real64> AZGC;
     278             :     Array1D<Real64> BZGC;
     279             :     Array1D<Real64> CZGC;
     280             : 
     281             :     Array1D<DataContaminantBalance::ZoneSystemContaminantDemandData> ZoneSysContDemand;
     282             :     DataContaminantBalance::ContaminantData
     283             :         Contaminant; // A logical flag to determine whether any contaminants are simulated or not | CO2 simulation flag | CO2 outdoor
     284             :     // level schedule pointer | Generic contaminant simulation flag | Generic contaminant outdoor level schedule pointer
     285             :     Array1D<DataContaminantBalance::ZoneContControls> ContaminantControlledZone;
     286             :     Array1D<DataContaminantBalance::ZoneContamGenericDataConstant> ZoneContamGenericConstant;
     287             :     Array1D<DataContaminantBalance::ZoneContamGenericDataPDriven> ZoneContamGenericPDriven;
     288             :     Array1D<DataContaminantBalance::ZoneContamGenericDataCutoff> ZoneContamGenericCutoff;
     289             :     Array1D<DataContaminantBalance::ZoneContamGenericDataDecay> ZoneContamGenericDecay;
     290             :     Array1D<DataContaminantBalance::ZoneContamGenericDataBLDiff> ZoneContamGenericBLDiff;
     291             :     Array1D<DataContaminantBalance::ZoneContamGenericDataDVS> ZoneContamGenericDVS;
     292             :     Array1D<DataContaminantBalance::ZoneContamGenericDataDRS> ZoneContamGenericDRS;
     293             : 
     294           0 :     void clear_state() override
     295             :     {
     296           0 :         *this = ContaminantBalanceData();
     297           0 :     }
     298             : };
     299             : 
     300             : } // namespace EnergyPlus
     301             : 
     302             : #endif

Generated by: LCOV version 1.13