OGS 6.2.0-97-g4a610c866
CreateFlowAndTemperatureControl.cpp
Go to the documentation of this file.
1 
12 #include "BaseLib/Algorithm.h"
13 #include "BaseLib/ConfigTree.h"
15 
17 #include "RefrigerantProperties.h"
18 
19 namespace ProcessLib
20 {
21 namespace HeatTransportBHE
22 {
23 namespace 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 == "FixedPowerConstantFlow")
48  {
50  auto const power = config.getConfigParameter<double>("power");
51 
53  auto const flow_rate = config.getConfigParameter<double>("flow_rate");
54  return FixedPowerConstantFlow{flow_rate, power,
55  refrigerant.specific_heat_capacity,
56  refrigerant.density};
57  }
58 
59  if (type == "FixedPowerFlowCurve")
60  {
61  auto const& flow_rate_curve = *BaseLib::getOrError(
62  curves,
64  config.getConfigParameter<std::string>("flow_rate_curve"),
65  "Required flow rate curve not found.");
66 
68  auto const power = config.getConfigParameter<double>("power");
69 
70  return FixedPowerFlowCurve{flow_rate_curve, power,
71  refrigerant.specific_heat_capacity,
72  refrigerant.density};
73  }
74 
75  if (type == "PowerCurveConstantFlow")
76  {
77  auto const& power_curve = *BaseLib::getOrError(
78  curves,
80  config.getConfigParameter<std::string>("power_curve"),
81  "Required power curve not found.");
82 
84  auto const flow_rate = config.getConfigParameter<double>("flow_rate");
85 
86  return PowerCurveConstantFlow{power_curve, flow_rate,
87  refrigerant.specific_heat_capacity,
88  refrigerant.density};
89  }
90  OGS_FATAL("FlowAndTemperatureControl type '%s' is not implemented.",
91  type.c_str());
92 }
93 } // namespace BHE
94 } // namespace HeatTransportBHE
95 } // namespace ProcessLib
Definition of the PiecewiseLinearInterpolation class.
Map::mapped_type & getOrError(Map &map, Key const &key, std::string const &error_message)
Definition: Algorithm.h:147
T getConfigParameter(std::string const &param) const
FlowAndTemperatureControl createFlowAndTemperatureControl(BaseLib::ConfigTree const &config, std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation >> const &curves, RefrigerantProperties const &refrigerant)
boost::variant< TemperatureCurveConstantFlow, FixedPowerConstantFlow, FixedPowerFlowCurve, PowerCurveConstantFlow > FlowAndTemperatureControl
#define OGS_FATAL(fmt,...)
Definition: Error.h:63