OGS
CreateFlowAndTemperatureControl.cpp
Go to the documentation of this file.
1
12
13#include "BaseLib/Algorithm.h"
14#include "BaseLib/ConfigTree.h"
15#include "BuildingPowerCurves.h"
18
19namespace ProcessLib
20{
21namespace HeatTransportBHE
22{
23namespace BHE
24{
26 BaseLib::ConfigTree const& config,
27 std::map<std::string,
28 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>> const&
29 curves,
30 RefrigerantProperties const& refrigerant)
31{
33 auto const type = config.getConfigParameter<std::string>("type");
34 if (type == "TemperatureCurveConstantFlow")
35 {
37 auto const flow_rate = config.getConfigParameter<double>("flow_rate");
38
39 auto const& temperature_curve = *BaseLib::getOrError(
40 curves,
42 config.getConfigParameter<std::string>("temperature_curve"),
43 "Required temperature curve not found.");
44
45 return TemperatureCurveConstantFlow{flow_rate, temperature_curve};
46 }
47 if (type == "TemperatureCurveFlowCurve")
48 {
49 auto const& flow_rate_curve = *BaseLib::getOrError(
50 curves,
52 config.getConfigParameter<std::string>("flow_rate_curve"),
53 "Required flow curve not found.");
54
55 auto const& temperature_curve = *BaseLib::getOrError(
56 curves,
58 config.getConfigParameter<std::string>("temperature_curve"),
59 "Required temperature curve not found.");
60
61 return TemperatureCurveFlowCurve{flow_rate_curve, temperature_curve};
62 }
63 if (type == "FixedPowerConstantFlow")
64 {
66 auto const power = config.getConfigParameter<double>("power");
67
69 auto const flow_rate = config.getConfigParameter<double>("flow_rate");
70
71 return FixedPowerConstantFlow{flow_rate, power,
72 refrigerant.specific_heat_capacity,
73 refrigerant.density};
74 }
75
76 if (type == "FixedPowerFlowCurve")
77 {
78 auto const& flow_rate_curve = *BaseLib::getOrError(
79 curves,
81 config.getConfigParameter<std::string>("flow_rate_curve"),
82 "Required flow rate curve not found.");
83
85 auto const power = config.getConfigParameter<double>("power");
86
87 return FixedPowerFlowCurve{flow_rate_curve, power,
88 refrigerant.specific_heat_capacity,
89 refrigerant.density};
90 }
91
92 if (type == "PowerCurveConstantFlow")
93 {
94 auto const& power_curve = *BaseLib::getOrError(
95 curves,
97 config.getConfigParameter<std::string>("power_curve"),
98 "Required power curve not found.");
99
101 auto const flow_rate = config.getConfigParameter<double>("flow_rate");
102
103 return PowerCurveConstantFlow{power_curve, flow_rate,
104 refrigerant.specific_heat_capacity,
105 refrigerant.density};
106 }
107
108 if (type == "PowerCurveFlowCurve")
109 {
110 auto const& power_curve = *BaseLib::getOrError(
111 curves,
113 config.getConfigParameter<std::string>("power_curve"),
114 "Required power curve not found.");
115
116 auto const& flow_rate_curve = *BaseLib::getOrError(
117 curves,
119 config.getConfigParameter<std::string>("flow_rate_curve"),
120 "Required flow rate curve not found.");
121
122 return PowerCurveFlowCurve{power_curve, flow_rate_curve,
123 refrigerant.specific_heat_capacity,
124 refrigerant.density};
125 }
126
127 if (type == "BuildingPowerCurveConstantFlow")
128 {
129 auto const& power_curve = *BaseLib::getOrError(
130 curves,
132 config.getConfigParameter<std::string>("power_curve"),
133 "Required power curve not found.");
134
135 auto const& cop_heating_curve = *BaseLib::getOrError(
136 curves,
138 config.getConfigParameter<std::string>("cop_heating_curve"),
139 "Required power curve not found.");
140
141 BuildingPowerCurves const building_power_curves{power_curve,
142 cop_heating_curve};
143
145 auto const flow_rate = config.getConfigParameter<double>("flow_rate");
146
148 building_power_curves, flow_rate,
149 refrigerant.specific_heat_capacity, refrigerant.density};
150 }
151 OGS_FATAL("FlowAndTemperatureControl type '{:s}' is not implemented.",
152 type);
153}
154} // namespace BHE
155} // namespace HeatTransportBHE
156} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
Definition of the PiecewiseLinearInterpolation class.
T getConfigParameter(std::string const &param) const
OGS_NO_DANGLING Map::mapped_type & getOrError(Map &map, Key const &key, std::string const &error_message)
Definition Algorithm.h:114
std::variant< TemperatureCurveConstantFlow, TemperatureCurveFlowCurve, FixedPowerConstantFlow, FixedPowerFlowCurve, PowerCurveConstantFlow, PowerCurveFlowCurve, BuildingPowerCurveConstantFlow > FlowAndTemperatureControl
FlowAndTemperatureControl createFlowAndTemperatureControl(BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > const &curves, RefrigerantProperties const &refrigerant)