LCOV - code coverage report
Current view: top level - EnergyPlus - HVACVariableRefrigerantFlow.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 48 102 47.1 %
Date: 2024-08-23 23:50:59 Functions: 5 6 83.3 %

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

Generated by: LCOV version 1.14