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

            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 PlantCentralGSHP_hh_INCLUDED
      49              : #define PlantCentralGSHP_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array1D.hh>
      53              : 
      54              : // EnergyPlus Headers
      55              : #include <EnergyPlus/Data/BaseData.hh>
      56              : #include <EnergyPlus/DataGlobals.hh>
      57              : #include <EnergyPlus/EnergyPlus.hh>
      58              : #include <EnergyPlus/PlantComponent.hh>
      59              : 
      60              : namespace EnergyPlus {
      61              : 
      62              : // Forward declarations
      63              : struct EnergyPlusData;
      64              : 
      65              : namespace PlantCentralGSHP {
      66              : 
      67              :     enum class CondenserType
      68              :     {
      69              :         Invalid = -1,
      70              :         WaterCooled,
      71              :         SmartMixing,
      72              :         Num
      73              :     };
      74              : 
      75              :     enum class CondenserModeTemperature
      76              :     {
      77              :         Invalid = -1,
      78              :         EnteringCondenser,
      79              :         LeavingCondenser,
      80              :         Num
      81              :     };
      82              : 
      83              :     struct CGSHPNodeData
      84              :     {
      85              :         // Members
      86              :         Real64 Temp;                 // {C}
      87              :         Real64 TempMin;              // {C}
      88              :         Real64 TempSetPoint;         // SensedNodeFlagValue ! {C}
      89              :         Real64 MassFlowRate;         // {kg/s}
      90              :         Real64 MassFlowRateMin;      // {kg/s}
      91              :         Real64 MassFlowRateMax;      // SensedNodeFlagValue ! {kg/s}
      92              :         Real64 MassFlowRateMinAvail; // {kg/s}
      93              :         Real64 MassFlowRateMaxAvail; // {kg/s}
      94              :         Real64 MassFlowRateSetPoint; // {kg/s}
      95              :         Real64 MassFlowRateRequest;  // {kg/s}
      96              : 
      97           52 :         CGSHPNodeData()
      98           52 :             : Temp(0.0), TempMin(0.0), TempSetPoint(0.0), MassFlowRate(0.0), MassFlowRateMin(0.0), MassFlowRateMax(0.0), MassFlowRateMinAvail(0.0),
      99           52 :               MassFlowRateMaxAvail(0.0), MassFlowRateSetPoint(0.0), MassFlowRateRequest(0.0)
     100              :         {
     101           52 :         }
     102              :     };
     103              : 
     104              :     struct WrapperComponentSpecs
     105              :     {
     106              :         std::string WrapperPerformanceObjectType; // Component type
     107              :         std::string WrapperComponentName;         // Component name
     108              :         int WrapperPerformanceObjectIndex;        // Component index in the input array
     109              :         int WrapperIdenticalObjectNum;            // Number of identical objects
     110              :         Sched::Schedule *chSched = nullptr;       // schedule
     111              : 
     112            7 :         WrapperComponentSpecs() : WrapperPerformanceObjectIndex(0), WrapperIdenticalObjectNum(0)
     113              :         {
     114            7 :         }
     115              :     };
     116              : 
     117              :     struct CHReportVars
     118              :     {
     119              :         int CurrentMode;                  // 0-off; 1-cooling only; 2-heating-only; 3-simutaneouls heat/cool
     120              :         Real64 ChillerPartLoadRatio;      // Chiller PLR (Load/Capacity)
     121              :         Real64 ChillerCyclingRatio;       // Chiller cycling ratio (time on/time step)
     122              :         Real64 ChillerFalseLoad;          // Chiller false load over and above water side load [J]
     123              :         Real64 ChillerFalseLoadRate;      // Chiller false load rate over and above water side load [W]
     124              :         Real64 CoolingPower;              // Chiller power, W
     125              :         Real64 HeatingPower;              // Chiller power, W
     126              :         Real64 QEvap;                     // Evaporator heat transfer rate [W]
     127              :         Real64 QCond;                     // Condenser heat transfer rate [W]
     128              :         Real64 CoolingEnergy;             // Chiller electric consumption [J]
     129              :         Real64 HeatingEnergy;             // Chiller electric consumption [J]
     130              :         Real64 EvapEnergy;                // Evaporator heat transfer energy [J]
     131              :         Real64 CondEnergy;                // Condenser heat transfer energy [J]
     132              :         Real64 CondInletTemp;             // Condenser inlet temperature [C]
     133              :         Real64 EvapInletTemp;             // Evaporator inlet temperature [C]
     134              :         Real64 CondOutletTemp;            // Condenser outlet temperature [C]
     135              :         Real64 EvapOutletTemp;            // Evaporator outlet temperature [C]
     136              :         Real64 Evapmdot;                  // Evaporator mass flow rate [kg/s]
     137              :         Real64 Condmdot;                  // Condenser mass flow rate [kg/s]
     138              :         Real64 ActualCOP;                 // Coefficient of performance
     139              :         Real64 ChillerCapFT;              // Chiller capacity curve output value
     140              :         Real64 ChillerEIRFT;              // Chiller EIRFT curve output value
     141              :         Real64 ChillerEIRFPLR;            // Chiller EIRFPLR curve output value
     142              :         Real64 CondenserFanPowerUse;      // Air-cooled condenser fan power [W]
     143              :         Real64 CondenserFanEnergy;        // Air-cooled condenser fan energy [J]
     144              :         Real64 ChillerPartLoadRatioSimul; // Chiller PLR (Load/Capacity) for simul clg/htg mode
     145              :         Real64 ChillerCyclingRatioSimul;  // Chiller cycling ratio (time on/time step) for simul clg/htg mode
     146              :         Real64 ChillerFalseLoadSimul;     // Chiller false load for simul clg/htg mode [J]
     147              :         Real64 ChillerFalseLoadRateSimul; // Chiller false load rate for simul clg/htg mode [W]
     148              :         Real64 CoolingPowerSimul;         // Chiller power for simul clg/htg mode [W]
     149              :         Real64 QEvapSimul;                // Evaporator heat transfer rate for simul clg/htg mode [W]
     150              :         Real64 QCondSimul;                // Evaporator heat transfer rate for simul clg/htg mode [W]
     151              :         Real64 CoolingEnergySimul;        // Chiller electric consumption for simul clg/htg mode [J]
     152              :         Real64 EvapEnergySimul;           // Evaporator heat transfer energy for simul clg/htg mode [J]
     153              :         Real64 CondEnergySimul;           // Condenser heat transfer energy for simul clg/htg mode [J]
     154              :         Real64 EvapInletTempSimul;        // Evaporator inlet temperature for simul clg/htg mode [C]
     155              :         Real64 EvapOutletTempSimul;       // Evaporator outlet temperature for simul clg/htg mode [C]
     156              :         Real64 EvapmdotSimul;             // Evaporator mass flow rate for simul clg/htg mode [kg/s]
     157              :         Real64 CondInletTempSimul;        // Condenser inlet temperature for simul clg/htg mode [C]
     158              :         Real64 CondOutletTempSimul;       // Condenser outlet temperature for simul clg/htg mode [C]
     159              :         Real64 CondmdotSimul;             // Condenser mass flow rate for simul clg/htg mode [kg/s]
     160              :         Real64 ChillerCapFTSimul;         // Chiller capacity curve output value for simul clg/htg mode
     161              :         Real64 ChillerEIRFTSimul;         // Chiller EIRFT curve output value for simul clg/htg mode
     162              :         Real64 ChillerEIRFPLRSimul;       // Chiller EIRFPLR curve output value for simul clg/htg mode
     163              : 
     164           13 :         CHReportVars()
     165           13 :             : CurrentMode(0), ChillerPartLoadRatio(0.0), ChillerCyclingRatio(0.0), ChillerFalseLoad(0.0), ChillerFalseLoadRate(0.0),
     166           13 :               CoolingPower(0.0), HeatingPower(0.0), QEvap(0.0), QCond(0.0), CoolingEnergy(0.0), HeatingEnergy(0.0), EvapEnergy(0.0), CondEnergy(0.0),
     167           13 :               CondInletTemp(0.0), EvapInletTemp(0.0), CondOutletTemp(0.0), EvapOutletTemp(0.0), Evapmdot(0.0), Condmdot(0.0), ActualCOP(0.0),
     168           13 :               ChillerCapFT(0.0), ChillerEIRFT(0.0), ChillerEIRFPLR(0.0), CondenserFanPowerUse(0.0), CondenserFanEnergy(0.0),
     169           13 :               ChillerPartLoadRatioSimul(0.0), ChillerCyclingRatioSimul(0.0), ChillerFalseLoadSimul(0.0), ChillerFalseLoadRateSimul(0.0),
     170           13 :               CoolingPowerSimul(0.0), QEvapSimul(0.0), QCondSimul(0.0), CoolingEnergySimul(0.0), EvapEnergySimul(0.0), CondEnergySimul(0.0),
     171           13 :               EvapInletTempSimul(0.0), EvapOutletTempSimul(0.0), EvapmdotSimul(0.0), CondInletTempSimul(0.0), CondOutletTempSimul(0.0),
     172           13 :               CondmdotSimul(0.0), ChillerCapFTSimul(0.0), ChillerEIRFTSimul(0.0), ChillerEIRFPLRSimul(0.0)
     173              :         {
     174           13 :         }
     175              :     };
     176              : 
     177              :     struct ChillerHeaterSpecs
     178              :     {
     179              :         std::string Name;                         // Name of the Chiller Heater object
     180              :         CondenserModeTemperature CondModeCooling; // Cooling mode temperature curve input variable
     181              :         CondenserModeTemperature CondModeHeating; // Clg/Htg mode temperature curve input variable
     182              :         CondenserModeTemperature CondMode;        // Current mode temperature curve input variable
     183              :         bool ConstantFlow;                        // True if this is a Constant Flow Chiller
     184              :         bool VariableFlow;                        // True if this is a Variable Flow Chiller
     185              :         bool CoolSetPointSetToLoop;               // True if the setpoint is missing at the outlet node
     186              :         bool HeatSetPointSetToLoop;               // True if the setpoint is missing at the outlet node
     187              :         bool CoolSetPointErrDone;                 // true if setpoint warning issued
     188              :         bool HeatSetPointErrDone;                 // true if setpoint warning issued
     189              :         bool PossibleSubcooling;                  // flag to indicate chiller is doing less cooling that requested
     190              :         int ChillerHeaterNum;                     // Chiller heater number
     191              :         CondenserType condenserType;              // Type of Condenser - only water cooled is allowed
     192              :         int ChillerCapFTCoolingIDX;               // Cooling capacity function of temperature curve index
     193              :         int ChillerEIRFTCoolingIDX;               // Elec Input to Cooling Output ratio function of temperature curve index
     194              :         int ChillerEIRFPLRCoolingIDX;             // Elec Input to cooling output ratio function of PLR curve index
     195              :         int ChillerCapFTHeatingIDX;               // Clg/Htg capacity function of temperature curve index
     196              :         int ChillerEIRFTHeatingIDX;               // Elec Input to Clg/Htg Output ratio function of temperature curve index
     197              :         int ChillerEIRFPLRHeatingIDX;             // Elec Input to Clg/Htg output ratio function of PLR curve index
     198              :         int ChillerCapFTIDX;                      // Capacity function of temperature curve index
     199              :         int ChillerEIRFTIDX;                      // Elec Input to demand output ratio function of temperature curve index
     200              :         int ChillerEIRFPLRIDX;                    // Elec Input to demand output ratio function of PLR curve index
     201              :         int EvapInletNodeNum;                     // Node number on the inlet side of the plant (evaporator side)
     202              :         int EvapOutletNodeNum;                    // Node number on the outlet side of the plant (evaporator side)
     203              :         int CondInletNodeNum;                     // Node number on the inlet side of the condenser
     204              :         int CondOutletNodeNum;                    // Node number on the outlet side of the condenser
     205              :         int ChillerCapFTError;                    // Used for negative capacity as a function of temp warnings
     206              :         int ChillerCapFTErrorIndex;               // Used for negative capacity as a function of temp warnings
     207              :         int ChillerEIRFTError;                    // Used for negative EIR as a function of temp warnings
     208              :         int ChillerEIRFTErrorIndex;               // Used for negative EIR as a function of temp warnings
     209              :         int ChillerEIRFPLRError;                  // Used for negative EIR as a function of PLR warnings
     210              :         int ChillerEIRFPLRErrorIndex;             // Used for negative EIR as a function of PLR warnings
     211              :         int ChillerEIRRefTempErrorIndex;          // Used for reference temperature problems
     212              :         int DeltaTErrCount;                       // Evaporator delta T equals 0 for variable flow chiller warning messages
     213              :         int DeltaTErrCountIndex;                  // Index to evaporator delta T = 0 for variable flow chiller warning messages
     214              :         int CondMassFlowIndex;                    // Index to condenser mass flow rate
     215              :         Real64 RefCapCooling;                     // Reference cooling-mode evaporator capacity [W]
     216              :         bool RefCapCoolingWasAutoSized;           // true if reference cooling capacity was autosize on input
     217              :         Real64 RefCOPCooling;                     // Reference cooling-mode COP
     218              :         Real64 TempRefEvapOutCooling;             // Reference cooling-mode evaporator leaving temperature [C]
     219              :         Real64 TempRefCondInCooling;              // Reference cooling-mode condenser entering temperature [C]
     220              :         Real64 TempRefCondOutCooling;             // Reference cooling-mode condenser leaving temperature [C]
     221              :         Real64 MaxPartLoadRatCooling;             // Maximum Part load ratio in cooling mode
     222              :         Real64 OptPartLoadRatCooling;             // Optimum Part load ratio in cooling mode
     223              :         Real64 MinPartLoadRatCooling;             // minimum Part load ratio in cooling mode
     224              :         Real64 ClgHtgToCoolingCapRatio;           // ratio of clg/htg-mode evaporator capacity to cooling-mode evap. cap
     225              :         Real64 ClgHtgtoCogPowerRatio;             // ratio of clg/htg-mode evaporator power to cooling-mode evap. power
     226              :         Real64 RefCapClgHtg;                      // Reference clg/htg-mode evaporator capacity [W]
     227              :         Real64 RefCOPClgHtg;                      // Reference clg/htg-mode COP
     228              :         Real64 RefPowerClgHtg;                    // Reference clg/htg-mode evaporator power [W]
     229              :         Real64 TempRefEvapOutClgHtg;              // Reference clg/htg-mode evaporator leaving temperature [C]
     230              :         Real64 TempRefCondInClgHtg;               // Reference clg/htg-mode condenser entering temperature [C]
     231              :         Real64 TempRefCondOutClgHtg;              // Reference clg/htg-mode condenser leaving temperature [C]
     232              :         Real64 TempLowLimitEvapOut;               // Low temperature shut off [C]
     233              :         Real64 MaxPartLoadRatClgHtg;              // Maximum Part load ratio in simultaneous heating/cooling mode
     234              :         Real64 OptPartLoadRatClgHtg;              // Optimum Part load ratio in simultaneous heating/cooling mode
     235              :         Real64 MinPartLoadRatClgHtg;              // minimum Part load ratio in simultaneous heating/cooling mode
     236              :         CGSHPNodeData EvapInletNode;              // Chiller heater evaperator inlet node
     237              :         CGSHPNodeData EvapOutletNode;             // Chiller heater evaperator outlet node
     238              :         CGSHPNodeData CondInletNode;              // Chiller heater condenser inlet node
     239              :         CGSHPNodeData CondOutletNode;             // Chiller heater condenser outlet node
     240              :         Real64 EvapVolFlowRate;                   // Reference water volumetric flow rate through the evaporator [m3/s]
     241              :         bool EvapVolFlowRateWasAutoSized;         // true if evaporator flow rate was autosize on input
     242              :         Real64 tmpEvapVolFlowRate;                // temporary ref water vol flow rate for intermediate sizing [m3/s]
     243              :         Real64 CondVolFlowRate;                   // Reference water volumetric flow rate through the condenser [m3/s]
     244              :         bool CondVolFlowRateWasAutoSized;         // true if condenser flow rate was autosize on input
     245              :         Real64 tmpCondVolFlowRate;                // temporary ref water vol flow rate for intermediate sizing [m3/s]
     246              :         Real64 CondMassFlowRateMax;               // Reference water mass flow rate through condenser [kg/s]
     247              :         Real64 EvapMassFlowRateMax;               // Reference water mass flow rate through evaporator [kg/s]
     248              :         Real64 Evapmdot;                          // Evaporator mass flow rate [kg/s]
     249              :         Real64 Condmdot;                          // Condenser mass flow rate [kg/s]
     250              :         Real64 DesignHotWaterVolFlowRate;         // Design hot water volumetric flow rate through the condenser [m3/s]
     251              :         Real64 OpenMotorEff;                      // Open chiller motor efficiency [fraction, 0 to 1]
     252              :         Real64 SizFac;                            // sizing factor
     253              :         Real64 RefCap;                            // Reference evaporator capacity [W]
     254              :         Real64 RefCOP;                            // Reference COP
     255              :         Real64 TempRefEvapOut;                    // Reference evaporator leaving temperature [C]
     256              :         Real64 TempRefCondIn;                     // Reference condenser entering temperature [C]
     257              :         Real64 TempRefCondOut;                    // Reference condenser leaving temperature [C]
     258              :         Real64 OptPartLoadRat;                    // Optimal operating fraction of full load
     259              :         Real64 ChillerEIRFPLRMin;                 // Minimum value of PLR from EIRFPLR curve
     260              :         Real64 ChillerEIRFPLRMax;                 // Maximum value of PLR from EIRFPLR curve
     261              :         CHReportVars Report;
     262              : 
     263           13 :         ChillerHeaterSpecs()
     264           26 :             : ConstantFlow(false), VariableFlow(false), CoolSetPointSetToLoop(false), HeatSetPointSetToLoop(false), CoolSetPointErrDone(false),
     265           13 :               HeatSetPointErrDone(false), PossibleSubcooling(false), ChillerHeaterNum(1), condenserType(CondenserType::Invalid),
     266           13 :               ChillerCapFTCoolingIDX(0), ChillerEIRFTCoolingIDX(0), ChillerEIRFPLRCoolingIDX(0), ChillerCapFTHeatingIDX(0), ChillerEIRFTHeatingIDX(0),
     267           13 :               ChillerEIRFPLRHeatingIDX(0), ChillerCapFTIDX(0), ChillerEIRFTIDX(0), ChillerEIRFPLRIDX(0), EvapInletNodeNum(0), EvapOutletNodeNum(0),
     268           13 :               CondInletNodeNum(0), CondOutletNodeNum(0), ChillerCapFTError(0), ChillerCapFTErrorIndex(0), ChillerEIRFTError(0),
     269           13 :               ChillerEIRFTErrorIndex(0), ChillerEIRFPLRError(0), ChillerEIRFPLRErrorIndex(0), ChillerEIRRefTempErrorIndex(0), DeltaTErrCount(0),
     270           13 :               DeltaTErrCountIndex(0), CondMassFlowIndex(0), RefCapCooling(0.0), RefCapCoolingWasAutoSized(false), RefCOPCooling(0.0),
     271           13 :               TempRefEvapOutCooling(0.0), TempRefCondInCooling(0.0), TempRefCondOutCooling(0.0), MaxPartLoadRatCooling(0.0),
     272           13 :               OptPartLoadRatCooling(0.0), MinPartLoadRatCooling(0.0), ClgHtgToCoolingCapRatio(0.0), ClgHtgtoCogPowerRatio(0.0), RefCapClgHtg(0.0),
     273           13 :               RefCOPClgHtg(0.0), RefPowerClgHtg(0.0), TempRefEvapOutClgHtg(0.0), TempRefCondInClgHtg(0.0), TempRefCondOutClgHtg(0.0),
     274           26 :               TempLowLimitEvapOut(0.0), MaxPartLoadRatClgHtg(0.0), OptPartLoadRatClgHtg(0.0), MinPartLoadRatClgHtg(0.0), EvapVolFlowRate(0.0),
     275           13 :               EvapVolFlowRateWasAutoSized(false), tmpEvapVolFlowRate(0.0), CondVolFlowRate(0.0), CondVolFlowRateWasAutoSized(false),
     276           13 :               tmpCondVolFlowRate(0.0), CondMassFlowRateMax(0.0), EvapMassFlowRateMax(0.0), Evapmdot(0.0), Condmdot(0.0),
     277           13 :               DesignHotWaterVolFlowRate(0.0), OpenMotorEff(0.0), SizFac(0.0), RefCap(0.0), RefCOP(0.0), TempRefEvapOut(0.0), TempRefCondIn(0.0),
     278           13 :               TempRefCondOut(0.0), OptPartLoadRat(0.0), ChillerEIRFPLRMin(0.0), ChillerEIRFPLRMax(0.0)
     279              :         {
     280           13 :         }
     281              :     };
     282              : 
     283              :     struct WrapperReportVars
     284              :     {
     285              :         Real64 Power;                  // Wrapper power, W
     286              :         Real64 QCHW;                   // Chilled water heat transfer rate [W]
     287              :         Real64 QHW;                    // Hot Water heat transfer rate [W]
     288              :         Real64 QGLHE;                  // Geo-field heat transfer rate [W]
     289              :         Real64 TotElecCooling;         // Wrapper cooling electric consumption [J]
     290              :         Real64 TotElecHeating;         // Wrapper heating electric consumption [J]
     291              :         Real64 CoolingEnergy;          // Chilled water heat transfer energy [J]
     292              :         Real64 HeatingEnergy;          // Hot Water heat transfer energy [J]
     293              :         Real64 GLHEEnergy;             // Geo-field heat transfer energy [J]
     294              :         Real64 TotElecCoolingPwr;      // Wrapper cooling electric consumption rate [W]
     295              :         Real64 TotElecHeatingPwr;      // Wrapper heating electric consumption rate [W]
     296              :         Real64 CoolingRate;            // Chilled water heat transfer rate [W]
     297              :         Real64 HeatingRate;            // Hot Water heat transfer rate [W]
     298              :         Real64 GLHERate;               // Geo-field heat transfer rate [W]
     299              :         Real64 CHWInletTemp;           // Chilled water inlet temperature [C]
     300              :         Real64 HWInletTemp;            // Hot water inlet temperature [C]
     301              :         Real64 GLHEInletTemp;          // Geo-field inlet temperature [C]
     302              :         Real64 CHWOutletTemp;          // Chilled water Outlet temperature [C]
     303              :         Real64 HWOutletTemp;           // Hot water Outlet temperature [C]
     304              :         Real64 GLHEOutletTemp;         // Geo-field Outlet temperature [C]
     305              :         Real64 CHWmdot;                // Chilled water mass flow rate [kg/s]
     306              :         Real64 HWmdot;                 // Hot water mass flow rate [kg/s]
     307              :         Real64 GLHEmdot;               // Geo-field mass flow rate [kg/s]
     308              :         Real64 TotElecCoolingSimul;    // Wrapper cooling electric consumption [J]
     309              :         Real64 CoolingEnergySimul;     // Chilled water heat transfer energy [J]
     310              :         Real64 TotElecCoolingPwrSimul; // Wrapper cooling electric consumption rate [W]
     311              :         Real64 CoolingRateSimul;       // Chilled water heat transfer rate [W]
     312              :         Real64 CHWInletTempSimul;      // Chilled water inlet temperature [C]
     313              :         Real64 GLHEInletTempSimul;     // Geo-field inlet temperature [C]
     314              :         Real64 CHWOutletTempSimul;     // Chilled water Outlet temperature [C]
     315              :         Real64 GLHEOutletTempSimul;    // Geo-field Outlet temperature [C]
     316              :         Real64 CHWmdotSimul;           // Chilled water mass flow rate [kg/s]
     317              :         Real64 GLHEmdotSimul;          // Geo-field mass flow rate [kg/s]
     318              : 
     319           14 :         WrapperReportVars()
     320           14 :             : Power(0.0), QCHW(0.0), QHW(0.0), QGLHE(0.0), TotElecCooling(0.0), TotElecHeating(0.0), CoolingEnergy(0.0), HeatingEnergy(0.0),
     321           14 :               GLHEEnergy(0.0), TotElecCoolingPwr(0.0), TotElecHeatingPwr(0.0), CoolingRate(0.0), HeatingRate(0.0), GLHERate(0.0), CHWInletTemp(0.0),
     322           14 :               HWInletTemp(0.0), GLHEInletTemp(0.0), CHWOutletTemp(0.0), HWOutletTemp(0.0), GLHEOutletTemp(0.0), CHWmdot(0.0), HWmdot(0.0),
     323           14 :               GLHEmdot(0.0), TotElecCoolingSimul(0.0), CoolingEnergySimul(0.0), TotElecCoolingPwrSimul(0.0), CoolingRateSimul(0.0),
     324           14 :               CHWInletTempSimul(0.0), GLHEInletTempSimul(0.0), CHWOutletTempSimul(0.0), GLHEOutletTempSimul(0.0), CHWmdotSimul(0.0),
     325           14 :               GLHEmdotSimul(0.0)
     326              :         {
     327           14 :         }
     328              :     };
     329              : 
     330              :     struct WrapperSpecs : PlantComponent
     331              :     {
     332              :         std::string Name;                               // User identifier
     333              :         bool VariableFlowCH;                            // True if all chiller heaters are variable flow control
     334              :         Sched::Schedule *ancillaryPowerSched = nullptr; // Schedule value for ancillary power control
     335              :         Sched::Schedule *chSched = nullptr;             // Schedule value for individual chiller heater control
     336              :         CondenserType ControlMode;                      // SmartMixing or FullyMixing
     337              :         int CHWInletNodeNum;                            // Node number on the inlet side of the plant (Chilled Water side)
     338              :         int CHWOutletNodeNum;                           // Node number on the outlet side of the plant (Chilled Water side)
     339              :         int HWInletNodeNum;                             // Node number on the inlet side of the plant (Hot Water side)
     340              :         int HWOutletNodeNum;                            // Node number on the outlet side of the plant (Hot Water side)
     341              :         int GLHEInletNodeNum;                           // Node number on the inlet side of the plant (GLHE Water side)
     342              :         int GLHEOutletNodeNum;                          // Node number on the outlet side of the plant (GLHE Water side)
     343              :         int NumOfComp;                                  // Number of Components under the wrapper
     344              :         Real64 CHWMassFlowRate;                         // Chilled water mass flow rate
     345              :         Real64 HWMassFlowRate;                          // Hot water mass flow rate
     346              :         Real64 GLHEMassFlowRate;                        // Condenser water mass flow rate
     347              :         Real64 CHWMassFlowRateMax;                      // Maximum chilled water mass flow rate
     348              :         Real64 HWMassFlowRateMax;                       // Maximum hot water mass flow rate
     349              :         Real64 GLHEMassFlowRateMax;                     // Maximum condenser water mass flow rate
     350              :         Real64 WrapperCoolingLoad;                      // Cooling demand for the central heat pump system
     351              :         Real64 WrapperHeatingLoad;                      // Heating demand for the central heat pump system
     352              :         Real64 AncillaryPower;                          // Wrapper Ancillary Power
     353              :         Array1D<WrapperComponentSpecs> WrapperComp;
     354              :         Array1D<ChillerHeaterSpecs> ChillerHeater; // Dimension to number of machines
     355              :         bool CoolSetPointErrDone;                  // true if setpoint warning issued
     356              :         bool HeatSetPointErrDone;                  // true if setpoint warning issued
     357              :         bool CoolSetPointSetToLoop;                // True if the setpoint is missing at the outlet node
     358              :         bool HeatSetPointSetToLoop;                // True if the setpoint is missing at the outlet node
     359              :         int ChillerHeaterNums;                     // Total number of chiller heater units
     360              :         PlantLocation CWPlantLoc;                  // Chilled water plant loop component index
     361              :         PlantLocation HWPlantLoc;                  // Hot water plant loop component index
     362              :         PlantLocation GLHEPlantLoc;                // Geo-field water plant loop component index
     363              :         int CHWMassFlowIndex;                      // Chilled water flow index
     364              :         int HWMassFlowIndex;                       // Hot water flow index
     365              :         int GLHEMassFlowIndex;                     // Condenser side flow index
     366              :         Real64 SizingFactor;                       // Sizing factor to adjust the capacity
     367              :         Real64 CHWVolFlowRate;                     // Chilled water volume flow rate [kg/s]
     368              :         Real64 HWVolFlowRate;                      // Hot water volume flow rate [kg/s]
     369              :         Real64 GLHEVolFlowRate;                    // Geo-field volume flow rate [kg/s]
     370              :         bool MyWrapperFlag;
     371              :         bool MyWrapperEnvrnFlag;
     372              :         bool SimulClgDominant;
     373              :         bool SimulHtgDominant;
     374              :         WrapperReportVars Report;
     375              :         bool setupOutputVarsFlag;
     376              :         bool mySizesReported;
     377              : 
     378           14 :         WrapperSpecs()
     379           28 :             : VariableFlowCH(false), ControlMode(CondenserType::Invalid), CHWInletNodeNum(0), CHWOutletNodeNum(0), HWInletNodeNum(0),
     380           14 :               HWOutletNodeNum(0), GLHEInletNodeNum(0), GLHEOutletNodeNum(0), NumOfComp(0), CHWMassFlowRate(0.0), HWMassFlowRate(0.0),
     381           14 :               GLHEMassFlowRate(0.0), CHWMassFlowRateMax(0.0), HWMassFlowRateMax(0.0), GLHEMassFlowRateMax(0.0), WrapperCoolingLoad(0.0),
     382           28 :               WrapperHeatingLoad(0.0), AncillaryPower(0.0), CoolSetPointErrDone(false), HeatSetPointErrDone(false), CoolSetPointSetToLoop(false),
     383           14 :               HeatSetPointSetToLoop(false), ChillerHeaterNums(0), CWPlantLoc{}, HWPlantLoc{}, GLHEPlantLoc{}, CHWMassFlowIndex(0), HWMassFlowIndex(0),
     384           14 :               GLHEMassFlowIndex(0), SizingFactor(1.0), CHWVolFlowRate(0.0), HWVolFlowRate(0.0), GLHEVolFlowRate(0.0), MyWrapperFlag(true),
     385           28 :               MyWrapperEnvrnFlag(true), SimulClgDominant(false), SimulHtgDominant(false), setupOutputVarsFlag(true), mySizesReported(false)
     386              :         {
     387           14 :         }
     388              : 
     389              :         static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
     390              : 
     391              :         void getSizingFactor(Real64 &SizFac) override;
     392              : 
     393              :         void getDesignCapacities(
     394              :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     395              : 
     396              :         void setupOutputVars(EnergyPlusData &state);
     397              : 
     398              :         void initialize(EnergyPlusData &state,
     399              :                         Real64 MyLoad, // Demand Load
     400              :                         int LoopNum    // Loop Number Index
     401              :         );
     402              : 
     403              :         void simulate([[maybe_unused]] EnergyPlusData &state,
     404              :                       const PlantLocation &calledFromLocation,
     405              :                       bool FirstHVACIteration,
     406              :                       Real64 &CurLoad,
     407              :                       bool RunFlag) override;
     408              : 
     409              :         void SizeWrapper(EnergyPlusData &state);
     410              : 
     411              :         void CalcWrapperModel(EnergyPlusData &state, Real64 &MyLoad, int LoopNum);
     412              : 
     413              :         void CalcChillerModel(EnergyPlusData &state);
     414              : 
     415              :         void CalcChillerHeaterModel(EnergyPlusData &state);
     416              : 
     417              :         void adjustChillerHeaterCondFlowTemp(EnergyPlusData &state,
     418              :                                              Real64 &QCondenser,
     419              :                                              Real64 &CondMassFlowRate,
     420              :                                              Real64 &CondOutletTemp,
     421              :                                              Real64 const CondInletTemp,
     422              :                                              Real64 const CondDeltaTemp);
     423              : 
     424              :         void adjustChillerHeaterEvapFlowTemp(
     425              :             EnergyPlusData &state, Real64 const qEvaporator, Real64 &evapMassFlowRate, Real64 &evapOutletTemp, Real64 const evapInletTemp);
     426              : 
     427              :         Real64
     428              :         setChillerHeaterCondTemp(EnergyPlusData &state, int const numChillerHeater, Real64 const condEnteringTemp, Real64 const condLeavingTemp);
     429              : 
     430              :         Real64 calcChillerCapFT(EnergyPlusData &state, int const numChillerHeater, Real64 const evapOutletTemp, Real64 const condTemp);
     431              : 
     432              :         void checkEvapOutletTemp(EnergyPlusData &state,
     433              :                                  int const numChillerHeater,
     434              :                                  Real64 &evapOutletTemp,
     435              :                                  Real64 const lowTempLimitEout,
     436              :                                  Real64 evapInletTemp,
     437              :                                  Real64 &qEvaporator,
     438              :                                  Real64 const evapMassFlowRate,
     439              :                                  Real64 const Cp);
     440              : 
     441              :         void calcPLRAndCyclingRatio(EnergyPlusData &state,
     442              :                                     Real64 const availChillerCap,
     443              :                                     Real64 &actualPartLoadRatio,
     444              :                                     Real64 const minPartLoadRatio,
     445              :                                     Real64 const maxPartLoadRatio,
     446              :                                     Real64 const qEvaporator,
     447              :                                     Real64 &frac);
     448              : 
     449              :         void UpdateChillerHeaterRecords(EnergyPlusData &state);
     450              : 
     451              :         void UpdateChillerRecords(EnergyPlusData &state);
     452              : 
     453              :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
     454              : 
     455              :         void oneTimeInit_new(EnergyPlusData &state) override;
     456              : 
     457              :         void oneTimeInit(EnergyPlusData &state) override;
     458              :     };
     459              : 
     460              :     void GetWrapperInput(EnergyPlusData &state);
     461              : 
     462              :     void GetChillerHeaterInput(EnergyPlusData &state);
     463              : 
     464              : } // namespace PlantCentralGSHP
     465              : 
     466              : struct PlantCentralGSHPData : BaseGlobalStruct
     467              : {
     468              : 
     469              :     bool getWrapperInputFlag = true;   // When TRUE, calls subroutine to read input file.
     470              :     int numWrappers = 0;               // Number of Wrappers specified in input
     471              :     int numChillerHeaters = 0;         // Number of Chiller/heaters specified in input
     472              :     Real64 ChillerCapFT = 0.0;         // Chiller/heater capacity fraction (evaluated as a function of temperature)
     473              :     Real64 ChillerEIRFT = 0.0;         // Chiller/heater electric input ratio (EIR = 1 / COP) as a function of temperature
     474              :     Real64 ChillerEIRFPLR = 0.0;       // Chiller/heater EIR as a function of part-load ratio (PLR)
     475              :     Real64 ChillerPartLoadRatio = 0.0; // Chiller/heater part-load ratio (PLR)
     476              :     Real64 ChillerCyclingRatio = 0.0;  // Chiller/heater cycling ratio
     477              :     Real64 ChillerFalseLoadRate = 0.0; // Chiller/heater false load over and above the water-side load [W]
     478              :     EPVector<PlantCentralGSHP::WrapperSpecs> Wrapper;
     479              :     EPVector<PlantCentralGSHP::ChillerHeaterSpecs> ChillerHeater;
     480              : 
     481         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     482              :     {
     483         2126 :     }
     484              : 
     485         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     486              :     {
     487         1152 :     }
     488              : 
     489         2100 :     void clear_state() override
     490              :     {
     491         2100 :         this->getWrapperInputFlag = true;
     492         2100 :         this->numWrappers = 0;
     493         2100 :         this->numChillerHeaters = 0;
     494         2100 :         this->ChillerCapFT = 0.0;
     495         2100 :         this->ChillerEIRFT = 0.0;
     496         2100 :         this->ChillerEIRFPLR = 0.0;
     497         2100 :         this->ChillerPartLoadRatio = 0.0;
     498         2100 :         this->ChillerCyclingRatio = 0.0;
     499         2100 :         this->ChillerFalseLoadRate = 0.0;
     500         2100 :         this->Wrapper.deallocate();
     501         2100 :         this->ChillerHeater.deallocate();
     502         2100 :     }
     503              : };
     504              : 
     505              : } // namespace EnergyPlus
     506              : 
     507              : #endif
        

Generated by: LCOV version 2.0-1