NANDRAD Data Model Library  Version 2.0
NANDRAD
NANDRAD_ConstructionInstance.h
1 /* The NANDRAD data model library.
2 
3  Copyright (c) 2012-today, Institut für Bauklimatik, TU Dresden, Germany
4 
5  Primary authors:
6  Andreas Nicolai <andreas.nicolai -[at]- tu-dresden.de>
7  Anne Paepcke <anne.paepcke -[at]- tu-dresden.de>
8 
9  This library is part of SIM-VICUS (https://github.com/ghorwin/SIM-VICUS)
10 
11  This library is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 */
21 
22 #ifndef NANDRAD_ConstructionInstanceH
23 #define NANDRAD_ConstructionInstanceH
24 
25 #include "NANDRAD_Material.h"
26 #include "NANDRAD_Interface.h"
27 #include "NANDRAD_EmbeddedObject.h"
28 #include "NANDRAD_CodeGenMacros.h"
29 
30 namespace IBK {
31  class Parameter;
32 }
33 
34 namespace NANDRAD {
35 
36 class Project;
37 class ConstructionType;
38 
39 /*! Defines a wall/floor/ceiling construction instance.
40 
41  A ConstructionInstance contains all information about a wall and possibly embedded objects
42  like windows.
43 
44  Note that the area parameter stores the gross area of the wall, including all embedded objects.
45  Naturally, their area must not exceed the wall area.
46  A window area that is equal to the wall area is interpreted as a wall consisting of only windows
47  without a construction behind.
48 
49  Each construction instance stores its surface information inside interface data structures
50  for side A and side B. Side A is besides construction layer with index 0.
51  By default, an interface has no boundary condition information (model types are set to undefined)
52  and hence no fluxes are calculated.
53  There must be at least one interface with valid boundary condition parametrization for a construction
54  instance to be valid. Not referenced wall constructions will still be calculated, as they may
55  serve as storage medium or provide sensor data. However, if not needed, they should be removed
56  to improve performance.
57 */
59 public:
60 
61  /*! Construction-specific parameters required by several models. */
62  enum para_t {
63  /*! Orientation of the wall [deg]. */
64  P_Orientation, // Keyword: Orientation [Deg] 'Orientation of the wall [deg].'
65  /*! Inclination of the wall [deg]. */
66  P_Inclination, // Keyword: Inclination [Deg] 'Inclination of the wall [deg].'
67  /*! Gross area of the wall [m2]. */
68  P_Area, // Keyword: Area [m2] 'Gross area of the wall [m2].'
69  NUM_P
70  };
71 
72  // *** PUBLIC MEMBER FUNCTIONS ***
73 
74  NANDRAD_READWRITE
75  NANDRAD_COMPARE_WITH_ID
76 
77  /*! Checks for valid parameters and stores quick-access pointer to associated construction type.
78  Material and ConstructionType objects have already been checked for correctness.
79  \note This function throws an exception if invalid parameters are defined, parameters are missing, or
80  the construction type ID is invalid/unknown.
81  */
82  void checkParameters(const Project & prj);
83 
84  /*! A special form of comparison operator: tests if the construction would yield
85  the same results as the other construction when being simulated.
86  The test checks for:
87  - same construction type ID
88  - interface objects for locations A and B result in same behavior
89  */
90  bool behavesLike(const ConstructionInstance & other) const;
91 
92  /*! If a valid interface parameter block exists at side A, this function returns the references zone ID, otherwise 0.
93  Use this function to check if there is an actual zone (not the outside) connected at this interface.
94  */
95  unsigned int interfaceAZoneID() const;
96 
97  /*! If a valid interface parameter block exists at side B, this function returns the references zone ID, otherwise 0.
98  Use this function to check if there is an actual zone (not the outside) connected at this interface.
99  */
100  unsigned int interfaceBZoneID() const;
101 
102  /*! Returns true if construction is connected on either side via existing Interface definition to
103  the zone with given zoneID.
104  */
105  bool connectedTo(unsigned int zoneId) const {
106  return ( (m_interfaceA.m_id != INVALID_ID && m_interfaceA.m_zoneId == zoneId) ||
107  (m_interfaceB.m_id != INVALID_ID && m_interfaceB.m_zoneId == zoneId) );
108  }
109 
110  // *** PUBLIC MEMBER VARIABLES ***
111 
112  /*! Unique id number. */
113  unsigned int m_id = INVALID_ID; // XML:A:required
114  /*! IBK-language encoded name of construction instance. */
115  std::string m_displayName; // XML:A
116  /*! The id number of the corresponding construction type. */
117  unsigned int m_constructionTypeId; // XML:E:required
118 
119  /*! List of parameters. */
120  IBK::Parameter m_para[NUM_P]; // XML:E
121 
122  /*! The interface at side A. */
123  Interface m_interfaceA; // XML:E:tag=InterfaceA
124  /*! The interface at side B. */
125  Interface m_interfaceB; // XML:E:tag=InterfaceB
126 
127  /*! All embedded objects. Embedded objects cut out an area of the current construction and substitute
128  wall simulation by an explicit simulation model.
129  */
130  std::vector<EmbeddedObject> m_embeddedObjects; // XML:E
131 
132  // *** Variables used only during simulation ***
133 
134  /*! Cached net transfer area [m2] for heat conduction to room, calculated as difference between P_Area parameter
135  and sum of all embedded object areas (updated in checkParameters()).
136  */
137  double m_netHeatTransferArea = 999;
138 
139  /*! Quick-access pointer to the underlying construction type. */
140  const NANDRAD::ConstructionType *m_constructionType = nullptr;
141 };
142 
143 
144 } // namespace NANDRAD
145 
146 #endif // NANDRAD_ConstructionInstanceH
Contains all input data that describes a room with walls, floor, ceiling, usage, HVAC etc...
Interface m_interfaceB
The interface at side B.
unsigned int m_constructionTypeId
The id number of the corresponding construction type.
Defines a multi-layered construction (without the boundary conditions).
unsigned int INVALID_ID
defines an invalid id
std::vector< EmbeddedObject > m_embeddedObjects
All embedded objects.
para_t
Construction-specific parameters required by several models.
bool connectedTo(unsigned int zoneId) const
Returns true if construction is connected on either side via existing Interface definition to the zon...
An Interface identifies a surface of a wall and stores all data that are needed for boundary conditio...
Defines a wall/floor/ceiling construction instance.
The namespace NANDRAD contains the data model classes that make up the NANDRAD solver input data...
std::string m_displayName
IBK-language encoded name of construction instance.
Interface m_interfaceA
The interface at side A.