CoolProp.Plots.Plots module¶
- CoolProp.Plots.Plots.InlineLabel(xv, yv, x=None, y=None, axis=None, fig=None)¶
- class CoolProp.Plots.Plots.PropertyPlot(fluid_name, graph_type, **kwargs)¶
Bases:
BasePlot
Create graph for the specified fluid properties
- Parameters:
fluid_name (string or AbstractState) – The name of the fluid to be plotted or a state instance
graph_type (string) – The graph type to be plotted, like “PH” or “TS”
axis (
matplotlib.pyplot.gca()
, Optional) – The current axis system to be plotted to. Default: create a new axis systemfig (
matplotlib.pyplot.figure()
, Optional) – The current figure to be plotted to. Default: create a new figureunit_system (string, ['EUR','KSI','SI']) – Select the units used for the plotting. ‘EUR’ is bar, kJ, C; ‘KSI’ is kPa, kJ, K; ‘SI’ is Pa, J, K
tp_limits (string, ['NONE','DEF','ACHP','ORC']) – Select the limits in T and p.
reciprocal_density (bool) – NOT IMPLEMENTED: If True, 1/rho will be plotted instead of rho
Examples
>>> from CoolProp.Plots import PropertyPlot >>> plot = PropertyPlot('HEOS::Water', 'TS') >>> plot.calc_isolines() >>> plot.show()
>>> import CoolProp >>> from CoolProp.Plots import PropertyPlot >>> plot = PropertyPlot('HEOS::R134a', 'PH', unit_system='EUR', tp_limits='ACHP') >>> plot.calc_isolines(CoolProp.iQ, num=11) >>> plot.calc_isolines(CoolProp.iT, num=25) >>> plot.calc_isolines(CoolProp.iSmass, num=15) >>> plot.show()
>>> import CoolProp >>> from CoolProp.Plots import PropertyPlot >>> plot = PropertyPlot('HEOS::R245fa', 'TS', unit_system='EUR', tp_limits='ORC') >>> plot.calc_isolines(CoolProp.iQ, num=11) >>> plot.calc_isolines(CoolProp.iP, iso_range=[1,50], num=10, rounding=True) >>> plot.draw() >>> plot.isolines.clear() >>> plot.props[CoolProp.iP]['color'] = 'green' >>> plot.props[CoolProp.iP]['lw'] = '0.5' >>> plot.calc_isolines(CoolProp.iP, iso_range=[1,50], num=10, rounding=False) >>> plot.show()
Note
See the online documentation for a list of the available fluids and graph types
- calc_isolines(iso_type=None, iso_range=None, num=15, rounding=False, points=250)¶
Calculate lines with constant values of type ‘iso_type’ in terms of x and y as defined by the plot object. ‘iso_range’ either is a collection of values or simply the minimum and maximum value between which ‘num’ lines get calculated. The ‘rounding’ parameter can be used to generate prettier labels if needed.
- draw()¶
- draw_isolines()¶
- draw_process(statecontainer, points=None, line_opts=None)¶
Draw process or cycle from x and y values in axis units
- Parameters:
statecontainer (CoolProp.Plots.SimpleCycles.StateContainer()) – A state container object that contains all the information required to draw the process. Note that points that appear several times get added to a special of highlighted points.
line_opts (dict) – Line options (please see
matplotlib.pyplot.plot()
), optional Use this parameter to pass a label for the legend.
Examples
>>> import CoolProp >>> from CoolProp.Plots import PropertyPlot >>> pp = PropertyPlot('HEOS::Water', 'TS', unit_system='EUR') >>> pp.calc_isolines(CoolProp.iP ) >>> pp.calc_isolines(CoolProp.iHmass ) >>> pp.calc_isolines(CoolProp.iQ, num=11) >>> cycle = SimpleRankineCycle('HEOS::Water', 'TS', unit_system='EUR') >>> T0 = 300 >>> pp.state.update(CoolProp.QT_INPUTS,0.0,T0+15) >>> p0 = pp.state.keyed_output(CoolProp.iP) >>> T2 = 700 >>> pp.state.update(CoolProp.QT_INPUTS,1.0,T2-150) >>> p2 = pp.state.keyed_output(CoolProp.iP) >>> cycle.simple_solve(T0, p0, T2, p2, 0.7, 0.8, SI=True) >>> cycle.steps = 50 >>> sc = cycle.get_state_changes() >>> pp.draw_process(sc) >>> # The same calculation can be carried out in another unit system: >>> cycle.simple_solve(T0-273.15-10, p0/1e5, T2-273.15+50, p2/1e5-5, 0.7, 0.8, SI=False) >>> sc2 = cycle.get_state_changes() >>> pp.draw_process(sc2, line_opts={'color':'blue', 'lw':1.5}) >>> pp.show()
- property isolines¶
- savefig(*args, **kwargs)¶
- show()¶
- class CoolProp.Plots.Plots.PropsPlot(fluid_name, graph_type, units='KSI', reciprocal_density=False, **kwargs)¶
Bases:
PropertyPlot
Create graph for the specified fluid properties
- Parameters:
fluid_name (string or AbstractState) – The name of the fluid to be plotted or a state instance
graph_type (string) – The graph type to be plotted, like “PH” or “TS”
axis (
matplotlib.pyplot.gca()
, Optional) – The current axis system to be plotted to. Default: create a new axis systemfig (
matplotlib.pyplot.figure()
, Optional) – The current figure to be plotted to. Default: create a new figureunit_system (string, ['EUR','KSI','SI']) – Select the units used for the plotting. ‘EUR’ is bar, kJ, C; ‘KSI’ is kPa, kJ, K; ‘SI’ is Pa, J, K
tp_limits (string, ['NONE','DEF','ACHP','ORC']) – Select the limits in T and p.
reciprocal_density (bool) – NOT IMPLEMENTED: If True, 1/rho will be plotted instead of rho
Examples
>>> from CoolProp.Plots import PropertyPlot >>> plot = PropertyPlot('HEOS::Water', 'TS') >>> plot.calc_isolines() >>> plot.show()
>>> import CoolProp >>> from CoolProp.Plots import PropertyPlot >>> plot = PropertyPlot('HEOS::R134a', 'PH', unit_system='EUR', tp_limits='ACHP') >>> plot.calc_isolines(CoolProp.iQ, num=11) >>> plot.calc_isolines(CoolProp.iT, num=25) >>> plot.calc_isolines(CoolProp.iSmass, num=15) >>> plot.show()
>>> import CoolProp >>> from CoolProp.Plots import PropertyPlot >>> plot = PropertyPlot('HEOS::R245fa', 'TS', unit_system='EUR', tp_limits='ORC') >>> plot.calc_isolines(CoolProp.iQ, num=11) >>> plot.calc_isolines(CoolProp.iP, iso_range=[1,50], num=10, rounding=True) >>> plot.draw() >>> plot.isolines.clear() >>> plot.props[CoolProp.iP]['color'] = 'green' >>> plot.props[CoolProp.iP]['lw'] = '0.5' >>> plot.calc_isolines(CoolProp.iP, iso_range=[1,50], num=10, rounding=False) >>> plot.show()
Note
See the online documentation for a list of the available fluids and graph types