LCOV - code coverage report
Current view: top level - EnergyPlus - HVACVariableRefrigerantFlow.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 19 73 26.0 %
Date: 2023-01-17 19:17:23 Functions: 15 20 75.0 %

          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 HVACVariableRefrigerantFlow_hh_INCLUDED
      49             : #define HVACVariableRefrigerantFlow_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : #include <ObjexxFCL/Optional.hh>
      54             : 
      55             : // EnergyPlus Headers
      56             : #include <EnergyPlus/Data/BaseData.hh>
      57             : #include <EnergyPlus/DataGlobals.hh>
      58             : #include <EnergyPlus/DataHeatBalance.hh>
      59             : #include <EnergyPlus/EnergyPlus.hh>
      60             : #include <EnergyPlus/Plant/PlantLocation.hh>
      61             : #include <EnergyPlus/PlantComponent.hh>
      62             : #include <EnergyPlus/SingleDuct.hh>
      63             : #include <EnergyPlus/StandardRatings.hh>
      64             : 
      65             : namespace EnergyPlus {
      66             : 
      67             : // Forward declarations
      68             : struct EnergyPlusData;
      69             : 
      70             : namespace HVACVariableRefrigerantFlow {
      71             : 
      72             :     // Thermostat Priority Control Type
      73             :     enum class ThermostatCtrlType
      74             :     {
      75             :         Invalid = -1,
      76             :         LoadPriority,             // total of zone loads dictate operation in cooling or heating
      77             :         ZonePriority,             // # of zones requiring cooling or heating dictate operation in cooling or heating
      78             :         ThermostatOffsetPriority, // zone with largest deviation from setpoint dictates operation
      79             :         ScheduledPriority,        // cooling and heating modes are scheduled
      80             :         MasterThermostatPriority, // Master zone thermostat dictates operation
      81             :         FirstOnPriority,          // first unit to respond dictates operation (not used at this time)
      82             :         Num
      83             :     };
      84             : 
      85             :     enum class EvapWaterSupply
      86             :     {
      87             :         Invalid = -1,
      88             :         FromMains, // mains water line used as water source
      89             :         FromTank,  // storage tank used as water source
      90             :         Num
      91             :     };
      92             : 
      93             :     constexpr Real64 MaxCap(1.0e+20); // limit of zone terminal unit capacity
      94             : 
      95             :     // VRF Algorithm Type
      96             :     enum class AlgorithmType
      97             :     {
      98             :         Invalid = -1,
      99             :         SysCurve,   // VRF model based on system curve
     100             :         FluidTCtrl, // VRF model based on physics, appreciable for Fluid Temperature Control
     101             :         Num
     102             :     };
     103             : 
     104             :     // VRF System Types (strings used in integer conversions)
     105             :     constexpr int VRF_HeatPump(1);
     106             : 
     107          57 :     constexpr auto cVRFTypes(int i)
     108             :     {
     109          57 :         if (i == 1) {
     110          57 :             return "AirConditioner:VariableRefrigerantFlow";
     111             :         } else {
     112           0 :             assert(false);
     113             :             return "";
     114             :         }
     115             :     }
     116             : 
     117             :     constexpr const char *fluidNameSteam("STEAM");
     118             : 
     119             :     // Flag for hex operation
     120             :     enum class HXOpMode
     121             :     {
     122             :         Invalid = -1,
     123             :         CondMode, // Flag for the hex running as condenser [-]
     124             :         EvapMode, // Flag for the hex running as evaporator [-]
     125             :         Num
     126             :     };
     127             : 
     128             :     // Flag for VRF operational mode
     129             :     constexpr int ModeCoolingOnly = 1;       // Flag for Cooling Only Mode [-]
     130             :     constexpr int ModeHeatingOnly = 2;       // Flag for Heating Only Mode [-]
     131             :     constexpr int ModeCoolingAndHeating = 3; // Flag for Simultaneous Cooling and Heating Only Mode [-]
     132             : 
     133             :     // Subroutine Specifications for the Module
     134          35 :     struct VRFCondenserEquipment : PlantComponent
     135             :     {
     136             :         // Members
     137             :         std::string Name;                      // Name of the VRF Terminal Unit
     138             :         int VRFSystemTypeNum;                  // integer equivalent of system type
     139             :         AlgorithmType VRFAlgorithmTypeNum;     // Algorithm type: 1_system curve based model; 2_physics based model (FluidTCtrl)
     140             :         DataPlant::PlantEquipmentType VRFType; // integer equivalent of index to DataPlant type
     141             :         PlantLocation SourcePlantLoc;          // plant data for water-cooled only
     142             :         Real64 WaterCondenserDesignMassFlow;   // plant data for water-cooled only
     143             :         Real64 WaterCondenserMassFlow;         // Water condenser flow rate (kg/s)
     144             :         Real64 QCondenser;                     // Water condenser heat rejection/absorption (W)
     145             :         Real64 QCondEnergy;                    // Water condenser heat rejection/aborption energy (J)
     146             :         Real64 CondenserSideOutletTemp;        // Water condenser outlet temp (C)
     147             :         int SchedPtr;                          // Pointer to the correct schedule
     148             :         Real64 CoolingCapacity;                // Nominal VRF heat pump cooling capacity (W)
     149             :         Real64 TotalCoolingCapacity;           // Nominal VRF heat pump cooling capacity (W)
     150             :         Real64 CoolingCombinationRatio;        // Ratio or terminal unit cooling capacity to VRF condenser capacity
     151             :         Real64 VRFCondPLR;                     // Condenser part-load ratio wrt total capacity
     152             :         Real64 VRFCondRTF;                     // Condenser runtime fraction
     153             :         Real64 VRFCondCyclingRatio;            // Condenser cycling ratio below MinPLR
     154             :         Real64 CondenserInletTemp;             // Condenser entering air temperature (C)
     155             :         Real64 CoolingCOP;                     // Nominal VRF heat pump cooling COP (W/W)
     156             :         Real64 OperatingCoolingCOP;            // Operating VRF heat pump cooling COP (W/W)
     157             :         Real64 RatedCoolingPower;              // Rated cooling power = Rated Cooling Capacity / Rated COP (W)
     158             :         Real64 HeatingCapacity;                // Nominal VRF heat pump heating capacity (W)
     159             :         Real64 HeatingCapacitySizeRatio;       // Ratio of heating to cooling when autosizing
     160             :         bool LockHeatingCapacity;              // used in sizing to size VRF heat cap to VRF cool cap
     161             :         Real64 TotalHeatingCapacity;           // Nominal VRF heat pump heating capacity (W)
     162             :         Real64 HeatingCombinationRatio;        // Ratio or terminal unit heating capacity to VRF condenser capacity
     163             :         Real64 HeatingCOP;                     // Nominal VRF heat pump heating COP
     164             :         Real64 OperatingHeatingCOP;            // Operating VRF heat pump heating COP
     165             :         Real64 RatedHeatingPower;              // Rated heating power = Rated Heating Capacity / Rated COP (W)
     166             :         Real64 MinOATCooling;                  // Minimum outdoor air dry-bulb temp in cooling mode (C)
     167             :         Real64 MaxOATCooling;                  // Maximum outdoor air dry-bulb temp in cooling mode (C)
     168             :         Real64 MinOATHeating;                  // Minimum outdoor air dry-bulb temp in heating mode (C)
     169             :         Real64 MaxOATHeating;                  // Maximum outdoor air dry-bulb temp in heating mode (C)
     170             :         int CoolCapFT;                         // index to cooling capacity function of temperature curve
     171             :         int CoolEIRFT;                         // index to cooling EIR function of temperature curve
     172             :         int HeatCapFT;                         // index to heating capacity function of temperature curve
     173             :         int HeatEIRFT;                         // index to heating EIR function of temperature curve
     174             :         int CoolBoundaryCurvePtr;              // index to cooling capacity boundary curve
     175             :         int HeatBoundaryCurvePtr;              // index to cooling capacity boundary curve
     176             :         int EIRCoolBoundaryCurvePtr;           // index to cooling EIR boundary curve
     177             :         int CoolEIRFPLR1;                      // index to cooling EIR function of PLR curve < 1
     178             :         int CoolEIRFPLR2;                      // index to cooling EIR function of PLR curve >= 1
     179             :         int CoolCapFTHi;                       // index to cooling capacity function of temperature curve
     180             :         int CoolEIRFTHi;                       // index to cooling EIR function of temperature curve
     181             :         int HeatCapFTHi;                       // index to heating capacity function of temperature curve
     182             :         int HeatEIRFTHi;                       // index to heating EIR function of temperature curve
     183             :         int EIRHeatBoundaryCurvePtr;           // index to heating EIR boundary curve
     184             :         int HeatEIRFPLR1;                      // index to heating EIR function of PLR curve < 1
     185             :         int HeatEIRFPLR2;                      // index to heating EIR function of PLR curve >= 1
     186             :         int CoolPLFFPLR;                       // index to cooling PLF function of PLR curve
     187             :         int HeatPLFFPLR;                       // index to heating PLF function of PLR curve
     188             :         int HeatingPerformanceOATType;         // Temperature type for heating performance curves
     189             :         Real64 MinPLR;                         // minimum PLR before cycling occurs
     190             :         int MasterZonePtr;                     // index to master thermostat zone
     191             :         int MasterZoneTUIndex;                 // index to TU in master thermostat zone
     192             :         ThermostatCtrlType ThermostatPriority; // VRF priority control (1=LoadPriority, 2=ZonePriority, etc)
     193             :         int SchedPriorityPtr;                  // VRF priority control schedule pointer
     194             :         int ZoneTUListPtr;                     // index to zone terminal unit list
     195             :         bool HeatRecoveryUsed;                 // .TRUE. = heat recovery used
     196             :         Real64 VertPipeLngth;                  // vertical piping length (m)
     197             :         int PCFLengthCoolPtr;                  // piping correction factor for length in cooling mode curve index
     198             :         Real64 PCFHeightCool;                  // piping correction factor for height in cooling mode
     199             :         Real64 EquivPipeLngthCool;             // equivalent piping length for cooling
     200             :         Real64 PipingCorrectionCooling;        // piping correction factor for cooling
     201             :         int PCFLengthHeatPtr;                  // piping correction factor for length in heating mode curve index
     202             :         Real64 PCFHeightHeat;                  // piping correction factor for height in heating mode
     203             :         Real64 EquivPipeLngthHeat;             // equivalent piping length for heating
     204             :         Real64 PipingCorrectionHeating;        // piping correction factor for heating
     205             :         Real64 CCHeaterPower;                  // crankcase heater power per compressor (W)
     206             :         Real64 CompressorSizeRatio;            // ratio of min compressor size to total capacity
     207             :         int NumCompressors;                    // number of compressors in VRF condenser
     208             :         Real64 MaxOATCCHeater;                 // maximum outdoor air dry-bulb temp for crankcase heater operation (C)
     209             :         // begin variables used for Defrost
     210             :         int DefrostEIRPtr;                                // index to defrost EIR curve
     211             :         Real64 DefrostFraction;                           // defrost time period fraction (hr)
     212             :         StandardRatings::DefrostStrat DefrostStrategy;    // Type of defrost (reversecycle or resistive)
     213             :         StandardRatings::HPdefrostControl DefrostControl; // type of defrost control (timed or ondemand)
     214             :         Real64 DefrostCapacity;                           // capacity of resistive defrost heating element (W)
     215             :         Real64 DefrostPower;                              // power used during defrost (W)
     216             :         Real64 DefrostConsumption;                        // energy used during defrost (J)
     217             :         Real64 MaxOATDefrost;                             // maximum outdoor air dry-bulb temp for defrost operation (C)
     218             :         // end variables used for Defrost
     219             :         DataHeatBalance::RefrigCondenserType CondenserType; // condenser type, evap- or air-cooled
     220             :         int CondenserNodeNum;                               // condenser inlet node number
     221             :         bool SkipCondenserNodeNumCheck;                     // used to check for duplicate node names
     222             :         int CondenserOutletNodeNum;                         // condenser outlet node number
     223             :         Real64 WaterCondVolFlowRate;                        // water condenser volume flow rate (m3/s)
     224             :         Real64 EvapCondEffectiveness;                       // evaporative condenser effectiveness
     225             :         Real64 EvapCondAirVolFlowRate;                      // air volume flow rate through condenser (m3/s)
     226             :         Real64 EvapCondPumpPower;                           // evaporative condenser water pump power (W)
     227             :         int CoolCombRatioPTR;                               // index to cooling combination ratio curve pointer
     228             :         int HeatCombRatioPTR;                               // index to heating combination ratio curve pointer
     229             :         int OperatingMode;                                  // VRF Condenser operating mode, 0=off, 1=cooling, 2=heating, 3=HR
     230             :         Real64 ElecPower;                                   // VRF Condenser power (W)
     231             :         Real64 ElecCoolingPower;                            // VRF Condenser power in cooling mode (W)
     232             :         Real64 ElecHeatingPower;                            // VRF Condenser power in heating mode (W)
     233             :         Real64 CoolElecConsumption;                         // VRF Condenser cooling energy (J)
     234             :         Real64 HeatElecConsumption;                         // VRF Condenser heating energy (J)
     235             :         Real64 CrankCaseHeaterPower;                        // VRF Condenser crankcase heater power (W)
     236             :         Real64 CrankCaseHeaterElecConsumption;              // VRF Condenser crankcase heater energy (J)
     237             :         Real64 EvapCondPumpElecPower;                       // VRF Condenser evaporatively cooled condenser pump power (W)
     238             :         Real64 EvapCondPumpElecConsumption;                 // VRF Condenser evaporatively cooled condenser pump elec consumption (J)
     239             :         Real64 EvapWaterConsumpRate;                        // VRF Condenser evaporatively cooled condenser water consumption (m3/s)
     240             :         int HRMaxTempLimitIndex = 0;                        // Warning message recurring error index
     241             :         int CoolingMaxTempLimitIndex = 0;                   // Warning message recurring error index
     242             :         int HeatingMaxTempLimitIndex = 0;                   // Warning message recurring error index
     243             :         std::string FuelType;                               // Fuel type
     244             :         DataGlobalConstants::ResourceType FuelTypeNum;      // Fuel type number
     245             :         Real64 SUMultiplier;                                // exponential timer for mode changes
     246             :         Real64 TUCoolingLoad;                               // total TU cooling load for each VRF system
     247             :         Real64 TUHeatingLoad;                               // total TU heating load for each VRF system
     248             :         bool SwitchedMode;                                  // used to derate capacity/power when system changes operating mode
     249             :         // begin variables used for heat recovery mode
     250             :         Real64 OperatingCOP;            // Operating VRF heat pump COP (total TU capacity/total power)
     251             :         Real64 MinOATHeatRecovery;      // Minimum outdoor air temperature for heat recovery operation (C)
     252             :         Real64 MaxOATHeatRecovery;      // Maximum outdoor air temperature for heat recovery operation (C)
     253             :         int HRCAPFTCool;                // Index to cool capacity as a function of temperature curve for heat recovery
     254             :         Real64 HRCAPFTCoolConst;        // constant used if curve is blank
     255             :         Real64 HRInitialCoolCapFrac;    // Fractional cooling degradation at the start of heat recovery from cooling mode
     256             :         Real64 HRCoolCapTC;             // Time constant used to recover from intial degratation in cooling heat recovery
     257             :         int HREIRFTCool;                // Index to cool EIR as a function of temperature curve for heat recovery
     258             :         Real64 HREIRFTCoolConst;        // constant used if curve is blank
     259             :         Real64 HRInitialCoolEIRFrac;    // Fractional EIR degradation at the start of heat recovery from cooling mode
     260             :         Real64 HRCoolEIRTC;             // Time constant used to recover from intial degratation in cooling heat recovery
     261             :         int HRCAPFTHeat;                // Index to heat capacity as a function of temperature curve for heat recovery
     262             :         Real64 HRCAPFTHeatConst;        // constant used if curve is blank
     263             :         Real64 HRInitialHeatCapFrac;    // Fractional heating degradation at the start of heat recovery from heating mode
     264             :         Real64 HRHeatCapTC;             // Time constant used to recover from intial degratation in heating heat recovery
     265             :         int HREIRFTHeat;                // Index to heat EIR as a function of temperature curve for heat recovery
     266             :         Real64 HREIRFTHeatConst;        // constant used if curve is blank
     267             :         Real64 HRInitialHeatEIRFrac;    // Fractional EIR degradation at the start of heat recovery from heating mode
     268             :         Real64 HRHeatEIRTC;             // Time constant used to recover from intial degratation in heating heat recovery
     269             :         bool HRCoolingActive;           // heat recovery mode active in cooling mode
     270             :         bool HRHeatingActive;           // heat recovery mode active in heating mode
     271             :         bool ModeChange;                // tracks changes in operating mode
     272             :         bool HRModeChange;              // tracks changes in heat recovery operating mode
     273             :         Real64 HRTimer;                 // timer used to model changes in system performance as mode changes
     274             :         Real64 HRTime;                  // length of time system has been in same mode (hr)
     275             :         int EIRFTempCoolErrorIndex = 0; // warning message index for recurring warnings
     276             :         int EIRFTempHeatErrorIndex = 0; // warning message index for recurring warnings
     277             :         int DefrostHeatErrorIndex = 0;  // warning message index for recurring warnings
     278             :         // end variables used for heat recovery mode
     279             :         // begin variables for Water System interactions
     280             :         EvapWaterSupply EvapWaterSupplyMode; // where does water come from
     281             :         std::string EvapWaterSupplyName;     // name of water source e.g. water storage tank
     282             :         int EvapWaterSupTankID;
     283             :         int EvapWaterTankDemandARRID;
     284             :         std::string CondensateCollectName; // name of water source e.g. water storage tank
     285             :         int CondensateTankID;
     286             :         int CondensateTankSupplyARRID;
     287             :         Real64 CondensateVdot; // rate of water condensation from air stream [m3/s]
     288             :         Real64 CondensateVol;  // amount of water condensed from air stream [m3]
     289             :         // end variables for water system interactions
     290             :         // begin variables for Basin Heater interactions
     291             :         Real64 BasinHeaterPowerFTempDiff; // Basin heater capacity per degree C below setpoint (W/C)
     292             :         Real64 BasinHeaterSetPointTemp;   // setpoint temperature for basin heater operation (C)
     293             :         Real64 BasinHeaterPower;          // Basin heater power (W)
     294             :         Real64 BasinHeaterConsumption;    // Basin heater energy consumption (J)
     295             :         int BasinHeaterSchedulePtr;       // Pointer to basin heater schedule
     296             :         // end variables for Basin Heater interactions
     297             :         bool EMSOverrideHPOperatingMode;
     298             :         Real64 EMSValueForHPOperatingMode;
     299             :         int HPOperatingModeErrorIndex;
     300             :         Real64 VRFHeatRec;             // Heat Recovery heat reclaim power (W)
     301             :         Real64 VRFHeatEnergyRec;       // Heat Recovery heat reclain energy (J)
     302             :         int HeatCapFTErrorIndex = 0;   // warning message index
     303             :         int CoolCapFTErrorIndex = 0;   // warning message index
     304             :         int HeatEIRFPLRErrorIndex = 0; // warning message index
     305             :         int CoolEIRFPLRErrorIndex = 0; // warning message index
     306             :         // The following are for the Algorithm Type: VRF model based on physics, applicable for Fluid Temperature Control
     307             :         int AlgorithmIUCtrl;              // VRF indoor unit contrl algorithm, 1-High sensible, 2-Te/Tc constant
     308             :         Array1D<Real64> CompressorSpeed;  // compressor speed array [rps]
     309             :         Real64 CondensingTemp;            // VRV system outdoor unit condensing temperature [C]
     310             :         Real64 CondTempFixed;             // Inddor unit condensing temperature, fixed, for AlgorithmIUCtrl is 2-Te/Tc constant [C]
     311             :         Real64 CoffEvapCap;               // Evaporative Capacity Correction Factor
     312             :         Real64 CompActSpeed;              // Compressor speed [rps]
     313             :         Real64 CompMaxDeltaP;             // maximum compressor pressure rise [Pa]
     314             :         Real64 C1Te;                      // VRF Outdoor Unit Coefficient 1 to calculate Te,req [--]
     315             :         Real64 C2Te;                      // VRF Outdoor Unit Coefficient 2 to calculate Te,req [--]
     316             :         Real64 C3Te;                      // VRF Outdoor Unit Coefficient 3 to calculate Te,req [--]
     317             :         Real64 C1Tc;                      // VRF Outdoor Unit Coefficient 1 to calculate Tc,req [--]
     318             :         Real64 C2Tc;                      // VRF Outdoor Unit Coefficient 2 to calculate Tc,req [--]
     319             :         Real64 C3Tc;                      // VRF Outdoor Unit Coefficient 3 to calculate Tc,req [--]
     320             :         Real64 DiffOUTeTo;                // Difference between Outdoor Unit Te and OAT during Simultaneous Heating and Cooling operations
     321             :         Real64 EffCompInverter;           // Compressor Inverter Efficiency
     322             :         Real64 EvaporatingTemp;           // VRV system outdoor unit evaporating temperature [C]
     323             :         Real64 EvapTempFixed;             // Indoor unit evaporating temperature, fixed, for AlgorithmIUCtrl is 2-Te/Tc constant [C]
     324             :         Real64 HROUHexRatio;              // HR OU Heat Exchanger Capacity Ratio [--]
     325             :         Real64 IUEvaporatingTemp;         // VRV system indoor unit evaporating temperature, min among all indoor units [C]
     326             :         Real64 IUCondensingTemp;          // VRV system indoor unit condensing temperature, max among all indoor units [C]
     327             :         Real64 IUEvapTempLow;             // VRV system indoor unit evaporating temperature, lower bound[C]
     328             :         Real64 IUEvapTempHigh;            // VRV system indoor unit evaporating temperature, higher bound [C]
     329             :         Real64 IUCondTempLow;             // VRV system indoor unit condensing temperature, lower bound [C]
     330             :         Real64 IUCondTempHigh;            // VRV system indoor unit condensing temperature, higher bound [C]
     331             :         Real64 IUCondHeatRate;            // Indoor Unit Condensers Total Heat Release Rate, excluding piping loss  [W]
     332             :         Real64 IUEvapHeatRate;            // Outdoor Unit Evaporators Total Heat Extract Rate, excluding piping loss  [W]
     333             :         Real64 Ncomp;                     // compressor electric power [W]
     334             :         Real64 NcompCooling;              // compressor electric power at cooling mode [W]
     335             :         Real64 NcompHeating;              // compressor electric power at heating mode [W]
     336             :         Array1D_int OUCoolingCAPFT;       // index to outdoor unit cooling capacity function of temperature at different compressor speed
     337             :         Array1D_int OUCoolingPWRFT;       // index to outdoor unit cooling power function of temperature at different compressor speed
     338             :         Real64 OUEvapTempLow;             // VRV system outdoor unit evaporating temperature, lower bound[C]
     339             :         Real64 OUEvapTempHigh;            // VRV system outdoor unit evaporating temperature, higher bound [C]
     340             :         Real64 OUCondTempLow;             // VRV system outdoor unit condensing temperature, lower bound [C]
     341             :         Real64 OUCondTempHigh;            // VRV system outdoor unit condensing temperature, higher bound [C]
     342             :         Real64 OUAirFlowRate;             // Max condenser air flow rate [m3/s]
     343             :         Real64 OUAirFlowRatePerCapcity;   // Max condenser air flow rate per Evaporative Capacity [m3/s]
     344             :         Real64 OUCondHeatRate;            // Outdoor Unit Condenser Heat Release Rate, excluding piping loss [W]
     345             :         Real64 OUEvapHeatRate;            // Outdoor Unit Evaporator Heat Extract Rate, excluding piping loss  [W]
     346             :         Real64 OUFanPower;                // Outdoor unit fan power at real conditions[W]
     347             :         std::string RefrigerantName;      // Name of refrigerant, must match name in FluidName (see fluidpropertiesrefdata.idf)
     348             :         Real64 RatedEvapCapacity;         // Rated Evaporative Capacity [W]
     349             :         Real64 RatedHeatCapacity;         // Rated Heating Capacity [W]
     350             :         Real64 RatedCompPower;            // Rated Compressor Power [W]
     351             :         Real64 RatedCompPowerPerCapcity;  // Rated Compressor Power per Evaporative Capacity [W]
     352             :         Real64 RatedOUFanPower;           // Outdoor unit fan power at rated conditions [W]
     353             :         Real64 RatedOUFanPowerPerCapcity; // Rated outdoor unit fan power per Evaporative Capacity [W]
     354             :         Real64 RateBFOUEvap;              // Outdoor Unit Evaporator Rated Bypass Factor
     355             :         Real64 RateBFOUCond;              // Outdoor Unit Condenser Rated Bypass Factor
     356             :         Real64 RefPipDiaSuc;              // diameter of refrigerant pipe (suction gas) that links the outdoor unit to the indoor units [m]
     357             :         Real64 RefPipDiaDis;              // diameter of refrigerant pipe (discharge gas) that links the outdoor unit to the indoor units [m]
     358             :         Real64 RefPipLen;                 // length of refrigerant pipe that links the outdoor unit to the indoor units [m]
     359             :         Real64 RefPipEquLen;              // Equivalent length of refrigerant pipe for pressure drop calculations [m]
     360             :         Real64 RefPipHei;                 // height of refrigerant pipe that links the outdoor unit to the indoor units [m]
     361             :         Real64 RefPipInsThi;              // thickness of refrigerant pipe insulation [m]
     362             :         Real64 RefPipInsCon;              // thermal conductivity of refrigerant pipe insulation [W/mk]
     363             :         Real64 SH;                        // VRF outdoor unit superheating degrees [C]
     364             :         Real64 SC;                        // VRF outdoor unit subcooling degrees [C]
     365             :         Real64 SCHE;                      // Simultaneous Cooling and Heating Efficiency [C]
     366             :         Real64 SHLow;                     // VRF outdoor unit superheating degrees lower limit [C]
     367             :         Real64 SCLow;                     // VRF outdoor unit subcooling degrees lower limit [C]
     368             :         Real64 SHHigh;                    // VRF outdoor unit superheating degrees uppler limit [C]
     369             :         Real64 SCHigh;                    // VRF outdoor unit subcooling degrees uppler limit [C]
     370             :         Real64 VRFOperationSimPath;       // simulation path indicating the VRF operation mode [--]
     371             :         bool checkPlantCondTypeOneTime;
     372             : 
     373             :         // Default Constructor
     374          23 :         VRFCondenserEquipment()
     375          23 :             : VRFSystemTypeNum(0), VRFAlgorithmTypeNum(AlgorithmType::Invalid), VRFType(DataPlant::PlantEquipmentType::Invalid), SourcePlantLoc{},
     376             :               WaterCondenserDesignMassFlow(0.0), WaterCondenserMassFlow(0.0), QCondenser(0.0), QCondEnergy(0.0), CondenserSideOutletTemp(0.0),
     377             :               SchedPtr(-1), CoolingCapacity(0.0), TotalCoolingCapacity(0.0), CoolingCombinationRatio(1.0), VRFCondPLR(0.0), VRFCondRTF(0.0),
     378             :               VRFCondCyclingRatio(0.0), CondenserInletTemp(0.0), CoolingCOP(0.0), OperatingCoolingCOP(0.0), RatedCoolingPower(0.0),
     379             :               HeatingCapacity(0.0), HeatingCapacitySizeRatio(1.0), LockHeatingCapacity(false), TotalHeatingCapacity(0.0),
     380             :               HeatingCombinationRatio(1.0), HeatingCOP(0.0), OperatingHeatingCOP(0.0), RatedHeatingPower(0.0), MinOATCooling(0.0), MaxOATCooling(0.0),
     381             :               MinOATHeating(0.0), MaxOATHeating(0.0), CoolCapFT(0), CoolEIRFT(0), HeatCapFT(0), HeatEIRFT(0), CoolBoundaryCurvePtr(0),
     382             :               HeatBoundaryCurvePtr(0), EIRCoolBoundaryCurvePtr(0), CoolEIRFPLR1(0), CoolEIRFPLR2(0), CoolCapFTHi(0), CoolEIRFTHi(0), HeatCapFTHi(0),
     383             :               HeatEIRFTHi(0), EIRHeatBoundaryCurvePtr(0), HeatEIRFPLR1(0), HeatEIRFPLR2(0), CoolPLFFPLR(0), HeatPLFFPLR(0),
     384             :               HeatingPerformanceOATType(0), MinPLR(0.0), MasterZonePtr(0), MasterZoneTUIndex(0), ThermostatPriority(ThermostatCtrlType::Invalid),
     385             :               SchedPriorityPtr(0), ZoneTUListPtr(0), HeatRecoveryUsed(false), VertPipeLngth(0.0), PCFLengthCoolPtr(0), PCFHeightCool(0.0),
     386             :               EquivPipeLngthCool(0.0), PipingCorrectionCooling(1.0), PCFLengthHeatPtr(0), PCFHeightHeat(0.0), EquivPipeLngthHeat(0.0),
     387             :               PipingCorrectionHeating(1.0), CCHeaterPower(0.0), CompressorSizeRatio(0.0), NumCompressors(0), MaxOATCCHeater(0.0), DefrostEIRPtr(0),
     388             :               DefrostFraction(0.0), DefrostStrategy(StandardRatings::DefrostStrat::Invalid),
     389             :               DefrostControl(StandardRatings::HPdefrostControl::Invalid), DefrostCapacity(0.0), DefrostPower(0.0), DefrostConsumption(0.0),
     390             :               MaxOATDefrost(0.0), CondenserType(DataHeatBalance::RefrigCondenserType::Invalid), CondenserNodeNum(0), SkipCondenserNodeNumCheck(false),
     391             :               CondenserOutletNodeNum(0), WaterCondVolFlowRate(0.0), EvapCondEffectiveness(0.0), EvapCondAirVolFlowRate(0.0), EvapCondPumpPower(0.0),
     392             :               CoolCombRatioPTR(0), HeatCombRatioPTR(0), OperatingMode(0), ElecPower(0.0), ElecCoolingPower(0.0), ElecHeatingPower(0.0),
     393             :               CoolElecConsumption(0.0), HeatElecConsumption(0.0), CrankCaseHeaterPower(0.0), CrankCaseHeaterElecConsumption(0.0),
     394             :               EvapCondPumpElecPower(0.0), EvapCondPumpElecConsumption(0.0), EvapWaterConsumpRate(0.0),
     395             :               FuelTypeNum(DataGlobalConstants::ResourceType::None), SUMultiplier(0.0), TUCoolingLoad(0.0), TUHeatingLoad(0.0), SwitchedMode(false),
     396             :               OperatingCOP(0.0), MinOATHeatRecovery(0.0), MaxOATHeatRecovery(0.0), HRCAPFTCool(0), HRCAPFTCoolConst(0.9), HRInitialCoolCapFrac(0.5),
     397             :               HRCoolCapTC(0.15), HREIRFTCool(0), HREIRFTCoolConst(1.1), HRInitialCoolEIRFrac(1.0), HRCoolEIRTC(0.0), HRCAPFTHeat(0),
     398             :               HRCAPFTHeatConst(1.1), HRInitialHeatCapFrac(1.0), HRHeatCapTC(0.0), HREIRFTHeat(0), HREIRFTHeatConst(1.1), HRInitialHeatEIRFrac(1.0),
     399             :               HRHeatEIRTC(0.0), HRCoolingActive(false), HRHeatingActive(false), ModeChange(false), HRModeChange(false), HRTimer(0.0), HRTime(0.0),
     400             :               EvapWaterSupplyMode(EvapWaterSupply::FromMains), EvapWaterSupTankID(0), EvapWaterTankDemandARRID(0), CondensateTankID(0),
     401             :               CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0),
     402             :               BasinHeaterPower(0.0), BasinHeaterConsumption(0.0), BasinHeaterSchedulePtr(0), EMSOverrideHPOperatingMode(false),
     403             :               EMSValueForHPOperatingMode(0.0), HPOperatingModeErrorIndex(0), VRFHeatRec(0.0), VRFHeatEnergyRec(0.0), AlgorithmIUCtrl(1),
     404             :               CondensingTemp(44.0), CondTempFixed(0.0), CoffEvapCap(1.0), CompActSpeed(0.0), CompMaxDeltaP(0.0), C1Te(0.0), C2Te(0.0), C3Te(0.0),
     405             :               C1Tc(0.0), C2Tc(0.0), C3Tc(0.0), DiffOUTeTo(5), EffCompInverter(0.95), EvaporatingTemp(6.0), EvapTempFixed(0.0), HROUHexRatio(0.0),
     406             :               IUEvaporatingTemp(6.0), IUCondensingTemp(44.0), IUEvapTempLow(4.0), IUEvapTempHigh(15.0), IUCondTempLow(42.0), IUCondTempHigh(46.0),
     407             :               IUCondHeatRate(0.0), IUEvapHeatRate(0.0), Ncomp(0.0), NcompCooling(0.0), NcompHeating(0.0), OUEvapTempLow(-30.0), OUEvapTempHigh(20.0),
     408             :               OUCondTempLow(30.0), OUCondTempHigh(96.0), OUAirFlowRate(0.0), OUAirFlowRatePerCapcity(0.0), OUCondHeatRate(0.0), OUEvapHeatRate(0.0),
     409             :               OUFanPower(0.0), RatedEvapCapacity(40000.0), RatedHeatCapacity(0.0), RatedCompPower(14000.0), RatedCompPowerPerCapcity(0.35),
     410             :               RatedOUFanPower(0.0), RatedOUFanPowerPerCapcity(0.0), RateBFOUEvap(0.45581), RateBFOUCond(0.21900), RefPipDiaSuc(0.0),
     411             :               RefPipDiaDis(0.0), RefPipLen(0.0), RefPipEquLen(0.0), RefPipHei(0.0), RefPipInsThi(0.0), RefPipInsCon(0.0), SH(0.0), SC(0.0), SCHE(0.0),
     412          23 :               SHLow(0.0), SCLow(0.0), SHHigh(0.0), SCHigh(0.0), VRFOperationSimPath(0.0), checkPlantCondTypeOneTime(true)
     413             :         {
     414          23 :         }
     415             : 
     416             :         // Begin of Methods for New VRF Model: Fluid Temperature Control
     417             :         //******************************************************************************
     418             : 
     419             :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     420             : 
     421             :         void getDesignCapacities(
     422             :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     423             : 
     424             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     425             :                       const PlantLocation &calledFromLocation,
     426             :                       bool FirstHVACIteration,
     427             :                       Real64 &CurLoad,
     428             :                       bool RunFlag) override;
     429             : 
     430             :         static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
     431             : 
     432             :         void SizeVRFCondenser(EnergyPlusData &state);
     433             : 
     434             :         void CalcVRFCondenser_FluidTCtrl(EnergyPlusData &state);
     435             : 
     436             :         void CalcVRFIUTeTc_FluidTCtrl(EnergyPlusData &state);
     437             : 
     438             :         void VRFOU_TeTc(EnergyPlusData &state,
     439             :                         HXOpMode OperationMode, // Flag for hex operation
     440             :                         Real64 Q_coil,          // // OU coil heat release at cooling mode or heat extract at heating mode [W]
     441             :                         Real64 SHSC,            // SH at cooling or SC at heating [C]
     442             :                         Real64 m_air,           // OU coil air mass flow rate [kg/s]
     443             :                         Real64 T_coil_in,       // Temperature of air at OU coil inlet [C]
     444             :                         Real64 W_coil_in,       // Humidity ratio of air at OU coil inlet [kg/kg]
     445             :                         Real64 OutdoorPressure, // Outdoor air pressure (Pa)
     446             :                         Real64 &T_coil_surf,    // Air temperature at coil surface [C]
     447             :                         Real64 &TeTc            // VRF Tc at cooling mode, or Te at heating mode [C]
     448             :         );
     449             : 
     450             :         Real64 VRFOU_FlowRate(EnergyPlusData &state,
     451             :                               HXOpMode OperationMode, // Flag for hex operation
     452             :                               Real64 TeTc,            // VRF Tc at cooling mode, or Te at heating mode [C]
     453             :                               Real64 SHSC,            // SC for OU condenser or SH for OU evaporator [C]
     454             :                               Real64 Q_coil,          // absolute value of OU coil heat release or heat extract [W]
     455             :                               Real64 T_coil_in,       // Temperature of air at OU coil inlet [C]
     456             :                               Real64 W_coil_in        // Humidity ratio of air at OU coil inlet [kg/kg]
     457             :         ) const;
     458             : 
     459             :         Real64 VRFOU_Cap(EnergyPlusData &state,
     460             :                          HXOpMode OperationMode, // Flag for hex operation
     461             :                          Real64 TeTc,            // VRF Tc at cooling mode, or Te at heating mode [C]
     462             :                          Real64 SHSC,            // SC for OU condenser or SH for OU evaporator [C]
     463             :                          Real64 m_air,           // OU coil air mass flow rate [kg/s]
     464             :                          Real64 T_coil_in,       // Temperature of air at OU coil inlet [C]
     465             :                          Real64 W_coil_in        // Humidity ratio of air at OU coil inlet [kg/kg]
     466             :         );
     467             : 
     468             :         Real64 VRFOU_SCSH(EnergyPlusData &state,
     469             :                           HXOpMode OperationMode, // Mode 0 for running as evaporator, 1 for condenser
     470             :                           Real64 Q_coil,          // // OU coil heat release at cooling mode or heat extract at heating mode [W]
     471             :                           Real64 TeTc,            // VRF Tc at cooling mode, or Te at heating mode [C]
     472             :                           Real64 m_air,           // OU coil air mass flow rate [kg/s]
     473             :                           Real64 T_coil_in,       // Temperature of air at OU coil inlet [C]
     474             :                           Real64 W_coil_in,       // Humidity ratio of air at OU coil inlet [kg/kg]
     475             :                           Real64 OutdoorPressure  // Outdoor air pressure [Pa]
     476             :         ) const;
     477             : 
     478             :         Real64 VRFOU_CapModFactor(EnergyPlusData &state,
     479             :                                   Real64 h_comp_in_real, // Enthalpy of refrigerant at the compressor inlet at real conditions [kJ/kg]
     480             :                                   Real64 h_evap_in_real, // Enthalpy of refrigerant at the evaporator inlet at real conditions [kJ/kg]
     481             :                                   Real64 P_evap_real,    // Evaporative pressure at real conditions [Pa]
     482             :                                   Real64 T_comp_in_real, // Temperature of the refrigerant at the compressor inlet at real conditions [C]
     483             :                                   Real64 T_comp_in_rate, // Temperature of the refrigerant at the compressor inlet at rated conditions [C]
     484             :                                   Real64 T_cond_out_rate // Temperature of the refrigerant at the condenser outlet at rated conditions [C]
     485             :         );
     486             : 
     487             :         void VRFOU_TeModification(EnergyPlusData &state,
     488             :                                   Real64 Te_up,          // Upper bound of Te during iteration, i.e., Te before reduction [C]
     489             :                                   Real64 Te_low,         // Lower bound of Te during iteration, i.e., the given suction temperature Te' [C]
     490             :                                   Real64 Pipe_h_IU_in,   // Piping Loss Algorithm Parameter: enthalpy of IU at inlet [kJ/kg]
     491             :                                   Real64 OutdoorDryBulb, // outdoor dry-bulb temperature [C]
     492             :                                   Real64 &Te_update,     // Updated Te that can generate the required Tsuction [C]
     493             :                                   Real64 &Pe_update,     // Piping Loss Algorithm Parameter: evaporating pressure assumed for iterations [Pa]
     494             :                                   Real64 &Pipe_m_ref,    // Piping Loss Algorithm Parameter: Refrigerant mass flow rate [kg/s]
     495             :                                   Real64 &Pipe_h_IU_out, // Piping Loss Algorithm Parameter: enthalpy of IU at outlet [kJ/kg]
     496             :                                   Real64 &Pipe_SH_merged // Piping Loss Algorithm Parameter: Average SH after the indoor units [C]
     497             :         );
     498             : 
     499             :         void VRFOU_CalcCompC(EnergyPlusData &state,
     500             :                              Real64 TU_load,            // Indoor unit cooling load [W]
     501             :                              Real64 T_suction,          // Compressor suction temperature Te' [C]
     502             :                              Real64 T_discharge,        // Compressor discharge temperature Tc' [C]
     503             :                              Real64 P_suction,          // Compressor suction pressure Pe' [Pa]
     504             :                              Real64 Pipe_T_comp_in,     // Refrigerant temperature at compressor inlet (after piping loss) [C]
     505             :                              Real64 Pipe_h_comp_in,     // Enthalpy after piping loss (compressor inlet) [kJ/kg]
     506             :                              Real64 Pipe_h_IU_in,       // Enthalpy of IU at inlet [kJ/kg]
     507             :                              Real64 Pipe_Q,             // Piping Loss Algorithm Parameter: Heat loss [W]
     508             :                              Real64 MaxOutdoorUnitTc,   // The maximum temperature that Tc can be at heating mode [C]
     509             :                              Real64 &OUCondHeatRelease, // Condenser heat release (cooling mode) [W]
     510             :                              Real64 &CompSpdActual,     // Actual compressor running speed [rps]
     511             :                              Real64 &Ncomp              // Compressor power [W]
     512             :         );
     513             : 
     514             :         void
     515             :         VRFOU_CalcCompH(EnergyPlusData &state,
     516             :                         Real64 TU_load,            // Indoor unit cooling load [W]
     517             :                         Real64 T_suction,          // Compressor suction temperature Te' [C]
     518             :                         Real64 T_discharge,        // Compressor discharge temperature Tc' [C]
     519             :                         Real64 Pipe_h_out_ave,     // Average Enthalpy of the refrigerant leaving IUs [kJ/kg]
     520             :                         Real64 IUMaxCondTemp,      // VRV IU condensing temperature, max among all indoor units [C]
     521             :                         Real64 MinOutdoorUnitTe,   // The minimum temperature that Te can be at cooling mode (only used for calculating Min capacity)
     522             :                         Real64 Tfs,                // Temperature of the air at the coil surface [C]]
     523             :                         Real64 Pipe_Q,             // Piping Loss Algorithm Parameter: Heat loss [W]
     524             :                         Real64 &OUEvapHeatExtract, // Condenser heat release (cooling mode) [W]
     525             :                         Real64 &CompSpdActual,     // Actual compressor running speed [rps]
     526             :                         Real64 &Ncomp              // Compressor power [W]
     527             :         );
     528             : 
     529             :         void VRFHR_OU_HR_Mode(EnergyPlusData &state,
     530             :                               Real64 h_IU_evap_in,   // enthalpy of IU evaporator at inlet [kJ/kg]
     531             :                               Real64 h_comp_out,     // enthalpy of refrigerant at compressor outlet [kJ/kg]
     532             :                               Real64 Q_c_TU_PL,      // IU evaporator load, including piping loss [W]
     533             :                               Real64 Q_h_TU_PL,      // IU condenser load, including piping loss [W]
     534             :                               Real64 Tdischarge,     // VRF Compressor discharge refrigerant temperature [C]
     535             :                               Real64 &Tsuction,      // VRF compressor suction refrigerant temperature [C]
     536             :                               Real64 &Te_update,     // updated evaporating temperature, only updated when Tsuction is updated [C]
     537             :                               Real64 &h_comp_in,     // enthalpy of refrigerant at compressor inlet [kJ/kg]
     538             :                               Real64 &h_IU_PLc_out,  // enthalpy of refrigerant at the outlet of IU evaporator side main pipe [kJ/kg]
     539             :                               Real64 &Pipe_Q_c,      // IU evaporator side piping loss [W]
     540             :                               Real64 &Q_c_OU,        // OU evaporator load [W]
     541             :                               Real64 &Q_h_OU,        // OU condenser load [W]
     542             :                               Real64 &m_ref_IU_evap, // mass flow rate of Refrigerant through IU evaporators [kg/s]
     543             :                               Real64 &m_ref_OU_evap, // mass flow rate of Refrigerant through OU evaporator [kg/s]
     544             :                               Real64 &m_ref_OU_cond, // mass flow rate of Refrigerant through OU condenser [kg/s]
     545             :                               Real64 &N_fan_OU,      // outdoor unit fan power [W]
     546             :                               Real64 &CompSpdActual, // Actual compressor running speed [rps]
     547             :                               Real64 &Ncomp          // compressor power [W]
     548             :         );
     549             : 
     550             :         void VRFOU_CompSpd(EnergyPlusData &state,
     551             :                            Real64 Q_req,         // Required capacity [W]
     552             :                            HXOpMode Q_type,      // Required capacity type: 0 for evaporator, 1 for condenser
     553             :                            Real64 T_suction,     // Compressor suction temperature Te' [C]
     554             :                            Real64 T_discharge,   // Compressor discharge temperature Tc' [C]
     555             :                            Real64 h_IU_evap_in,  // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg]
     556             :                            Real64 h_comp_in,     // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg]
     557             :                            Real64 &CompSpdActual // Actual compressor running speed [rps]
     558             :         );
     559             : 
     560             :         void VRFOU_CompCap(EnergyPlusData &state,
     561             :                            int CompSpdActual,   // Given compressor speed
     562             :                            Real64 T_suction,    // Compressor suction temperature Te' [C]
     563             :                            Real64 T_discharge,  // Compressor discharge temperature Tc' [C]
     564             :                            Real64 h_IU_evap_in, // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg]
     565             :                            Real64 h_comp_in,    // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg]
     566             :                            Real64 &Q_c_tot,     // Compressor evaporative capacity [W]
     567             :                            Real64 &Ncomp        // Compressor power [W]
     568             :         );
     569             : 
     570             :         void VRFOU_PipeLossC(EnergyPlusData &state,
     571             :                              Real64 Pipe_m_ref,     // Refrigerant mass flow rate [kg/s]
     572             :                              Real64 Pevap,          // VRF evaporating pressure [Pa]
     573             :                              Real64 Pipe_h_IU_out,  // Enthalpy of IU at outlet [kJ/kg]
     574             :                              Real64 Pipe_SH_merged, // Average super heating degrees after the indoor units [C]
     575             :                              Real64 OutdoorDryBulb, // outdoor dry-bulb temperature (C)
     576             :                              Real64 &Pipe_Q,        // unit part load ratio
     577             :                              Real64 &Pipe_DeltP,    // ratio of compressor ON airflow to AVERAGE airflow over timestep
     578             :                              Real64 &Pipe_h_comp_in // Piping Loss Algorithm Parameter: Enthalpy after piping loss (compressor inlet) [kJ/kg]
     579             :         );
     580             : 
     581             :         void VRFOU_PipeLossH(EnergyPlusData &state,
     582             :                              Real64 Pipe_m_ref,      // Refrigerant mass flow rate [kg/s]
     583             :                              Real64 Pcond,           // VRF condensing pressure [Pa]
     584             :                              Real64 Pipe_h_IU_in,    // Enthalpy of IU at outlet [kJ/kg]
     585             :                              Real64 OutdoorDryBulb,  // outdoor dry-bulb temperature (C)
     586             :                              Real64 &Pipe_Q,         // unit part load ratio
     587             :                              Real64 &Pipe_DeltP,     // ratio of compressor ON airflow to AVERAGE airflow over timestep
     588             :                              Real64 &Pipe_h_comp_out // Piping Loss Algorithm Parameter: Enthalpy before piping loss (compressor outlet) [kJ/kg]
     589             :         ) const;
     590             : 
     591             :         void oneTimeInit(EnergyPlusData &state) override;
     592             : 
     593             :         void oneTimeInit_new(EnergyPlusData &state) override;
     594             :     };
     595             : 
     596          35 :     struct TerminalUnitListData
     597             :     {
     598             :         // Members
     599             :         std::string Name;                     // Name of the VRF Terminal Unit List
     600             :         int NumTUInList;                      // Number of VRF Terminal Units in List
     601             :         bool reset_isSimulatedFlags;          // used to align simulate flags with order of each TU in simulation
     602             :         Array1D_int ZoneTUPtr;                // index to VRF Terminal Unit
     603             :         Array1D_string ZoneTUName;            // Name of the VRF Terminal Unit
     604             :         Array1D_bool IsSimulated;             // TRUE if TU has been simulated
     605             :         Array1D<Real64> TotalCoolLoad;        // Total zone cooling coil load met by TU
     606             :         Array1D<Real64> TotalHeatLoad;        // Total zone heating coil load met by TU
     607             :         Array1D_bool CoolingCoilPresent;      // FALSE if coil not present
     608             :         Array1D_bool HeatingCoilPresent;      // FALSE if coil not present
     609             :         Array1D_bool SuppHeatingCoilPresent;  // FALSE if supplemental heating coil not present
     610             :         Array1D_bool TerminalUnitNotSizedYet; // TRUE if terminal unit not sized
     611             :         Array1D_bool HRHeatRequest;           // defines a heating load on VRFTerminalUnits when QZnReq < 0
     612             :         Array1D_bool HRCoolRequest;           // defines a cooling load on VRFTerminalUnits when QZnReq > 0
     613             :         Array1D_bool CoolingCoilAvailable;    // cooling coil availability scheduled on
     614             :         Array1D_bool HeatingCoilAvailable;    // cooling coil availability scheduled on
     615             :         Array1D_int CoolingCoilAvailSchPtr;   // cooling coil availability schedule index
     616             :         Array1D_int HeatingCoilAvailSchPtr;   // heating coil availability schedule index
     617             : 
     618             :         // Default Constructor
     619          23 :         TerminalUnitListData() : NumTUInList(0), reset_isSimulatedFlags(true)
     620             :         {
     621          23 :         }
     622             :     };
     623             : 
     624         123 :     struct VRFTerminalUnitEquipment
     625             :     {
     626             :         // Members
     627             :         std::string Name;                    // Name of the VRF Terminal Unit
     628             :         int VRFTUType_Num;                   // DataHVACGlobals VRF Terminal Unit type
     629             :         int SchedPtr;                        // Pointer to the correct schedule
     630             :         int VRFSysNum;                       // index to VRF Condenser
     631             :         int TUListIndex;                     // index to VRF Terminal Unit List
     632             :         int IndexToTUInTUList;               // index to TU in VRF Terminal Unit List
     633             :         int ZoneNum;                         // index to zone where VRF Terminal Unit resides
     634             :         int ZoneAirNode;                     // zone air node number
     635             :         int VRFTUInletNodeNum;               // VRF Terminal Unit inlet node number
     636             :         int VRFTUOutletNodeNum;              // VRF Terminal Unit outlet node number
     637             :         int VRFTUOAMixerOANodeNum;           // OA node number for this TU's OA mixer
     638             :         int VRFTUOAMixerRelNodeNum;          // Relief node number for this TU's OA mixer
     639             :         int VRFTUOAMixerRetNodeNum;          // Return node number for this TU's OA mixer
     640             :         int VRFTUOAMixerMixedNodeNum;        // Mixed node number for this TU's OA mixer
     641             :         Real64 MaxCoolAirVolFlow;            // supply air volumetric flow rate during cooling operation [m3/s]
     642             :         Real64 MaxHeatAirVolFlow;            // supply air volumetric flow rate during heating operation [m3/s]
     643             :         Real64 MaxNoCoolAirVolFlow;          // supply air volumetric flow rate when no cooling [m3/s]
     644             :         Real64 MaxNoHeatAirVolFlow;          // supply air volumetric flow rate when no heating [m3/s]
     645             :         Real64 MaxCoolAirMassFlow;           // supply air mass flow rate during cooling operation [kg/s]
     646             :         Real64 MaxHeatAirMassFlow;           // supply air mass flow rate during heating operation [kg/s]
     647             :         Real64 MaxNoCoolAirMassFlow;         // supply air mass flow rate when no cooling [kg/s]
     648             :         Real64 MaxNoHeatAirMassFlow;         // supply air mass flow rate when no heating [kg/s]
     649             :         Real64 CoolOutAirVolFlow;            // OA volumetric flow rate during cooling operation [m3/s]
     650             :         Real64 HeatOutAirVolFlow;            // OA volumetric flow rate during heating operation [m3/s]
     651             :         Real64 NoCoolHeatOutAirVolFlow;      // OA volumetric flow rate when no cooling or heating [m3/s]
     652             :         Real64 CoolOutAirMassFlow;           // OA mass flow rate during cooling operation [kg/s]
     653             :         Real64 HeatOutAirMassFlow;           // OA mass flow rate during heating operation [kg/s]
     654             :         Real64 NoCoolHeatOutAirMassFlow;     // OA mass flow rate when no cooling or heating [kg/s]
     655             :         Real64 MinOperatingPLR;              // minimum part-load ratio for operating of fan/coil
     656             :         Real64 SuppHeatCoilFluidMaxFlow;     // supplemental heating coil fluid (hot water or steam) maximum flow rate [kg/s]
     657             :         Real64 DesignSuppHeatingCapacity;    // supplemental heating coil design capacity  [W]
     658             :         Real64 MaxSATFromSuppHeatCoil;       // maximum supply air temperature from supplemental heating coil [C]
     659             :         Real64 MaxOATSuppHeatingCoil;        // maximum outdoor dry-bulb temperature for supplemental heating coil [C]
     660             :         Real64 SuppHeatPartLoadRatio;        // supplemental heating coil part load ratio
     661             :         Real64 SuppHeatingCoilLoad;          // supplemental heating coil heating load
     662             :         int fanType_Num;                     // index to fan type
     663             :         int FanOpModeSchedPtr;               // Pointer to the correct fan operating mode schedule
     664             :         int FanAvailSchedPtr;                // Pointer to the correct fan availability schedule
     665             :         int FanIndex;                        // Index to fan object
     666             :         Real64 FanPower;                     // power reported by fan component
     667             :         int OpMode;                          // operation mode: 1 = cycling fan, cycling coil 2 = constant fan, cycling coil
     668             :         int FanPlace;                        // fan placement; 1=blow through, 2=draw through
     669             :         Real64 ActualFanVolFlowRate;         // volumetric flow rate from fan object
     670             :         std::string SuppHeatCoilType;        // type of supplemental heating coil
     671             :         std::string SuppHeatCoilName;        // name of supplemental heating coil
     672             :         std::string OAMixerName;             // name of outside air mixer
     673             :         int OAMixerIndex;                    // index to outside air mixer
     674             :         bool OAMixerUsed;                    // true if OA Mixer object is used
     675             :         int CoolCoilIndex;                   // index to terminal unit cooling coil
     676             :         int HeatCoilIndex;                   // index to terminal unit heating coil
     677             :         int SuppHeatCoilIndex;               // index to terminal unit supplemental heating coil
     678             :         int DXCoolCoilType_Num;              // type of VRF cooling coil
     679             :         int DXHeatCoilType_Num;              // type of VRF heating coil
     680             :         int SuppHeatCoilType_Num;            // type of VRF supplemental heating coil
     681             :         Real64 ParasiticElec;                // parasitic electric for VRF terminal unit
     682             :         Real64 ParasiticOffElec;             // parasitic electric for VRF terminal unit when off
     683             :         Real64 HeatingSpeedRatio;            // Fan speed ratio in heating mode
     684             :         Real64 NoHeatingSpeedRatio;          // Fan speed ratio when no heating
     685             :         Real64 HeatingCapacitySizeRatio;     // Ratio of heating to cooling when autosizing
     686             :         Real64 CoolingSpeedRatio;            // Fan speed ratio in cooling mode
     687             :         Real64 NoCoolingSpeedRatio;          // Fan speed ratio when no cooling
     688             :         Real64 ParasiticCoolElecPower;       // Terminal unit cooling parasitic electric power [W]
     689             :         Real64 ParasiticHeatElecPower;       // Terminal unit heating parasitic electric power [W]
     690             :         Real64 ParasiticElecCoolConsumption; // Terminal unit parasitic electric consumption in cooling [J]
     691             :         Real64 ParasiticElecHeatConsumption; // Terminal unit parasitic electric consumption in heating [J]
     692             :         bool CoolingCoilPresent;             // FALSE if coil not present
     693             :         bool HeatingCoilPresent;             // FALSE if coil not present
     694             :         bool SuppHeatingCoilPresent;         // FALSE if coil not present
     695             :         std::string AvailManagerListName;    // Name of an availability manager list object
     696             :         int AvailStatus;
     697             :         Real64 TerminalUnitSensibleRate;    // sensible cooling/heating rate of VRF terminal unit (W)
     698             :         Real64 TerminalUnitLatentRate;      // latent dehumidification/humidification rate of VRF terminal unit (W)
     699             :         Real64 TotalCoolingRate;            // report variable for total cooling rate (W)
     700             :         Real64 TotalHeatingRate;            // report variable for total heating rate (W)
     701             :         Real64 SensibleCoolingRate;         // report variable for sensible cooling rate (W)
     702             :         Real64 SensibleHeatingRate;         // report variable for sensible heating rate (W)
     703             :         Real64 LatentCoolingRate;           // report variable for latent cooling rate (W)
     704             :         Real64 LatentHeatingRate;           // report variable for latent heating rate (W)
     705             :         Real64 TotalCoolingEnergy;          // report variable for total cooling energy (J)
     706             :         Real64 TotalHeatingEnergy;          // report variable for total heating energy (J)
     707             :         Real64 SensibleCoolingEnergy;       // report variable for sensible cooling energy (J)
     708             :         Real64 SensibleHeatingEnergy;       // report variable for sensible heating energy (J)
     709             :         Real64 LatentCoolingEnergy;         // report variable for latent cooling energy (J)
     710             :         Real64 LatentHeatingEnergy;         // report variable for latent heating energy (J)
     711             :         bool EMSOverridePartLoadFrac;       // User defined EMS function
     712             :         Real64 EMSValueForPartLoadFrac;     // user defined value for EMS function
     713             :         int IterLimitExceeded;              // index used for warning messages
     714             :         int FirstIterfailed;                // index used for warning messages
     715             :         int HVACSizingIndex;                // index of a HVACSizing object for a VRF terminal
     716             :         bool ATMixerExists;                 // True if there is an ATMixer
     717             :         std::string ATMixerName;            // name of air terminal mixer
     718             :         int ATMixerIndex;                   // index to the air terminal mixer
     719             :         int ATMixerType;                    // 1 = inlet side mixer, 2 = supply side mixer
     720             :         int ATMixerPriNode;                 // primary inlet air node number for the air terminal mixer
     721             :         int ATMixerSecNode;                 // secondary air inlet node number for the air terminal mixer
     722             :         int ATMixerOutNode;                 // outlet air node number for the air terminal mixer
     723             :         int SuppHeatCoilAirInletNode;       // supplemental heating coil air inlet node
     724             :         int SuppHeatCoilAirOutletNode;      // supplemental heating coil air outlet node
     725             :         int SuppHeatCoilFluidInletNode;     // supplemental heating coil fluid inlet node
     726             :         int SuppHeatCoilFluidOutletNode;    // supplemental heating coil fluid outlet node
     727             :         bool firstPass;                     // used to reset global sizing data
     728             :         PlantLocation SuppHeatCoilPlantLoc; // supplemental heating coil plant component index
     729             :         Real64 coilInNodeT;                 // coil inlet node temp at full flow (C)
     730             :         Real64 coilInNodeW;                 // coil inlet node humidity ratio at full flow (kg/kg)
     731             :         int fanInletNode;                   // fan inlet node index
     732             :         int fanOutletNode;                  // fan outlet node index
     733             :         bool MySuppCoilPlantScanFlag;       // flag used to initialize plant comp for water and steam heating coils
     734             :         int airLoopNum;                     // index to air loop
     735             :         bool isInOASys;                     // true if TU is configured in outside air system
     736             :         bool isInAirLoop;                   // true if TU is configured in an air loop
     737             :         bool isInZone;                      // true if TU is configured as zone equipment
     738             :         bool isSetPointControlled;          // TU is controlled via setpoint instead of the standard load control
     739             :         bool coolSPActive;                  // set point controlled cooling coil active (needs to operate)
     740             :         bool heatSPActive;                  // set point controlled heating coil active (needs to operate)
     741             :         Real64 coolLoadToSP;                // load to set point in cooling mode
     742             :         Real64 heatLoadToSP;                // load to set point in heating mode
     743             :         Real64 coilTempSetPoint;            // coil control temperature
     744             :         Real64 suppTempSetPoint;            // supplemental heating coil control temperature
     745             :         Real64 controlZoneMassFlowFrac;     // ratio of control zone air mass flow rate to total zone air mass flow rate
     746             :         int zoneSequenceCoolingNum;         // zone equipment cooling sequence
     747             :         int zoneSequenceHeatingNum;         // zone equipment heating sequence
     748             :         int coolCoilAirInNode;              // cooling coil air inlet node number
     749             :         int coolCoilAirOutNode;             // cooling coil air outlet node number
     750             :         int heatCoilAirInNode;              // heating coil air inlet node number
     751             :         int heatCoilAirOutNode;             // heating coil air outlet node number
     752             :         // Default Constructor
     753          67 :         VRFTerminalUnitEquipment()
     754          67 :             : VRFTUType_Num(0), SchedPtr(-1), VRFSysNum(0), TUListIndex(0), IndexToTUInTUList(0), ZoneNum(0), ZoneAirNode(0), VRFTUInletNodeNum(0),
     755             :               VRFTUOutletNodeNum(0), VRFTUOAMixerOANodeNum(0), VRFTUOAMixerRelNodeNum(0), VRFTUOAMixerRetNodeNum(0), VRFTUOAMixerMixedNodeNum(0),
     756             :               MaxCoolAirVolFlow(0.0), MaxHeatAirVolFlow(0.0), MaxNoCoolAirVolFlow(0.0), MaxNoHeatAirVolFlow(0.0), MaxCoolAirMassFlow(0.0),
     757             :               MaxHeatAirMassFlow(0.0), MaxNoCoolAirMassFlow(0.0), MaxNoHeatAirMassFlow(0.0), CoolOutAirVolFlow(0.0), HeatOutAirVolFlow(0.0),
     758             :               NoCoolHeatOutAirVolFlow(0.0), CoolOutAirMassFlow(0.0), HeatOutAirMassFlow(0.0), NoCoolHeatOutAirMassFlow(0.0), MinOperatingPLR(1.0E-20),
     759             :               SuppHeatCoilFluidMaxFlow(0.0), DesignSuppHeatingCapacity(0.0), MaxSATFromSuppHeatCoil(0.0), MaxOATSuppHeatingCoil(0.0),
     760             :               SuppHeatPartLoadRatio(0.0), SuppHeatingCoilLoad(0.0), fanType_Num(0), FanOpModeSchedPtr(0), FanAvailSchedPtr(-1), FanIndex(0),
     761             :               FanPower(0.0), OpMode(0), FanPlace(0), ActualFanVolFlowRate(0.0), OAMixerIndex(0), OAMixerUsed(false), CoolCoilIndex(0),
     762             :               HeatCoilIndex(0), SuppHeatCoilIndex(0), DXCoolCoilType_Num(0), DXHeatCoilType_Num(0), SuppHeatCoilType_Num(0), ParasiticElec(0.0),
     763             :               ParasiticOffElec(0.0), HeatingSpeedRatio(1.0), NoHeatingSpeedRatio(0.0), HeatingCapacitySizeRatio(1.0), CoolingSpeedRatio(1.0),
     764             :               NoCoolingSpeedRatio(1.0), ParasiticCoolElecPower(0.0), ParasiticHeatElecPower(0.0), ParasiticElecCoolConsumption(0.0),
     765             :               ParasiticElecHeatConsumption(0.0), CoolingCoilPresent(true), HeatingCoilPresent(true), SuppHeatingCoilPresent(false), AvailStatus(0),
     766             :               TerminalUnitSensibleRate(0.0), TerminalUnitLatentRate(0.0), TotalCoolingRate(0.0), TotalHeatingRate(0.0), SensibleCoolingRate(0.0),
     767             :               SensibleHeatingRate(0.0), LatentCoolingRate(0.0), LatentHeatingRate(0.0), TotalCoolingEnergy(0.0), TotalHeatingEnergy(0.0),
     768             :               SensibleCoolingEnergy(0.0), SensibleHeatingEnergy(0.0), LatentCoolingEnergy(0.0), LatentHeatingEnergy(0.0),
     769             :               EMSOverridePartLoadFrac(false), EMSValueForPartLoadFrac(0.0), IterLimitExceeded(0), FirstIterfailed(0), HVACSizingIndex(0),
     770             :               ATMixerExists(false), ATMixerIndex(0), ATMixerType(0), ATMixerPriNode(0), ATMixerSecNode(0), ATMixerOutNode(0),
     771             :               SuppHeatCoilAirInletNode(0), SuppHeatCoilAirOutletNode(0), SuppHeatCoilFluidInletNode(0), SuppHeatCoilFluidOutletNode(0),
     772             :               firstPass(true), SuppHeatCoilPlantLoc{}, coilInNodeT(0.0), coilInNodeW(0.0), fanInletNode(0), fanOutletNode(0),
     773             :               MySuppCoilPlantScanFlag(true), airLoopNum(0), isInOASys(false), isInAirLoop(false), isInZone(false), isSetPointControlled(false),
     774             :               coolSPActive(false), heatSPActive(false), coolLoadToSP(0.0), heatLoadToSP(0.0), coilTempSetPoint(0.0), suppTempSetPoint(0.0),
     775             :               controlZoneMassFlowFrac(1.0), zoneSequenceCoolingNum(0), zoneSequenceHeatingNum(0), coolCoilAirInNode(0), coolCoilAirOutNode(0),
     776          67 :               heatCoilAirInNode(0), heatCoilAirOutNode(0)
     777             :         {
     778          67 :         }
     779             : 
     780             :         // Methods for New VRF Model: Fluid Temperature Control
     781             :         //******************************************************************************
     782             :         // Note: the argument VRFTUNum should be removed later in the deeper OO re-factor. Now this argument may be used by other functions that are
     783             :         // not member functions of this class.
     784             : 
     785             :         void CalcVRFIUVariableTeTc(EnergyPlusData &state,
     786             :                                    Real64 &EvapTemp, // evaporating temperature
     787             :                                    Real64 &CondTemp  // condensing temperature
     788             :         );
     789             : 
     790             :         void ControlVRF_FluidTCtrl(EnergyPlusData &state,
     791             :                                    int VRFTUNum,              // Index to VRF terminal unit
     792             :                                    Real64 QZnReq,             // Index to zone number
     793             :                                    bool FirstHVACIteration,   // flag for 1st HVAC iteration in the time step
     794             :                                    Real64 &PartLoadRatio,     // unit part load ratio
     795             :                                    Real64 &OnOffAirFlowRatio, // ratio of compressor ON airflow to AVERAGE airflow over timestep
     796             :                                    Real64 &SuppHeatCoilLoad   // supplemental heating coil load (W)
     797             :         );
     798             : 
     799             :         void CalcVRF_FluidTCtrl(EnergyPlusData &state,
     800             :                                 int VRFTUNum,                          // Index to VRF terminal unit
     801             :                                 bool FirstHVACIteration,               // flag for 1st HVAC iteration in the time step
     802             :                                 Real64 PartLoadRatio,                  // compressor part load fraction
     803             :                                 Real64 &LoadMet,                       // load met by unit (W)
     804             :                                 Real64 &OnOffAirFlowRatio,             // ratio of ON air flow to average air flow
     805             :                                 Real64 &SuppHeatCoilLoad,              // supplemental heating coil load (W)
     806             :                                 Optional<Real64> LatOutputProvided = _ // delivered latent capacity (W)
     807             :         );
     808             : 
     809             :         Real64 CalVRFTUAirFlowRate_FluidTCtrl(EnergyPlusData &state,
     810             :                                               int VRFTUNum,           // Index to VRF terminal unit
     811             :                                               Real64 PartLoadRatio,   // part load ratio of the coil
     812             :                                               bool FirstHVACIteration // FirstHVACIteration flag
     813             :         );
     814             : 
     815             :         // Methods for cruve based VRF Model
     816             :         //******************************************************************************
     817             :         void ControlVRF(EnergyPlusData &state,
     818             :                         int VRFTUNum,              // Index to VRF terminal unit
     819             :                         Real64 QZnReq,             // Index to zone number
     820             :                         bool FirstHVACIteration,   // flag for 1st HVAC iteration in the time step
     821             :                         Real64 &PartLoadRatio,     // unit part load ratio
     822             :                         Real64 &OnOffAirFlowRatio, // ratio of compressor ON airflow to AVERAGE airflow over timestep
     823             :                         Real64 &SuppHeatCoilLoad   // supplemental heating coil load (W)
     824             :         );
     825             : 
     826             :         void ControlVRFToLoad(EnergyPlusData &state,
     827             :                               int const VRFTUNum,            // Index to VRF terminal unit
     828             :                               Real64 const QZnReq,           // Index to zone number
     829             :                               bool const FirstHVACIteration, // flag for 1st HVAC iteration in the time step
     830             :                               Real64 &PartLoadRatio,         // unit part load ratio
     831             :                               Real64 &OnOffAirFlowRatio,     // ratio of compressor ON airflow to AVERAGE airflow over timestep
     832             :                               Real64 &SuppHeatCoilLoad       // supplemental heating coil load (W)
     833             :         );
     834             : 
     835             :         void CalcVRF(EnergyPlusData &state,
     836             :                      int const VRFTUNum,                    // Unit index in VRF terminal unit array
     837             :                      bool const FirstHVACIteration,         // flag for 1st HVAC iteration in the time step
     838             :                      Real64 const PartLoadRatio,            // compressor part load fraction
     839             :                      Real64 &LoadMet,                       // load met by unit (W)
     840             :                      Real64 &OnOffAirFlowRatio,             // ratio of ON air flow to average air flow
     841             :                      Real64 &SuppHeatCoilLoad,              // supplemental heating coil load (W)
     842             :                      Optional<Real64> LatOutputProvided = _ // delivered latent capacity (W)
     843             :         );
     844             : 
     845             :         // Methods for curve based and refrigerant flow control based models
     846             :         //******************************************************************************
     847             :         void CalcVRFSuppHeatingCoil(EnergyPlusData &state,
     848             :                                     int VRFTUNum,            // index of vrf terminal unit
     849             :                                     bool FirstHVACIteration, // True when first HVAC iteration
     850             :                                     Real64 PartLoadRatio,    // coil operating part-load ratio
     851             :                                     Real64 &SuppCoilLoad     // adjusted supp coil load when outlet temp exceeds max (W)
     852             :         );
     853             : 
     854             :         static Real64 HotWaterHeatingCoilResidual(EnergyPlusData &state,
     855             :                                                   Real64 PartLoadFrac,           // water heating coil part-load ratio
     856             :                                                   std::vector<Real64> const &Par // par(1) = VRF TU Numberindex to current VRF terminal unit
     857             :         );
     858             : 
     859             :         static Real64
     860             :         HeatingCoilCapacityLimit(EnergyPlusData &state,
     861             :                                  Real64 const HeatCoilAirInletNode, // supplemental heating coil air inlet node
     862             :                                  Real64 const HeatCoilMaxSATAllowed // supplemental heating coil maximum supply air temperature allowed [C]
     863             :         );
     864             :     };
     865             : 
     866         123 :     struct VRFTUNumericFieldData
     867             :     {
     868             :         // Members
     869             :         Array1D_string FieldNames;
     870             : 
     871             :         // Default Constructor
     872          56 :         VRFTUNumericFieldData() = default;
     873             :     };
     874             : 
     875             :     // Functions
     876             : 
     877             :     void SimulateVRF(EnergyPlusData &state,
     878             :                      std::string_view CompName,
     879             :                      bool const FirstHVACIteration,
     880             :                      int const ZoneNum,
     881             :                      int &CompIndex,
     882             :                      bool &HeatingActive,
     883             :                      bool &CoolingActive,
     884             :                      int const OAUnitNum,         // If the system is an equipment of OutdoorAirUnit
     885             :                      Real64 const OAUCoilOutTemp, // the coil inlet temperature of OutdoorAirUnit
     886             :                      bool const ZoneEquipment,    // TRUE if called as zone equipment
     887             :                      Real64 &SysOutputProvided,
     888             :                      Real64 &LatOutputProvided);
     889             : 
     890             :     void CalcVRFCondenser(EnergyPlusData &state, int VRFCond);
     891             : 
     892             :     void GetVRFInput(EnergyPlusData &state);
     893             : 
     894             :     void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound // flag for errors in GetInput
     895             :     );
     896             : 
     897             :     void CheckVRFTUNodeConnections(EnergyPlusData &state, int const VRFTUNum, bool &ErrorsFound);
     898             : 
     899             :     void InitVRF(EnergyPlusData &state, int VRFTUNum, int ZoneNum, bool FirstHVACIteration, Real64 &OnOffAirFlowRatio, Real64 &QZnReq);
     900             : 
     901             :     void SetCompFlowRate(EnergyPlusData &state, int VRFTUNum, int VRFCond, Optional_bool_const UseCurrentMode = _);
     902             : 
     903             :     void SizeVRF(EnergyPlusData &state, int const VRFTUNum);
     904             : 
     905             :     void SimVRF(EnergyPlusData &state,
     906             :                 int VRFTUNum,
     907             :                 bool FirstHVACIteration,
     908             :                 Real64 &OnOffAirFlowRatio,
     909             :                 Real64 &SysOutputProvided,
     910             :                 Real64 &LatOutputProvided,
     911             :                 Real64 QZnReq);
     912             : 
     913             :     int GetVRFTUOutAirNode(EnergyPlusData &state, int VRFTUNum);
     914             : 
     915             :     int GetVRFTUZoneInletAirNode(EnergyPlusData &state, int VRFTUNum);
     916             : 
     917             :     int GetVRFTUMixedAirNode(EnergyPlusData &state, int VRFTUNum);
     918             : 
     919             :     int GetVRFTUOutAirNodeFromName(EnergyPlusData &state, std::string const VRFTUName, bool &errorsFound);
     920             : 
     921             :     int GetVRFTUInAirNodeFromName(EnergyPlusData &state, std::string const VRFTUName, bool &errorsFound);
     922             : 
     923             :     int GetVRFTUReturnAirNode(EnergyPlusData &state, int const VRFTUNum);
     924             : 
     925             :     void getVRFTUZoneLoad(
     926             :         EnergyPlusData &state, int const VRFTUNum, Real64 &zoneLoad, Real64 &LoadToHeatingSP, Real64 &LoadToCoolingSP, bool const InitFlag);
     927             : 
     928             :     void ReportVRFTerminalUnit(EnergyPlusData &state, int VRFTUNum); // index to VRF terminal unit
     929             : 
     930             :     void ReportVRFCondenser(EnergyPlusData &state, int VRFCond); // index to VRF condensing unit
     931             : 
     932             :     void UpdateVRFCondenser(EnergyPlusData &state, int VRFCond); // index to VRF condensing unit
     933             : 
     934             :     void isVRFCoilPresent(EnergyPlusData &state, std::string_view VRFTUName, bool &CoolCoilPresent, bool &HeatCoilPresent);
     935             : 
     936             :     void SetAverageAirFlow(EnergyPlusData &state,
     937             :                            int VRFTUNum,             // Unit index
     938             :                            Real64 PartLoadRatio,     // unit part load ratio
     939             :                            Real64 &OnOffAirFlowRatio // ratio of compressor ON airflow to average airflow over timestep
     940             :     );
     941             : 
     942             :     void InitializeOperatingMode(EnergyPlusData &state,
     943             :                                  bool FirstHVACIteration,  // flag for first time through HVAC systems
     944             :                                  int VRFCond,              // Condenser Unit index
     945             :                                  int TUListNum,            // Condenser Unit terminal unit list
     946             :                                  Real64 &OnOffAirFlowRatio // ratio of on to off flow rate
     947             :     );
     948             : 
     949             :     void LimitTUCapacity(EnergyPlusData &state,
     950             :                          int VRFCond,                     // Condenser Unit index
     951             :                          int NumTUInList,                 // Number of terminal units in list
     952             :                          Real64 StartingCapacity,         // temporary variable holding condenser capacity [W]
     953             :                          const Array1D<Real64> &CapArray, // Array of coil capacities in either cooling or heating mode [W]
     954             :                          Real64 &MaxLimit,                // Maximum terminal unit capacity for coils in same operating mode [W]
     955             :                          Real64 AltCapacity,              // temporary variable holding heat recovery capacity [W]
     956             :                          const Array1D<Real64> &AltArray, // Array of coil capacities of heat recovery [W]
     957             :                          Real64 &AltLimit                 // Maximum terminal unit capacity of heat recovery coils [W]
     958             :     );
     959             : 
     960             :     void LimitCoilCapacity(int NumTUInList,                 // Number of terminal units in list
     961             :                            Real64 TotalCapacity,            // temporary variable holding condenser capacity [W]
     962             :                            const Array1D<Real64> &CapArray, // Array of coil capacities in either cooling or heating mode [W]
     963             :                            Real64 &MaxLimit                 // Maximum terminal unit capacity for coils in same operating mode [W]
     964             :     );
     965             : 
     966             :     Real64 CompResidual_FluidTCtrl(EnergyPlusData &state,
     967             :                                    Real64 T_dis,
     968             :                                    Real64 CondHeat,
     969             :                                    int CAPFT,
     970             :                                    Real64 const T_suc // Compressor suction temperature Te' [C]
     971             :     );
     972             : 
     973             : } // namespace HVACVariableRefrigerantFlow
     974             : 
     975        1542 : struct HVACVarRefFlowData : BaseGlobalStruct
     976             : {
     977             : 
     978             :     bool GetVRFInputFlag = true;             // Flag set to make sure you get input once
     979             :     bool MyOneTimeFlag = true;               // One time flag used to allocate MyEnvrnFlag and MySizeFlag
     980             :     bool MyOneTimeSizeFlag = true;           // One time flag used to allocate MyEnvrnFlag and MySizeFlag
     981             :     bool ZoneEquipmentListNotChecked = true; // False after the Zone Equipment List has been checked for items
     982             :     int NumVRFCond = 0;                      // total number of VRF condensers (All VRF Algorithm Types)
     983             :     int NumVRFCond_SysCurve = 0;             // total number of VRF condensers with VRF Algorithm Type 1
     984             :     int NumVRFCond_FluidTCtrl_HP = 0;        // total number of VRF condensers with VRF Algorithm Type 2 (HP)
     985             :     int NumVRFCond_FluidTCtrl_HR = 0;        // total number of VRF condensers with VRF Algorithm Type 2 (HR)
     986             :     int NumVRFTU = 0;                        // total number of VRF terminal units
     987             :     int NumVRFTULists = 0;                   // The number of VRF TU lists
     988             :     Real64 CompOnMassFlow = 0.0;             // Supply air mass flow rate w/ compressor ON
     989             :     Real64 OACompOnMassFlow = 0.0;           // OA mass flow rate w/ compressor ON
     990             :     Real64 CompOffMassFlow = 0.0;            // Supply air mass flow rate w/ compressor OFF
     991             :     Real64 OACompOffMassFlow = 0.0;          // OA mass flow rate w/ compressor OFF
     992             :     Real64 CompOnFlowRatio = 0.0;            // fan flow ratio when coil on
     993             :     Real64 CompOffFlowRatio = 0.0;           // fan flow ratio when coil off
     994             :     Real64 FanSpeedRatio = 0.0;              // ratio of air flow ratio passed to fan object
     995             :     Real64 LoopDXCoolCoilRTF = 0.0;          // holds value of DX cooling coil RTF
     996             :     Real64 LoopDXHeatCoilRTF = 0.0;          // holds value of DX heating coil RTF
     997             :     Real64 CondenserWaterMassFlowRate = 0.0; // VRF water-cooled condenser mass flow rate (kg/s)
     998             :     Real64 CurrentEndTimeLast = 0.0;         // end time of last time step
     999             :     Array1D_bool HeatingLoad;                // defines a heating load on VRFTerminalUnits
    1000             :     Array1D_bool CoolingLoad;                // defines a cooling load on VRFTerminalUnits
    1001             :     Array1D_bool LastModeHeating;            // defines last mode was heating mode
    1002             :     Array1D_bool LastModeCooling;            // defines last mode was cooling mode
    1003             :     Array1D_bool CheckEquipName;             // Flag set to check equipment connections once
    1004             :     Array1D_bool MyEnvrnFlag;                // Flag for initializing at beginning of each new environment
    1005             :     Array1D_bool MySizeFlag;                 // False after TU has been sized
    1006             :     Array1D_bool MyBeginTimeStepFlag;        // Flag to sense beginning of time step
    1007             :     Array1D_bool MyVRFFlag;                  // used for sizing VRF inputs one time
    1008             :     Array1D_bool MyVRFCondFlag;              // used to reset timer counter
    1009             :     Array1D_bool MyZoneEqFlag;               // used to set up zone equipment availability managers
    1010             :     Array1D_int NumCoolingLoads;             // number of TU's requesting cooling
    1011             :     Array1D_int NumHeatingLoads;             // number of TU's requesting heating
    1012             :     Array1D<Real64> MaxCoolingCapacity;      // maximum capacity of any terminal unit
    1013             :     Array1D<Real64> MaxHeatingCapacity;      // maximum capacity of any terminal unit
    1014             :     Array1D<Real64> CoolCombinationRatio;    // ratio of terminal unit capacity to VRF condenser capacity
    1015             :     Array1D<Real64> HeatCombinationRatio;    // ratio of terminal unit capacity to VRF condenser capacity
    1016             :     Array1D<Real64> MaxDeltaT;               // maximum zone temperature difference from setpoint
    1017             :     Array1D<Real64> MinDeltaT;               // minimum zone temperature difference from setpoint
    1018             :     Array1D<Real64> SumCoolingLoads;         // sum of cooling loads
    1019             :     Array1D<Real64> SumHeatingLoads;         // sum of heating loads
    1020             :     Array1D_bool CheckVRFCombinationRatio;
    1021             :     bool MyOneTimeEIOFlag = true; // eio header flag reporting
    1022             :     int ATMixOutNode = 0;         // terminal unit mixer outlet node
    1023             :     int ATMixOutNode2 = 0;        // terminal unit mixer outlet node
    1024             : 
    1025             :     // Object Data
    1026             :     EPVector<HVACVariableRefrigerantFlow::VRFCondenserEquipment> VRF; // AirConditioner:VariableRefrigerantFlow object
    1027             :     std::unordered_map<std::string, std::string> VrfUniqueNames;
    1028             :     EPVector<HVACVariableRefrigerantFlow::VRFTerminalUnitEquipment> VRFTU;           // ZoneHVAC:TerminalUnit:VariableRefrigerantFlow object
    1029             :     EPVector<HVACVariableRefrigerantFlow::TerminalUnitListData> TerminalUnitList;    // zoneTerminalUnitList object
    1030             :     EPVector<HVACVariableRefrigerantFlow::VRFTUNumericFieldData> VRFTUNumericFields; // holds VRF TU numeric input fields character field name
    1031             : 
    1032           0 :     void clear_state() override
    1033             :     {
    1034           0 :         this->GetVRFInputFlag = true;
    1035           0 :         this->MyOneTimeFlag = true;
    1036           0 :         this->MyOneTimeSizeFlag = true;
    1037           0 :         this->ZoneEquipmentListNotChecked = true;
    1038           0 :         this->NumVRFCond = 0;
    1039           0 :         this->NumVRFCond_SysCurve = 0;
    1040           0 :         this->NumVRFCond_FluidTCtrl_HP = 0;
    1041           0 :         this->NumVRFCond_FluidTCtrl_HR = 0;
    1042           0 :         this->NumVRFTU = 0;
    1043           0 :         this->NumVRFTULists = 0;
    1044           0 :         this->CompOnMassFlow = 0.0;
    1045           0 :         this->OACompOnMassFlow = 0.0;
    1046           0 :         this->CompOffMassFlow = 0.0;
    1047           0 :         this->OACompOffMassFlow = 0.0;
    1048           0 :         this->CompOnFlowRatio = 0.0;
    1049           0 :         this->CompOffFlowRatio = 0.0;
    1050           0 :         this->FanSpeedRatio = 0.0;
    1051           0 :         this->LoopDXCoolCoilRTF = 0.0;
    1052           0 :         this->LoopDXHeatCoilRTF = 0.0;
    1053           0 :         this->CondenserWaterMassFlowRate = 0.0;
    1054           0 :         this->CurrentEndTimeLast = 0.0;
    1055           0 :         this->HeatingLoad.deallocate();
    1056           0 :         this->CoolingLoad.deallocate();
    1057           0 :         this->LastModeHeating.deallocate();
    1058           0 :         this->LastModeCooling.deallocate();
    1059           0 :         this->CheckEquipName.deallocate();
    1060           0 :         this->MyEnvrnFlag.deallocate();
    1061           0 :         this->MySizeFlag.deallocate();
    1062           0 :         this->MyBeginTimeStepFlag.deallocate();
    1063           0 :         this->MyVRFFlag.deallocate();
    1064           0 :         this->MyVRFCondFlag.deallocate();
    1065           0 :         this->MyZoneEqFlag.deallocate();
    1066           0 :         this->NumCoolingLoads.deallocate();
    1067           0 :         this->NumHeatingLoads.deallocate();
    1068           0 :         this->MaxCoolingCapacity.deallocate();
    1069           0 :         this->MaxHeatingCapacity.deallocate();
    1070           0 :         this->CoolCombinationRatio.deallocate();
    1071           0 :         this->HeatCombinationRatio.deallocate();
    1072           0 :         this->MaxDeltaT.deallocate();
    1073           0 :         this->MinDeltaT.deallocate();
    1074           0 :         this->SumCoolingLoads.deallocate();
    1075           0 :         this->SumHeatingLoads.deallocate();
    1076           0 :         this->VRF.deallocate();
    1077           0 :         this->VrfUniqueNames.clear();
    1078           0 :         this->VRFTU.deallocate();
    1079           0 :         this->TerminalUnitList.deallocate();
    1080           0 :         this->VRFTUNumericFields.deallocate();
    1081           0 :         this->CheckVRFCombinationRatio.clear();
    1082           0 :         this->MyOneTimeEIOFlag = true;
    1083           0 :         this->ATMixOutNode = 0;
    1084           0 :         this->ATMixOutNode2 = 0;
    1085           0 :     }
    1086             : };
    1087             : 
    1088             : } // namespace EnergyPlus
    1089             : 
    1090             : #endif

Generated by: LCOV version 1.13