LCOV - code coverage report
Current view: top level - EnergyPlus - MixedAir.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 19 51 37.3 %
Date: 2023-01-17 19:17:23 Functions: 14 19 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 MixedAir_hh_INCLUDED
      49             : #define MixedAir_hh_INCLUDED
      50             : 
      51             : // C++ Headers
      52             : #include <unordered_set>
      53             : 
      54             : // ObjexxFCL Headers
      55             : #include <ObjexxFCL/Array1D.hh>
      56             : #include <ObjexxFCL/Optional.hh>
      57             : 
      58             : // EnergyPlus Headers
      59             : #include <EnergyPlus/Data/BaseData.hh>
      60             : #include <EnergyPlus/DataGlobals.hh>
      61             : #include <EnergyPlus/DataHVACGlobals.hh>
      62             : #include <EnergyPlus/DataSizing.hh>
      63             : #include <EnergyPlus/EPVector.hh>
      64             : #include <EnergyPlus/EnergyPlus.hh>
      65             : #include <EnergyPlus/SimAirServingZones.hh>
      66             : 
      67             : namespace EnergyPlus {
      68             : 
      69             : // Forward declarations
      70             : struct EnergyPlusData;
      71             : 
      72             : namespace MixedAir {
      73             : 
      74             :     // Using/Aliasing
      75             :     using DataHVACGlobals::BypassWhenWithinEconomizerLimits;
      76             : 
      77             :     // Data
      78             :     // MODULE PARAMETER DEFINITIONS
      79             : 
      80             :     enum class LockoutType
      81             :     {
      82             :         Invalid = -1,
      83             :         NoLockoutPossible,
      84             :         LockoutWithHeatingPossible,
      85             :         LockoutWithCompressorPossible,
      86             :         Num
      87             :     };
      88             : 
      89             :     enum class EconoOp
      90             :     {
      91             :         Invalid = -1,
      92             :         NoEconomizer,
      93             :         FixedDryBulb,
      94             :         FixedEnthalpy,
      95             :         DifferentialDryBulb,
      96             :         DifferentialEnthalpy,
      97             :         FixedDewPointAndDryBulb,
      98             :         ElectronicEnthalpy,
      99             :         DifferentialDryBulbAndEnthalpy,
     100             :         Num
     101             :     };
     102             : 
     103             :     enum class MixedAirControllerType
     104             :     {
     105             :         Invalid = -1,
     106             :         None,
     107             :         ControllerSimple,
     108             :         ControllerOutsideAir,
     109             :         ControllerStandAloneERV,
     110             :         Num,
     111             :     };
     112             : 
     113             :     // Parameters below (CMO - Current Module Object.  used primarily in Get Inputs)
     114             :     // Multiple Get Input routines in this module or these would be in individual routines.
     115             :     enum class CMO
     116             :     {
     117             :         Invalid = -1,
     118             :         None,
     119             :         OASystem,
     120             :         AirLoopEqList,
     121             :         ControllerList,
     122             :         SysAvailMgrList,
     123             :         OAController,
     124             :         ERVController,
     125             :         MechVentilation,
     126             :         OAMixer,
     127             :         Num,
     128             :     };
     129             : 
     130             :     // OA Controller Limiting Factor (used for integer output variable values for OAControllerProps::OALimitingFactor
     131             :     // can't change these to enum class since these are used in SetupOutputVariable()
     132             :     constexpr int limitFactorNone = 0;        // No limit other than fixed OA amount
     133             :     constexpr int limitFactorLimits = 1;      // Limits and scheduled limits
     134             :     constexpr int limitFactorEconomizer = 2;  // Economizer operation
     135             :     constexpr int limitFactorExhaust = 3;     // Exhaust flow
     136             :     constexpr int limitFactorMixedAir = 4;    // Mixed air flow rate
     137             :     constexpr int limitFactorHighHum = 5;     // High humidity economizer control
     138             :     constexpr int limitFactorDCV = 6;         // Demand-controlled ventilation
     139             :     constexpr int limitFactorNightVent = 7;   // Night ventilation
     140             :     constexpr int limitFactorDemandLimit = 8; // Demand-limiting
     141             :     constexpr int limitFactorEMS = 9;         // EMS override
     142             : 
     143             :     extern Array1D_string const CurrentModuleObjects;
     144             : 
     145        3654 :     struct ControllerListProps
     146             :     {
     147             :         // Members
     148             :         std::string Name;
     149             :         int NumControllers; // number of controllers on list
     150             :         Array1D_string ControllerType;
     151             :         Array1D_string ControllerName;
     152             : 
     153             :         // Default Constructor
     154        2212 :         ControllerListProps() : NumControllers(0)
     155             :         {
     156        2212 :         }
     157             :     };
     158             : 
     159        2644 :     struct OAControllerProps // Derived type for Outside Air Controller data
     160             :     {
     161             :         // Members
     162             :         std::string Name;
     163             :         std::string ControllerType;
     164             :         MixedAirControllerType ControllerType_Num; // Parameter equivalent of controller type
     165             :         int OACtrlIndex;
     166             :         LockoutType Lockout; // 0=NoLockoutPossible; 1=LockoutWithHeatingPossible;
     167             :         // 2=LockoutWithCompressorPossible;
     168             :         bool FixedMin;        // Fixed Minimum or Proportional Minimum
     169             :         Real64 TempLim;       // Temperature Limit
     170             :         Real64 TempLowLim;    // Temperature Lower Limit
     171             :         Real64 EnthLim;       // Enthalpy Limit
     172             :         Real64 DPTempLim;     // Dew Point Temperature Limit
     173             :         int EnthalpyCurvePtr; // Electronic Enthalpy Curve Index (max HumRat = f[OAT])
     174             :         Real64 MinOA;         // Minimum outside air flow (m3/sec)
     175             :         Real64 MaxOA;         // Maximum outside air flow (m3/sec)
     176             :         EconoOp Econo;        // 0 = NoEconomizer, 1 = FixedDryBulb, 2 = FixedEnthalpy, 3=DifferentialDryBulb,
     177             :         // 4=DifferentialEnthalpy, 5=FixedDewPointAndDryBulb, 6 = ElectronicEnthalpy,
     178             :         // 7 =DifferentialDryBulbAndEnthalpy
     179             :         bool EconBypass;      // ModulateFlow =FALSE , MinimumFlowWithBypass =TRUE
     180             :         int MixNode;          // Controlled node (mixed air node)
     181             :         int OANode;           // Actuated node (outside air node)
     182             :         int InletNode;        // Inlet Air Node for into Mixer  (BTG Nov 2004)
     183             :         int RelNode;          // Relief Air Node Number
     184             :         int RetNode;          // Return Air Node Number
     185             :         std::string MinOASch; // Name of the minimum outside air schedule
     186             :         int MinOASchPtr;      // Index to the minimum outside air schedule
     187             :         Real64 RelMassFlow;
     188             :         Real64 OAMassFlow;
     189             :         Real64 ExhMassFlow;
     190             :         Real64 MixMassFlow;
     191             :         Real64 InletTemp;
     192             :         Real64 InletEnth;
     193             :         Real64 InletPress;
     194             :         Real64 InletHumRat;
     195             :         Real64 OATemp;
     196             :         Real64 OAEnth;
     197             :         Real64 OAPress;
     198             :         Real64 OAHumRat;
     199             :         Real64 RetTemp;
     200             :         Real64 RetEnth;
     201             :         Real64 MixSetTemp;
     202             :         Real64 MinOAMassFlowRate; // Minimum outside air flow (kg/s)
     203             :         Real64 MaxOAMassFlowRate; // Maximum outside air flow (kg/s)
     204             :         Real64 RelTemp;
     205             :         Real64 RelEnth;
     206             :         Real64 RelSensiLossRate; // Heat lost to ambient from relief air (W)
     207             :         Real64 RelLatentLossRate;
     208             :         Real64 RelTotalLossRate;
     209             : 
     210             :         int ZoneEquipZoneNum;
     211             :         std::string VentilationMechanicalName; // Name of ventilation:mechanical object used for DCV
     212             :         int VentMechObjectNum;                 // Index to VENTILATION:MECHANICAL object for this controller
     213             :         int HumidistatZoneNum;                 // zone number where humidistat is located
     214             :         int NodeNumofHumidistatZone;           // node number of zone where humidistat is located
     215             :         Real64 HighRHOAFlowRatio;              // Modify ratio with respect to maximum outdoor air flow rate (high RH)
     216             :         bool ModifyDuringHighOAMoisture; // flag to Modify outdoor air flow, TRUE when modify any time, FALSE when modify only when indoor air humrat
     217             :                                          // is less than outdoor HR
     218             :         int EconomizerOASchedPtr;        // schedule to modify outdoor air flow
     219             :         std::string MinOAflowSch;        // Name of the Minimum fraction of Design/Mixed Mass of air
     220             :         std::string MaxOAflowSch;        // Name of the Maximum fraction of Design/Mixed Mass of air
     221             :         int MinOAflowSchPtr;             // Index to the Minimum Fraction of Outdoor Air Schedule
     222             :         int MaxOAflowSchPtr;             // Index to the Maximum Fraction of Outdoor Air Schedule
     223             :         //   Economizer Status, which is currently following the EconomizerOperationFlag, might be something like "Economizer status
     224             :         //   indicates when the conditions are favorable for the economizer to operate (i.e., none of the control limits have been exceeded).
     225             :         //   While this status signal indicates favorable conditions for economizer operation, it does not guarantee that the air-side
     226             :         //   economizer has increased outdoor air flow above the minimum level since the actual outdoor air flow rate is also governed
     227             :         //   by other controls (e.g., mixed air setpoint temperature, time of day economizer control, etc.).
     228             :         int EconomizerStatus;           // Air Economizer status (1 = on, 0 = off or economizer not exists)
     229             :         int HeatRecoveryBypassStatus;   // OA Sys Heat Recovery Bypass status (1 = on, 0 = off or economizer not exists)
     230             :         int HRHeatingCoilActive;        // OA Sys Heat Recovery Heating Coil Was Active status (1 = on, 0 = off)
     231             :         Real64 MixedAirTempAtMinOAFlow; // calculated mixed air temp when using special HX bypass control
     232             :         int HighHumCtrlStatus;          // High Humidity Control status (1 = on, 0 = off or high hum ctrl not used)
     233             :         Real64 OAFractionRpt;           // Actual outdoor air fraction for reporting (based on mixed air flow rate),
     234             :         // 0 to 1 (normally)
     235             :         Real64 MinOAFracLimit;             // Minimum OA fraction limit
     236             :         Real64 MechVentOAMassFlowRequest;  // outside air mass flow rate calculated by mechanical ventilation object [kg/s]
     237             :         bool EMSOverrideOARate;            // if true, EMS is calling to override OA rate
     238             :         Real64 EMSOARateValue;             // Value EMS is directing to use. [kg/s]
     239             :         int HeatRecoveryBypassControlType; // User input selects type of heat recovery optimization
     240             :         bool ManageDemand;                 // Used by demand manager to manage ventilation
     241             :         Real64 DemandLimitFlowRate;        // Current demand limit if demand manager is ON
     242             :         Real64 MaxOAFracBySetPoint;        // The maximum OA fraction due to freezing cooling coil check
     243             :         int MixedAirSPMNum;                // index of mixed air setpoint manager
     244             :         bool CoolCoilFreezeCheck;          // if true, cooling coil freezing is prevented by recalculating the amount of OA
     245             :         bool EconoActive;                  // if true economizer is active
     246             :         bool HighHumCtrlActive;            // if true high humidity control is active
     247             :         Array1D_int EconmizerFaultNum;     // index to economizer fault
     248             :         int NumFaultyEconomizer;           // total number of economizer faults
     249             :         int CountMechVentFrac;             // Count when OA min fraction > mech vent fraction
     250             :         int IndexMechVentFrac;             // Index when OA min fraction > mech vent fraction
     251             :         int OALimitingFactor; // OA controller limiting factor: 0=none, 1=limits, 2=exhaust flow, 3=economizer, 4=DCV, 5=high hum, 6=night vent,
     252             :                               // 7=demand limiting, 8=EMS
     253             : 
     254             :         // Default Constructor
     255        1519 :         OAControllerProps()
     256        1519 :             : ControllerType_Num(MixedAirControllerType::None), OACtrlIndex(0), Lockout(LockoutType::NoLockoutPossible), FixedMin(true), TempLim(0.0),
     257             :               TempLowLim(0.0), EnthLim(0.0), DPTempLim(0.0), EnthalpyCurvePtr(0), MinOA(0.0), MaxOA(0.0), Econo(EconoOp::NoEconomizer),
     258             :               EconBypass(false), MixNode(0), OANode(0), InletNode(0), RelNode(0), RetNode(0), MinOASchPtr(0), RelMassFlow(0.0), OAMassFlow(0.0),
     259             :               ExhMassFlow(0.0), MixMassFlow(0.0), InletTemp(0.0), InletEnth(0.0), InletPress(0.0), InletHumRat(0.0), OATemp(0.0), OAEnth(0.0),
     260             :               OAPress(0.0), OAHumRat(0.0), RetTemp(0.0), RetEnth(0.0), MixSetTemp(0.0), MinOAMassFlowRate(0.0), MaxOAMassFlowRate(0.0), RelTemp(0.0),
     261             :               RelEnth(0.0), RelSensiLossRate(0.0), RelLatentLossRate(0.0), RelTotalLossRate(0.0), ZoneEquipZoneNum(0), VentMechObjectNum(0),
     262             :               HumidistatZoneNum(0), NodeNumofHumidistatZone(0), HighRHOAFlowRatio(1.0), ModifyDuringHighOAMoisture(false), EconomizerOASchedPtr(0),
     263             :               MinOAflowSchPtr(0), MaxOAflowSchPtr(0), EconomizerStatus(0), HeatRecoveryBypassStatus(0), HRHeatingCoilActive(0),
     264             :               MixedAirTempAtMinOAFlow(0.0), HighHumCtrlStatus(0), OAFractionRpt(0.0), MinOAFracLimit(0.0), MechVentOAMassFlowRequest(0.0),
     265             :               EMSOverrideOARate(false), EMSOARateValue(0.0), HeatRecoveryBypassControlType(BypassWhenWithinEconomizerLimits), ManageDemand(false),
     266             :               DemandLimitFlowRate(0.0), MaxOAFracBySetPoint(0), MixedAirSPMNum(0), CoolCoilFreezeCheck(false), EconoActive(false),
     267        1519 :               HighHumCtrlActive(false), EconmizerFaultNum(0), NumFaultyEconomizer(0), CountMechVentFrac(0), IndexMechVentFrac(0), OALimitingFactor(0)
     268             :         {
     269        1519 :         }
     270             : 
     271             :         void CalcOAController(EnergyPlusData &state, int const AirLoopNum, bool const FirstHVACIteration);
     272             : 
     273             :         void CalcOAEconomizer(EnergyPlusData &state,
     274             :                               int const AirLoopNum,
     275             :                               Real64 const OutAirMinFrac,
     276             :                               Real64 &OASignal,
     277             :                               bool &HighHumidityOperationFlag,
     278             :                               bool const FirstHVACIteration);
     279             : 
     280             :         void SizeOAController(EnergyPlusData &state);
     281             : 
     282             :         void UpdateOAController(EnergyPlusData &state);
     283             : 
     284             :         void Checksetpoints(EnergyPlusData &state,
     285             :                             Real64 const OutAirMinFrac,   // Local variable used to calculate min OA fraction
     286             :                             Real64 &OutAirSignal,         // Used to set OA mass flow rate
     287             :                             bool &EconomizerOperationFlag // logical used to show economizer status
     288             :         );
     289             :     };
     290             : 
     291         128 :     struct VentilationMechanicalProps // Derived type for Ventilation:Mechanical data
     292             :     {
     293             :         // Members
     294             :         std::string Name;                       // Name of Ventilation:Mechanical object
     295             :         std::string SchName;                    // Name of the mechanical ventilation schedule
     296             :         int SchPtr;                             // Index to the mechanical ventilation schedule
     297             :         bool DCVFlag;                           // if true, implement OA based on demand controlled ventilation
     298             :         int NumofVentMechZones;                 // Number of zones with mechanical ventilation
     299             :         Real64 TotAreaOAFlow;                   // Total outdoor air flow rate for all zones per area (m3/s/m2)
     300             :         Real64 TotPeopleOAFlow;                 // Total outdoor air flow rate for all PEOPLE objects in zones (m3/s)
     301             :         Real64 TotZoneOAFlow;                   // Total outdoor air flow rate for all zones (m3/s)
     302             :         Real64 TotZoneOAACH;                    // Total outdoor air flow rate for all zones Air Changes per hour (m3/s/m3)
     303             :         DataSizing::SysOAMethod SystemOAMethod; // System Outdoor Air Method - SOAM_ZoneSum, SOAM_VRP, SOAM_VRPL
     304             :         Real64 ZoneMaxOAFraction;               // Zone maximum outdoor air fraction
     305             :         Array1D<Real64> ZoneOAAreaRate;         // Mechanical ventilation rate (m3/s/m2) for each zone
     306             :         Array1D<Real64> ZoneOAPeopleRate;       // Mechanical ventilation rate (m3/s/person) for each zone
     307             :         Array1D<Real64> ZoneOAFlowRate;         // OA Flow Rate (m3/s/zone) for each zone
     308             :         Array1D<Real64> ZoneOAACHRate;          // OA ACH (m3/s/volume) for each zone
     309             :         Array1D_int VentMechZone;               // Zones requiring mechanical ventilation
     310             :         Array1D_string VentMechZoneName;        // name of mech vent zone
     311             :         Array1D_int ZoneDesignSpecOAObjIndex;   // index of the design specification outdoor air object for each zone
     312             :         Array1D_string ZoneDesignSpecOAObjName; // name of the design specification outdoor air object for each zone
     313             :         int CO2MaxMinLimitErrorCount;           // Counter when max CO2 concentration < min CO2 concentration for SOAM_ProportionalControlSchOcc
     314             :         int CO2MaxMinLimitErrorIndex;           // Index for max CO2 concentration < min CO2 concentration recurring error message for
     315             :                                                 // SOAM_ProportionalControlSchOcc
     316             :         int CO2GainErrorCount;                  // Counter when CO2 generation from people is zero for SOAM_ProportionalControlSchOcc
     317             :         int CO2GainErrorIndex;       // Index for recurring error message when CO2 generation from people is zero for SOAM_ProportionalControlSchOcc
     318             :         int OAMaxMinLimitErrorCount; // Counter when max OA < min OA for SOAM_ProportionalControlDesOARate
     319             :         int OAMaxMinLimitErrorIndex; // Index for max OA < min OA recurring error message for SOAM_ProportionalControlDesOARate
     320             :         Array1D<Real64> ZoneADEffCooling;                       // Zone air distribution effectiveness in cooling mode for each zone
     321             :         Array1D<Real64> ZoneADEffHeating;                       // Zone air distribution effectiveness in heating mode for each zone
     322             :         Array1D_int ZoneADEffSchPtr;                            // Pointer to the zone air distribution effectiveness schedule for each zone
     323             :         Array1D_int ZoneDesignSpecADObjIndex;                   // index of the design specification zone air distribution object for each zone
     324             :         Array1D_string ZoneDesignSpecADObjName;                 // name of the design specification zone air distribution object for each zone
     325             :         Array1D<Real64> ZoneSecondaryRecirculation;             // zone air secondary recirculation ratio for each zone
     326             :         Array1D<DataSizing::OAFlowCalcMethod> ZoneOAFlowMethod; // OA flow method for each zone
     327             :         Array1D_int ZoneOASchPtr;               // Index to the outdoor air schedule for each zone (from DesignSpecification:OutdoorAir or default)
     328             :         Array1D<Real64> OAPropCtlMinRateSchPtr; // Outdoor design OA flow rate schedule from DesignSpecification:OutdoorAir
     329             :         Real64 Ep = 1.0;                        // zone primary air fraction
     330             :         Real64 Er = 0.0;                        // zone secondary recirculation fraction
     331             :         Real64 Fa = 1.0;                        // temporary variable used in multi-path VRP calc
     332             :         Real64 Fb = 1.0;
     333             :         Real64 Fc = 1.0;
     334             :         Real64 Xs = 1.0;       // uncorrected system outdoor air fraction
     335             :         Real64 Evz = 1.0;      // zone ventilation efficiency
     336             :         Real64 SysDesOA = 0.0; // System design OA
     337             : 
     338             :         // Default Constructor
     339          76 :         VentilationMechanicalProps()
     340          76 :             : SchPtr(0), DCVFlag(false), NumofVentMechZones(0), TotAreaOAFlow(0.0), TotPeopleOAFlow(0.0), TotZoneOAFlow(0.0), TotZoneOAACH(0.0),
     341             :               SystemOAMethod(DataSizing::SysOAMethod::Invalid), ZoneMaxOAFraction(1.0), CO2MaxMinLimitErrorCount(0), CO2MaxMinLimitErrorIndex(0),
     342          76 :               CO2GainErrorCount(0), CO2GainErrorIndex(0), OAMaxMinLimitErrorCount(0), OAMaxMinLimitErrorIndex(0)
     343             :         {
     344          76 :         }
     345             : 
     346             :         void CalcMechVentController(EnergyPlusData &state,
     347             :                                     Real64 &SysSA,             // System supply air mass flow rate [kg/s]
     348             :                                     Real64 &MechVentOAMassFlow // outside air mass flow rate calculated by mechanical ventilation object [kg/s]
     349             :         );
     350             :     };
     351             : 
     352        3113 :     struct OAMixerProps // Derived type for Outside Air Mixing Component
     353             :     {
     354             :         // Members
     355             :         std::string Name;
     356             :         int MixerIndex; // Set on first call...
     357             :         int MixNode;    // Outlet node - mixed air
     358             :         int InletNode;  // Inlet node for outside air stream (Nov. 2004 BTG was OANode )
     359             :         int RelNode;    // Outlet node - relief air
     360             :         int RetNode;    // Inlet node - return air
     361             :         Real64 MixTemp;
     362             :         Real64 MixHumRat;
     363             :         Real64 MixEnthalpy;
     364             :         Real64 MixPressure;
     365             :         Real64 MixMassFlowRate;
     366             :         Real64 OATemp;
     367             :         Real64 OAHumRat;
     368             :         Real64 OAEnthalpy;
     369             :         Real64 OAPressure;
     370             :         Real64 OAMassFlowRate;
     371             :         Real64 RelTemp;
     372             :         Real64 RelHumRat;
     373             :         Real64 RelEnthalpy;
     374             :         Real64 RelPressure;
     375             :         Real64 RelMassFlowRate;
     376             :         Real64 RetTemp;
     377             :         Real64 RetHumRat;
     378             :         Real64 RetEnthalpy;
     379             :         Real64 RetPressure;
     380             :         Real64 RetMassFlowRate;
     381             : 
     382             :         // Default Constructor
     383        1774 :         OAMixerProps()
     384        1774 :             : MixerIndex(0), MixNode(0), InletNode(0), RelNode(0), RetNode(0), MixTemp(0.0), MixHumRat(0.0), MixEnthalpy(0.0), MixPressure(0.0),
     385             :               MixMassFlowRate(0.0), OATemp(0.0), OAHumRat(0.0), OAEnthalpy(0.0), OAPressure(0.0), OAMassFlowRate(0.0), RelTemp(0.0), RelHumRat(0.0),
     386             :               RelEnthalpy(0.0), RelPressure(0.0), RelMassFlowRate(0.0), RetTemp(0.0), RetHumRat(0.0), RetEnthalpy(0.0), RetPressure(0.0),
     387        1774 :               RetMassFlowRate(0.0)
     388             :         {
     389        1774 :         }
     390             :     };
     391             : 
     392             :     // Functions
     393             : 
     394             :     Real64 OAGetFlowRate(EnergyPlusData &state, int OAPtr);
     395             : 
     396             :     Real64 OAGetMinFlowRate(EnergyPlusData &state, int OAPtr);
     397             : 
     398             :     void OASetDemandManagerVentilationState(EnergyPlusData &state, int OAPtr, bool aState);
     399             : 
     400             :     void OASetDemandManagerVentilationFlow(EnergyPlusData &state, int OAPtr, Real64 aFlow);
     401             : 
     402             :     int GetOAController(EnergyPlusData &state, std::string const &OAName);
     403             : 
     404             :     void
     405             :     ManageOutsideAirSystem(EnergyPlusData &state, std::string const &OASysName, bool const FirstHVACIteration, int const AirLoopNum, int &OASysNum);
     406             : 
     407             :     void SimOutsideAirSys(EnergyPlusData &state, int const OASysNum, bool const FirstHVACIteration, int const AirLoopNum);
     408             : 
     409             :     void SimOASysComponents(EnergyPlusData &state, int const OASysNum, bool const FirstHVACIteration, int const AirLoopNum);
     410             : 
     411             :     void SimOAComponent(EnergyPlusData &state,
     412             :                         std::string const &CompType,                    // the component type
     413             :                         std::string const &CompName,                    // the component Name
     414             :                         SimAirServingZones::CompType const CompTypeNum, // Component Type -- Integerized for this module
     415             :                         bool const FirstHVACIteration,
     416             :                         int &CompIndex,
     417             :                         int const AirLoopNum, // air loop index for economizer lockout coordination
     418             :                         bool const Sim,       // if TRUE, simulate component; if FALSE, just set the coil exisitence flags
     419             :                         int const OASysNum,   // index to outside air system
     420             :                         bool &OAHeatingCoil,  // TRUE indicates a heating coil has been found
     421             :                         bool &OACoolingCoil,  // TRUE indicates a cooling coil has been found
     422             :                         bool &OAHX            // TRUE indicates a heat exchanger has been found
     423             :     );
     424             : 
     425             :     void SimOAMixer(EnergyPlusData &state, std::string const &CompName, bool const FirstHVACIteration, int &CompIndex);
     426             : 
     427             :     void SimOAController(EnergyPlusData &state, std::string const &CtrlName, int &CtrlIndex, bool const FirstHVACIteration, int const AirLoopNum);
     428             : 
     429             :     // Get Input Section of the Module
     430             :     //******************************************************************************
     431             : 
     432             :     void GetOutsideAirSysInputs(EnergyPlusData &state);
     433             : 
     434             :     void GetOAControllerInputs(EnergyPlusData &state);
     435             : 
     436             :     void AllocateOAControllers(EnergyPlusData &state);
     437             : 
     438             :     void GetOAMixerInputs(EnergyPlusData &state);
     439             : 
     440             :     void ProcessOAControllerInputs(EnergyPlusData &state,
     441             :                                    std::string const &CurrentModuleObject,
     442             :                                    int const OutAirNum,
     443             :                                    Array1D_string const &AlphArray,
     444             :                                    int &NumAlphas,
     445             :                                    Array1D<Real64> const &NumArray,
     446             :                                    int &NumNums,
     447             :                                    Array1D_bool const &lNumericBlanks, // Unused
     448             :                                    Array1D_bool const &lAlphaBlanks,
     449             :                                    Array1D_string const &cAlphaFields,
     450             :                                    Array1D_string const &cNumericFields, // Unused
     451             :                                    bool &ErrorsFound                     // If errors found in input
     452             :     );
     453             : 
     454             :     // End of Get Input subroutines for the Module
     455             :     //******************************************************************************
     456             : 
     457             :     // Beginning Initialization Section of the Module
     458             :     //******************************************************************************
     459             : 
     460             :     void InitOutsideAirSys(EnergyPlusData &state, int const OASysNum, bool const FirstHVACIteration, int const AirLoopNum);
     461             : 
     462             :     void InitOAController(EnergyPlusData &state, int const OAControllerNum, bool const FirstHVACIteration, int const AirLoopNum);
     463             : 
     464             :     void InitOAMixer(EnergyPlusData &state, int const OAMixerNum, bool const FirstHVACIteration);
     465             : 
     466             :     // End of Initialization Section of the Module
     467             :     //******************************************************************************
     468             : 
     469             :     // Beginning Calculation Section of the Module
     470             :     //******************************************************************************
     471             : 
     472             :     void CalcOAMixer(EnergyPlusData &state, int const OAMixerNum);
     473             : 
     474             :     // End of Calculation/Simulation Section of the Module
     475             :     //******************************************************************************
     476             : 
     477             :     // Beginning Sizing Section of the Module
     478             :     //******************************************************************************
     479             : 
     480             :     // End of Sizing Section of the Module
     481             :     //******************************************************************************
     482             : 
     483             :     // Beginning Update/Reporting Section of the Module
     484             :     //******************************************************************************
     485             : 
     486             :     void UpdateOAMixer(EnergyPlusData &state, int const OAMixerNum);
     487             : 
     488             :     void ReportOAMixer(int const OAMixerNum); // unused1208
     489             : 
     490             :     // End of Sizing Section of the Module
     491             :     //******************************************************************************
     492             : 
     493             :     // Beginning Utility Section of the Module
     494             :     //******************************************************************************
     495             : 
     496             :     Array1D_int GetOAMixerNodeNumbers(EnergyPlusData &state,
     497             :                                       std::string const &OAMixerName, // must match OA mixer names for the OA mixer type
     498             :                                       bool &ErrorsFound               // set to true if problem
     499             :     );
     500             : 
     501             :     int GetNumOAMixers(EnergyPlusData &state);
     502             : 
     503             :     int GetNumOAControllers(EnergyPlusData &state);
     504             : 
     505             :     int GetOAMixerReliefNodeNumber(EnergyPlusData &state, int const OAMixerNum); // Which Mixer
     506             : 
     507             :     int GetOASysControllerListIndex(EnergyPlusData &state, int const OASysNumber); // OA Sys Number
     508             : 
     509             :     int GetOASysNumSimpControllers(EnergyPlusData &state, int const OASysNumber); // OA Sys Number
     510             : 
     511             :     int GetOASysNumHeatingCoils(EnergyPlusData &state, int const OASysNumber); // OA Sys Number
     512             : 
     513             :     int GetOASysNumHXs(EnergyPlusData &state, int const OASysNumber); // OA Sys Number
     514             : 
     515             :     int GetOASysNumCoolingCoils(EnergyPlusData &state, int const OASysNumber); // OA Sys Number
     516             : 
     517             :     int GetOASystemNumber(EnergyPlusData &state, std::string const &OASysName); // OA Sys Name
     518             : 
     519             :     int FindOAMixerMatchForOASystem(EnergyPlusData &state, int const OASysNumber); // Which OA System
     520             : 
     521             :     int GetOAMixerIndex(EnergyPlusData &state, std::string const &OAMixerName); // Which Mixer
     522             : 
     523             :     int GetOAMixerInletNodeNumber(EnergyPlusData &state, int const OAMixerNumber); // Which Mixer
     524             : 
     525             :     int GetOAMixerReturnNodeNumber(EnergyPlusData &state, int const OAMixerNumber); // Which Mixer
     526             : 
     527             :     int GetOAMixerMixedNodeNumber(EnergyPlusData &state, int const OAMixerNumber); // Which Mixer
     528             : 
     529             :     bool CheckForControllerWaterCoil(EnergyPlusData &state,
     530             :                                      std::string const &ControllerType, // should be passed in as UPPERCASE
     531             :                                      std::string const &ControllerName  // should be passed in as UPPERCASE
     532             :     );
     533             : 
     534             :     void CheckControllerLists(EnergyPlusData &state, bool &ErrFound);
     535             : 
     536             :     void CheckOAControllerName(
     537             :         EnergyPlusData &state, std::string &OAControllerName, std::string const &ObjectType, std::string const &FieldName, bool &ErrorsFound);
     538             : 
     539             :     int GetNumOASystems(EnergyPlusData &state);
     540             : 
     541             :     int GetOACompListNumber(EnergyPlusData &state, int const OASysNum); // OA Sys Number
     542             : 
     543             :     std::string GetOACompName(EnergyPlusData &state,
     544             :                               int const OASysNum, // OA Sys Number
     545             :                               int const InListNum // In-list Number
     546             :     );
     547             : 
     548             :     std::string GetOACompType(EnergyPlusData &state,
     549             :                               int const OASysNum, // OA Sys Number
     550             :                               int const InListNum // In-list Number
     551             :     );
     552             : 
     553             :     SimAirServingZones::CompType GetOACompTypeNum(EnergyPlusData &state,
     554             :                                                   int const OASysNum, // OA Sys Number
     555             :                                                   int const InListNum // In-list Number
     556             :     );
     557             : 
     558             :     int GetOAMixerNumber(EnergyPlusData &state, std::string const &OAMixerName); // must match OA mixer names for the OA mixer type
     559             : 
     560             :     // End of Utility Section of the Module
     561             :     //******************************************************************************
     562             : 
     563             : } // namespace MixedAir
     564             : 
     565        1542 : struct MixedAirData : BaseGlobalStruct
     566             : {
     567             : 
     568             :     int NumControllerLists = 0;     // Number of Controller Lists
     569             :     int NumOAControllers = 0;       // Number of OA Controllers (includes ERV controllers)
     570             :     int NumERVControllers = 0;      // Number of ERV Controllers
     571             :     int NumOAMixers = 0;            // Number of Outdoor Air Mixers
     572             :     int NumVentMechControllers = 0; // Number of Controller:MechanicalVentilation objects in input deck
     573             :     Array1D_bool MyOneTimeErrorFlag;
     574             :     Array1D_bool MyOneTimeCheckUnitarySysFlag;
     575             :     Array1D_bool initOASysFlag;
     576             :     bool GetOASysInputFlag = true;
     577             :     bool GetOAMixerInputFlag = true;
     578             :     bool GetOAControllerInputFlag = true;
     579             :     bool InitOAControllerOneTimeFlag = true;
     580             :     Array1D_bool InitOAControllerSetPointCheckFlag;
     581             :     bool InitOAControllerSetUpAirLoopHVACVariables = true;
     582             :     bool AllocateOAControllersFlag = true;
     583             :     Array1D_string DesignSpecOAObjName;     // name of the design specification outdoor air object
     584             :     Array1D_int DesignSpecOAObjIndex;       // index of the design specification outdoor air object
     585             :     Array1D_string VentMechZoneOrListName;  // Zone or Zone List to apply mechanical ventilation rate
     586             :     Array1D_string DesignSpecZoneADObjName; // name of the design specification zone air distribution object
     587             :     Array1D_int DesignSpecZoneADObjIndex;   // index of the design specification zone air distribution object
     588             :     EPVector<MixedAir::ControllerListProps> ControllerLists;
     589             :     EPVector<MixedAir::OAControllerProps> OAController;
     590             :     EPVector<MixedAir::OAMixerProps> OAMixer;
     591             :     EPVector<MixedAir::VentilationMechanicalProps> VentilationMechanical;
     592             :     std::unordered_set<std::string> ControllerListUniqueNames;
     593             :     std::unordered_map<std::string, std::string> OAControllerUniqueNames;
     594             :     std::string CompType;
     595             :     std::string CompName;
     596             :     std::string CtrlName;
     597             :     Array1D_bool OAControllerMyOneTimeFlag;
     598             :     Array1D_bool OAControllerMyEnvrnFlag;
     599             :     Array1D_bool OAControllerMySizeFlag;
     600             :     Array1D_bool MechVentCheckFlag;
     601             : 
     602           0 :     void clear_state() override
     603             :     {
     604           0 :         this->NumControllerLists = 0;
     605           0 :         this->NumOAControllers = 0;
     606           0 :         this->NumERVControllers = 0;
     607           0 :         this->NumOAMixers = 0;
     608           0 :         this->NumVentMechControllers = 0;
     609           0 :         this->MyOneTimeErrorFlag.deallocate();
     610           0 :         this->MyOneTimeCheckUnitarySysFlag.deallocate();
     611           0 :         this->initOASysFlag.deallocate();
     612           0 :         this->GetOASysInputFlag = true;
     613           0 :         this->GetOAMixerInputFlag = true;
     614           0 :         this->GetOAControllerInputFlag = true;
     615           0 :         this->InitOAControllerOneTimeFlag = true;
     616           0 :         this->InitOAControllerSetPointCheckFlag.deallocate();
     617           0 :         this->InitOAControllerSetUpAirLoopHVACVariables = true;
     618           0 :         this->AllocateOAControllersFlag = true;
     619           0 :         this->DesignSpecOAObjName.deallocate();
     620           0 :         this->DesignSpecOAObjIndex.deallocate();
     621           0 :         this->VentMechZoneOrListName.deallocate();
     622           0 :         this->DesignSpecZoneADObjName.deallocate();
     623           0 :         this->DesignSpecZoneADObjIndex.deallocate();
     624           0 :         this->ControllerLists.deallocate();
     625           0 :         this->OAController.deallocate();
     626           0 :         this->OAMixer.deallocate();
     627           0 :         this->VentilationMechanical.deallocate();
     628           0 :         this->ControllerListUniqueNames.clear();
     629           0 :         this->OAControllerUniqueNames.clear();
     630           0 :         this->OAControllerMyOneTimeFlag.clear();
     631           0 :         this->OAControllerMyEnvrnFlag.clear();
     632           0 :         this->OAControllerMySizeFlag.clear();
     633           0 :         this->MechVentCheckFlag.clear();
     634           0 :     }
     635             : };
     636             : 
     637             : } // namespace EnergyPlus
     638             : 
     639             : #endif

Generated by: LCOV version 1.13