NANDRAD Data Model Library  Version 2.0
NANDRAD
NANDRAD_HydraulicNetworkComponent.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_HydraulicNetworkComponentH
23 #define NANDRAD_HydraulicNetworkComponentH
24 
25 #include <IBK_Parameter.h>
26 
27 #include "NANDRAD_CodeGenMacros.h"
28 #include "NANDRAD_Constants.h"
29 #include "NANDRAD_LinearSplineParameter.h"
30 #include "NANDRAD_DataTable.h"
31 
32 
33 namespace NANDRAD {
34 
35 /*! Parameters for a hydraulic component for the network. */
37 public:
38 
39  /*! The various types (equations) of the hydraulic component. */
40  enum ModelType {
41  MT_SimplePipe, // Keyword: SimplePipe 'Pipe with a single fluid volume and with heat exchange'
42  MT_DynamicPipe, // Keyword: DynamicPipe 'Pipe with a discretized fluid volume and heat exchange'
43  MT_ConstantPressurePump, // Keyword: ConstantPressurePump 'Pump with constant/externally defined pressure'
44  MT_ConstantMassFluxPump, // Keyword: ConstantMassFluxPump 'Pump with constant/externally defined mass flux'
45  MT_ControlledPump, // Keyword: ControlledPump 'Pump with pressure head controlled based on flow controller'
46  MT_HeatExchanger, // Keyword: HeatExchanger 'Simple heat exchanger with given heat flux'
47  MT_HeatPumpIdealCarnotSourceSide, // Keyword: HeatPumpIdealCarnotSourceSide 'Heat pump with variable heating power based on carnot efficiency, installed at source side (collector cycle)'
48  MT_HeatPumpIdealCarnotSupplySide, // Keyword: HeatPumpIdealCarnotSupplySide 'Heat pump with variable heating power based on carnot efficiency, installed at supply side'
49  MT_HeatPumpRealSourceSide, // Keyword: HeatPumpRealSourceSide 'On-off-type heat pump based on polynoms, installed at source side'
50  MT_ControlledValve, // Keyword: ControlledValve 'Valve with associated control model'
51  MT_IdealHeaterCooler, // Keyword: IdealHeaterCooler 'Ideal heat exchange model that provides a defined supply temperature to the network and calculates the heat loss/gain'
52  MT_ConstantPressureLossValve, // Keyword: ConstantPressureLossValve 'Valve with constant pressure loss'
53  NUM_MT
54  };
55 
56  /*! Parameters for the component. */
57  enum para_t {
58  P_HydraulicDiameter, // Keyword: HydraulicDiameter [mm] 'Only used for pressure loss calculation with PressureLossCoefficient (NOT for pipes)'
59  P_PressureLossCoefficient, // Keyword: PressureLossCoefficient [---] 'Pressure loss coefficient for the component (zeta-value)'
60  P_PressureHead, // Keyword: PressureHead [Pa] 'Pressure head for a pump'
61  P_MassFlux, // Keyword: MassFlux [kg/s] 'Pump predefined mass flux'
62  P_PumpEfficiency, // Keyword: PumpEfficiency [---] 'Pump efficiency'
63  P_FractionOfMotorInefficienciesToFluidStream, // Keyword: FractionOfMotorInefficienciesToFluidStream [---] 'Fraction of pump heat loss due to inefficiency that heats up the fluid'
64  P_Volume, // Keyword: Volume [m3] 'Water or air volume of the component'
65  P_PipeMaxDiscretizationWidth, // Keyword: PipeMaxDiscretizationWidth [m] 'Maximum width/length of discretized volumes in pipe'
66  P_CarnotEfficiency, // Keyword: CarnotEfficiency [---] 'Carnot efficiency eta'
67  P_MaximumHeatingPower, // Keyword: MaximumHeatingPower [W] 'Maximum heating power'
68  P_PressureLoss, // Keyword: PressureLoss [Pa] 'Pressure loss for valve'
69  P_MaximumPressureHead, // Keyword: MaximumPressureHead [Pa] 'Maximum pressure head at point of minimal mass flow of pump'
70  P_PumpMaximumElectricalPower, // Keyword: PumpMaximumElectricalPower [W] 'Maximum electrical power at point of optimal operation of pump'
71  NUM_P
72  };
73 
74 
75  // *** PUBLIC MEMBER FUNCTIONS ***
76 
77  NANDRAD_READWRITE
78  NANDRAD_COMPARE_WITH_ID
79  NANDRAD_COMP(HydraulicNetworkComponent)
80 
81  /*! Compares two component definitions by parameters only, without comparing ID. */
82  bool sameParametersAs(const HydraulicNetworkComponent & other) const;
83 
84  /*! Checks for valid and required parameters (value ranges).
85  \param networkModelType Type of network calculation model (HydraulicNetwork::ModelType).
86  */
87  void checkParameters(int networkModelType);
88 
89  // *** PUBLIC MEMBER VARIABLES ***
90 
91  /*! Unique ID for this component. */
92  unsigned int m_id = NANDRAD::INVALID_ID; // XML:A:required
93 
94  /*! Display name. */
95  std::string m_displayName; // XML:A
96 
97  /*! Model type. */
98  ModelType m_modelType = NUM_MT; // XML:A:required
99 
100  /*! Parameters of the flow component. */
101  IBK::Parameter m_para[NUM_P]; // XML:E
102 
103  /*! Array parameters of the flow component */
105 
106  // *** STATIC FUNCTIONS ***
107 
108  /*! Needed both in user interface and for valid parameter checking in solver.
109  \param networkModelType Identifies network model (HydraulicNetwork::ModelType).
110  */
111  static std::vector<unsigned int> requiredParameter(const ModelType modelType, int networkModelType);
112 
113  static std::vector<std::string> requiredScheduleNames(const ModelType modelType);
114 
115  /*! Helper function that implements specific rules for testing a single parameter.
116  This is useful if the same parameter is used by several models and we want to avoid implementing
117  the same checking rule multiple times.
118  Is used in Nandrad as well as in the graphical user interface.
119  */
120  static void checkModelParameter(const IBK::Parameter &para, const unsigned int numPara);
121 
122 };
123 
124 } // namespace NANDRAD
125 
126 #endif // NANDRAD_HydraulicNetworkComponentH
A data member for a table with named columns.
static std::vector< unsigned int > requiredParameter(const ModelType modelType, int networkModelType)
Needed both in user interface and for valid parameter checking in solver.
Contains global constants for the Nandrad data model.
IBK::Parameter m_para[NUM_P]
Parameters of the flow component.
DataTable m_polynomCoefficients
Array parameters of the flow component.
ModelType
The various types (equations) of the hydraulic component.
Parameters for a hydraulic component for the network.
unsigned int INVALID_ID
defines an invalid id
static void checkModelParameter(const IBK::Parameter &para, const unsigned int numPara)
Helper function that implements specific rules for testing a single parameter.
unsigned int m_id
Unique ID for this component.
void checkParameters(int networkModelType)
Checks for valid and required parameters (value ranges).
The namespace NANDRAD contains the data model classes that make up the NANDRAD solver input data...
NANDRAD_READWRITE NANDRAD_COMPARE_WITH_ID bool sameParametersAs(const HydraulicNetworkComponent &other) const
Compares two component definitions by parameters only, without comparing ID.