CoolProp 6.8.1dev
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 { return x.size(); };
45
46 private:
47 std::shared_ptr<CoolProp::AbstractState> state_;
48 std::shared_ptr<CoolProp::AbstractState> critical_state_;
52
53 Isoline(CoolProp::parameters key, CoolProp::parameters xkey, CoolProp::parameters ykey, double value, const std::shared_ptr<CoolProp::AbstractState>& state);
54
55 Range get_sat_bounds(CoolProp::parameters key) const;
56 void calc_sat_range(int count);
57 void update_pair(int& ipos, int& xpos, int& ypos, int& pair);
58 void calc_range(std::vector<double>& xvals, std::vector<double>& yvals);
59
60 friend class PropertyPlot;
61};
62
63using Isolines = std::vector<Isoline>;
64
72std::vector<double> generate_values_in_range(Scale scale, const Range& range, int count);
80std::vector<double> generate_values_in_range(CoolProp::parameters type, const Range& range, int count);
81
82enum class TPLimits
83{
84 None,
85 Def,
86 Achp,
87 Orc
88};
89
115{
116 public:
117 struct Axis
118 {
120 union
121 {
123 struct
124 {
125 double min, max;
126 };
127 };
130
140
152 Isolines calc_isolines(CoolProp::parameters key, const std::vector<double>& values, int points) const;
156 std::vector<CoolProp::parameters> supported_isoline_keys() const;
165 double value_at(CoolProp::parameters key, double xvalue, double yvalue, CoolProp::phases phase = CoolProp::phases::iphase_not_imposed) const;
166
167 private:
168 struct Range2D
169 {
170 union
171 {
172 Range x, T;
173 };
174 union
175 {
176 Range y, p;
177 };
178 };
179
182 CoolProp::input_pairs axis_pair_;
183 bool swap_axis_inputs_for_update_;
184 std::shared_ptr<CoolProp::AbstractState> state_;
185 std::shared_ptr<CoolProp::AbstractState> critical_state_;
186 Range2D Tp_limits_;
187
188 Range get_sat_bounds(CoolProp::parameters key) const;
189 Range2D get_Tp_limits() const;
191};
192
193} /* namespace Plot */
194} /* namespace CoolProp */
195
196#endif /* COOLPROPPLOT_H_ */