LCOV - code coverage report
Current view: top level - EnergyPlus - HVACMultiSpeedHeatPump.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 27 49 55.1 %
Date: 2024-08-23 23:50:59 Functions: 3 4 75.0 %

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

Generated by: LCOV version 1.14