LCOV - code coverage report
Current view: top level - EnergyPlus - HeatPumpWaterToWaterHEATING.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 0.0 % 371 0
Test Date: 2025-06-02 12:03:30 Functions: 0.0 % 11 0

            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              : // C++ Headers
      49              : #include <cmath>
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/string.functions.hh>
      53              : 
      54              : // EnergyPlus Headers
      55              : #include <EnergyPlus/BranchNodeConnections.hh>
      56              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      57              : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
      58              : #include <EnergyPlus/DataHVACGlobals.hh>
      59              : #include <EnergyPlus/DataLoopNode.hh>
      60              : #include <EnergyPlus/FluidProperties.hh>
      61              : #include <EnergyPlus/General.hh>
      62              : #include <EnergyPlus/HeatPumpWaterToWaterHEATING.hh>
      63              : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      64              : #include <EnergyPlus/NodeInputManager.hh>
      65              : #include <EnergyPlus/OutputProcessor.hh>
      66              : #include <EnergyPlus/Plant/DataPlant.hh>
      67              : #include <EnergyPlus/Plant/PlantLocation.hh>
      68              : #include <EnergyPlus/PlantUtilities.hh>
      69              : #include <EnergyPlus/UtilityRoutines.hh>
      70              : 
      71              : namespace EnergyPlus::HeatPumpWaterToWaterHEATING {
      72              : 
      73              : // Module containing the routines dealing with the Water to Water Heat Pump (Heating)
      74              : 
      75              : // MODULE INFORMATION:
      76              : //       AUTHOR         ARUN
      77              : //       DATE WRITTEN   7/18/2000
      78              : //       MODIFIED       ARUN: 6/27/2002: Cycle Time
      79              : //                      L Lawrie: V1.1.1 (5/20/2003) add meters and energy to several reporting variables
      80              : //                      L Lawrie: V1.1.1 (5/20/2003) restructure modules to comply with standard templates
      81              : //                      B. Griffith, Sept 2010, plant upgrades, generalize fluid properties
      82              : 
      83              : // PURPOSE OF THIS MODULE:
      84              : // This module simulates a water to Water Heat Pump (Heating)
      85              : 
      86              : // METHODOLOGY EMPLOYED:
      87              : // This simulation is based on a set of selected parameters,
      88              : // Which are obtained using Parameter Estimation technique.
      89              : 
      90              : // MODULE PARAMETER DEFINITIONS
      91              : std::string const ModuleCompName("HeatPump:WaterToWater:ParameterEstimation:Heating");
      92              : std::string const ModuleCompNameUC("HEATPUMP:WATERTOWATER:PARAMETERESTIMATION:HEATING");
      93              : std::string const GSHPRefrigerant("R22");
      94              : 
      95            0 : GshpPeHeatingSpecs *GshpPeHeatingSpecs::factory(EnergyPlusData &state, const std::string &objectName)
      96              : {
      97            0 :     if (state.dataHPWaterToWaterHtg->GetWWHPHeatingInput) {
      98            0 :         GetGshpInput(state);
      99            0 :         state.dataHPWaterToWaterHtg->GetWWHPHeatingInput = false;
     100              :     }
     101            0 :     auto thisObj = std::find_if(state.dataHPWaterToWaterHtg->GSHP.begin(),
     102            0 :                                 state.dataHPWaterToWaterHtg->GSHP.end(),
     103            0 :                                 [&objectName](const GshpPeHeatingSpecs &myObj) { return myObj.Name == objectName; });
     104            0 :     if (thisObj != state.dataHPWaterToWaterHtg->GSHP.end()) {
     105            0 :         return thisObj;
     106              :     }
     107              :     // If we didn't find it, fatal
     108              :     ShowFatalError(state, format("WWHPHeatingFactory: Error getting inputs for heat pump named: {}", objectName)); // LCOV_EXCL_LINE
     109              :     // Shut up the compiler
     110              :     return nullptr; // LCOV_EXCL_LINE
     111              : }
     112              : 
     113            0 : void GshpPeHeatingSpecs::simulate(
     114              :     EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, [[maybe_unused]] bool RunFlag)
     115              : {
     116              : 
     117              :     // Simulate the model for the Demand "MyLoad"
     118            0 :     if (calledFromLocation.loopNum == this->LoadPlantLoc.loopNum) { // chilled water loop
     119            0 :         this->initialize(state);
     120            0 :         this->calculate(state, CurLoad);
     121            0 :         this->update(state);
     122            0 :     } else if (calledFromLocation.loopNum == this->SourcePlantLoc.loopNum) { // condenser loop
     123            0 :         PlantUtilities::UpdateChillerComponentCondenserSide(state,
     124              :                                                             this->SourcePlantLoc.loopNum,
     125              :                                                             this->SourcePlantLoc.loopSideNum,
     126              :                                                             DataPlant::PlantEquipmentType::HPWaterEFHeating,
     127              :                                                             this->SourceSideInletNodeNum,
     128              :                                                             this->SourceSideOutletNodeNum,
     129            0 :                                                             -this->QSource,
     130              :                                                             this->SourceSideWaterInletTemp,
     131              :                                                             this->SourceSideWaterOutletTemp,
     132              :                                                             this->SourceSideWaterMassFlowRate,
     133              :                                                             FirstHVACIteration);
     134              :     } else {
     135            0 :         ShowFatalError(state, format("SimHPWatertoWaterHEATING:: Invalid loop connection {}, Requested Unit={}", ModuleCompName, this->Name));
     136              :     }
     137            0 : }
     138              : 
     139            0 : void GshpPeHeatingSpecs::getDesignCapacities([[maybe_unused]] EnergyPlusData &state,
     140              :                                              [[maybe_unused]] const PlantLocation &calledFromLocation,
     141              :                                              Real64 &MaxLoad,
     142              :                                              Real64 &MinLoad,
     143              :                                              Real64 &OptLoad)
     144              : {
     145            0 :     MinLoad = this->NomCap * this->MinPartLoadRat;
     146            0 :     MaxLoad = this->NomCap * this->MaxPartLoadRat;
     147            0 :     OptLoad = this->NomCap * this->OptPartLoadRat;
     148            0 : }
     149              : 
     150            0 : void GshpPeHeatingSpecs::onInitLoopEquip(EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation)
     151              : {
     152            0 :     if (this->plantScanFlag) {
     153              :         // Locate the heating on the plant loops for later usage
     154            0 :         bool errFlag = false;
     155            0 :         PlantUtilities::ScanPlantLoopsForObject(state,
     156              :                                                 this->Name,
     157              :                                                 DataPlant::PlantEquipmentType::HPWaterPEHeating,
     158            0 :                                                 this->SourcePlantLoc,
     159              :                                                 errFlag,
     160              :                                                 _,
     161              :                                                 _,
     162              :                                                 _,
     163            0 :                                                 this->SourceSideInletNodeNum,
     164              :                                                 _);
     165            0 :         PlantUtilities::ScanPlantLoopsForObject(
     166            0 :             state, this->Name, DataPlant::PlantEquipmentType::HPWaterPEHeating, this->LoadPlantLoc, errFlag, _, _, _, this->LoadSideInletNodeNum, _);
     167            0 :         if (errFlag) {
     168            0 :             ShowFatalError(state, "InitGshp: Program terminated due to previous condition(s).");
     169              :         }
     170              : 
     171            0 :         PlantUtilities::InterConnectTwoPlantLoopSides(state, this->LoadPlantLoc, this->SourcePlantLoc, this->WWHPPlantType, true);
     172            0 :         this->plantScanFlag = false;
     173              :     }
     174            0 : }
     175              : 
     176              : #pragma clang diagnostic push
     177              : #pragma ide diagnostic ignored "readability-magic-numbers"
     178            0 : void GetGshpInput(EnergyPlusData &state)
     179              : {
     180              :     //       SUBROUTINE INFORMATION:
     181              :     //       DATE WRITTEN:    April 1998
     182              : 
     183              :     // PURPOSE OF THIS SUBROUTINE:
     184              :     // This routine will get the input
     185              :     // required by the GSHP models.  As such
     186              :     // it will interact with the Input Scanner to retrieve
     187              :     // information from the input file, count the number of
     188              :     // GSHPs and begin to fill the
     189              :     // arrays associated with the type GSHP.
     190              : 
     191              :     static constexpr std::string_view routineName = "GetGshpInput";
     192              :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     193              :     int NumAlphas;                // Number of elements in the alpha array
     194              :     int NumNums;                  // Number of elements in the numeric array
     195              :     int IOStat;                   // IO Status when calling get input subroutine
     196            0 :     Array1D_string AlphArray(5);  // character string data
     197            0 :     Array1D<Real64> NumArray(23); // numeric data
     198              : 
     199            0 :     bool ErrorsFound(false);
     200              : 
     201            0 :     state.dataHPWaterToWaterHtg->NumGSHPs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, ModuleCompName);
     202              : 
     203            0 :     if (state.dataHPWaterToWaterHtg->NumGSHPs <= 0) {
     204            0 :         ShowSevereError(state, format("{}: No Equipment found", ModuleCompName));
     205            0 :         ErrorsFound = true;
     206              :     }
     207              : 
     208              :     // Allocate Arrays
     209            0 :     state.dataHPWaterToWaterHtg->GSHP.allocate(state.dataHPWaterToWaterHtg->NumGSHPs);
     210              : 
     211            0 :     for (int GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterHtg->NumGSHPs; ++GSHPNum) {
     212            0 :         auto &thisGSHP = state.dataHPWaterToWaterHtg->GSHP(GSHPNum);
     213            0 :         state.dataInputProcessing->inputProcessor->getObjectItem(state, ModuleCompNameUC, GSHPNum, AlphArray, NumAlphas, NumArray, NumNums, IOStat);
     214              : 
     215            0 :         ErrorObjectHeader eoh{routineName, ModuleCompNameUC, AlphArray(1)};
     216              : 
     217            0 :         thisGSHP.Name = AlphArray(1);
     218              : 
     219            0 :         thisGSHP.WWHPPlantType = DataPlant::PlantEquipmentType::HPWaterPEHeating;
     220              : 
     221            0 :         thisGSHP.COP = NumArray(1);
     222            0 :         if (NumArray(1) == 0.0) {
     223            0 :             ShowSevereError(state, format("{}:COP = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     224            0 :             ErrorsFound = true;
     225              :         }
     226              : 
     227              :         // zero values for NumArray 3 - 6 checked in input - idd
     228            0 :         thisGSHP.NomCap = NumArray(2);
     229              : 
     230            0 :         thisGSHP.MinPartLoadRat = NumArray(3);
     231              : 
     232            0 :         thisGSHP.MaxPartLoadRat = NumArray(4);
     233              : 
     234            0 :         thisGSHP.OptPartLoadRat = NumArray(5);
     235              : 
     236            0 :         thisGSHP.LoadSideVolFlowRate = NumArray(6);
     237            0 :         if (NumArray(6) == 0.0) {
     238            0 :             ShowSevereError(state, format("{}:Load Side Flow Rate = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     239            0 :             ErrorsFound = true;
     240              :         }
     241              : 
     242            0 :         thisGSHP.SourceSideVolFlowRate = NumArray(7);
     243            0 :         if (NumArray(7) == 0.0) {
     244            0 :             ShowSevereError(state, format("{}:Source Side Flow Rate = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     245            0 :             ErrorsFound = true;
     246              :         }
     247              : 
     248            0 :         thisGSHP.LoadSideUACoeff = NumArray(8);
     249            0 :         if (NumArray(8) == 0.0) {
     250            0 :             ShowSevereError(state, format("{}:Load Side Heat Transfer Coeffcient = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     251            0 :             ErrorsFound = true;
     252              :         }
     253              : 
     254            0 :         thisGSHP.SourceSideUACoeff = NumArray(9);
     255            0 :         if (NumArray(9) == 0.0) {
     256            0 :             ShowSevereError(state, format("{}:Source Side Heat Transfer Coeffcient = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     257            0 :             ErrorsFound = true;
     258              :         }
     259              : 
     260            0 :         thisGSHP.CompPistonDisp = NumArray(10);
     261            0 :         if (NumArray(10) == 0.0) {
     262            0 :             ShowSevereError(state, format("{}:Compressor Piston displacement/Storke = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     263            0 :             ErrorsFound = true;
     264              :         }
     265              : 
     266            0 :         thisGSHP.CompClearanceFactor = NumArray(11);
     267            0 :         if (NumArray(11) == 0.0) {
     268            0 :             ShowSevereError(state, format("{}:Compressor Clearance Factor = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     269            0 :             ErrorsFound = true;
     270              :         }
     271              : 
     272            0 :         thisGSHP.CompSucPressDrop = NumArray(12);
     273            0 :         if (NumArray(12) == 0.0) {
     274            0 :             ShowSevereError(state, format("{}: Pressure Drop = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     275            0 :             ErrorsFound = true;
     276              :         }
     277              : 
     278            0 :         thisGSHP.SuperheatTemp = NumArray(13);
     279            0 :         if (NumArray(13) == 0.0) {
     280            0 :             ShowSevereError(state, format("{}:Source Side SuperHeat = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     281            0 :             ErrorsFound = true;
     282              :         }
     283              : 
     284            0 :         thisGSHP.PowerLosses = NumArray(14);
     285            0 :         if (NumArray(14) == 0.0) {
     286            0 :             ShowSevereError(state, format("{}:Compressor Power Loss = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     287            0 :             ErrorsFound = true;
     288              :         }
     289            0 :         thisGSHP.LossFactor = NumArray(15);
     290            0 :         if (NumArray(15) == 0.0) {
     291            0 :             ShowSevereError(state, format("{}:Efficiency = 0.0, Heatpump={}", ModuleCompName, thisGSHP.Name));
     292            0 :             ErrorsFound = true;
     293              :         }
     294              : 
     295            0 :         thisGSHP.HighPressCutoff = NumArray(16);
     296            0 :         if (NumArray(16) == 0.0) {
     297            0 :             thisGSHP.HighPressCutoff = 500000000.0;
     298              :         }
     299              : 
     300            0 :         thisGSHP.LowPressCutoff = NumArray(17);
     301            0 :         if (NumArray(17) == 0.0) {
     302            0 :             thisGSHP.LowPressCutoff = 0.0;
     303              :         }
     304              : 
     305            0 :         thisGSHP.SourceSideInletNodeNum = GetOnlySingleNode(state,
     306            0 :                                                             AlphArray(2),
     307              :                                                             ErrorsFound,
     308              :                                                             DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterParameterEstimationHeating,
     309            0 :                                                             thisGSHP.Name,
     310              :                                                             DataLoopNode::NodeFluidType::Water,
     311              :                                                             DataLoopNode::ConnectionType::Inlet,
     312              :                                                             NodeInputManager::CompFluidStream::Primary,
     313              :                                                             DataLoopNode::ObjectIsNotParent);
     314              : 
     315            0 :         thisGSHP.SourceSideOutletNodeNum = GetOnlySingleNode(state,
     316            0 :                                                              AlphArray(3),
     317              :                                                              ErrorsFound,
     318              :                                                              DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterParameterEstimationHeating,
     319            0 :                                                              thisGSHP.Name,
     320              :                                                              DataLoopNode::NodeFluidType::Water,
     321              :                                                              DataLoopNode::ConnectionType::Outlet,
     322              :                                                              NodeInputManager::CompFluidStream::Primary,
     323              :                                                              DataLoopNode::ObjectIsNotParent);
     324              : 
     325            0 :         thisGSHP.LoadSideInletNodeNum = GetOnlySingleNode(state,
     326            0 :                                                           AlphArray(4),
     327              :                                                           ErrorsFound,
     328              :                                                           DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterParameterEstimationHeating,
     329            0 :                                                           thisGSHP.Name,
     330              :                                                           DataLoopNode::NodeFluidType::Water,
     331              :                                                           DataLoopNode::ConnectionType::Inlet,
     332              :                                                           NodeInputManager::CompFluidStream::Secondary,
     333              :                                                           DataLoopNode::ObjectIsNotParent);
     334              : 
     335            0 :         thisGSHP.LoadSideOutletNodeNum = GetOnlySingleNode(state,
     336            0 :                                                            AlphArray(5),
     337              :                                                            ErrorsFound,
     338              :                                                            DataLoopNode::ConnectionObjectType::HeatPumpWaterToWaterParameterEstimationHeating,
     339            0 :                                                            thisGSHP.Name,
     340              :                                                            DataLoopNode::NodeFluidType::Water,
     341              :                                                            DataLoopNode::ConnectionType::Outlet,
     342              :                                                            NodeInputManager::CompFluidStream::Secondary,
     343              :                                                            DataLoopNode::ObjectIsNotParent);
     344              : 
     345              :         // Test node sets
     346            0 :         BranchNodeConnections::TestCompSet(state, ModuleCompNameUC, thisGSHP.Name, AlphArray(2), AlphArray(3), "Condenser Water Nodes");
     347            0 :         BranchNodeConnections::TestCompSet(state, ModuleCompNameUC, thisGSHP.Name, AlphArray(4), AlphArray(5), "Hot Water Nodes");
     348              : 
     349              :         // save the design source side flow rate for use by plant loop sizing algorithms
     350            0 :         PlantUtilities::RegisterPlantCompDesignFlow(state, thisGSHP.SourceSideInletNodeNum, 0.5 * thisGSHP.SourceSideVolFlowRate);
     351              : 
     352            0 :         if ((thisGSHP.refrig = Fluid::GetRefrig(state, GSHPRefrigerant)) == nullptr) {
     353            0 :             ShowSevereItemNotFound(state, eoh, "Refrigerant", GSHPRefrigerant);
     354            0 :             ErrorsFound = true;
     355              :         }
     356              :     }
     357              : 
     358            0 :     if (ErrorsFound) {
     359            0 :         ShowFatalError(state, format("Errors Found in getting {} Input", ModuleCompNameUC));
     360              :     }
     361              : 
     362              :     // CurrentModuleObject='HeatPump:WaterToWater:ParameterEstimation:Heating'
     363            0 :     for (int GSHPNum = 1; GSHPNum <= state.dataHPWaterToWaterHtg->NumGSHPs; ++GSHPNum) {
     364            0 :         auto &thisGSHP = state.dataHPWaterToWaterHtg->GSHP(GSHPNum);
     365            0 :         SetupOutputVariable(state,
     366              :                             "Heat Pump Electricity Rate",
     367              :                             Constant::Units::W,
     368            0 :                             thisGSHP.Power,
     369              :                             OutputProcessor::TimeStepType::System,
     370              :                             OutputProcessor::StoreType::Average,
     371            0 :                             thisGSHP.Name);
     372            0 :         SetupOutputVariable(state,
     373              :                             "Heat Pump Electricity Energy",
     374              :                             Constant::Units::J,
     375            0 :                             thisGSHP.Energy,
     376              :                             OutputProcessor::TimeStepType::System,
     377              :                             OutputProcessor::StoreType::Sum,
     378            0 :                             thisGSHP.Name,
     379              :                             Constant::eResource::Electricity,
     380              :                             OutputProcessor::Group::Plant,
     381              :                             OutputProcessor::EndUseCat::Heating);
     382              : 
     383            0 :         SetupOutputVariable(state,
     384              :                             "Heat Pump Load Side Heat Transfer Rate",
     385              :                             Constant::Units::W,
     386            0 :                             thisGSHP.QLoad,
     387              :                             OutputProcessor::TimeStepType::System,
     388              :                             OutputProcessor::StoreType::Average,
     389            0 :                             thisGSHP.Name);
     390            0 :         SetupOutputVariable(state,
     391              :                             "Heat Pump Load Side Heat Transfer Energy",
     392              :                             Constant::Units::J,
     393            0 :                             thisGSHP.QLoadEnergy,
     394              :                             OutputProcessor::TimeStepType::System,
     395              :                             OutputProcessor::StoreType::Sum,
     396            0 :                             thisGSHP.Name);
     397              : 
     398            0 :         SetupOutputVariable(state,
     399              :                             "Heat Pump Source Side Heat Transfer Rate",
     400              :                             Constant::Units::W,
     401            0 :                             thisGSHP.QSource,
     402              :                             OutputProcessor::TimeStepType::System,
     403              :                             OutputProcessor::StoreType::Average,
     404            0 :                             thisGSHP.Name);
     405            0 :         SetupOutputVariable(state,
     406              :                             "Heat Pump Source Side Heat Transfer Energy",
     407              :                             Constant::Units::J,
     408            0 :                             thisGSHP.QSourceEnergy,
     409              :                             OutputProcessor::TimeStepType::System,
     410              :                             OutputProcessor::StoreType::Sum,
     411            0 :                             thisGSHP.Name);
     412              : 
     413            0 :         SetupOutputVariable(state,
     414              :                             "Heat Pump Load Side Outlet Temperature",
     415              :                             Constant::Units::C,
     416            0 :                             thisGSHP.LoadSideWaterOutletTemp,
     417              :                             OutputProcessor::TimeStepType::System,
     418              :                             OutputProcessor::StoreType::Average,
     419            0 :                             thisGSHP.Name);
     420            0 :         SetupOutputVariable(state,
     421              :                             "Heat Pump Load Side Inlet Temperature",
     422              :                             Constant::Units::C,
     423            0 :                             thisGSHP.LoadSideWaterInletTemp,
     424              :                             OutputProcessor::TimeStepType::System,
     425              :                             OutputProcessor::StoreType::Average,
     426            0 :                             thisGSHP.Name);
     427            0 :         SetupOutputVariable(state,
     428              :                             "Heat Pump Source Side Outlet Temperature",
     429              :                             Constant::Units::C,
     430            0 :                             thisGSHP.SourceSideWaterOutletTemp,
     431              :                             OutputProcessor::TimeStepType::System,
     432              :                             OutputProcessor::StoreType::Average,
     433            0 :                             thisGSHP.Name);
     434            0 :         SetupOutputVariable(state,
     435              :                             "Heat Pump Source Side Inlet Temperature",
     436              :                             Constant::Units::C,
     437            0 :                             thisGSHP.SourceSideWaterInletTemp,
     438              :                             OutputProcessor::TimeStepType::System,
     439              :                             OutputProcessor::StoreType::Average,
     440            0 :                             thisGSHP.Name);
     441            0 :         SetupOutputVariable(state,
     442              :                             "Heat Pump Load Side Mass Flow Rate",
     443              :                             Constant::Units::kg_s,
     444            0 :                             thisGSHP.LoadSideWaterMassFlowRate,
     445              :                             OutputProcessor::TimeStepType::System,
     446              :                             OutputProcessor::StoreType::Average,
     447            0 :                             thisGSHP.Name);
     448            0 :         SetupOutputVariable(state,
     449              :                             "Heat Pump Source Side Mass Flow Rate",
     450              :                             Constant::Units::kg_s,
     451            0 :                             thisGSHP.SourceSideWaterMassFlowRate,
     452              :                             OutputProcessor::TimeStepType::System,
     453              :                             OutputProcessor::StoreType::Average,
     454            0 :                             thisGSHP.Name);
     455              :     }
     456            0 : }
     457              : #pragma clang diagnostic pop
     458              : 
     459            0 : void GshpPeHeatingSpecs::initialize(EnergyPlusData &state)
     460              : {
     461              : 
     462              :     // SUBROUTINE INFORMATION:
     463              :     //       AUTHOR:          Dan Fisher
     464              :     //       DATE WRITTEN:    July 2007
     465              : 
     466              :     // SUBROUTINE PARAMETER DEFINITIONS:
     467              :     static constexpr std::string_view RoutineName("InitGshp");
     468              : 
     469              :     // For each new environment
     470            0 :     if (state.dataGlobal->BeginEnvrnFlag && this->beginEnvironFlag) {
     471            0 :         this->QLoad = 0.0;
     472            0 :         this->QSource = 0.0;
     473            0 :         this->Power = 0.0;
     474            0 :         this->QLoadEnergy = 0.0;
     475            0 :         this->QSourceEnergy = 0.0;
     476            0 :         this->Energy = 0.0;
     477            0 :         this->LoadSideWaterInletTemp = 0.0;
     478            0 :         this->SourceSideWaterInletTemp = 0.0;
     479            0 :         this->LoadSideWaterOutletTemp = 0.0;
     480            0 :         this->SourceSideWaterOutletTemp = 0.0;
     481            0 :         this->SourceSideWaterMassFlowRate = 0.0;
     482            0 :         this->LoadSideWaterMassFlowRate = 0.0;
     483            0 :         this->IsOn = false;
     484            0 :         this->MustRun = true;
     485              : 
     486            0 :         this->beginEnvironFlag = false;
     487            0 :         Real64 rho = state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
     488            0 :         this->LoadSideDesignMassFlow = this->LoadSideVolFlowRate * rho;
     489              : 
     490            0 :         PlantUtilities::InitComponentNodes(state, 0.0, this->LoadSideDesignMassFlow, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum);
     491              : 
     492            0 :         rho = state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
     493            0 :         this->SourceSideDesignMassFlow = this->SourceSideVolFlowRate * rho;
     494              : 
     495            0 :         PlantUtilities::InitComponentNodes(state, 0.0, this->SourceSideDesignMassFlow, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum);
     496            0 :         if (state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).TempSetPoint == DataLoopNode::SensedNodeFlagValue) {
     497            0 :             state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).TempSetPoint = 0.0;
     498              :         }
     499            0 :         state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp = state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).TempSetPoint + 30.0;
     500              :     }
     501              : 
     502            0 :     if (!state.dataGlobal->BeginEnvrnFlag) {
     503            0 :         this->beginEnvironFlag = true;
     504              :     }
     505              : 
     506              :     // On every call
     507            0 :     this->Running = 0;
     508            0 :     this->MustRun = true;                    // Reset MustRun Flag to TRUE
     509            0 :     this->LoadSideWaterMassFlowRate = 0.0;   // Load Side mass flow rate, water side
     510            0 :     this->SourceSideWaterMassFlowRate = 0.0; // Source Side mass flow rate, water side
     511            0 :     this->Power = 0.0;                       // power consumption
     512            0 :     this->QLoad = 0.0;                       // heat rejection from Load Side coil
     513            0 :     this->QSource = 0.0;
     514            0 : }
     515              : 
     516            0 : void GshpPeHeatingSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad)
     517              : {
     518              :     // SUBROUTINE INFORMATION:
     519              :     //       AUTHOR
     520              :     //       DATE WRITTEN   Sept. 1998
     521              :     //       MODIFIED       April 1999
     522              :     //                      September 2002, SJR
     523              :     //       RE-ENGINEERED  Mar2000
     524              : 
     525              :     // SUBROUTINE PARAMETER DEFINITIONS:
     526            0 :     constexpr Real64 gamma(1.114); // Expansion Coefficient
     527            0 :     constexpr Real64 HeatBalTol(0.0005);
     528            0 :     constexpr Real64 RelaxParam(0.6);
     529            0 :     constexpr Real64 SmallNum(1.0e-20);
     530            0 :     constexpr int IterationLimit(500);
     531            0 :     constexpr const char *RoutineName("CalcGshpModel");
     532            0 :     constexpr const char *RoutineNameLoadSideTemp("CalcGSHPModel:LoadSideTemp");
     533            0 :     constexpr const char *RoutineNameSourceSideTemp("CalcGSHPModel:SourceSideTemp");
     534            0 :     constexpr const char *RoutineNameCompressInletTemp("CalcGSHPModel:CompressInletTemp");
     535            0 :     constexpr const char *RoutineNameSuctionPr("CalcGSHPModel:SuctionPr");
     536            0 :     constexpr const char *RoutineNameCompSuctionTemp("CalcGSHPModel:CompSuctionTemp");
     537              : 
     538              :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     539              :     Real64 CompSuctionTemp;
     540              :     Real64 CompSuctionEnth;
     541              :     Real64 CompSuctionDensity;
     542              :     Real64 CompSuctionSatTemp;
     543              :     Real64 DutyFactor;
     544              : 
     545            0 :     if (MyLoad > 0.0) {
     546            0 :         this->MustRun = true;
     547            0 :         this->IsOn = true;
     548              :     } else {
     549            0 :         this->MustRun = false;
     550            0 :         this->IsOn = false;
     551              :     }
     552            0 :     this->LoadSideWaterInletTemp = state.dataLoopNodes->Node(this->LoadSideInletNodeNum).Temp;
     553            0 :     this->SourceSideWaterInletTemp = state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp;
     554              : 
     555              :     //*******Set flow based on "run" flags**********
     556              :     // Set flows if the heat pump is not running
     557            0 :     if (!this->MustRun) {
     558            0 :         this->LoadSideWaterMassFlowRate = 0.0;
     559            0 :         PlantUtilities::SetComponentFlowRate(
     560            0 :             state, this->LoadSideWaterMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc);
     561            0 :         this->SourceSideWaterMassFlowRate = 0.0;
     562            0 :         PlantUtilities::SetComponentFlowRate(
     563            0 :             state, this->SourceSideWaterMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc);
     564            0 :         PlantUtilities::PullCompInterconnectTrigger(state,
     565            0 :                                                     this->LoadPlantLoc,
     566            0 :                                                     this->CondMassFlowIndex,
     567            0 :                                                     this->SourcePlantLoc,
     568              :                                                     DataPlant::CriteriaType::MassFlowRate,
     569              :                                                     this->SourceSideWaterMassFlowRate);
     570              :         // now initialize simulation variables for "heat pump off"
     571            0 :         this->LoadSideWaterOutletTemp = this->LoadSideWaterInletTemp;
     572            0 :         this->SourceSideWaterOutletTemp = this->SourceSideWaterInletTemp;
     573            0 :         return; // if heat pump is not running return without simulation, power, Q already zeroed in init
     574              :     } else {    // the heat pump must run, request design flow
     575              : 
     576            0 :         this->LoadSideWaterMassFlowRate = this->LoadSideDesignMassFlow;
     577            0 :         PlantUtilities::SetComponentFlowRate(
     578            0 :             state, this->LoadSideWaterMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc);
     579              : 
     580            0 :         this->SourceSideWaterMassFlowRate = this->SourceSideDesignMassFlow;
     581            0 :         PlantUtilities::SetComponentFlowRate(
     582            0 :             state, this->SourceSideWaterMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc);
     583              :         // if there's no flow, turn the "heat pump off"
     584            0 :         if (this->LoadSideWaterMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance ||
     585            0 :             this->SourceSideWaterMassFlowRate < DataBranchAirLoopPlant::MassFlowTolerance) {
     586            0 :             this->LoadSideWaterMassFlowRate = 0.0;
     587            0 :             PlantUtilities::SetComponentFlowRate(
     588            0 :                 state, this->LoadSideWaterMassFlowRate, this->LoadSideInletNodeNum, this->LoadSideOutletNodeNum, this->LoadPlantLoc);
     589            0 :             this->SourceSideWaterMassFlowRate = 0.0;
     590            0 :             PlantUtilities::SetComponentFlowRate(
     591            0 :                 state, this->SourceSideWaterMassFlowRate, this->SourceSideInletNodeNum, this->SourceSideOutletNodeNum, this->SourcePlantLoc);
     592            0 :             PlantUtilities::PullCompInterconnectTrigger(state,
     593            0 :                                                         this->LoadPlantLoc,
     594            0 :                                                         this->CondMassFlowIndex,
     595            0 :                                                         this->SourcePlantLoc,
     596              :                                                         DataPlant::CriteriaType::MassFlowRate,
     597              :                                                         this->SourceSideWaterMassFlowRate);
     598            0 :             this->LoadSideWaterOutletTemp = this->LoadSideWaterInletTemp;
     599            0 :             this->SourceSideWaterOutletTemp = this->SourceSideWaterInletTemp;
     600            0 :             return;
     601              :         }
     602            0 :         PlantUtilities::PullCompInterconnectTrigger(state,
     603            0 :                                                     this->LoadPlantLoc,
     604            0 :                                                     this->CondMassFlowIndex,
     605            0 :                                                     this->SourcePlantLoc,
     606              :                                                     DataPlant::CriteriaType::MassFlowRate,
     607              :                                                     this->SourceSideWaterMassFlowRate);
     608              :     }
     609              : 
     610              :     //***********BEGIN CALCULATION****************
     611              :     // initialize the source and load side heat transfer rates for the simulation
     612            0 :     Real64 initialQSource = 0.0;
     613            0 :     Real64 initialQLoad = 0.0;
     614            0 :     int IterationCount = 0;
     615              : 
     616              :     Real64 CpSourceSide =
     617            0 :         state.dataPlnt->PlantLoop(this->SourcePlantLoc.loopNum).glycol->getSpecificHeat(state, this->SourceSideWaterInletTemp, RoutineName);
     618              : 
     619              :     Real64 CpLoadSide =
     620            0 :         state.dataPlnt->PlantLoop(this->LoadPlantLoc.loopNum).glycol->getSpecificHeat(state, this->LoadSideWaterInletTemp, RoutineName);
     621              : 
     622              :     // Determine effectiveness of Source Side (the Evaporator in heating mode)
     623            0 :     Real64 SourceSideEffect = 1.0 - std::exp(-this->SourceSideUACoeff / (CpSourceSide * this->SourceSideWaterMassFlowRate));
     624              :     // Determine effectiveness of Load Side the condenser in heating mode
     625            0 :     Real64 LoadSideEffect = 1.0 - std::exp(-this->LoadSideUACoeff / (CpLoadSide * this->LoadSideWaterMassFlowRate));
     626              : 
     627              :     while (true) { // main loop to solve model equations
     628            0 :         ++IterationCount;
     629              :         // Determine Source Side temperature
     630            0 :         Real64 SourceSideTemp =
     631            0 :             this->SourceSideWaterInletTemp - initialQSource / (SourceSideEffect * CpSourceSide * this->SourceSideWaterMassFlowRate);
     632              : 
     633              :         // To determine Load Side temperature condenser
     634            0 :         Real64 LoadSideTemp = this->LoadSideWaterInletTemp + initialQLoad / (LoadSideEffect * CpLoadSide * this->LoadSideWaterMassFlowRate);
     635              : 
     636              :         // Determine the evaporating and condensing pressures
     637            0 :         Real64 SourceSidePressure = this->refrig->getSatPressure(state, SourceSideTemp, RoutineNameSourceSideTemp);
     638            0 :         Real64 LoadSidePressure = this->refrig->getSatPressure(state, LoadSideTemp, RoutineNameLoadSideTemp);
     639              : 
     640              :         // check cutoff pressures
     641            0 :         if (SourceSidePressure < this->LowPressCutoff) {
     642            0 :             ShowSevereError(state, format("{}=\"{}\" Heating Source Side Pressure Less than the Design Minimum", ModuleCompName, this->Name));
     643            0 :             ShowContinueError(
     644              :                 state,
     645            0 :                 format("Source Side Pressure={:.2T} and user specified Design Minimum Pressure={:.2T}", SourceSidePressure, this->LowPressCutoff));
     646            0 :             ShowFatalError(state, "Preceding Conditions cause termination.");
     647              :         }
     648            0 :         if (LoadSidePressure > this->HighPressCutoff) {
     649            0 :             ShowSevereError(state, format("{}=\"{}\" Heating Load Side Pressure greater than the Design Maximum", ModuleCompName, this->Name));
     650            0 :             ShowContinueError(
     651              :                 state,
     652            0 :                 format("Load Side Pressure={:.2T} and user specified Design Maximum Pressure={:.2T}", LoadSidePressure, this->HighPressCutoff));
     653            0 :             ShowFatalError(state, "Preceding Conditions cause termination.");
     654              :         }
     655              : 
     656              :         // Determine Suction Pressure at compressor inlet
     657            0 :         Real64 SuctionPr = SourceSidePressure - this->CompSucPressDrop;
     658              :         // Determine Discharge Pressure at compressor exit
     659            0 :         Real64 DischargePr = LoadSidePressure + this->CompSucPressDrop;
     660              :         // check cutoff pressures
     661            0 :         if (SuctionPr < this->LowPressCutoff) {
     662            0 :             ShowSevereError(state, format("{}=\"{}\" Heating Suction Pressure Less than the Design Minimum", ModuleCompName, this->Name));
     663            0 :             ShowContinueError(
     664            0 :                 state, format("Heating Suction Pressure={:.2T} and user specified Design Minimum Pressure={:.2T}", SuctionPr, this->LowPressCutoff));
     665            0 :             ShowFatalError(state, "Preceding Conditions cause termination.");
     666              :         }
     667            0 :         if (DischargePr > this->HighPressCutoff) {
     668            0 :             ShowSevereError(state, format("{}=\"{}\" Heating Discharge Pressure greater than the Design Maximum", ModuleCompName, this->Name));
     669            0 :             ShowContinueError(
     670              :                 state,
     671            0 :                 format("Heating Discharge Pressure={:.2T} and user specified Design Maximum Pressure={:.2T}", DischargePr, this->HighPressCutoff));
     672            0 :             ShowFatalError(state, "Preceding Conditions cause termination.");
     673              :         }
     674              : 
     675              :         // Determine the Source Side Outlet Enthalpy
     676            0 :         Real64 qualOne = 1.0;
     677            0 :         Real64 SourceSideOutletEnth = this->refrig->getSatEnthalpy(state, SourceSideTemp, qualOne, RoutineNameSourceSideTemp);
     678              : 
     679              :         // Determine Load Side Outlet Enthalpy
     680            0 :         Real64 qualZero = 0.0;
     681            0 :         Real64 LoadSideOutletEnth = this->refrig->getSatEnthalpy(state, LoadSideTemp, qualZero, RoutineNameLoadSideTemp);
     682              : 
     683              :         // Determine superheated temperature of the Source Side outlet/compressor inlet
     684            0 :         Real64 CompressInletTemp = SourceSideTemp + this->SuperheatTemp;
     685              :         // Determine the enathalpy of the super heated fluid at Source Side outlet
     686            0 :         Real64 SuperHeatEnth = this->refrig->getSupHeatEnthalpy(state, CompressInletTemp, SourceSidePressure, RoutineNameCompressInletTemp);
     687              : 
     688              :         // Determining the suction state of the fluid from inlet state involves interation
     689              :         // Method employed...
     690              :         // Determine the saturated temp at suction pressure, shoot out into the superheated region find the enthalpy
     691              :         // check that with the inlet enthalpy ( as suction loss is isenthalpic). Iterate till desired accuracy is reached
     692              : 
     693            0 :         CompSuctionSatTemp = this->refrig->getSatTemperature(state, SuctionPr, RoutineNameSuctionPr);
     694              : 
     695            0 :         Real64 T110 = CompSuctionSatTemp;
     696              :         // Shoot into the super heated region
     697            0 :         Real64 T111 = CompSuctionSatTemp + 80;
     698              : 
     699              :         // Iterate to find the Suction State - given suction pressure and superheat enthalpy
     700              :         while (true) {
     701            0 :             CompSuctionTemp = 0.5 * (T110 + T111);
     702              : 
     703            0 :             CompSuctionEnth = this->refrig->getSupHeatEnthalpy(state, CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp);
     704            0 :             if (std::abs(CompSuctionEnth - SuperHeatEnth) / SuperHeatEnth < 0.0001) {
     705            0 :                 break;
     706              :             }
     707              : 
     708            0 :             if (CompSuctionEnth < SuperHeatEnth) {
     709            0 :                 T110 = CompSuctionTemp;
     710              :             } else {
     711            0 :                 T111 = CompSuctionTemp;
     712              :             }
     713              :         }
     714              : 
     715              :         // Determine the Mass flow rate of refrigerant
     716            0 :         CompSuctionDensity = this->refrig->getSupHeatDensity(state, CompSuctionTemp, SuctionPr, RoutineNameCompSuctionTemp);
     717            0 :         Real64 MassRef = this->CompPistonDisp * CompSuctionDensity *
     718            0 :                          (1.0 + this->CompClearanceFactor - this->CompClearanceFactor * std::pow(DischargePr / SuctionPr, 1.0 / gamma));
     719              : 
     720              :         // Find the  Source Side Heat Transfer
     721            0 :         this->QSource = MassRef * (SourceSideOutletEnth - LoadSideOutletEnth);
     722              : 
     723              :         // Determine the theoretical power
     724            0 :         this->Power = this->PowerLosses + (MassRef * gamma / (gamma - 1) * SuctionPr / CompSuctionDensity / this->LossFactor *
     725            0 :                                            (std::pow(DischargePr / SuctionPr, (gamma - 1) / gamma) - 1));
     726              : 
     727              :         // Determine the Loadside HeatRate (QLoad)
     728            0 :         this->QLoad = this->Power + this->QSource;
     729              : 
     730              :         // convergence and iteration limit check
     731            0 :         if (std::abs((this->QLoad - initialQLoad) / (initialQLoad + SmallNum)) < HeatBalTol || IterationCount > IterationLimit) {
     732            0 :             if (IterationCount > IterationLimit) {
     733            0 :                 ShowWarningError(state, format("{} did not converge", ModuleCompName));
     734            0 :                 ShowContinueErrorTimeStamp(state, "");
     735            0 :                 ShowContinueError(state, format("Heatpump Name = {}", this->Name));
     736            0 :                 ShowContinueError(
     737              :                     state,
     738            0 :                     format("Heat Inbalance (%)             = {:S}", std::abs(100.0 * (this->QLoad - initialQLoad) / (initialQLoad + SmallNum))));
     739            0 :                 ShowContinueError(state, format("Load-side heat transfer rate   = {:S}", this->QLoad));
     740            0 :                 ShowContinueError(state, format("Source-side heat transfer rate = {:S}", this->QSource));
     741            0 :                 ShowContinueError(state, format("Source-side mass flow rate     = {:S}", this->SourceSideWaterMassFlowRate));
     742            0 :                 ShowContinueError(state, format("Load-side mass flow rate       = {:S}", this->LoadSideWaterMassFlowRate));
     743            0 :                 ShowContinueError(state, format("Source-side inlet temperature  = {:S}", this->SourceSideWaterInletTemp));
     744            0 :                 ShowContinueError(state, format("Load-side inlet temperature    = {:S}", this->LoadSideWaterInletTemp));
     745              :             }
     746            0 :             goto LOOPLoadEnth_exit;
     747              : 
     748              :         } else { // update load
     749            0 :             initialQLoad += RelaxParam * (this->QLoad - initialQLoad);
     750            0 :             initialQSource += RelaxParam * (this->QSource - initialQSource);
     751              :         }
     752            0 :     }
     753            0 : LOOPLoadEnth_exit:;
     754              : 
     755              :     // Control Strategy
     756            0 :     if (std::abs(MyLoad) < this->QLoad) {
     757            0 :         DutyFactor = std::abs(MyLoad) / this->QLoad;
     758            0 :         this->QLoad = std::abs(MyLoad);
     759            0 :         this->Power *= DutyFactor;
     760            0 :         this->QSource *= DutyFactor;
     761              : 
     762              :         // Determine the Exterior fluid temperature at the Load Side oulet and eveporator outlet...
     763              :         // Refrigerant = "Steam"
     764            0 :         this->LoadSideWaterOutletTemp = this->LoadSideWaterInletTemp + this->QLoad / (this->LoadSideWaterMassFlowRate * CpLoadSide);
     765            0 :         this->SourceSideWaterOutletTemp = this->SourceSideWaterInletTemp - this->QSource / (this->SourceSideWaterMassFlowRate * CpSourceSide);
     766            0 :         return;
     767              :     }
     768              : 
     769            0 :     this->LoadSideWaterOutletTemp = this->LoadSideWaterInletTemp + this->QLoad / (this->LoadSideWaterMassFlowRate * CpLoadSide);
     770            0 :     this->SourceSideWaterOutletTemp = this->SourceSideWaterInletTemp - this->QSource / (this->SourceSideWaterMassFlowRate * CpSourceSide);
     771              :     // REPORT VAR
     772            0 :     this->Running = 1;
     773              : }
     774              : 
     775            0 : void GshpPeHeatingSpecs::update(EnergyPlusData &state)
     776              : {
     777              :     // SUBROUTINE INFORMATION:
     778              :     //       AUTHOR:          Dan Fisher
     779              :     //       DATE WRITTEN:    October 1998
     780              : 
     781            0 :     if (!this->MustRun) {
     782              :         // set node temperatures
     783            0 :         state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).Temp = state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp;
     784            0 :         state.dataLoopNodes->Node(this->LoadSideOutletNodeNum).Temp = state.dataLoopNodes->Node(this->LoadSideInletNodeNum).Temp;
     785            0 :         this->Power = 0.0;
     786            0 :         this->Energy = 0.0;
     787            0 :         this->QSource = 0.0;
     788            0 :         this->QLoad = 0.0;
     789            0 :         this->QSourceEnergy = 0.0;
     790            0 :         this->QLoadEnergy = 0.0;
     791            0 :         this->SourceSideWaterInletTemp = state.dataLoopNodes->Node(this->SourceSideInletNodeNum).Temp;
     792            0 :         this->SourceSideWaterOutletTemp = state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).Temp;
     793            0 :         this->LoadSideWaterInletTemp = state.dataLoopNodes->Node(this->LoadSideInletNodeNum).Temp;
     794            0 :         this->LoadSideWaterOutletTemp = state.dataLoopNodes->Node(this->LoadSideOutletNodeNum).Temp;
     795              : 
     796              :     } else {
     797              :         // set node temperatures
     798            0 :         state.dataLoopNodes->Node(this->LoadSideOutletNodeNum).Temp = this->LoadSideWaterOutletTemp;
     799            0 :         state.dataLoopNodes->Node(this->SourceSideOutletNodeNum).Temp = this->SourceSideWaterOutletTemp;
     800              : 
     801              :         // set node flow rates;  for these load based models
     802              :         // assume that the sufficient Source Side flow rate available
     803              : 
     804            0 :         Real64 const ReportingConstant = state.dataHVACGlobal->TimeStepSysSec;
     805              : 
     806            0 :         this->Energy = this->Power * ReportingConstant;
     807            0 :         this->QSourceEnergy = QSource * ReportingConstant;
     808            0 :         this->QLoadEnergy = QLoad * ReportingConstant;
     809              :     }
     810            0 : }
     811            0 : void GshpPeHeatingSpecs::oneTimeInit([[maybe_unused]] EnergyPlusData &state)
     812              : {
     813            0 : }
     814            0 : void GshpPeHeatingSpecs::oneTimeInit_new([[maybe_unused]] EnergyPlusData &state)
     815              : {
     816            0 : }
     817              : 
     818              : } // namespace EnergyPlus::HeatPumpWaterToWaterHEATING
        

Generated by: LCOV version 2.0-1