LCOV - code coverage report
Current view: top level - EnergyPlus - HVACMultiSpeedHeatPump.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 51 51
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 5 5

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, 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 HVACMultiSpeedHeatPump_hh_INCLUDED
      49              : #define HVACMultiSpeedHeatPump_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array1D.hh>
      53              : #include <ObjexxFCL/Optional.hh>
      54              : 
      55              : // EnergyPlus Headers
      56              : #include <EnergyPlus/Data/BaseData.hh>
      57              : #include <EnergyPlus/DataGlobals.hh>
      58              : #include <EnergyPlus/EnergyPlus.hh>
      59              : 
      60              : namespace EnergyPlus {
      61              : 
      62              : // Forward declarations
      63              : struct EnergyPlusData;
      64              : 
      65              : namespace HVACMultiSpeedHeatPump {
      66              : 
      67              :     // Heating coil types
      68              :     int constexpr MultiSpeedHeatingCoil(1); // COIL:DX:MultiSpeed:Heating
      69              :     // Cooling coil types
      70              :     int constexpr MultiSpeedCoolingCoil(2); // COIL:DX:MultiSpeed:Cooling
      71              :     // Supplymental heating coil types
      72              :     int constexpr SuppHeatingCoilGas(1);  // Supplymental heating coil type: COIL:GAS:HEATING
      73              :     int constexpr SuppHeatingCoilElec(2); // Supplymental heating coil type: COIL:ELECTRIC:HEATING
      74              :     int constexpr SuppHeatingCoilRec(3);  // Supplymental heating coil type: COIL:ENGINEHEATRECOVERY:HEATING
      75              : 
      76              :     // Mode of operation
      77              :     enum class ModeOfOperation
      78              :     {
      79              :         Invalid = -1,
      80              :         CoolingMode, // System operating mode is cooling
      81              :         HeatingMode, // System operating mode is heating
      82              :         Num
      83              :     };
      84              : 
      85              :     // Airflow control for constant fan mode
      86              :     enum class AirflowControl
      87              :     {
      88              :         Invalid = -1,
      89              :         UseCompressorOnFlow,  // set compressor OFF air flow rate equal to compressor ON air flow rate
      90              :         UseCompressorOffFlow, // set compressor OFF air flow rate equal to user defined value
      91              :         Num
      92              :     };
      93              : 
      94              :     // Types
      95              : 
      96              :     struct MSHeatPumpData
      97              :     {
      98              :         // Members
      99              :         // Some variables in this type are arrays (dimension=MaxSpeed) to support the number of speeds
     100              :         std::string Name;                          // Name of the engine driven heat pump
     101              :         Sched::Schedule *availSched = nullptr;     // availability schedule
     102              :         int AirInletNodeNum;                       // Node number of the heat pump air inlet
     103              :         int AirOutletNodeNum;                      // Node number of the heat pump air inlet
     104              :         std::string AirInletNodeName;              // Node name of the heat pump air inlet
     105              :         std::string AirOutletNodeName;             // Node name of the heat pump air outlet
     106              :         int ControlZoneNum;                        // Controlling zone or thermostat location
     107              :         int ZoneSequenceCoolingNum;                // Index to cooling sequence/priority for this zone
     108              :         int ZoneSequenceHeatingNum;                // Index to heating sequence/priority for this zone
     109              :         std::string ControlZoneName;               // Controlled zone name
     110              :         int NodeNumOfControlledZone;               // Controlled zone node number
     111              :         Real64 FlowFraction;                       // Fraction of the total volume flow that goes through the controlling zone
     112              :         std::string FanName;                       // Name of supply air fan
     113              :         HVAC::FanType fanType;                     // Supply fan type
     114              :         int FanNum;                                // Supply fan number
     115              :         HVAC::FanPlace fanPlace;                   // Supply air fan placement: 1 Blow through; 2 Draw through
     116              :         int FanInletNode;                          // Fan Inlet node
     117              :         int FanOutletNode;                         // Fan Outlet node
     118              :         Real64 FanVolFlow;                         // Supply fan volumetric flow rate
     119              :         Sched::Schedule *fanOpModeSched = nullptr; // Supply air fan operating mode schedule
     120              :         HVAC::FanOp fanOp = HVAC::FanOp::Invalid;  // mode of operation; 1=cycling fan, cycling compressor; 2=continuous fan, cycling compresor
     121              :         std::string DXHeatCoilName;                // COIL:DX:MultiSpeed:Heating name
     122              :         int HeatCoilType;                          // Heating coil type: 1 COIL:DX:MultiSpeed:Heating only
     123              :         int HeatCoilNum;                           // Heating coil number
     124              :         int DXHeatCoilIndex;                       // DX heating coil index number
     125              :         std::string HeatCoilName;                  // Coil:Electric:MultiSpeed:Heating OR Coil:Gas:MultiSpeed:Heating name
     126              :         int HeatCoilIndex;                         // heating coil index number (Coil:Electric:MultiSpeed:Heating OR Coil:Gas:MultiSpeed:Heating)
     127              :         std::string DXCoolCoilName;                // COIL:DX:MultiSpeed:Cooling name
     128              :         int CoolCoilType;                          // Cooling coil type: 1 COIL:DX:MultiSpeed:Cooling only
     129              :         int DXCoolCoilIndex;                       // DX cooling coil index number
     130              :         std::string SuppHeatCoilName;              // Supplymental heating coil name
     131              :         int SuppHeatCoilType;                      // Supplymental heating coil type: 1 Gas; 2 Electric; 3 Recovery
     132              :         int SuppHeatCoilNum;                       // Supplymental heating coil number
     133              :         Real64 DesignSuppHeatingCapacity;          // Supplemental heating coil design capacity
     134              :         Real64 SuppMaxAirTemp;                     // Maximum supply air temperature from supplemental heater
     135              :         Real64 SuppMaxOATemp;                      // Maximum outdoor dry-bulb temperature for supplemental heater operation
     136              :         Real64 AuxOnCyclePower;                    // Auxiliary On-Cycle Electric Power
     137              :         Real64 AuxOffCyclePower;                   // Auxiliary Off-Cycle Electric Power
     138              :         Real64 DesignHeatRecFlowRate;              // Design water volume flow rate through heat recovery loop [m3/s]
     139              :         bool HeatRecActive;                        // True when entered Heat Rec Vol Flow Rate > 0
     140              :         std::string HeatRecName;                   // heat recovery water inlet name
     141              :         int HeatRecInletNodeNum;                   // Node number on heat recovery water inlet
     142              :         int HeatRecOutletNodeNum;                  // Node number on heat recovery water outlet
     143              :         Real64 MaxHeatRecOutletTemp;               // Maximum outlet water temperature for heat recovery
     144              :         Real64 DesignHeatRecMassFlowRate;          // Design water mass flow rate through heat recovery loop [kg/s]
     145              :         PlantLocation HRPlantLoc;                  // plant loop component for heat recovery
     146              :         Real64 AuxElecPower;                       // Auxiliary Electric Power
     147              :         Real64 IdleVolumeAirRate;                  // Supply air volumetric flow rate when no cooling or heating is needed
     148              :         Real64 IdleMassFlowRate;                   // Supply air mass flow rate when no cooling or heating is needed
     149              :         Real64 IdleSpeedRatio;                     // Fan speed ratio in idle mode
     150              :         int NumOfSpeedCooling;                     // The number of speeds for cooling
     151              :         int NumOfSpeedHeating;                     // The number of speeds for heating
     152              :         Array1D<Real64> HeatVolumeFlowRate;        // Supply air volume flow rate during heating operation
     153              :         Array1D<Real64> HeatMassFlowRate;          // Supply air mass flow rate during heating operation
     154              :         Array1D<Real64> CoolVolumeFlowRate;        // Supply air volume flow rate during cooling operation
     155              :         Array1D<Real64> CoolMassFlowRate;          // Supply air mass flow rate during cooling operation
     156              :         Array1D<Real64> HeatingSpeedRatio;         // Fan speed ratio in heating mode
     157              :         Array1D<Real64> CoolingSpeedRatio;         // Fan speed ratio in cooling mode
     158              :         bool CheckFanFlow;                         // Supply airflow check
     159              :         ModeOfOperation LastMode;                  // MSHP operation mode
     160              :         ModeOfOperation HeatCoolMode;              // System operating mode (0 = floating, 1 = cooling, 2 = heating)
     161              :         int AirLoopNumber;                         // Air loop served by the engine driven heat pump system
     162              :         int NumControlledZones;                    // Number of controlled zones for this system
     163              :         int ZoneInletNode;                         // Zone inlet node number in the controlled zone
     164              :         Real64 CompPartLoadRatio;                  // Compressor part load ratio
     165              :         Real64 FanPartLoadRatio;                   // Fan part load ratio
     166              :         Real64 TotCoolEnergyRate;                  // Total cooling enertgy rate
     167              :         Real64 TotHeatEnergyRate;                  // Total heating enertgy rate
     168              :         Real64 SensCoolEnergyRate;                 // Sensible cooling enertgy rate
     169              :         Real64 SensHeatEnergyRate;                 // Sensible heating enertgy rate
     170              :         Real64 LatCoolEnergyRate;                  // Latent cooling enertgy rate
     171              :         Real64 LatHeatEnergyRate;                  // Latent heating enertgy rate
     172              :         Real64 ElecPower;                          // Electric power (fan + supplemental electric coil)
     173              :         Real64 LoadMet;                            // met system load
     174              :         Real64 HeatRecoveryRate;                   // Heat recovery rate [W]
     175              :         Real64 HeatRecoveryInletTemp;              // Inlet temperature for heat recovery rate [C]
     176              :         Real64 HeatRecoveryOutletTemp;             // Outlet temperature for heat recovery rate [C]
     177              :         Real64 HeatRecoveryMassFlowRate;           // Mass flow rate for heat recovery rate [kg/s]
     178              :         AirflowControl AirFlowControl;             // fan control mode, UseCompressorOnFlow or UseCompressorOffFlow
     179              :         int ErrIndexCyc;                           // Error index at low speed
     180              :         int ErrIndexVar;                           // Error index at high speed
     181              :         Real64 LoadLoss;                           // Air distribution system loss
     182              :         int SuppCoilAirInletNode;                  // air inlet node number of supplemental heating coil
     183              :         int SuppCoilAirOutletNode;                 // air outlet node number of supplemental heating coil
     184              :         int SuppHeatCoilType_Num;                  // Numeric Equivalent for Supplemental Heat Coil Type
     185              :         int SuppHeatCoilIndex;                     // Index to supplemental heater
     186              :         int SuppCoilControlNode;                   // control node for simple water and steam heating coil
     187              :         Real64 MaxSuppCoilFluidFlow;               // water or steam mass flow rate for supplemental heating coil [kg/s]
     188              :         int SuppCoilOutletNode;                    // outlet node for hot water and steam supplemental heating coil
     189              :         int CoilAirInletNode;                      // air inlet node number of supplemental heating coil
     190              :         int CoilControlNode;                       // control node for simple water and steam heating coil
     191              :         Real64 MaxCoilFluidFlow;                   // water or steam mass flow rate for supplemental heating coil [kg/s]
     192              :         int CoilOutletNode;                        // outlet node for hot water and steam supplemental heating coil
     193              :         int HotWaterCoilControlNode;
     194              :         int HotWaterCoilOutletNode;
     195              :         std::string HotWaterCoilName;
     196              :         int HotWaterCoilNum;
     197              :         PlantLocation plantLoc;         // plant loop component location for hot water and steam heating coil
     198              :         PlantLocation SuppPlantLoc;     // plant loop component location for hot water and steam supplemental heating coil
     199              :         PlantLocation HotWaterPlantLoc; // plant loop component location for hot water and steam heating coil
     200              :         int HotWaterCoilMaxIterIndex;   // Index to recurring warning message
     201              :         int HotWaterCoilMaxIterIndex2;  // Index to recurring warning message
     202              :         int StageNum;                   // Stage number specified by staged thermostat
     203              :         bool Staged;                    // Using Staged thermostat
     204              :         int CoolCountAvail;             // Counter used to minimize the occurrence of output warnings
     205              :         int CoolIndexAvail;             // Index used to minimize the occurrence of output warnings
     206              :         int HeatCountAvail;             // Counter used to minimize the occurrence of output warnings
     207              :         int HeatIndexAvail;             // Index used to minimize the occurrence of output warnings
     208              :         bool FirstPass;                 // used to determine when first call is made
     209              :         Array1D<Real64> FullOutput;     // Full output for different speed
     210              :         Real64 MinOATCompressorCooling; // min OAT from multispeed cooling coil object
     211              :         Real64 MinOATCompressorHeating; // min OAT from multispeed heating coil object
     212              :         bool MyEnvrnFlag;
     213              :         bool MySizeFlag;
     214              :         bool MyCheckFlag;
     215              :         bool MyFlowFracFlag;
     216              :         bool MyPlantScantFlag;
     217              :         bool MyStagedFlag;
     218              :         bool EMSOverrideCoilSpeedNumOn;
     219              :         Real64 EMSOverrideCoilSpeedNumValue;
     220              :         int CoilSpeedErrIndex;
     221              : 
     222              :         // Default Constructor
     223            4 :         MSHeatPumpData()
     224           12 :             : AirInletNodeNum(0), AirOutletNodeNum(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0), ZoneSequenceHeatingNum(0),
     225            8 :               NodeNumOfControlledZone(0), FlowFraction(0.0), fanType(HVAC::FanType::Invalid), FanNum(0), fanPlace(HVAC::FanPlace::Invalid),
     226           12 :               FanInletNode(0), FanOutletNode(0), FanVolFlow(0.0), HeatCoilType(0), HeatCoilNum(0), DXHeatCoilIndex(0), HeatCoilIndex(0),
     227            8 :               CoolCoilType(0), DXCoolCoilIndex(0), SuppHeatCoilType(0), SuppHeatCoilNum(0), DesignSuppHeatingCapacity(0.0), SuppMaxAirTemp(0.0),
     228            4 :               SuppMaxOATemp(0.0), AuxOnCyclePower(0.0), AuxOffCyclePower(0.0), DesignHeatRecFlowRate(0.0), HeatRecActive(false),
     229            4 :               HeatRecInletNodeNum(0), HeatRecOutletNodeNum(0), MaxHeatRecOutletTemp(0.0), DesignHeatRecMassFlowRate(0.0), HRPlantLoc{},
     230            4 :               AuxElecPower(0.0), IdleVolumeAirRate(0.0), IdleMassFlowRate(0.0), IdleSpeedRatio(0.0), NumOfSpeedCooling(0), NumOfSpeedHeating(0),
     231            4 :               CheckFanFlow(true), LastMode(ModeOfOperation::Invalid), HeatCoolMode(ModeOfOperation::Invalid), AirLoopNumber(0), NumControlledZones(0),
     232            4 :               ZoneInletNode(0), CompPartLoadRatio(0.0), FanPartLoadRatio(0.0), TotCoolEnergyRate(0.0), TotHeatEnergyRate(0.0),
     233            4 :               SensCoolEnergyRate(0.0), SensHeatEnergyRate(0.0), LatCoolEnergyRate(0.0), LatHeatEnergyRate(0.0), ElecPower(0.0), LoadMet(0.0),
     234            4 :               HeatRecoveryRate(0.0), HeatRecoveryInletTemp(0.0), HeatRecoveryOutletTemp(0.0), HeatRecoveryMassFlowRate(0.0),
     235            4 :               AirFlowControl(AirflowControl::Invalid), ErrIndexCyc(0), ErrIndexVar(0), LoadLoss(0.0), SuppCoilAirInletNode(0),
     236            4 :               SuppCoilAirOutletNode(0), SuppHeatCoilType_Num(0), SuppHeatCoilIndex(0), SuppCoilControlNode(0), MaxSuppCoilFluidFlow(0.0),
     237            4 :               SuppCoilOutletNode(0), CoilAirInletNode(0), CoilControlNode(0), MaxCoilFluidFlow(0.0), CoilOutletNode(0),
     238            4 :               HotWaterCoilControlNode(0), plantLoc{}, SuppPlantLoc{}, HotWaterPlantLoc{}, HotWaterCoilMaxIterIndex(0), HotWaterCoilMaxIterIndex2(0),
     239            4 :               StageNum(0), Staged(false), CoolCountAvail(0), CoolIndexAvail(0), HeatCountAvail(0), HeatIndexAvail(0), FirstPass(true),
     240            4 :               MinOATCompressorCooling(0.0), MinOATCompressorHeating(0.0), MyEnvrnFlag(true), MySizeFlag(true), MyCheckFlag(true),
     241            4 :               MyFlowFracFlag(true), MyPlantScantFlag(true), MyStagedFlag(true), EMSOverrideCoilSpeedNumOn(false), EMSOverrideCoilSpeedNumValue(0.0),
     242           12 :               CoilSpeedErrIndex(0)
     243              :         {
     244            4 :         }
     245              :     };
     246              : 
     247              :     struct MSHeatPumpReportData
     248              :     {
     249              :         // Members
     250              :         Real64 ElecPowerConsumption;   // Electricity Rate comsumption: CondenserFan+CrankcaseHeater+Defroster+aux
     251              :         Real64 HeatRecoveryEnergy;     // Heat recovery rate [J]
     252              :         Real64 CycRatio;               // Cycle ratio
     253              :         Real64 SpeedRatio;             // Speed ratio between two stages
     254              :         int SpeedNum;                  // Speed number
     255              :         Real64 AuxElecCoolConsumption; // Auxiliary Electricity Rate consumption during cooling
     256              :         Real64 AuxElecHeatConsumption; // Auxiliary Electricity Rate consumption during heating
     257              : 
     258              :         // Default Constructor
     259            3 :         MSHeatPumpReportData()
     260            3 :             : ElecPowerConsumption(0.0), HeatRecoveryEnergy(0.0), CycRatio(0.0), SpeedRatio(0.0), SpeedNum(0), AuxElecCoolConsumption(0.0),
     261            3 :               AuxElecHeatConsumption(0.0)
     262              :         {
     263            3 :         }
     264              :     };
     265              : 
     266              :     void SimMSHeatPump(EnergyPlusData &state,
     267              :                        std::string_view CompName,     // Name of the unitary engine driven heat pump system
     268              :                        bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system time step
     269              :                        int const AirLoopNum,          // air loop index
     270              :                        int &CompIndex                 // Index to changeover-bypass VAV system
     271              :     );
     272              : 
     273              :     //******************************************************************************
     274              : 
     275              :     void SimMSHP(EnergyPlusData &state,
     276              :                  int const MSHeatPumpNum,       // number of the current engine driven Heat Pump being simulated
     277              :                  bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
     278              :                  int const AirLoopNum,          // air loop index
     279              :                  Real64 &QSensUnitOut,          // cooling/heating deliveded to zones [W]
     280              :                  Real64 const QZnReq,           // required zone load
     281              :                  Real64 &OnOffAirFlowRatio      // ratio of compressor ON airflow to AVERAGE airflow over timestep
     282              :     );
     283              : 
     284              :     //******************************************************************************
     285              : 
     286              :     void GetMSHeatPumpInput(EnergyPlusData &state);
     287              : 
     288              :     //******************************************************************************
     289              : 
     290              :     void InitMSHeatPump(EnergyPlusData &state,
     291              :                         int const MSHeatPumpNum,       // Engine driven heat pump number
     292              :                         bool const FirstHVACIteration, // TRUE if first HVAC iteration
     293              :                         int const AirLoopNum,          // air loop index
     294              :                         Real64 &QZnReq,                // Heating/Cooling load for all served zones
     295              :                         Real64 &OnOffAirFlowRatio      // Ratio of compressor ON airflow to average airflow over timestep
     296              :     );
     297              : 
     298              :     //******************************************************************************
     299              : 
     300              :     void SizeMSHeatPump(EnergyPlusData &state, int const MSHeatPumpNum); // Engine driven heat pump number
     301              : 
     302              :     //******************************************************************************
     303              : 
     304              :     void ControlMSHPOutput(EnergyPlusData &state,
     305              :                            int const MSHeatPumpNum,         // Unit index of engine driven heat pump
     306              :                            bool const FirstHVACIteration,   // flag for 1st HVAC iteration in the time step
     307              :                            HVAC::CompressorOp compressorOp, // compressor operation; 1=on, 0=off
     308              :                            HVAC::FanOp const fanOp,         // operating mode: FanOp::Cycling | FanOp::Continuous
     309              :                            Real64 const QZnReq,             // cooling or heating output needed by zone [W]
     310              :                            int const ZoneNum,               // Index to zone number
     311              :                            int &SpeedNum,                   // Speed number
     312              :                            Real64 &SpeedRatio,              // unit speed ratio for DX coils
     313              :                            Real64 &PartLoadFrac,            // unit part load fraction
     314              :                            Real64 &OnOffAirFlowRatio,       // ratio of compressor ON airflow to AVERAGE airflow over timestep
     315              :                            Real64 &SupHeaterLoad            // Supplemental heater load [W]
     316              :     );
     317              : 
     318              :     void ControlMSHPSupHeater(EnergyPlusData &state,
     319              :                               int const MSHeatPumpNum,         // Unit index of engine driven heat pump
     320              :                               bool const FirstHVACIteration,   // flag for 1st HVAC iteration in the time step
     321              :                               HVAC::CompressorOp compressorOp, // compressor operation; 1=on, 0=off
     322              :                               HVAC::FanOp const fanOp,         // operating mode: FanOp::Cycling | FanOp::Continuous
     323              :                               Real64 const QZnReq,             // cooling or heating output needed by zone [W]
     324              :                               int const FullOutput,            // unit full output when compressor is operating [W]vvvv
     325              :                               int const SpeedNum,              // Speed number
     326              :                               Real64 SpeedRatio,               // unit speed ratio for DX coils
     327              :                               Real64 PartLoadFrac,             // unit part load fraction
     328              :                               Real64 OnOffAirFlowRatio,        // ratio of compressor ON airflow to AVERAGE airflow over timestep
     329              :                               Real64 &SupHeaterLoad            // Supplemental heater load [W]
     330              : 
     331              :     );
     332              : 
     333              :     void ControlMSHPOutputEMS(EnergyPlusData &state,
     334              :                               int const MSHeatPumpNum,         // Unit index of engine driven heat pump
     335              :                               bool const FirstHVACIteration,   // flag for 1st HVAC iteration in the time step
     336              :                               HVAC::CompressorOp compressorOp, // compressor operation; 1=on, 0=off
     337              :                               HVAC::FanOp const fanOp,         // operating mode: FanOp::Cycling | FanOp::Continuous
     338              :                               Real64 const QZnReq,             // cooling or heating output needed by zone [W]
     339              :                               Real64 const SpeedVal,           // continuous speed value
     340              :                               int &SpeedNum,                   // discrete speed level
     341              :                               Real64 &SpeedRatio,              // unit speed ratio for DX coils
     342              :                               Real64 &PartLoadFrac,            // unit part load fraction
     343              :                               Real64 &OnOffAirFlowRatio,       // ratio of compressor ON airflow to AVERAGE airflow over timestep
     344              :                               Real64 &SupHeaterLoad            // Supplemental heater load [W]
     345              : 
     346              :     );
     347              : 
     348              :     //******************************************************************************
     349              : 
     350              :     void CalcMSHeatPump(EnergyPlusData &state,
     351              :                         int const MSHeatPumpNum,         // Engine driven heat pump number
     352              :                         bool const FirstHVACIteration,   // Flag for 1st HVAC iteration
     353              :                         HVAC::CompressorOp compressorOp, // Compressor on/off; 1=on, 0=off
     354              :                         int const SpeedNum,              // Speed number
     355              :                         Real64 const SpeedRatio,         // Compressor speed ratio
     356              :                         Real64 const PartLoadFrac,       // Compressor part load fraction
     357              :                         Real64 &LoadMet,                 // Load met by unit (W)
     358              :                         Real64 const QZnReq,             // Zone load (W)
     359              :                         Real64 &OnOffAirFlowRatio,       // Ratio of compressor ON airflow to AVERAGE airflow over timestep
     360              :                         Real64 &SupHeaterLoad            // supplemental heater load (W)
     361              :     );
     362              : 
     363              :     void UpdateMSHeatPump(EnergyPlusData &state, int const MSHeatPumpNum); // Engine driven heat pump number
     364              : 
     365              :     void ReportMSHeatPump(EnergyPlusData &state, int const MSHeatPumpNum); // Engine driven heat pump number
     366              : 
     367              :     void MSHPHeatRecovery(EnergyPlusData &state,
     368              :                           int const MSHeatPumpNum); // Number of the current electric MSHP being simulated
     369              : 
     370              :     void SetAverageAirFlow(EnergyPlusData &state,
     371              :                            int const MSHeatPumpNum,                         // Unit index
     372              :                            Real64 const PartLoadRatio,                      // unit part load ratio
     373              :                            Real64 &OnOffAirFlowRatio,                       // ratio of compressor ON airflow to average airflow over timestep
     374              :                            ObjexxFCL::Optional_int_const SpeedNum = _,      // Speed number
     375              :                            ObjexxFCL::Optional<Real64 const> SpeedRatio = _ // Speed ratio
     376              :     );
     377              : 
     378              :     void CalcNonDXHeatingCoils(EnergyPlusData &state,
     379              :                                int const MSHeatPumpNum,       // multispeed heatpump index
     380              :                                bool const FirstHVACIteration, // flag for first HVAC iteration in the time step
     381              :                                Real64 const HeatingLoad,      // supplemental coil load to be met by unit (watts)
     382              :                                HVAC::FanOp const fanOp,       // fan operation mode
     383              :                                Real64 &HeatCoilLoadmet,       // Heating Load Met
     384              :                                ObjexxFCL::Optional<Real64 const> PartLoadFrac = _);
     385              : 
     386              : } // namespace HVACMultiSpeedHeatPump
     387              : 
     388              : struct HVACMultiSpeedHeatPumpData : BaseGlobalStruct
     389              : {
     390              : 
     391              :     int NumMSHeatPumps = 0;     // Number of multi speed heat pumps
     392              :     int AirLoopPass = 0;        // Number of air loop pass
     393              :     Real64 TempSteamIn = 100.0; // steam coil steam inlet temperature
     394              : 
     395              :     std::string CurrentModuleObject; // Object type for getting and error messages
     396              :     Real64 CompOnMassFlow = 0.0;     // System air mass flow rate w/ compressor ON
     397              :     Real64 CompOffMassFlow = 0.0;    // System air mass flow rate w/ compressor OFF
     398              :     Real64 CompOnFlowRatio = 0.0;    // fan flow ratio when coil on
     399              :     Real64 CompOffFlowRatio = 0.0;   // fan flow ratio when coil off
     400              :     Real64 FanSpeedRatio = 0.0;      // fan speed ratio passed to on/off fan object
     401              :     Real64 SupHeaterLoad = 0.0;      // load to be met by supplemental heater [W]
     402              :     Real64 SaveLoadResidual = 0.0;   // Saved load residual used to check convergence
     403              :     Real64 SaveCompressorPLR = 0.0;  // holds compressor PLR from active DX coil
     404              :     Array1D_bool CheckEquipName;
     405              : 
     406              :     // SUBROUTINE SPECIFICATIONS FOR MODULE
     407              : 
     408              :     // Object Data
     409              :     Array1D<HVACMultiSpeedHeatPump::MSHeatPumpData> MSHeatPump;
     410              :     Array1D<HVACMultiSpeedHeatPump::MSHeatPumpReportData> MSHeatPumpReport;
     411              : 
     412              :     bool GetInputFlag = true;      // Get input flag
     413              :     bool FlowFracFlagReady = true; // one time flag for calculating flow fraction through controlled zone
     414              :     int ErrCountCyc = 0;           // Counter used to minimize the occurrence of output warnings
     415              :     int ErrCountVar = 0;           // Counter used to minimize the occurrence of output warnings
     416              : 
     417              :     std::string HeatCoilName; // TODO: What's the best plan here?
     418              : 
     419         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     420              :     {
     421         2126 :     }
     422              : 
     423         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     424              :     {
     425         1152 :     }
     426              : 
     427         2100 :     void clear_state() override
     428              :     {
     429         2100 :         this->NumMSHeatPumps = 0;
     430         2100 :         this->AirLoopPass = 0;
     431         2100 :         this->TempSteamIn = 100.0;
     432         2100 :         this->CurrentModuleObject = "";
     433         2100 :         this->CompOnMassFlow = 0.0;
     434         2100 :         this->CompOffMassFlow = 0.0;
     435         2100 :         this->CompOnFlowRatio = 0.0;
     436         2100 :         this->CompOffFlowRatio = 0.0;
     437         2100 :         this->FanSpeedRatio = 0.0;
     438         2100 :         this->SupHeaterLoad = 0.0;
     439         2100 :         this->SaveLoadResidual = 0.0;
     440         2100 :         this->SaveCompressorPLR = 0.0;
     441         2100 :         this->CheckEquipName.clear();
     442         2100 :         this->MSHeatPump.clear();
     443         2100 :         this->MSHeatPumpReport.clear();
     444         2100 :         this->GetInputFlag = true; // Get input flag
     445         2100 :         this->FlowFracFlagReady = true;
     446         2100 :         this->ErrCountCyc = 0;
     447         2100 :         this->ErrCountVar = 0;
     448         2100 :         this->HeatCoilName = "";
     449         2100 :     }
     450              : };
     451              : 
     452              : } // namespace EnergyPlus
     453              : 
     454              : #endif
        

Generated by: LCOV version 2.0-1