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

          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 PlantUtilities_hh_INCLUDED
      49             : #define PlantUtilities_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Optional.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/EnergyPlus.hh>
      57             : #include <EnergyPlus/Plant/Enums.hh>
      58             : #include <EnergyPlus/Plant/PlantLocation.hh>
      59             : 
      60             : namespace EnergyPlus {
      61             : 
      62             : // Forward declarations
      63             : struct EnergyPlusData;
      64             : 
      65             : namespace PlantUtilities {
      66             : 
      67             :     // Functions
      68             :     void InitComponentNodes(EnergyPlusData &state, Real64 const MinCompMdot, Real64 const MaxCompMdot, int const InletNode, int const OutletNode);
      69             : 
      70             :     void SetComponentFlowRate(EnergyPlusData &state,
      71             :                               Real64 &CompFlow,             // [kg/s]
      72             :                               int InletNode,                // component's inlet node index in node structure
      73             :                               int OutletNode,               // component's outlet node index in node structure
      74             :                               PlantLocation const &plantLoc // component location for PlantLoop
      75             :     );
      76             : 
      77             :     void SetActuatedBranchFlowRate(EnergyPlusData &state,
      78             :                                    Real64 &CompFlow,
      79             :                                    int ActuatedNode,
      80             :                                    PlantLocation const &plantLoc,
      81             :                                    bool ResetMode // flag to indicate if this is a real flow set, or a reset flow setting.
      82             :     );
      83             : 
      84             :     Real64 RegulateCondenserCompFlowReqOp(EnergyPlusData &state, PlantLocation const &plantLoc, Real64 TentativeFlowRequest);
      85             : 
      86             :     bool AnyPlantSplitterMixerLacksContinuity(EnergyPlusData &state);
      87             : 
      88             :     void CheckPlantMixerSplitterConsistency(EnergyPlusData &state,
      89             :                                             const int LoopNum,
      90             :                                             const DataPlant::LoopSideLocation LoopSideNum,
      91             :                                             const bool FirstHVACIteration);
      92             : 
      93             :     void CheckForRunawayPlantTemps(EnergyPlusData &state, int LoopNum, const DataPlant::LoopSideLocation LoopSideNum);
      94             : 
      95             :     void SetAllFlowLocks(EnergyPlusData &state, DataPlant::FlowLock Value);
      96             : 
      97             :     void ResetAllPlantInterConnectFlags(EnergyPlusData &state);
      98             : 
      99             :     void PullCompInterconnectTrigger(EnergyPlusData &state,
     100             :                                      const PlantLocation &plantLoc,              // Component Location
     101             :                                      int &UniqueCriteriaCheckIndex,              // An integer given to this particular check
     102             :                                      const PlantLocation &ConnectedPlantLoc,     // Interconnected Component's Location
     103             :                                      const DataPlant::CriteriaType CriteriaType, // The criteria check to use, see DataPlant: SimFlagCriteriaTypes
     104             :                                      const Real64 CriteriaValue                  // The value of the criteria check to evaluate
     105             :     );
     106             : 
     107             :     void UpdateChillerComponentCondenserSide(EnergyPlusData &state,
     108             :                                              int LoopNum,                          // component's loop index
     109             :                                              DataPlant::LoopSideLocation LoopSide, // component's loop side number
     110             :                                              DataPlant::PlantEquipmentType Type,   // Component's type index
     111             :                                              int InletNodeNum,                     // Component's inlet node pointer
     112             :                                              int OutletNodeNum,                    // Component's outlet node pointer
     113             :                                              Real64 ModelCondenserHeatRate,        // model's heat rejection rate at condenser (W)
     114             :                                              Real64 ModelInletTemp,                // model's inlet temperature (C)
     115             :                                              Real64 ModelOutletTemp,               // model's outlet temperature (C)
     116             :                                              Real64 ModelMassFlowRate,             // model's condenser water mass flow rate (kg/s)
     117             :                                              bool FirstHVACIteration);
     118             : 
     119             :     void UpdateComponentHeatRecoverySide(EnergyPlusData &state,
     120             :                                          int LoopNum,                          // component's loop index
     121             :                                          DataPlant::LoopSideLocation LoopSide, // component's loop side number
     122             :                                          DataPlant::PlantEquipmentType Type,   // Component's type index
     123             :                                          int InletNodeNum,                     // Component's inlet node pointer
     124             :                                          int OutletNodeNum,                    // Component's outlet node pointer
     125             :                                          Real64 ModelRecoveryHeatRate,         // model's heat rejection rate at recovery (W)
     126             :                                          Real64 ModelInletTemp,                // model's inlet temperature (C)
     127             :                                          Real64 ModelOutletTemp,               // model's outlet temperature (C)
     128             :                                          Real64 ModelMassFlowRate,             // model's condenser water mass flow rate (kg/s)
     129             :                                          bool FirstHVACIteration);
     130             : 
     131             :     void UpdateAbsorberChillerComponentGeneratorSide(EnergyPlusData &state,
     132             :                                                      int LoopNum,                                // component's loop index
     133             :                                                      DataPlant::LoopSideLocation LoopSide,       // component's loop side number
     134             :                                                      DataPlant::PlantEquipmentType Type,         // Component's type index
     135             :                                                      int InletNodeNum,                           // Component's inlet node pointer
     136             :                                                      int OutletNodeNum,                          // Component's outlet node pointer
     137             :                                                      DataLoopNode::NodeFluidType HeatSourceType, // Type of fluid in Generator loop
     138             :                                                      Real64 ModelGeneratorHeatRate,              // model's generator heat rate (W)
     139             :                                                      Real64 ModelMassFlowRate,                   // model's generator mass flow rate (kg/s)
     140             :                                                      bool FirstHVACIteration);
     141             : 
     142             :     void InterConnectTwoPlantLoopSides(EnergyPlusData &state,
     143             :                                        PlantLocation const &Loop1PlantLoc,
     144             :                                        PlantLocation const &Loop2PlantLoc,
     145             :                                        DataPlant::PlantEquipmentType ComponentType,
     146             :                                        bool Loop1DemandsOnLoop2);
     147             : 
     148             :     void ShiftPlantLoopSideCallingOrder(EnergyPlusData &state, int OldIndex, int NewIndex);
     149             : 
     150             :     void RegisterPlantCompDesignFlow(EnergyPlusData &state,
     151             :                                      int ComponentInletNodeNum, // the component's water inlet node number
     152             :                                      Real64 DesPlantFlow        // the component's design fluid volume flow rate [m3/s]
     153             :     );
     154             : 
     155             :     void SafeCopyPlantNode(EnergyPlusData &state,
     156             :                            int InletNodeNum,
     157             :                            int OutletNodeNum,
     158             :                            Optional_int_const LoopNum = _,
     159             :                            Optional<Real64 const> OutletTemp = _ // set on outlet node if present and water.
     160             :     );
     161             : 
     162             :     Real64 BoundValueToNodeMinMaxAvail(EnergyPlusData &state, Real64 ValueToBound, int NodeNumToBoundWith);
     163             : 
     164             :     void TightenNodeMinMaxAvails(EnergyPlusData &state, int NodeNum, Real64 NewMinAvail, Real64 NewMaxAvail);
     165             : 
     166             :     Real64 BoundValueToWithinTwoValues(Real64 ValueToBound, Real64 LowerBound, Real64 UpperBound);
     167             : 
     168             :     bool IntegerIsWithinTwoValues(int ValueToCheck, int LowerBound, int UpperBound);
     169             : 
     170             :     void LogPlantConvergencePoints(EnergyPlusData &state, bool FirstHVACIteration);
     171             : 
     172             :     void ScanPlantLoopsForObject(EnergyPlusData &state,
     173             :                                  std::string_view CompName,
     174             :                                  DataPlant::PlantEquipmentType CompType,
     175             :                                  PlantLocation &plantLoc,
     176             :                                  bool &errFlag,
     177             :                                  Optional<Real64 const> LowLimitTemp = _,
     178             :                                  Optional<Real64 const> HighLimitTemp = _,
     179             :                                  Optional_int CountMatchPlantLoops = _,
     180             :                                  Optional_int_const InletNodeNumber = _,
     181             :                                  Optional_int_const SingleLoopSearch = _);
     182             : 
     183             :     void ScanPlantLoopsForNodeNum(EnergyPlusData &state,
     184             :                                   std::string_view const CallerName, // really used for error messages
     185             :                                   int NodeNum,                       // index in Node structure of node to be scanned
     186             :                                   PlantLocation &pLantLoc,           // return value for location
     187             :                                   Optional_int CompNum = _);
     188             : 
     189             :     bool AnyPlantLoopSidesNeedSim(EnergyPlusData &state);
     190             : 
     191             :     void SetAllPlantSimFlagsToValue(EnergyPlusData &state, bool Value);
     192             : 
     193             :     void ShowBranchesOnLoop(EnergyPlusData &state, int LoopNum); // Loop number of loop
     194             : 
     195             :     int MyPlantSizingIndex(EnergyPlusData &state,
     196             :                            std::string const &CompType,          // component description
     197             :                            std::string_view CompName,            // user name of component
     198             :                            int NodeNumIn,                        // component water inlet node
     199             :                            int NodeNumOut,                       // component water outlet node
     200             :                            bool &ErrorsFound,                    // set to true if there's an error
     201             :                            Optional_bool_const SupressErrors = _ // used for WSHP's where condenser loop may not be on a plant loop
     202             :     );
     203             : 
     204             :     bool verifyTwoNodeNumsOnSamePlantLoop(EnergyPlusData &state, int nodeIndexA, int nodeIndexB);
     205             : 
     206             :     struct CriteriaData
     207             :     {
     208             :         // Members
     209             :         int CallingCompLoopNum;                             // for debug error handling
     210             :         DataPlant::LoopSideLocation CallingCompLoopSideNum; // for debug error handling
     211             :         int CallingCompBranchNum;                           // for debug error handling
     212             :         int CallingCompCompNum;                             // for debug error handling
     213             :         Real64 ThisCriteriaCheckValue;                      // the previous value, to check the current against
     214             : 
     215             :         // Default Constructor
     216    10130857 :         CriteriaData()
     217    10130857 :             : CallingCompLoopNum(0), CallingCompLoopSideNum(DataPlant::LoopSideLocation::Invalid), CallingCompBranchNum(0), CallingCompCompNum(0),
     218    10130857 :               ThisCriteriaCheckValue(0.0)
     219             :         {
     220    10130857 :         }
     221             :     };
     222             : 
     223             : } // namespace PlantUtilities
     224             : 
     225        1542 : struct PlantUtilitiesData : BaseGlobalStruct
     226             : {
     227             : 
     228             :     Array1D<PlantUtilities::CriteriaData> CriteriaChecks; // stores criteria information
     229             : 
     230           0 :     void clear_state() override
     231             :     {
     232           0 :         this->CriteriaChecks.deallocate();
     233           0 :     }
     234             : };
     235             : 
     236             : } // namespace EnergyPlus
     237             : 
     238             : #endif

Generated by: LCOV version 1.13