LCOV - code coverage report
Current view: top level - EnergyPlus - HeatPumpWaterToWaterHEATING.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 7 15 46.7 %
Date: 2023-01-17 19:17:23 Functions: 5 8 62.5 %

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

Generated by: LCOV version 1.13