You are on page 1of 5

X STEAM FOR MATLAB

By Magnus Holmgren, www.x-eng.com Date: 2006-01-20


By Magnus Holmgren, www.x-eng.com The steam tables are free and provided as is. We take no responsibilities for any errors in the code or damage thereby. You are free to use, modify and distribute the code as long as authorship is properly acknowledged. Please notify me at magnus@x-eng.com if the code is used in commercial applications

Conclusion
X Steam for Matlab is a implementation of the IAPWS IF97 standard formulation. It provides accurate data for water and steam and mixtures of water and steam properties from 0 - 1000 bar and from 0 - 2000 deg C. It is programmed as a matlab .m file. XSteam are also available for MS Excel or OpenOffice at www.x-eng.com. The initial units of XSteam are SI units as denoted in this document. All functions however call unit conversion functions so the units can be easily changed. A text file with unit conversion functions for English units are enclosed with the file. Calling syntax: XSteam(fun,In1.[In2]) XSteam take 2 or 3 arguments. The first argument must always be the steam table function you want to use. The other arguments are the inputs to that function. Example: XSteam('h_pt',1,20) Returns the enthalpy of water at 1 bar and 20 degC Example: XSteam('TSat_p',1) Returns the saturation temperature of water at 1 bar.

For a list of valid Steam Table functions se section 3 or the XSteam macros for MS Excel.

Contents 1 2 3 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 INTRODUCTION ........................................................................................ 2 USING THE MATLAB IMPLEMENTATION................................................ 2 XSTEAM CALLING FUNCTIONS .............................................................. 3 Temperature .............................................................................................. 3 Pressure .................................................................................................... 3 Enthalpy .................................................................................................... 3 Specific volume......................................................................................... 3 Density....................................................................................................... 3 Specific entropy........................................................................................ 3 Specific internal energy............................................................................ 4 Specific isobaric heat capacity ................................................................ 4 Specific isochoric heat capacity.............................................................. 4 Speed of sound......................................................................................... 4 Viscosity.................................................................................................... 4 Thermal Conductivity ............................................................................... 5 Surface Tension........................................................................................ 5 Vapour fraction ......................................................................................... 5 Vapour Volume Fraction........................................................................... 5

INTRODUCTION
X Steam for matlab is a implementation of the IAPWS IF97 standard formulation. It provides accurate thermo hydraulic data for water and steam and mixtures of water and steam in the region: 0C < temperature < 2000C for 0.00611 bar a < pressure < 100 bar a 0C < temperature < 1000C for 0.00611 bar a < pressure < 1000 bar a

For accuracy and further information on IAPWS IF97 formulation, se homepage of the international association for properties of water and steam (www.iapws.org).

USING THE MATLAB IMPLEMENTATION


X Steam are available both for matlab and for MS excel. The MS Excel version can be useful also for matlab users to get valid calling functions. The XSteam code are used in the following way: Out=XSteam(function name,In1,In2)

Function name are the name on the XSteam function and In1 and In2 are the inputs to that function. The results are returned (in this case to Out). Example: XSteam(rho_pT,1,200) returns the density at 1 bar and 200C. Valid XSteam functions are listed in section 3. The notaions used in XSteam are listed in the table bellow with the currently implemented.

Notation
T p h v rho s u Cp Cv w my tc st x vx

Quantity
Temperature Pressure Enthalpy Specific volume Density Specific entropy Specific internal energy Specific isobaric heat capacity Specific isochoric heat capacity Speed of sound Viscosity Thermal Conductivity Surface Tension Vapour fraction (0-1) Vapour Volume Fraction (0-1)

Unit
C bar kJ/kg m3/kg kg/ m3 kJ/(kg C) kJ/kg kJ/(kg C) kJ/(kg C) m/s Pa s W/(m C) N/m -

3 3.1

XSTEAM CALLING FUNCTIONS Temperature


Function Tsat_p T_ph T_ps T_hs In1 p p p h In2 H S S Out Saturation temperature Temperture as a function of pressure and enthalpy Temperture as a function of pressure and entropy Temperture as a function of enthalpy and entropy

3.2

Pressure
Function psat_T p_hs p_hrho In1 T h h In2 s rho Out Saturation pressure Pressure as a function of h and s. Pressure as a function of h and rho (density). Very unaccurate for solid water region since it's almost incompressible!

3.3

Enthalpy
Function hV_p hL_p hV_T hL_T h_pT h_ps h_px h_Tx h_prho In1 p p T T p p p T p In2 Out Saturated vapour enthalpy Saturated liquid enthalpy Saturated vapour enthalpy Saturated liquid enthalpy Entalpy as a function of pressure and temperature. Entalpy as a function of pressure and entropy. Entalpy as a function of pressure and vapour fraction Entalpy as a function of temperature and vapour fraction Entalpy as a function of pressure and density. Observe for low temperatures (liquid) this equation has 2 solutions. (Not valid!!)

T s x X rho

3.4

Specific volume
Function vV_p vL_p vV_T vL_T v_pT v_ph v_ps In1 p p T T p p p In2 Out Saturated vapour volume Saturated liquid volume Saturated vapour volume Saturated liquid volume Specific volume as a function of pressure and temperature. Specific volume as a function of pressure and enthalpy Specific volume as a function of pressure and entropy.

T h s

3.5

Density
Function rhoV_p rhoL_p rhoV_T rhoL_T rho_pT rho_ph rho_ps In1 p p T T p p p In2 Out Saturated vapour density Saturated liquid density Saturated vapour density Saturated liquid density Density as a function of pressure and temperature. Density as a function of pressure and enthalpy Density as a function of pressure and entropy.

T h s

3.6

Specific entropy
Function sV_p sL_p sV_T sL_T s_pT s_ph In1 p p T T p p In2 Out Saturated vapour entropy Saturated liquid entropy Saturated vapour entropy Saturated liquid entropy Specific entropy as a function of pressure and temperature (Returns saturated vapour entalpy if mixture.) Specific entropy as a function of pressure and enthalpy

T h

3.7

Specific internal energy


Function uV_p uL_p uV_T uL_T u_pT u_ph u_ps In1 p p T T p p p In2 Out Saturated vapour internal energy Saturated liquid internal energy Saturated vapour internal energy Saturated liquid internal energy Specific internal energy as a function of pressure and temperature. Specific internal energy as a function of pressure and enthalpy Specific internal energy as a function of pressure and entropy.

T h s

3.8

Specific isobaric heat capacity


Function CpV_p CpL_p CpV_T CpL_T Cp_pT Cp_ph Cp_ps In1 p p T T p p p In2 Out Saturated vapour heat capacity Saturated liquid heat capacity Saturated vapour heat capacity Saturated liquid heat capacity Specific isobaric heat capacity as a function of pressure and temperature. Specific isobaric heat capacity as a function of pressure and enthalpy Specific isobaric heat capacity as a function of pressure and entropy.

T h s

3.9

Specific isochoric heat capacity


Function CvV_p CvL_p CvV_T CvL_T Cv_pT Cv_ph Cv_ps In1 p p T T p p p In2 Out Saturated vapour isochoric heat capacity Saturated liquid isochoric heat capacity Saturated vapour isochoric heat capacity Saturated liquid isochoric heat capacity Specific isochoric heat capacity as a function of pressure and temperature. Specific isochoric heat capacity as a function of pressure and enthalpy Specific isochoric heat capacity as a function of pressure and entropy.

T h s

3.10

Speed of sound
Function wV_p wL_p wV_T wL_T w_pT w_ph w_ps In1 p p T T p p p In2 Out Saturated vapour speed of sound Saturated liquid speed of sound Saturated vapour speed of sound Saturated liquid speed of sound Speed of sound as a function of pressure and temperature. Speed of sound as a function of pressure and enthalpy Speed of sound as a function of pressure and entropy.

T h s

3.11

Viscosity
Viscosity is not part of IAPWS Steam IF97. Equations from "Revised Release on the IAPWS Formulation 1985 for the Viscosity of Ordinary Water Substance", 2003 are used. Viscosity in the mixed region (4) is interpolated according to the density. This is not true since it will be two fases.

Function my_pT my_ph my_ps

In1 p p p

In2 T h s

Out Viscosity as a function of pressure and temperature. Viscosity as a function of pressure and enthalpy Viscosity as a function of pressure and entropy.

3.12

Thermal Conductivity
Revised release on the IAPS Formulation 1985 for the Thermal Conductivity of ordinary water substance (IAPWS 1998) Function tcL_p tcV_p tcL_T tcV_T tc_pT tc_ph tc_hs In1 p p T T p p h In2 Out Saturated vapour thermal conductivity Saturated liquid thermal conductivity Saturated vapour thermal conductivity Saturated liquid thermal conductivity Thermal conductivity as a function of pressure and temperature. Thermal conductivity as a function of pressure and enthalpy Thermal conductivity as a function of enthalpy and entropy

T h s

3.13

Surface Tension
IAPWS Release on Surface Tension of Ordinary Water Substance, September 1994 Function st_T st_p In1 T p In2 Out Surface tension for two phase water/steam as a function of T Surface tension for two phase water/steam as a function of T

3.14

Vapour fraction
Function x_ph x_ps In1 p p In2 h s Out Surface tension for two phase water/steam as a function of T Surface tension for two phase water/steam as a function of T

3.15

Vapour Volume Fraction


Observe that vapour volume fraction is very sensitive. Vapour volume is about 1000 times greater than liquid volume and therefore vapour volume fraction gets close to the accurancy of IAPWS IF-97 Function vx_ph vx_ps In1 p p In2 h s Out Vapour volume fraction as a function of pressure and enthalpy Vapour volume fraction as a function of pressure and entropy.

You might also like