Files
CoolProp/Web/coolprop/examples/examples.rst
2014-08-05 15:00:53 +02:00

59 lines
1.8 KiB
ReStructuredText

Examples
========
This page serves as a teaser of the functionality of CoolProp. These examples are written in the Python programming language. For more information see:
- :ref:`Pure and Pseudo-Pure fluid properties <Fluid-Properties>`
- :ref:`Mixture properties <mixtures>`
- :ref:`Wrapper-specific code examples <wrappers>`
Sample Props Code
-------------------
To use the ``PropsSI`` function, import it and do some calls, do something like this
.. ipython::
# Import the things you need
In [1]: from CoolProp.CoolProp import PropsSI
# Print the currently used version of coolprop
In [1]: import CoolProp; print(CoolProp.__version__)
# Density of carbon dioxide at 100 bar and 25C
In [2]: PropsSI('D', 'T', 298.15, 'P', 100e5, 'CO2')
# Saturated vapor enthalpy [J/kg] of R134a at 25C
In [2]: PropsSI('H', 'T', 298.15, 'Q', 1, 'R134a')
Or go to the :ref:`Fluid-Properties` documentation.
All the possible input and output parameters are listed in the
:py:func:`CoolProp.CoolProp.Props` documentation
Sample HAProps Code
-------------------
To use the HAProps function, import it and do some calls, do something like this
.. ipython::
# import the things you need
In [1]: from CoolProp.HumidAirProp import HAProps, HAProps_Aux
# Enthalpy (kJ per kg dry air) as a function of temperature, pressure,
# and relative humidity at STP
In [2]: h = HAProps('H','T',298.15,'P',101.325,'R',0.5); print h
# Temperature of saturated air at the previous enthalpy
In [2]: T = HAProps('T','P',101.325,'H',h,'R',1.0); print T
# Temperature of saturated air - order of inputs doesn't matter
In [2]: T = HAProps('T','H',h,'R',1.0,'P',101.325); print T
Or go to the :ref:`Humid-Air` documentation.
Plotting
--------
.. toctree::
:maxdepth: 1
Python/plotting.rst