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

            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 PlantHeatExchangerFluidToFluid_hh_INCLUDED
      49              : #define PlantHeatExchangerFluidToFluid_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/PlantLocation.hh>
      59              : #include <EnergyPlus/PlantComponent.hh>
      60              : 
      61              : namespace EnergyPlus {
      62              : 
      63              : // Forward declarations
      64              : struct EnergyPlusData;
      65              : 
      66              : namespace PlantHeatExchangerFluidToFluid {
      67              : 
      68              :     enum class FluidHXType
      69              :     {
      70              :         Invalid = -1,
      71              :         CrossFlowBothUnMixed,
      72              :         CrossFlowBothMixed,
      73              :         CrossFlowSupplyLoopMixedDemandLoopUnMixed,
      74              :         CrossFlowSupplyLoopUnMixedDemandLoopMixed,
      75              :         CounterFlow,
      76              :         ParallelFlow,
      77              :         Ideal,
      78              :         Num
      79              :     };
      80              : 
      81              :     enum class ControlType
      82              :     {
      83              :         Invalid = -1,
      84              :         UncontrolledOn,
      85              :         OperationSchemeModulated,
      86              :         OperationSchemeOnOff,
      87              :         HeatingSetPointModulated,
      88              :         HeatingSetPointOnOff,
      89              :         CoolingSetPointModulated,
      90              :         CoolingSetPointOnOff,
      91              :         DualDeadBandSetPointModulated,
      92              :         DualDeadBandSetPointOnOff,
      93              :         CoolingDifferentialOnOff,
      94              :         CoolingSetPointOnOffWithComponentOverride,
      95              :         TrackComponentOnOff,
      96              :         Num
      97              :     };
      98              : 
      99              :     enum class CtrlTempType
     100              :     {
     101              :         Invalid = -1,
     102              :         WetBulbTemperature,
     103              :         DryBulbTemperature,
     104              :         LoopTemperature,
     105              :         Num
     106              :     };
     107              : 
     108              :     enum class HXAction
     109              :     {
     110              :         Invalid = -1,
     111              :         HeatingSupplySideLoop,
     112              :         CoolingSupplySideLoop,
     113              :         Num
     114              :     };
     115              : 
     116              :     struct PlantConnectionStruct : PlantLocation
     117              :     {
     118              :         // Members
     119              :         int inletNodeNum;                      // plant loop inlet node index
     120              :         int outletNodeNum;                     // plant loop outlet node index
     121              :         Real64 MassFlowRateMin;                // minimum (hardware) flow rate for component [kg/s]
     122              :         Real64 MassFlowRateMax;                // maximum (hardware) flow rate for component [kg/s]
     123              :         Real64 DesignVolumeFlowRate;           // design flow rate [m3/s]
     124              :         bool DesignVolumeFlowRateWasAutoSized; // true if design flow rate was autosize on input
     125              :         Real64 MyLoad;                         // current load request of supply equip for op scheme control[W]
     126              :         Real64 MinLoad;                        // reports back size for load dispatch routines [W]
     127              :         Real64 MaxLoad;                        // reports back size for load dispatch [W]
     128              :         Real64 OptLoad;                        // reports back size for load dispatch [W]
     129              :         Real64 InletTemp;                      // current inlet fluid temperature [C]
     130              :         Real64 InletMassFlowRate;              // current inlet mass flow rate [kg/s]
     131              :         Real64 OutletTemp;                     // component outlet temperature [C]
     132              : 
     133              :         // Default Constructor
     134           24 :         PlantConnectionStruct()
     135           48 :             : inletNodeNum(0), outletNodeNum(0), MassFlowRateMin(0.0), MassFlowRateMax(0.0), DesignVolumeFlowRate(0.0),
     136           24 :               DesignVolumeFlowRateWasAutoSized(false), MyLoad(0.0), MinLoad(0.0), MaxLoad(0.0), OptLoad(0.0), InletTemp(0.0), InletMassFlowRate(0.0),
     137           24 :               OutletTemp(0.0)
     138              :         {
     139           24 :         }
     140              :     };
     141              : 
     142              :     struct PlantLocatorStruct : PlantLocation
     143              :     {
     144              :         // Members
     145              :         int inletNodeNum; // plant loop inlet node index
     146              : 
     147              :         // Default Constructor
     148           24 :         PlantLocatorStruct() : inletNodeNum(0)
     149              :         {
     150           24 :         }
     151              :     };
     152              : 
     153              :     struct HeatExchangerStruct : PlantComponent
     154              :     {
     155              :         // Members
     156              :         std::string Name;
     157              :         Sched::Schedule *availSched = nullptr;
     158              :         FluidHXType HeatExchangeModelType;
     159              :         Real64 UA;
     160              :         bool UAWasAutoSized; // true is UA was autosized on input
     161              :         ControlType controlMode;
     162              :         int SetPointNodeNum;
     163              :         Real64 TempControlTol;
     164              :         CtrlTempType ControlSignalTemp;
     165              :         Real64 MinOperationTemp;
     166              :         Real64 MaxOperationTemp;
     167              :         PlantConnectionStruct DemandSideLoop; // plant connections and data for the side of HX connected to demand side
     168              :         PlantConnectionStruct SupplySideLoop;
     169              :         OutputProcessor::EndUseCat HeatTransferMeteringEndUse = OutputProcessor::EndUseCat::Invalid;
     170              :         std::string ComponentUserName; // user name for control-associated  component
     171              :         DataPlant::PlantEquipmentType ComponentType;
     172              :         PlantLocatorStruct OtherCompSupplySideLoop;
     173              :         PlantLocatorStruct OtherCompDemandSideLoop;
     174              :         Real64 SizingFactor;
     175              :         Real64 HeatTransferRate;
     176              :         Real64 HeatTransferEnergy;
     177              :         Real64 Effectiveness;
     178              :         Real64 OperationStatus;
     179              :         int DmdSideModulatSolvNoConvergeErrorCount;
     180              :         int DmdSideModulatSolvNoConvergeErrorIndex;
     181              :         int DmdSideModulatSolvFailErrorCount;
     182              :         int DmdSideModulatSolvFailErrorIndex;
     183              :         bool MyOneTimeFlag;
     184              :         bool MyFlag;
     185              :         bool MyEnvrnFlag;
     186              : 
     187              :         // Default Constructor
     188           12 :         HeatExchangerStruct()
     189           24 :             : HeatExchangeModelType(FluidHXType::Invalid), UA(0.0), UAWasAutoSized(false), controlMode(ControlType::Invalid), SetPointNodeNum(0),
     190           12 :               TempControlTol(0.0), ControlSignalTemp(CtrlTempType::Invalid), MinOperationTemp(-99999.0), MaxOperationTemp(99999.0),
     191           24 :               ComponentType(DataPlant::PlantEquipmentType::Invalid), SizingFactor(1.0), HeatTransferRate(0.0), HeatTransferEnergy(0.0),
     192           12 :               Effectiveness(0.0), OperationStatus(0.0), DmdSideModulatSolvNoConvergeErrorCount(0), DmdSideModulatSolvNoConvergeErrorIndex(0),
     193           12 :               DmdSideModulatSolvFailErrorCount(0), DmdSideModulatSolvFailErrorIndex(0), MyOneTimeFlag(true), MyFlag(true), MyEnvrnFlag(true)
     194              :         {
     195           12 :         }
     196              : 
     197              :         static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
     198              : 
     199              :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     200              : 
     201              :         void getDesignCapacities(
     202              :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     203              : 
     204              :         void simulate([[maybe_unused]] EnergyPlusData &state,
     205              :                       const PlantLocation &calledFromLocation,
     206              :                       bool FirstHVACIteration,
     207              :                       Real64 &CurLoad,
     208              :                       bool RunFlag) override;
     209              : 
     210              :         void setupOutputVars(EnergyPlusData &state);
     211              : 
     212              :         void initialize(EnergyPlusData &state);
     213              : 
     214              :         void size(EnergyPlusData &state);
     215              : 
     216              :         void calculate(EnergyPlusData &state, Real64 SupSideMdot, Real64 DmdSideMdot);
     217              : 
     218              :         void control(EnergyPlusData &state, Real64 MyLoad, bool FirstHVACIteration);
     219              : 
     220              :         void findDemandSideLoopFlow(EnergyPlusData &state, Real64 TargetSupplySideLoopLeavingTemp, HXAction HXActionMode);
     221              : 
     222              :         void oneTimeInit(EnergyPlusData &state) override;
     223              :     };
     224              : 
     225              :     void GetFluidHeatExchangerInput(EnergyPlusData &state);
     226              : 
     227              : } // namespace PlantHeatExchangerFluidToFluid
     228              : 
     229              : struct PlantHeatExchangerFluidToFluidData : BaseGlobalStruct
     230              : {
     231              : 
     232              :     int NumberOfPlantFluidHXs = 0;
     233              :     bool GetInput = true;
     234              :     EPVector<PlantHeatExchangerFluidToFluid::HeatExchangerStruct> FluidHX;
     235              : 
     236         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     237              :     {
     238         2126 :     }
     239              : 
     240         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     241              :     {
     242         1152 :     }
     243              : 
     244         2100 :     void clear_state() override
     245              :     {
     246         2100 :         this->NumberOfPlantFluidHXs = 0;
     247         2100 :         this->GetInput = true;
     248         2100 :         this->FluidHX.deallocate();
     249         2100 :     }
     250              : };
     251              : 
     252              : } // namespace EnergyPlus
     253              : 
     254              : #endif
        

Generated by: LCOV version 2.0-1