OGS
FlowAndTemperatureControl.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <variant>
7
8#include "BaseLib/Error.h"
11
12namespace ProcessLib
13{
14namespace HeatTransportBHE
15{
16namespace BHE
17{
19{
20 double const flow_rate;
21 double const temperature;
22};
23
25 double power,
26 double heat_capacity,
27 double density,
28 double T_out,
29 double flow_rate_min,
30 double power_min)
31{
32 flow_rate = (std::abs(flow_rate) < flow_rate_min) ? 0.0 : flow_rate;
33
34 if (std::abs(power) < power_min)
35 {
36 return {flow_rate, T_out};
37 }
38
39 if (flow_rate == 0)
40 {
42 "BHE power {:0.2f} W with flow rate of 0 m3/s requested, "
43 "calculation not possible!",
44 power);
45 }
46 return {flow_rate, power / flow_rate / heat_capacity / density + T_out};
47};
48
50{
51 FlowAndTemperature operator()(double const /*T_out*/,
52 double const time) const
53 {
54 return {(std::abs(flow_rate) < flow_rate_min) ? 0.0 : flow_rate,
55 temperature_curve.getValue(time)};
56 }
57 double flow_rate;
60 static constexpr bool is_power_bc = false;
61};
62
64{
65 FlowAndTemperature operator()(double const /*T_out*/,
66 double const time) const
67 {
68 double flow_rate = flow_rate_curve.getValue(time);
69 flow_rate = (std::abs(flow_rate) < flow_rate_min) ? 0.0 : flow_rate;
70 return {flow_rate, temperature_curve.getValue(time)};
71 }
75 static constexpr bool is_power_bc = false;
76};
77
79{
80 FlowAndTemperature operator()(double const T_out,
81 double const /*time*/) const
82 {
84 power,
86 density,
87 T_out,
89 power_min);
90 }
91 double flow_rate;
92 double power; // Value is expected to be in Watt.
94 double density;
96 double power_min;
97 static constexpr bool is_power_bc = true;
98};
99
101{
102 FlowAndTemperature operator()(double const T_out, double const time) const
103 {
104 double const flow_rate = flow_curve.getValue(time);
105
106 return check_power_and_flow_rate(flow_rate,
107 power,
109 density,
110 T_out,
112 power_min);
113 }
115
116 double power; // Value is expected to be in Watt.
118 double density;
120 double power_min;
121 static constexpr bool is_power_bc = true;
122};
123
125{
126 FlowAndTemperature operator()(double const T_out, double const time) const
127 {
128 double const power = power_curve.getValue(time);
129
131 power,
133 density,
134 T_out,
136 power_min);
137 }
139
140 double flow_rate;
142 double density;
144 double power_min;
145 static constexpr bool is_power_bc = true;
146};
147
149{
150 FlowAndTemperature operator()(double const T_out, double const time) const
151 {
152 double const power = power_curve.getValue(time);
153 double const flow_rate = flow_curve.getValue(time);
154
155 return check_power_and_flow_rate(flow_rate,
156 power,
158 density,
159 T_out,
161 power_min);
162 }
165
167 double density;
169 double power_min;
170 static constexpr bool is_power_bc = true;
171};
172
174{
175 FlowAndTemperature operator()(double const T_out, double const time) const
176 {
177 double const power_building =
178 building_power_curves.power_curve.getValue(time);
179 double const cop = building_power_curves.cop_curve.getValue(T_out);
180
181 double const power = power_building - power_building / cop;
182
184 power,
186 density,
187 T_out,
189 power_min);
190 }
192
193 double flow_rate;
195 double density;
197 double power_min;
198 static constexpr bool is_power_bc = true;
199};
200
202{
203 FlowAndTemperature operator()(double const T_out, double const time) const
204 {
205 double const power_heating =
206 building_heating_curves.power_curve.getValue(time);
207 double const cop_heating =
208 building_heating_curves.cop_curve.getValue(T_out);
209
210 double const power_hot_water =
211 building_hot_water_curves.power_curve.getValue(time);
212 double const cop_hot_water =
213 building_hot_water_curves.cop_curve.getValue(T_out);
214
215 double const power_cooling =
216 building_active_cooling_curves.power_curve.getValue(time);
217 double const cop_cooling =
218 building_active_cooling_curves.cop_curve.getValue(T_out);
219
220 double const flow_rate = flow_curve.getValue(time);
221
222 double const power = power_heating - power_heating / cop_heating +
223 power_hot_water - power_hot_water / cop_hot_water +
224 power_cooling - power_cooling / cop_cooling;
225
226 return check_power_and_flow_rate(flow_rate,
227 power,
229 density,
230 T_out,
232 power_min);
233 }
238
240 double density;
242 double power_min;
243 static constexpr bool is_power_bc = true;
244};
245
247{
248 FlowAndTemperature operator()(double const T_out, double const time) const
249 {
250 double const power_heating =
251 building_heating_curves.power_curve.getValue(time);
252 double const cop_heating =
253 building_heating_curves.cop_curve.getValue(T_out);
254
255 double const power_hot_water =
256 building_hot_water_curves.power_curve.getValue(time);
257 double const cop_hot_water =
258 building_hot_water_curves.cop_curve.getValue(T_out);
259
260 double const power_cooling = cooling_power.getValue(time);
261
262 double const flow_rate = flow_curve.getValue(time);
263
264 double const power = power_heating - power_heating / cop_heating +
265 power_hot_water - power_hot_water / cop_hot_water +
266 power_cooling;
267
268 return check_power_and_flow_rate(flow_rate,
269 power,
271 density,
272 T_out,
274 power_min);
275 }
280
282 double density;
284 double power_min;
285 static constexpr bool is_power_bc = true;
286};
287
289{
290 FlowAndTemperature operator()(double const T_out, double const time) const
291 {
292 double const power_heating =
293 building_heating_curves.power_curve.getValue(time);
294 double const cop_heating =
295 building_heating_curves.cop_curve.getValue(T_out);
296
297 double const power_hot_water =
298 building_hot_water_curves.power_curve.getValue(time);
299 double const cop_hot_water =
300 building_hot_water_curves.cop_curve.getValue(T_out);
301
302 double const flow_rate = flow_curve.getValue(time);
303
304 double const power = power_heating - power_heating / cop_heating +
305 power_hot_water - power_hot_water / cop_hot_water;
306
307 return check_power_and_flow_rate(flow_rate,
308 power,
310 density,
311 T_out,
313 power_min);
314 }
318
320 double density;
322 double power_min;
323 static constexpr bool is_power_bc = true;
324};
325
327{
328 FlowAndTemperature operator()(double const T_out, double const time) const
329 {
330 double const power_heating =
331 building_heating_curves.power_curve.getValue(time);
332 double const cop_heating =
333 building_heating_curves.cop_curve.getValue(T_out);
334
335 double const power_cooling =
336 building_active_cooling_curves.power_curve.getValue(time);
337 double const cop_cooling =
338 building_active_cooling_curves.cop_curve.getValue(T_out);
339
340 double const flow_rate = flow_curve.getValue(time);
341
342 double const power = power_heating - power_heating / cop_heating +
343 power_cooling - power_cooling / cop_cooling;
344
345 return check_power_and_flow_rate(flow_rate,
346 power,
348 density,
349 T_out,
351 power_min);
352 }
356
358 double density;
360 double power_min;
361 static constexpr bool is_power_bc = true;
362};
363
365{
366 FlowAndTemperature operator()(double const T_out, double const time) const
367 {
368 double const power_heating =
369 building_heating_curves.power_curve.getValue(time);
370 double const cop_heating =
371 building_heating_curves.cop_curve.getValue(T_out);
372
373 double const power_cooling = cooling_power.getValue(time);
374
375 double const flow_rate = flow_curve.getValue(time);
376
377 double const power =
378 power_heating - power_heating / cop_heating + power_cooling;
379
380 return check_power_and_flow_rate(flow_rate,
381 power,
383 density,
384 T_out,
386 power_min);
387 }
391
393 double density;
395 double power_min;
396 static constexpr bool is_power_bc = true;
397};
398
400{
401 FlowAndTemperature operator()(double const T_out, double const time) const
402 {
403 double const power_heating =
404 building_heating_curves.power_curve.getValue(time);
405 double const cop_heating =
406 building_heating_curves.cop_curve.getValue(T_out);
407
408 double const flow_rate = flow_curve.getValue(time);
409
410 double const power = power_heating - power_heating / cop_heating;
411
412 return check_power_and_flow_rate(flow_rate,
413 power,
415 density,
416 T_out,
418 power_min);
419 }
422
424 double density;
426 double power_min;
427 static constexpr bool is_power_bc = true;
428};
429
431{
432 FlowAndTemperature operator()(double const T_out, double const time) const
433 {
434 double const power_cooling =
435 building_active_cooling_curves.power_curve.getValue(time);
436 double const cop_cooling =
437 building_active_cooling_curves.cop_curve.getValue(T_out);
438
439 double const flow_rate = flow_curve.getValue(time);
440
441 double const power = power_cooling - power_cooling / cop_cooling;
442
443 return check_power_and_flow_rate(flow_rate,
444 power,
446 density,
447 T_out,
449 power_min);
450 }
453
455 double density;
457 double power_min;
458 static constexpr bool is_power_bc = true;
459};
460
462 std::variant<TemperatureCurveConstantFlow,
476} // namespace BHE
477} // namespace HeatTransportBHE
478} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:19
std::variant< TemperatureCurveConstantFlow, TemperatureCurveFlowCurve, FixedPowerConstantFlow, FixedPowerFlowCurve, PowerCurveConstantFlow, PowerCurveFlowCurve, BuildingPowerCurveConstantFlow, BuildingPowerCurveHotWaterCurveActiveCoolingCurveFlowCurve, BuildingPowerCurveHotWaterCurvePassiveCoolingCurveFlowCurve, BuildingPowerCurveHotWaterCurveFlowCurve, BuildingPowerCurveActiveCoolingCurveFlowCurve, BuildingPowerCurvePassiveCoolingCurveFlowCurve, BuildingPowerCurveFlowCurve, ActiveCoolingCurveFlowCurve > FlowAndTemperatureControl
FlowAndTemperature check_power_and_flow_rate(double flow_rate, double power, double heat_capacity, double density, double T_out, double flow_rate_min, double power_min)
FlowAndTemperature operator()(double const T_out, double const time) const
FlowAndTemperature operator()(double const T_out, double const time) const
FlowAndTemperature operator()(double const T_out, double const time) const
FlowAndTemperature operator()(double const T_out, double const time) const
FlowAndTemperature operator()(double const T_out, double const time) const
FlowAndTemperature operator()(double const T_out, double const time) const
FlowAndTemperature operator()(double const T_out, double const) const
MathLib::PiecewiseLinearInterpolation const & flow_curve
FlowAndTemperature operator()(double const T_out, double const time) const
FlowAndTemperature operator()(double const T_out, double const time) const
MathLib::PiecewiseLinearInterpolation const & power_curve
MathLib::PiecewiseLinearInterpolation const & power_curve
FlowAndTemperature operator()(double const T_out, double const time) const
MathLib::PiecewiseLinearInterpolation const & flow_curve
FlowAndTemperature operator()(double const, double const time) const
MathLib::PiecewiseLinearInterpolation const & flow_rate_curve
MathLib::PiecewiseLinearInterpolation const & temperature_curve
FlowAndTemperature operator()(double const, double const time) const