NANDRAD Data Model Library  Version 2.0
NANDRAD
NANDRAD_FMIVariableDefinition.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_FMIVariableDefinitionH
23 #define NANDRAD_FMIVariableDefinitionH
24 
25 #include <string>
26 
27 #include "NANDRAD_CodeGenMacros.h"
28 #include "NANDRAD_Constants.h"
29 
30 namespace NANDRAD {
31 
32 
33 /*! Definition of an FMI input/output variable and the corresponding value reference info for NANDRAD.
34 */
36 public:
37 
38  // *** PUBLIC MEMBER FUNCTIONS ***
39 
40  NANDRAD_READWRITE
41 
42  /*! Checks variable names. */
43  void checkParameters();
44 
45  // *** PUBLIC MEMBER VARIABLES ***
46 
47  bool operator<(const FMIVariableDefinition & other) const {
48  // Note: compare properties starting with fast comparisons (integers) before strings.
49  if (m_objectId < other.m_objectId) return true;
50  if (m_objectId > other.m_objectId) return false;
51 
52  if (m_vectorIndex < other.m_vectorIndex) return true;
53  if (m_vectorIndex > other.m_vectorIndex) return false;
54 
55  if (m_fmiValueRef < other.m_fmiValueRef) return true;
56  if (m_fmiValueRef > other.m_fmiValueRef) return false;
57 
58  if (m_varName < other.m_varName) return true;
59  if (m_varName > other.m_varName) return false;
60 
61  if (m_fmiVarName < other.m_fmiVarName) return true;
62  if (m_fmiVarName > other.m_fmiVarName) return false;
63 
64  return m_fmiTypeName < other.m_fmiTypeName;
65  }
66 
67 
68  /*! Compares NANDRAD model variable definitions (not FMI variables). */
69  bool sameModelVarAs(const FMIVariableDefinition & other) const {
70  return m_objectId == other.m_objectId &&
71  m_vectorIndex == other.m_vectorIndex &&
72  m_varName == other.m_varName;
73  }
74 
75  /*! The variable name as it appears in the FMI model description. */
76  std::string m_fmiVarName; // XML:A:required
77  /*! Optional description of the variable. */
78  std::string m_fmiVarDescription; // XML:E
79  /*! Unit of the variable. */
80  std::string m_unit; // XML:A:required
81  /*! The variable variable type as it appears in the FMI model description. */
82  std::string m_fmiTypeName; // XML:E
83  /*! The unqiue variable reference number for the FMI model description. */
84  IDType m_fmiValueRef = NANDRAD::INVALID_ID; // XML:A:required
85  /*! The start value to be used for this variable. */
86  double m_fmiStartValue; // XML:E:required
87 
88  /*! The variable name for the variable reference in NANDRAD.
89  This is an encoded name in format <objectRefType>.<variableName>, for example
90  'Zone.AirTemperature'.
91  */
92  std::string m_varName; // XML:E:required
93  /*! The ID of the referenced object. */
94  IDType m_objectId = NANDRAD::INVALID_ID; // XML:E:required
95  /*! Vector ID/Index for vector valued quantities. */
97 };
98 
99 
100 } // namespace NANDRAD
101 
102 #endif // NANDRAD_FMIVariableDefinitionH
bool sameModelVarAs(const FMIVariableDefinition &other) const
Compares NANDRAD model variable definitions (not FMI variables).
Contains global constants for the Nandrad data model.
std::string m_unit
Unit of the variable.
std::string m_fmiVarDescription
Optional description of the variable.
Definition of an FMI input/output variable and the corresponding value reference info for NANDRAD...
unsigned int INVALID_ID
defines an invalid id
std::string m_fmiTypeName
The variable variable type as it appears in the FMI model description.
NANDRAD_READWRITE void checkParameters()
Checks variable names.
std::string m_fmiVarName
The variable name as it appears in the FMI model description.
IDType m_fmiValueRef
The unqiue variable reference number for the FMI model description.
IDType m_vectorIndex
Vector ID/Index for vector valued quantities.
The namespace NANDRAD contains the data model classes that make up the NANDRAD solver input data...
std::string m_varName
The variable name for the variable reference in NANDRAD.
IDType m_objectId
The ID of the referenced object.
double m_fmiStartValue
The start value to be used for this variable.