| 271 | } |
| 272 | |
| 273 | PropertyPlot::PropertyPlot(const std::string& fluid_name, CoolProp::parameters ykey, CoolProp::parameters xkey, TPLimits tp_limits) |
| 274 | : xkey_(xkey), ykey_(ykey) { |
| 275 | this->state_ = Detail::process_fluid_state(fluid_name); |
| 276 | this->critical_state_ = Detail::get_critical_point(state_); |
| 277 | |
| 278 | xaxis.scale = Detail::default_scale(xkey); |
| 279 | yaxis.scale = Detail::default_scale(ykey); |
| 280 | |
| 281 | // We are just assuming that all inputs and outputs are in SI units. We |
| 282 | // take care of any conversions before calling the library and after |
| 283 | // getting the results. |
| 284 | int out1 = 0, out2 = 0; |
| 285 | axis_pair_ = CoolProp::generate_update_pair(xkey, 0, ykey, 1, out1, out2); |
| 286 | swap_axis_inputs_for_update_ = (out1 == 1); |
| 287 | |
| 288 | const double HI_FACTOR = 2.25; // Upper default limits: HI_FACTOR*T_crit and HI_FACTOR*p_crit |
| 289 | const double LO_FACTOR = 1.01; // Lower default limits: LO_FACTOR*T_triple and LO_FACTOR*p_triple |
| 290 | switch (tp_limits) { |
| 291 | case TPLimits::None: |
| 292 | this->Tp_limits_ = {{Detail::NaN, Detail::NaN}, {Detail::NaN, Detail::NaN}}; |
| 293 | break; |
| 294 | case TPLimits::Def: |
| 295 | this->Tp_limits_ = {{LO_FACTOR, HI_FACTOR}, {LO_FACTOR, HI_FACTOR}}; |
| 296 | break; |
| 297 | case TPLimits::Achp: |
| 298 | this->Tp_limits_ = {{173.15, 493.15}, {0.25e5, HI_FACTOR}}; |
| 299 | break; |
| 300 | case TPLimits::Orc: |
| 301 | this->Tp_limits_ = {{273.15, 673.15}, {0.25e5, HI_FACTOR}}; |
| 302 | break; |
| 303 | } |
| 304 | |
| 305 | Range2D ranges = get_axis_limits(); |
| 306 | xaxis.range = ranges.x; |
| 307 | yaxis.range = ranges.y; |
| 308 | } |
| 309 | |
| 310 | Range PropertyPlot::isoline_range(CoolProp::parameters key) const { |
| 311 | if (key == CoolProp::iQ) |
nothing calls this directly
no test coverage detected