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

            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 HeatPumpWaterToWaterHEATING_hh_INCLUDED
      49              : #define HeatPumpWaterToWaterHEATING_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/Plant/DataPlant.hh>
      59              : #include <EnergyPlus/PlantComponent.hh>
      60              : 
      61              : namespace EnergyPlus {
      62              : 
      63              : // Forward declarations
      64              : struct EnergyPlusData;
      65              : 
      66              : namespace HeatPumpWaterToWaterHEATING {
      67              : 
      68              :     struct GshpPeHeatingSpecs : PlantComponent
      69              :     {
      70              :         // Members
      71              :         std::string Name;                            // user identifier
      72              :         DataPlant::PlantEquipmentType WWHPPlantType; // equipment type num
      73              : 
      74              :         Fluid::RefrigProps *refrig = nullptr;
      75              :         bool Available;                  // need an array of logicals--load identifiers of available equipment
      76              :         bool ON;                         // simulate the machine at it's operating part load ratio
      77              :         Real64 COP;                      // Coefficient of Performance of the machine
      78              :         Real64 NomCap;                   // Nominal Capacity of the HeatPump
      79              :         Real64 MinPartLoadRat;           // Minimum operating Part Load Ratio
      80              :         Real64 MaxPartLoadRat;           // Maximum operating Part Load Ratio
      81              :         Real64 OptPartLoadRat;           // Optimal operating Part Load Ratio
      82              :         Real64 LoadSideVolFlowRate;      // Design Flow Rate on the Load side m3/sec
      83              :         Real64 LoadSideDesignMassFlow;   // Design flow rate (kg/s)
      84              :         Real64 SourceSideVolFlowRate;    // Design Flow Rate on th Source Side m3/sec
      85              :         Real64 SourceSideDesignMassFlow; // Design flow rate (kg/s)
      86              :         int SourceSideInletNodeNum;      // Node number on the inlet side of the plant
      87              :         int SourceSideOutletNodeNum;     // Node number on the outlet side of the plant
      88              :         int LoadSideInletNodeNum;        // Node number on the inlet side of the Load Side
      89              :         int LoadSideOutletNodeNum;       // Node number on the outlet side of the Load Side
      90              :         Real64 SourceSideUACoeff;        // Source Side heat transfer coeff W/K
      91              :         Real64 LoadSideUACoeff;          // Load Side heat transfer coeff  W/K
      92              :         Real64 CompPistonDisp;           // compressor piston displacement m3
      93              :         Real64 CompClearanceFactor;      // compressor clearance factor
      94              :         Real64 CompSucPressDrop;         // deltap ,  compressor suction and discharge pressure drop Pascals
      95              :         Real64 SuperheatTemp;            // deltatsh , super heating  °C
      96              :         Real64 PowerLosses;              // constant part of electro mechanical power losses  watts Joules/sec
      97              :         Real64 LossFactor;               // loss factor used ot define the electro mechanical
      98              :         // loss that is supposed to be proportional to the theoretical power
      99              :         Real64 HighPressCutoff; // Maximum Design Pressure on the Load Side Pascals
     100              :         Real64 LowPressCutoff;  // Minimum Design Pressure on the Source Side Pascals
     101              :         bool IsOn;
     102              :         bool MustRun;
     103              :         // loop topology variables
     104              :         PlantLocation SourcePlantLoc; // source side plant loop component location
     105              :         PlantLocation LoadPlantLoc;   // load side plant loop component location
     106              :         int CondMassFlowIndex;        // index for criteria in PullCompInterconnectTrigger
     107              : 
     108              :         // Members
     109              :         Real64 Power;                       // Power Consumption Watts
     110              :         Real64 Energy;                      // Energy Consumption Joules
     111              :         Real64 QLoad;                       // Load Side heat transfer rate Watts
     112              :         Real64 QLoadEnergy;                 // Load Side heat transfer Joules
     113              :         Real64 QSource;                     // Source Side heat transfer rate Watts
     114              :         Real64 QSourceEnergy;               // Source Side heat transfer Joules
     115              :         Real64 LoadSideWaterInletTemp;      // Load Side outlet temperature °C
     116              :         Real64 SourceSideWaterInletTemp;    // Source Side outlet temperature °C
     117              :         Real64 LoadSideWaterOutletTemp;     // Load Side outlet temperature °C
     118              :         Real64 SourceSideWaterOutletTemp;   // Source Side outlet temperature °C
     119              :         Real64 LoadSideWaterMassFlowRate;   // Mass flow rate of the cooling water in Load Side Kg/s
     120              :         Real64 SourceSideWaterMassFlowRate; // Mass flow rate of chilled water in Eavporator Kg/s
     121              :         int Running;                        // On reporting Flag
     122              :         bool plantScanFlag;
     123              :         bool beginEnvironFlag;
     124              : 
     125              :         // Default Constructor
     126            0 :         GshpPeHeatingSpecs()
     127            0 :             : WWHPPlantType(DataPlant::PlantEquipmentType::Invalid), Available(false), ON(false), COP(0.0), NomCap(0.0), MinPartLoadRat(0.0),
     128            0 :               MaxPartLoadRat(0.0), OptPartLoadRat(0.0), LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0),
     129            0 :               SourceSideDesignMassFlow(0.0), SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0),
     130            0 :               SourceSideUACoeff(0.0), LoadSideUACoeff(0.0), CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0),
     131            0 :               PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false), MustRun(false), CondMassFlowIndex(0),
     132            0 :               Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0), QSource(0.0), QSourceEnergy(0.0), LoadSideWaterInletTemp(0.0),
     133            0 :               SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), SourceSideWaterOutletTemp(0.0), LoadSideWaterMassFlowRate(0.0),
     134            0 :               SourceSideWaterMassFlowRate(0.0), Running(0), plantScanFlag(true), beginEnvironFlag(true)
     135              :         {
     136            0 :         }
     137              : 
     138            0 :         virtual ~GshpPeHeatingSpecs() = default;
     139              : 
     140              :         static GshpPeHeatingSpecs *factory(EnergyPlusData &state, const std::string &objectName);
     141              : 
     142              :         void simulate([[maybe_unused]] EnergyPlusData &state,
     143              :                       const PlantLocation &calledFromLocation,
     144              :                       bool FirstHVACIteration,
     145              :                       Real64 &CurLoad,
     146              :                       bool RunFlag) override;
     147              : 
     148              :         void getDesignCapacities(
     149              :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     150              : 
     151              :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
     152              : 
     153              :         void initialize(EnergyPlusData &state);
     154              : 
     155              :         void calculate(EnergyPlusData &state, Real64 &MyLoad);
     156              : 
     157              :         void update(EnergyPlusData &state);
     158              : 
     159              :         void oneTimeInit(EnergyPlusData &state) override;
     160              : 
     161              :         void oneTimeInit_new(EnergyPlusData &state) override;
     162              :     };
     163              : 
     164              :     void GetGshpInput(EnergyPlusData &state);
     165              : 
     166              : } // namespace HeatPumpWaterToWaterHEATING
     167              : 
     168              : struct HeatPumpWaterToWaterHEATINGData : BaseGlobalStruct
     169              : {
     170              : 
     171              :     int NumGSHPs = 0;
     172              :     bool GetWWHPHeatingInput = true;
     173              :     Array1D<HeatPumpWaterToWaterHEATING::GshpPeHeatingSpecs> GSHP;
     174              : 
     175         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     176              :     {
     177         2126 :     }
     178              : 
     179         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     180              :     {
     181         1152 :     }
     182              : 
     183         2100 :     void clear_state() override
     184              :     {
     185         2100 :         this->NumGSHPs = 0;
     186         2100 :         this->GetWWHPHeatingInput = true;
     187         2100 :         this->GSHP.deallocate();
     188         2100 :     }
     189              : };
     190              : 
     191              : } // namespace EnergyPlus
     192              : 
     193              : #endif
        

Generated by: LCOV version 2.0-1