LCOV - code coverage report
Current view: top level - EnergyPlus - HeatPumpWaterToWaterCOOLING.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 42.9 % 21 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 HeatPumpWaterToWaterCOOLING_hh_INCLUDED
      49              : #define HeatPumpWaterToWaterCOOLING_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 HeatPumpWaterToWaterCOOLING {
      67              : 
      68              :     struct GshpPeCoolingSpecs : PlantComponent // Needs Some Modifications talk with Dr.Fisher and decide....
      69              :     {
      70              :         // Members
      71              :         std::string Name; // user identifier
      72              :         DataPlant::PlantEquipmentType WWHPPlantTypeOfNum;
      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
      83              :         Real64 LoadSideDesignMassFlow;   // Design flow rate (kg/s)
      84              :         Real64 SourceSideVolFlowRate;    // Design Flow Rate on th Source Side
      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
      91              :         Real64 LoadSideUACoeff;          // Load Side heat transfer coeff
      92              :         Real64 CompPistonDisp;           // compressor piston displacement
      93              :         Real64 CompClearanceFactor;      // compressor clearance factor
      94              :         Real64 CompSucPressDrop;         // deltap ,  compressor suction and discharge pressure drop
      95              :         Real64 SuperheatTemp;            // deltatsh , super heating
      96              :         Real64 PowerLosses;              // constant part of electro mechanical power losses
      97              :         Real64 LossFactor;               // loss factor used ot define the electro mechanical loss
      98              :         //  that is supposed to be proportional to the theoretical power
      99              :         Real64 HighPressCutoff; // Maximum Design Pressure on the Load Side
     100              :         Real64 LowPressCutoff;  // Minimum Design Pressure on the Source Side
     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              :         int Running;                      // On reporting Flag
     120              : 
     121              :         Real64 LoadSideWaterMassFlowRate;
     122              :         Real64 SourceSideWaterMassFlowRate;
     123              : 
     124              :         bool plantScanFlag;
     125              :         bool beginEnvironFlag;
     126              : 
     127              :         // Default Constructor
     128            0 :         GshpPeCoolingSpecs()
     129            0 :             : WWHPPlantTypeOfNum(DataPlant::PlantEquipmentType::Invalid), Available(false), ON(false), COP(0.0), NomCap(0.0), MinPartLoadRat(0.0),
     130            0 :               MaxPartLoadRat(0.0), OptPartLoadRat(0.0), LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0),
     131            0 :               SourceSideDesignMassFlow(0.0), SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0),
     132            0 :               SourceSideUACoeff(0.0), LoadSideUACoeff(0.0), CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0),
     133            0 :               PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false),
     134            0 :               MustRun(false), SourcePlantLoc{}, LoadPlantLoc{}, CondMassFlowIndex(0), Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0),
     135            0 :               QSource(0.0), QSourceEnergy(0.0), LoadSideWaterInletTemp(0.0), SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0),
     136            0 :               SourceSideWaterOutletTemp(0.0), Running(0), LoadSideWaterMassFlowRate(0.0), SourceSideWaterMassFlowRate(0.0), plantScanFlag(true),
     137            0 :               beginEnvironFlag(true)
     138              :         {
     139            0 :         }
     140              : 
     141            0 :         virtual ~GshpPeCoolingSpecs() = default;
     142              : 
     143              :         static GshpPeCoolingSpecs *factory(EnergyPlusData &state, const std::string &objectName);
     144              : 
     145              :         void simulate([[maybe_unused]] EnergyPlusData &state,
     146              :                       const PlantLocation &calledFromLocation,
     147              :                       bool FirstHVACIteration,
     148              :                       Real64 &CurLoad,
     149              :                       bool RunFlag) override;
     150              : 
     151              :         void getDesignCapacities(
     152              :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     153              : 
     154              :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
     155              : 
     156              :         void initialize(EnergyPlusData &state);
     157              : 
     158              :         void calculate(EnergyPlusData &state, Real64 &MyLoad);
     159              : 
     160              :         void update(EnergyPlusData &state);
     161              : 
     162              :         void oneTimeInit(EnergyPlusData &state) override;
     163              : 
     164              :         void oneTimeInit_new(EnergyPlusData &state) override;
     165              :     };
     166              : 
     167              :     void GetGshpInput(EnergyPlusData &state);
     168              : 
     169              : } // namespace HeatPumpWaterToWaterCOOLING
     170              : 
     171              : struct HeatPumpWaterToWaterCOOLINGData : BaseGlobalStruct
     172              : {
     173              : 
     174              :     int NumGSHPs = 0;
     175              :     bool GetWWHPCoolingInput = true;
     176              :     Array1D<HeatPumpWaterToWaterCOOLING::GshpPeCoolingSpecs> GSHP;
     177              : 
     178         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     179              :     {
     180         2126 :     }
     181              : 
     182         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     183              :     {
     184         1152 :     }
     185              : 
     186         2100 :     void clear_state() override
     187              :     {
     188         2100 :         this->NumGSHPs = 0;
     189         2100 :         this->GetWWHPCoolingInput = true;
     190         2100 :         this->GSHP.deallocate();
     191         2100 :     }
     192              : };
     193              : 
     194              : } // namespace EnergyPlus
     195              : 
     196              : #endif
        

Generated by: LCOV version 2.0-1