CoolProp 7.2.0
An open-source fluid property and humid air property database
CoolPropPlot.h
Go to the documentation of this file.
1#ifndef COOLPROPPLOT_H_
2#define COOLPROPPLOT_H_
3
4#include "AbstractState.h"
5#include <vector>
6
7namespace CoolProp {
8namespace Plot {
9
10enum class Scale
11{
12 Lin,
13 Log
14};
15
16struct Range
17{
18 double min, max;
19};
20
21namespace Detail {
22
24std::shared_ptr<CoolProp::AbstractState> process_fluid_state(const std::string& fluid_ref);
25inline std::shared_ptr<CoolProp::AbstractState> get_critical_point(const std::shared_ptr<CoolProp::AbstractState>& state);
26
27} /* namespace Detail */
28
35{
36 public:
37 std::vector<double> x;
38 std::vector<double> y;
39 double value;
40
44 size_t size() const {
45 return x.size();
46 };
47
48 private:
49 std::shared_ptr<CoolProp::AbstractState> state_;
50 std::shared_ptr<CoolProp::AbstractState> critical_state_;
54
56 const std::shared_ptr<CoolProp::AbstractState>& state);
57
58 Range get_sat_bounds(CoolProp::parameters key) const;
59 void calc_sat_range(int count);
60 void update_pair(int& ipos, int& xpos, int& ypos, int& pair);
61 void calc_range(std::vector<double>& xvals, std::vector<double>& yvals);
62
63 friend class PropertyPlot;
64};
65
66using Isolines = std::vector<Isoline>;
67
75std::vector<double> generate_values_in_range(Scale scale, const Range& range, int count);
83std::vector<double> generate_values_in_range(CoolProp::parameters type, const Range& range, int count);
84
85enum class TPLimits
86{
87 None,
88 Def,
89 Achp,
90 Orc
91};
92
118{
119 public:
120 struct Axis
121 {
123 union
124 {
126 struct
127 {
128 double min, max;
129 };
130 };
133
142 PropertyPlot(const std::string& fluid_name, CoolProp::parameters ykey, CoolProp::parameters xkey,
144
156 Isolines calc_isolines(CoolProp::parameters key, const std::vector<double>& values, int points) const;
160 std::vector<CoolProp::parameters> supported_isoline_keys() const;
169 double value_at(CoolProp::parameters key, double xvalue, double yvalue, CoolProp::phases phase = CoolProp::phases::iphase_not_imposed) const;
170
171 private:
172 struct Range2D
173 {
174 union
175 {
176 Range x, T;
177 };
178 union
179 {
180 Range y, p;
181 };
182 };
183
186 CoolProp::input_pairs axis_pair_;
187 bool swap_axis_inputs_for_update_;
188 std::shared_ptr<CoolProp::AbstractState> state_;
189 std::shared_ptr<CoolProp::AbstractState> critical_state_;
190 Range2D Tp_limits_;
191
192 Range get_sat_bounds(CoolProp::parameters key) const;
193 Range2D get_Tp_limits() const;
195 CoolProp::parameters ykey = CoolProp::parameters::iundefined_parameter, bool autoscale = true) const;
196};
197
198} /* namespace Plot */
199} /* namespace CoolProp */
200
201#endif /* COOLPROPPLOT_H_ */