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: 2023-01-17 19:17:23 Functions: 5 7 71.4 %

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

Generated by: LCOV version 1.13