LCOV - code coverage report
Current view: top level - EnergyPlus - NodeInputManager.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 4 20 20.0 %
Date: 2024-08-24 18:31:18 Functions: 2 3 66.7 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, 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 NodeInputManager_hh_INCLUDED
      49             : #define NodeInputManager_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/DataLoopNode.hh>
      58             : #include <EnergyPlus/EnergyPlus.hh>
      59             : 
      60             : namespace EnergyPlus {
      61             : 
      62             : // Forward declarations
      63             : struct EnergyPlusData;
      64             : 
      65             : namespace NodeInputManager {
      66             : 
      67             :     // Using/Aliasing
      68             :     using DataLoopNode::MarkedNodeData;
      69             :     using DataLoopNode::NodeData;
      70             : 
      71             :     // For GetOnlySingleNode(), GetNodeNums(), etc
      72             :     enum class CompFluidStream
      73             :     {
      74             :         Invalid = -1,
      75             :         Primary = 1,
      76             :         Secondary = 2,
      77             :         Tertiary = 3,
      78             :         Quaternary = 4,
      79             :         Num
      80             :     };
      81             : 
      82             :     struct NodeListDef // Derived Type for Node Lists
      83             :     {
      84             :         // Members
      85             :         std::string Name;         // Name of this Node List
      86             :         int NumOfNodesInList;     // Number of Nodes in this Node List
      87             :         Array1D_string NodeNames; // List of Names in this Node List
      88             :         Array1D_int NodeNumbers;  // Number of each Node (ref NodeNames) in this Node List
      89             : 
      90             :         // Default Constructor
      91         796 :         NodeListDef() : NumOfNodesInList(0)
      92             :         {
      93         796 :         }
      94             :     };
      95             : 
      96             :     void GetNodeNums(EnergyPlusData &state,
      97             :                      std::string const &Name,                           // Name for which to obtain information
      98             :                      int &NumNodes,                                     // Number of nodes accompanying this Name
      99             :                      Array1D_int &NodeNumbers,                          // Node Numbers accompanying this Name
     100             :                      bool &ErrorsFound,                                 // True when errors are found...
     101             :                      DataLoopNode::NodeFluidType nodeFluidType,         // Fluidtype for checking/setting node FluidType
     102             :                      DataLoopNode::ConnectionObjectType NodeObjectType, // Node Object Type (i.e. "Chiller:Electric")
     103             :                      std::string const &NodeObjectName,                 // Node Object Name (i.e. "MyChiller")
     104             :                      DataLoopNode::ConnectionType nodeConnectionType,   // Node Connection Type (see DataLoopNode)
     105             :                      CompFluidStream NodeFluidStream,                   // Which Fluid Stream (1,2,3,...)
     106             :                      bool ObjectIsParent,                               // True/False
     107             :                      bool const IncrementFluidStream = false,           // True/False
     108             :                      std::string_view const InputFieldName = {}         // Input Field Name
     109             :     );
     110             : 
     111             :     void SetupNodeVarsForReporting(EnergyPlusData &state);
     112             : 
     113             :     void GetNodeListsInput(EnergyPlusData &state, bool &ErrorsFound); // Set to true when requested Node List not found, unchanged otherwise
     114             : 
     115             :     int AssignNodeNumber(EnergyPlusData &state,
     116             :                          std::string const &Name,                   // Name for assignment
     117             :                          DataLoopNode::NodeFluidType nodeFluidType, // must be valid
     118             :                          bool &ErrorsFound);
     119             : 
     120             :     int GetOnlySingleNode(EnergyPlusData &state,
     121             :                           std::string const &NodeName,
     122             :                           bool &errFlag,
     123             :                           DataLoopNode::ConnectionObjectType NodeObjectType, // Node Object Type (i.e. "Chiller:Electric")
     124             :                           std::string const &NodeObjectName,                 // Node Object Name (i.e. "MyChiller")
     125             :                           DataLoopNode::NodeFluidType nodeFluidType,         // Fluidtype for checking/setting node FluidType
     126             :                           DataLoopNode::ConnectionType nodeConnectionType,   // Node Connection Type (see DataLoopNode)
     127             :                           CompFluidStream NodeFluidStream,                   // Which Fluid Stream (1,2,3,...)
     128             :                           bool ObjectIsParent,                               // True/False
     129             :                           std::string_view const InputFieldName = {}         // Input Field Name
     130             :     );
     131             : 
     132             :     void InitUniqueNodeCheck(EnergyPlusData &state, std::string const &ContextName);
     133             : 
     134             :     void CheckUniqueNodeNames(
     135             :         EnergyPlusData &state, std::string const &NodeTypes, bool &ErrorsFound, std::string const &CheckName, std::string const &ObjectName);
     136             : 
     137             :     void CheckUniqueNodeNumbers(
     138             :         EnergyPlusData &state, std::string const &NodeTypes, bool &ErrorsFound, int const CheckNumber, std::string const &ObjectName);
     139             : 
     140             :     void EndUniqueNodeCheck(EnergyPlusData &state, std::string const &ContextName);
     141             : 
     142             :     void CalcMoreNodeInfo(EnergyPlusData &state);
     143             : 
     144             :     void MarkNode(EnergyPlusData &state,
     145             :                   int NodeNumber, // Node Number to be marked
     146             :                   DataLoopNode::ConnectionObjectType ObjectType,
     147             :                   std::string const &ObjectName,
     148             :                   std::string const &FieldName);
     149             : 
     150             :     void CheckMarkedNodes(EnergyPlusData &state, bool &ErrorsFound);
     151             : 
     152             : } // namespace NodeInputManager
     153             : 
     154             : struct NodeInputManagerData : BaseGlobalStruct
     155             : {
     156             : 
     157             :     int NumOfNodeLists = 0;       // Total number of Node Lists in IDF
     158             :     int NumOfUniqueNodeNames = 0; // Number of Unique Node Names (current)
     159             :     // The following is a module level flag because there are several possible "entries" into
     160             :     // this module that may need to get the Node Inputs.
     161             :     bool GetNodeInputFlag = true;    // Flag to Get Node Input(s)
     162             :     Array1D_int NodeRef;             // Number of times a Node is "referenced"
     163             :     std::string CurCheckContextName; // Used in Uniqueness checks
     164             :     Array1D_string UniqueNodeNames;  // used in uniqueness checks
     165             :     int NumCheckNodes = 0;           // Num of Unique nodes in check
     166             :     int MaxCheckNodes = 0;           // Current "max" unique nodes in check
     167             :     bool NodeVarsSetup = false;      // Setup indicator of node vars for reporting (also that all nodes have been entered)
     168             :     Array1D_bool NodeWetBulbRepReq;
     169             :     bool CalcMoreNodeInfoMyOneTimeFlag = true; // one time flag
     170             :     Array1D_int GetOnlySingleNodeNodeNums;
     171             :     bool GetOnlySingleNodeFirstTime = true;
     172             : 
     173             :     // Object Data
     174             :     Array1D<NodeInputManager::NodeListDef> NodeLists; // Node Lists
     175             : 
     176             :     Real64 RhoAirStdInit;
     177             :     Real64 RhoWaterStdInit;
     178             :     Array1D_int NodeWetBulbSchedPtr;
     179             :     Array1D_bool NodeRelHumidityRepReq;
     180             :     Array1D_int NodeRelHumiditySchedPtr;
     181             :     Array1D_bool NodeDewPointRepReq;
     182             :     Array1D_int NodeDewPointSchedPtr;
     183             :     Array1D_bool NodeSpecificHeatRepReq;
     184             :     Array1D_int NodeSpecificHeatSchedPtr;
     185             :     std::vector<std::string> nodeReportingStrings;
     186             :     std::vector<std::string> nodeFluidNames;
     187             : 
     188         796 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     189             :     {
     190         796 :     }
     191             : 
     192           0 :     void clear_state() override
     193             :     {
     194           0 :         this->CalcMoreNodeInfoMyOneTimeFlag = true;
     195           0 :         this->NumOfNodeLists = 0;
     196           0 :         this->NumOfUniqueNodeNames = 0;
     197           0 :         this->GetNodeInputFlag = true;
     198           0 :         this->NodeRef.deallocate();
     199           0 :         this->CurCheckContextName = std::string();
     200           0 :         this->UniqueNodeNames.deallocate();
     201           0 :         this->NumCheckNodes = 0;
     202           0 :         this->MaxCheckNodes = 0;
     203           0 :         this->NodeVarsSetup = false;
     204           0 :         this->NodeLists.deallocate();
     205           0 :         this->GetOnlySingleNodeNodeNums.deallocate();
     206           0 :         this->GetOnlySingleNodeFirstTime = true;
     207           0 :         this->NodeWetBulbRepReq.deallocate();
     208           0 :     }
     209             : };
     210             : 
     211             : } // namespace EnergyPlus
     212             : 
     213             : #endif

Generated by: LCOV version 1.14