Loading [MathJax]/extensions/TeX/AMSsymbols.js
CoolProp  6.7.0
An open-source fluid property and humid air property database
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Public Attributes | List of all members
CoolProp::Plot::PropertyPlot Class Reference

Detailed Description

A class representing a property plot of a fluid. Used to generate isolines of a given parameter over a given pair of parameters. The code is a C++ reimplementation of the Python CoolProp.Plots.PropertyPlot class, with the actual drawing of the calculated values of the plot left to the user.

Supported plots: "p-h", "T-s", "h-s", "p-s", "p-rho", "T-rho", and "p-T".

Example usage for generating a log p-h plot for R134a with temperature isolines (for more examples, see the tests at the bottom of src/CoolPropPlot.cpp):

// Create a plot object for R134a with pressure on the y axis and enthalpy on the x axis
// print the axis properties:
std::cout << "x axis: h, " << (plot.xaxis.scale == CoolProp::Plot::Scale::Lin ? "lin" : "log") << ", limits [" << plot.xaxis.min << ", " << plot.xaxis.max << "] J/kg" << "\n";
std::cout << "y axis: p, " << (plot.yaxis.scale == CoolProp::Plot::Scale::Lin ? "lin" : "log") << ", limits [" << plot.yaxis.min << ", " << plot.yaxis.max << "] Pa" << "\n";
// Generate 5 isolines for temperature in K on this plot, 100 points per isoline
std::vector<double> t_values = CoolProp::Plot::generate_values_in_range(CoolProp::iT, plot.isoline_range(CoolProp::iT), 5);
CoolProp::Plot::Isolines t_isolines = plot.calc_isolines(CoolProp::iT, t_values, 100);
// print the first temperature isoline:
std::cout << "T: " << t_isolines[0].value << " K\n";
for (int i = 0; i < t_isolines[0].size(); ++i) {
std::cout << "h: " << t_isolines[0].x[i] << " J/kg, p: " << t_isolines[0].y[i] << " Pa\n";
}

Definition at line 114 of file CoolPropPlot.h.

#include <CoolPropPlot.h>

Classes

struct  Axis
 

Public Member Functions

 PropertyPlot (const std::string &fluid_name, CoolProp::parameters ykey, CoolProp::parameters xkey, CoolProp::Plot::TPLimits tp_limits=CoolProp::Plot::TPLimits::Def)
 Construct a PropertyPlot object for a given fluid and a pair of parameters to plot. More...
 
Range isoline_range (CoolProp::parameters key) const
 Retrieve a valid range of values (inclusive) for the isoline with the given key in SI units. More...
 
Isolines calc_isolines (CoolProp::parameters key, const std::vector< double > &values, int points) const
 Calculate the isolines for the given key at given values in SI unit. More...
 
std::vector< CoolProp::parameterssupported_isoline_keys () const
 Retrieve a list of supported isoline keys for this plot. More...
 
double value_at (CoolProp::parameters key, double xvalue, double yvalue, CoolProp::phases phase=CoolProp::phases::iphase_not_imposed) const
 A method for calculating the value of a parameter at a given point in the plot. Useful for "value under cursor" type of queries. Returns NaN if the value is not defined at the given point. Convenience method for CoolProp::PropsSI based on the configuration of the plot object. More...
 

Public Attributes

struct CoolProp::Plot::PropertyPlot::Axis xaxis
 The (non-modifiable) properties of the x axis of the plot. More...
 
struct CoolProp::Plot::PropertyPlot::Axis yaxis
 The (non-modifiable) properties of the y axis of the plot. More...
 

Constructor & Destructor Documentation

◆ PropertyPlot()

CoolProp::Plot::PropertyPlot::PropertyPlot ( const std::string &  fluid_name,
CoolProp::parameters  ykey,
CoolProp::parameters  xkey,
CoolProp::Plot::TPLimits  tp_limits = CoolProp::Plot::TPLimits::Def 
)

Construct a PropertyPlot object for a given fluid and a pair of parameters to plot.

Parameters
fluid_nameThe name of the fluid to plot (e.g. "HEOS::R134a", or "Water")
ykeyThe parameter to plot on the y axis (e.g. for "ph" plots this would be CoolProp::iP, and for "Ts" plots this would be CoolProp::iT)
xkeyThe parameter to plot on the x axis (e.g. for "ph" plots this would be CoolProp::iHmass, and for "Ts" plots this would be CoolProp::iSmass)
tp_limitsThe temperature and pressure limits of the plot.

Definition at line 263 of file CoolPropPlot.cpp.

Member Function Documentation

◆ calc_isolines()

Isolines CoolProp::Plot::PropertyPlot::calc_isolines ( CoolProp::parameters  key,
const std::vector< double > &  values,
int  points 
) const

Calculate the isolines for the given key at given values in SI unit.

Parameters
keyThe parameter to calculate the isolines for (usually one of the supported isoline keys, e.g. CoolProp::iP or CoolProp::iT. Full list can be obtained with PropertyPlot::supported_isoline_keys())
valuesThe values of the isolines to calculate in SI units
pointsThe number of points to calculate for each isoline. The larger the number, the smoother the isoline will look

Definition at line 300 of file CoolPropPlot.cpp.

◆ isoline_range()

Range CoolProp::Plot::PropertyPlot::isoline_range ( CoolProp::parameters  key) const

Retrieve a valid range of values (inclusive) for the isoline with the given key in SI units.

Definition at line 293 of file CoolPropPlot.cpp.

◆ supported_isoline_keys()

std::vector< CoolProp::parameters > CoolProp::Plot::PropertyPlot::supported_isoline_keys ( ) const

Retrieve a list of supported isoline keys for this plot.

Definition at line 313 of file CoolPropPlot.cpp.

◆ value_at()

double CoolProp::Plot::PropertyPlot::value_at ( CoolProp::parameters  key,
double  xvalue,
double  yvalue,
CoolProp::phases  phase = CoolProp::phases::iphase_not_imposed 
) const

A method for calculating the value of a parameter at a given point in the plot. Useful for "value under cursor" type of queries. Returns NaN if the value is not defined at the given point. Convenience method for CoolProp::PropsSI based on the configuration of the plot object.

Parameters
keyThe parameter to calculate the value for (usually one of the supported isoline keys, e.g. CoolProp::iP or CoolProp::iT. Full list can be obtained with PropertyPlot::supported_isoline_keys())
xvalueThe x coordinate of the query point in SI units of the x axis of the plot
yvalueThe y coordinate of the query point in SI units of the y axis of the plot
phaseThe phase to impose for the calculation. By default, the phase is not imposed.

Definition at line 325 of file CoolPropPlot.cpp.

Member Data Documentation

◆ xaxis

struct CoolProp::Plot::PropertyPlot::Axis CoolProp::Plot::PropertyPlot::xaxis

The (non-modifiable) properties of the x axis of the plot.

◆ yaxis

struct CoolProp::Plot::PropertyPlot::Axis CoolProp::Plot::PropertyPlot::yaxis

The (non-modifiable) properties of the y axis of the plot.


The documentation for this class was generated from the following files: