本文整理汇总了Python中CoolProp.CoolProp.toSI方法的典型用法代码示例。如果您正苦于以下问题:Python CoolProp.toSI方法的具体用法?Python CoolProp.toSI怎么用?Python CoolProp.toSI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoolProp.CoolProp
的用法示例。
在下文中一共展示了CoolProp.toSI方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_isolines
# 需要导入模块: from CoolProp import CoolProp [as 别名]
# 或者: from CoolProp.CoolProp import toSI [as 别名]
def draw_isolines(self, iso_type, iso_range, num=10, rounding=False,
units='kSI', line_opts=None, axis_limits=None):
""" Create isolines
Parameters
----------
iso_type : str
Type of the isolines
iso_range : list
Range between isolines will be created [min, max]
num : int
Number of the isolines within range, Optional
units : str
Unit system of the input data ('kSI' or 'SI'), Optional
line_opts : dict
Line options (please see :func:`matplotlib.pyplot.plot`), Optional
axis_limits : list
Limits for drawing isolines [[xmin, xmax], [ymin, ymax]], Optional
"""
# convert input data to SI units for internal use
iso_range = CP.toSI(iso_type, iso_range, units)
if axis_limits is not None:
axis_limits = [CP.toSI(self.graph_type[1].upper(), axis_limits[0], units),
CP.toSI(self.graph_type[0].upper(), axis_limits[1], units),
]
iso_lines = IsoLines(self.fluid_ref,
self.graph_type,
iso_type,
axis=self.axis)
iso_lines.draw_isolines(iso_range, num, rounding, line_opts, axis_limits)
示例2: draw_process
# 需要导入模块: from CoolProp import CoolProp [as 别名]
# 或者: from CoolProp.CoolProp import toSI [as 别名]
def draw_process(self, states, line_opts={'color' : 'r', 'lw' : 1.5}):
""" Draw process or cycle from list of State objects
Parameters
----------
states : list
List of CoolProp.State.State objects
line_opts : dict
Line options (please see :func:`matplotlib.pyplot.plot`), Optional
"""
# plot above other lines
line_opts['zorder'] = 10
for i, state in enumerate(states):
if state.Fluid != self.fluid_ref:
raise ValueError('Fluid [{0}] from State object does not match PropsPlot fluid [{1}].'.format(state.Fluid, self.fluid_ref))
if i == 0: continue
S2 = states[i]
S1 = states[i-1]
iso = False
y_name, x_name = self.graph_type.lower().replace('t', 'T')
x1 = getattr(S1, x_name)
x2 = getattr(S2, x_name)
y1 = getattr(S1, y_name)
y2 = getattr(S2, y_name)
# search for equal properties between states
for iso_type in ['p', 'T', 's', 'h', 'rho']:
if getattr(S1, iso_type) == getattr(S2, iso_type):
axis_limits = [[x1, x2], [y1, y2]]
self.draw_isolines(iso_type.upper(), [getattr(S1, iso_type)],
num=1, units='kSI', line_opts=line_opts,
axis_limits=axis_limits)
iso = True
break
# connect states with straight line
if not iso:
# convert values to SI for plotting
x_val = [CP.toSI(x_name.upper(), x1, 'kSI'),
CP.toSI(x_name.upper(), x2, 'kSI')]
y_val = [CP.toSI(y_name.upper(), y1, 'kSI'),
CP.toSI(y_name.upper(), y2, 'kSI')]
self.axis.plot(x_val, y_val, **line_opts)
示例3: draw_isolines
# 需要导入模块: from CoolProp import CoolProp [as 别名]
# 或者: from CoolProp.CoolProp import toSI [as 别名]
def draw_isolines(self, iso_type, iso_range, num=10, rounding=False, units='kSI'):
# convert range to SI units for internal use
iso_range = CP.toSI(iso_type, iso_range, units)
iso_lines = IsoLines(self.fluid_ref,
self.graph_type,
iso_type,
axis=self.axis)
iso_lines.draw_isolines(iso_range, num, rounding)
示例4: drawIsoLines
# 需要导入模块: from CoolProp import CoolProp [as 别名]
# 或者: from CoolProp.CoolProp import toSI [as 别名]
def drawIsoLines(Ref, plot, which, iValues=[], num=0, show=False, axis=None, units='kSI', line_opts=None):
"""
Draw lines with constant values of type 'which' in terms of x and y as
defined by 'plot'. 'iMin' and 'iMax' are minimum and maximum value
between which 'num' get drawn.
:Note:
:func:`CoolProps.Plots.drawIsoLines` will be depreciated in future
releases and replaced with :func:`CoolProps.Plots.IsoLines`
Parameters
-----------
Ref : str
The given reference fluid
plot : str
The plot type used
which : str
The iso line type
iValues : list
The list of constant iso line values
num : int, Optional
The number of iso lines
(Default: 0 - Use iValues list only)
show : bool, Optional
Show the current plot
(Default: False)
axis : :func:`matplotlib.pyplot.gca()`, Optional
The current axis system to be plotted to.
(Default: create a new axis system)
units : str
Unit system of the input data ('kSI' or 'SI'), Optional
line_opts : dict
Line options (please see :func:`matplotlib.pyplot.plot`), Optional
Examples
--------
>>> from matplotlib import pyplot
>>> from CoolProp.Plots import Ts, drawIsoLines
>>>
>>> Ref = 'n-Pentane'
>>> ax = Ts(Ref)
>>> ax.set_xlim([-0.5, 1.5])
>>> ax.set_ylim([300, 530])
>>> quality = drawIsoLines(Ref, 'Ts', 'Q', [0.3, 0.5, 0.7, 0.8], axis=ax)
>>> isobars = drawIsoLines(Ref, 'Ts', 'P', [100, 2000], num=5, axis=ax)
>>> isochores = drawIsoLines(Ref, 'Ts', 'D', [2, 600], num=7, axis=ax)
>>> pyplot.show()
"""
# convert input data to SI units for internal use
iValues = CP.toSI(which, iValues, units)
isolines = IsoLines(Ref, plot, which, axis=axis)
lines = isolines.draw_isolines(iValues, num=num, line_opts=line_opts)
if show:
isolines.show()
return lines
示例5: set_axis_limits
# 需要导入模块: from CoolProp import CoolProp [as 别名]
# 或者: from CoolProp.CoolProp import toSI [as 别名]
def set_axis_limits(self, limits, units='kSI'):
# convert limits to SI units for internal use
limits[0:2] = CP.toSI(self.graph_type[1], limits[0:2], units)
limits[2:] = CP.toSI(self.graph_type[0], limits[2:], units)
self.axis.set_xlim([limits[0], limits[1]])
self.axis.set_ylim([limits[2], limits[3]])