[ Go to CENG301 Homepage | CENG301 Notes Table of Contents]

Chapter 2: 2.1-2.5, 2.6, 2.7



2.7: Thermodynamic Properties Programs


2.7: Thermodynamic properties programs

The Program: Steam

The two programs steam and thermprop were borrowed from Professor A. J. Chapman in the Mechanical Engineering Department. Thermprop was revised and combined with steam to produce programs called tprop2 and tprop3 that facilitate creating thermodynamic tables. They give you an alternative to looking up thermodynamic properties of steam and several refrigerant fluids in printed tables such as in Appendix 8 of Reklaitis. A Matlab plotting program called tplot3 uses the files created by the FORTRAN programs to show you how the thermodynamic functions look. Here is a demonstration of steam.

wsname% steam
 This program calculates the thermodynamic
 properties of steam in either English or SI units.
 Enter either  eng  or  si :
si   <-- Usually this is easier.

 Steam properties are calculated using one of
 four options:
           1: given p,t,x(if necessary)
           2: given p,v
           3: given p,s
           4: given p,h
 Enter 1, 2, 3, or 4:


The first two symbols in option 1 are obvious: we will need to give the pressure and temperature. The third symbol, x, is the "quality" of the steam; i. e. the fraction that is a vapor. The symbol, v, in option 2 is the specific volume of the steam. The symbol, s, in option 3 is the specific entropy, and the symbol h in option 4 is the specific enthalpy.

Let's try the first option and see where it leads if we try to specify all three quantities.

1      <-- asking for the first option

 Option 1;Enter: p(MPa),t(C),x -separated by commas
    <-- Note the "SI" units: MPa is 10^6 Pa or 1000kPa. and
      temperaure is in C.  Let's try 1 atm and 100C with 50% vapor.
0.101,100,.5

 Steam; given p,t,x

           p=      0.10100  MPa          s=  7.35695  kJ/kg-K
           t=      100.000  C            h=  2676.05  kJ/kg
           v=  0.16785e+01  m3/kg        u=  2506.52  kJ/kg
           Superheated vapor   <-- Strange! This is not what we wanted!

 
 Enter:
 1 to run another case for same option & same units
 2 to run another case for new option with same units
 3 to change option and/or units
 4 to terminate program


Steam listed specific volume, specific entropy, specific enthalpy, and u, the specific internal energy of steam along with p and t. Notice that the state of the "steam" is listed also--as superheated vapor--although x was given as 0.5. On reflection, 101kPa and 100°C is superheated and therefore we could not have a saturated vapor-liquid system. Let's try that again and this time enter a more precise value for one atmosphere.

1   <-- Asking to run another case for same option & same units

 Option 1;Enter: p(MPa),t(C),x -separated by commas

0.101325,100,.5

 Steam; given p,t,x

           p=      0.10132  MPa          s=  4.33116  kJ/kg-K
           t=      100.000  C            h=  1547.54  kJ/kg
           v=  0.83702e+00  m3/kg        u=  1462.73  kJ/kg
           Wet mixture: x=   0.5000


Now we know a little more about the first option. It is the one that you will probably use the most. It can also be used to find the saturation pressure or temperature of a fluid. If you give 0 for the pressure, the program assumes you want the saturated pressure that goes with the temperature and quality. Conversely, if you give the temperature as 0, it will find the temperature of saturation that goes with the given pressure.

Let's now try the second option.

2    <-- Asking to run another case for new option with same units

 Steam properties are calculated using one of
 four options:

           1: given p,t,x(if necessary)
           2: given p,v
           3: given p,s
           4: given p,h

 Enter 1, 2, 3, or 4:
2   <-- and choosing to specify p and v.

 Option 2;Enter: p(MPa), v(m3/kg) -separated by a comma

0.101325, 1.5
  Steam; given p,v  

           p=      0.10132  MPa          s=  6.72954  kJ/kg-K
           t=      100.000  C            h=  2442.48  kJ/kg
           v=  0.15000e+01  m3/kg        u=  2290.49  kJ/kg
           Wet mixture: x=   0.8965


You will find that it is much easier to find properties of "wet steam" with this option, since you do not have to give a precise (p,t) pair that are on the saturation line for water.

Since we don't deal with entropy in this course we will not consider the third option, but option 4 may be handy.

Enter:
 1 to run another case for same option & same units
 2 to run another case for new option with same units
 3 to change option and/or units
 4 to terminate program
2

 Steam properties are calculated using one of four options:

           1: given p,t,x(if necessary)
           2: given p,v
           3: given p,s
           4: given p,h

 Enter 1, 2, 3, or 4:
4

 Option 4;Enter: p(MPa), h(kJ/kg) -separated by a comma

0.101325, 2300

 Steam; given p,h  

           p=      0.10132  MPa          s=  6.34771  kJ/kg-K
           t=      100.000  C            h=  2300.00  kJ/kg
           v=  0.13945e+01  m3/kg        u=  2158.71  kJ/kg
           Wet mixture: x=   0.8334


The Programs: tprop2 and tprop3

The programs tprop2 and tprop3 allow you to get properties for 12 different fluids, including water, for a range of temperatures and pressures. Tprop2 allows you to specify up to ten pressures and to specify a range of up to 50 equally-spaced temperatures. Tprop3 is the other way around, allowing a range of up to 50 pressures, and up to ten temperatures. Each one starts by asking if you want to save your output in a MATLAB .mat-file and then goes on to list the fluids. For each pressure in tprop2 (each temperature in tprop3 ) a table is shown containing the same data given by steamprop for each temperature (each pressure in tprop3 ). In addition to this, the state for each temperature and pressure is given, and, if there is a change of state then data is given for the saturated vapor and saturated liquid conditions. Here is what a run of tprop2 looks like:

wsname% tprop2
Give the name of your data variable for a .dat file
to be put in your matlab directory or just hit a
RETURN if you do not want to store such a file.
ammonia
You should have started in your home directory.
You should also have a matlab directory.
To correct either of these, just reply: y
to the prompt:
Do you want to stop?

The file name will be: matlab/ammonia.mat

 

                     THERMODYNAMIC PROPERTIES OF FLUIDS

           This routine calculates the thermodynamic properties of the
            fluids listed below given t, p and x

                               1: Ammonia
                               2: Carbon dioxide
                               3: Butane
                               4: Ethane
                               5: Methane
                               6: Propane
                               7: Refrigerant-11
                               8: Refrigerant-12
                               9: Refrigerant-14
                              10: Refrigerant-22
                              11: Refrigerant-114
                              12: Water

           Enter the Fluid number, above

1                   <--to get properties for ammonia
Give the number of pressures, max.=  10
4
Pressures must be between:       8.644and    20000.000 kPa.
Give the pressure Number:   1 in kPa
10
Give the pressure Number:   2 in kPa
60
Give the pressure Number:   3 in kPa
101.325
Give the pressure Number:   4 in kPa
250
Give the number of temperatures, max. =  50
6
Temperatures must be between:     -73.150and      386.850 C.
Give the min. and max. temperatures in C.
-50
50
Ammonia           pressure =     10.0000kPa
  Temperature     Volume      Entropy    Enthalpy Int. Energy   State
       C          m3/kg       kJ/kg-K      kJ/kg      kJ/kg
      -50.000   0.10855E+02    6.86007    1377.68  1269.23   Vapor
      -30.000   0.11842E+02    7.03469    1418.37  1300.06   Vapor
      -10.000   0.12825E+02    7.19680    1459.39  1331.24   Vapor
       10.000   0.13806E+02    7.34850    1500.81  1362.85   Vapor
       30.000   0.14786E+02    7.49150    1542.72  1394.96   Vapor
       50.000   0.15765E+02    7.62713    1585.18  1427.64   Vapor
Press a RETURN to continue.

Ammonia           pressure =     60.0000kPa
  Temperature     Volume      Entropy    Enthalpy Int. Energy   State
       C          m3/kg       kJ/kg-K      kJ/kg      kJ/kg
      -50.000   0.14245E-02   -0.19227     -43.88   -43.86   Liquid
      -43.284   0.14410E-02   -0.06227     -14.43   -14.42   Sat. Liquid
      -43.284   0.18345E+01    6.01841    1383.31  1273.34   Sat. Vapor
      -30.000   0.19489E+01    6.13902    1411.83  1294.99   Vapor
      -10.000   0.21188E+01    6.30787    1454.54  1327.52   Vapor
       10.000   0.22863E+01    6.46394    1497.16  1360.08   Vapor
       30.000   0.24524E+01    6.60976    1539.89  1392.85   Vapor
       50.000   0.26176E+01    6.74721    1582.92  1425.97   Vapor
Press a RETURN to continue.

Ammonia           pressure =    101.3250kPa
  Temperature     Volume      Entropy    Enthalpy Int. Energy   State
       C          m3/kg       kJ/kg-K      kJ/kg      kJ/kg
      -50.000   0.14245E-02   -0.19227     -43.82   -43.86   Liquid
      -33.339   0.14667E-02    0.12411      29.40    29.35   Sat. Liquid
      -33.339   0.11241E+01    5.83444    1398.80  1285.00   Sat. Vapor
      -30.000   0.11416E+01    5.86530    1406.25  1290.67   Vapor
      -10.000   0.12453E+01    6.04005    1450.45  1324.38   Vapor
       10.000   0.13465E+01    6.19986    1494.09  1357.75   Vapor
       30.000   0.14463E+01    6.34809    1537.52  1391.08   Vapor
       50.000   0.15451E+01    6.48709    1581.03  1424.58   Vapor
Press a RETURN to continue.

Ammonia           pressure =    250.0000kPa
  Temperature     Volume      Entropy    Enthalpy Int. Energy   State
       C          m3/kg       kJ/kg-K      kJ/kg      kJ/kg
      -50.000   0.14245E-02   -0.19227     -43.61   -43.86   Liquid
      -30.000   0.14757E-02    0.18501      44.32    44.05   Liquid
      -13.666   0.15225E-02    0.47554     117.32   117.04   Sat. Liquid
      -13.666   0.48213E+00    5.51920    1426.07  1305.64   Sat. Vapor
      -10.000   0.49051E+00    5.55357    1435.05  1312.53   Vapor
       10.000   0.53480E+00    5.72814    1482.70  1349.10   Vapor
       30.000   0.57744E+00    5.88552    1528.81  1384.55   Vapor
       50.000   0.61904E+00    6.03035    1574.14  1419.49   Vapor
Press a RETURN to continue.

 
 Session ended.
 Your data is in your              matlab directory
 under the name:ammonia.mat

wsname% cd matlab

wsname% more ammonia.mat
       10.000     -50.000   0.10855E+02    6.86007    1377.68  1269.23
       10.000     -30.000   0.11842E+02    7.03469    1418.37  1300.06
       10.000     -10.000   0.12825E+02    7.19680    1459.39  1331.24
       10.000      10.000   0.13806E+02    7.34850    1500.81  1362.85
       10.000      30.000   0.14786E+02    7.49150    1542.72  1394.96
       10.000      50.000   0.15765E+02    7.62713    1585.18  1427.64
       60.000     -50.000   0.14245E-02   -0.19227     -43.88   -43.86
       60.000     -43.284   0.14410E-02   -0.06227     -14.43   -14.42

       (more data at 60 kPa)

       60.000      50.000   0.26176E+01    6.74721    1582.92  1425.97

      101.325     -50.000   0.14245E-02   -0.19227     -43.82   -43.86

       (more data at 101.325 kPa)

      101.325      30.000   0.14463E+01    6.34809    1537.52  1391.08
      101.325      50.000   0.15451E+01    6.48709    1581.03  1424.58
      250.000     -50.000   0.14245E-02   -0.19227     -43.61   -43.86
      250.000     -30.000   0.14757E-02    0.18501      44.32    44.05

       (more data at 250 kPa)

      250.000      50.000   0.61904E+00    6.03035    1574.14  1419.49
wsname%


Tprop3 is similar to tprop2, except it is more useful when you know the temperature and need to find a pressure. The file created by the programs is formatted so that the MATLAB program tplot2 can read them and plot various properties.


2.8: Properties of Humid Air

The Program: humid

This program finds properties for Humid air. You must give its temperature and either its wet bulb temperature or its relative humidity.

The program will then report for a given T, in C or K, and relative humidity the wet bulb temperature, the water vapor pressure, the mass ratio of water to dry air, the enthalpy in the units kJ per kg of dry air, the specific volume in the units m3 per kg of dry air, and the dew point.

If the wet bulb temperature is given, the relative humidity is reported. If the temperature is given in R or F, the units reported will be: Btu per lbm of dry air for the enthalpy and ft3 per lbm of dry air for the specific volume.

The following is a demo of its use:

wsname% humid                                                                   

This program finds properties for Humid air.                            
You must give its temperature and either its wet                        
bulb temperature or its relative humidity.                              

Give the unit for temp. K, C, R, or F                                   
C                                                                       
Give the temperature in C                                               
25                                                                      
You can now specify either the relative humidity or wet bulb.           
Reply rh for relative humidity or wb for wetbulb.                       
rh                                                                      
Give the relative humidity                                              
.75                                                                     


Temperature  Relative Humidity  Wet Bulb Temp.                          
     C                               C                                  
   25.00        0.75000           21.64                                 

H2O Vapor P.  Mass Ratio   Enthalpy   Specific Volume Dew Point         
    kPa       H2O/dry air  kJ/kg DA      m3/kg DA        C              
    3.182      0.015057      63.42       0.8682        20.24            

NOTES:                                                                  
The reference temperature is 0C or 273.15K.                             
The reference state for water is as a liquid.                           

If you want to give another set of conditions, reply: y                 
y                                                                       
Give the unit for temp. K, C, R, or F                                   
F                                                                       
Give the temperature in F                                               
95                                                                      

You can now specify either the relative humidity or wet bulb.           
Reply rh for relative humidity or wb for wetbulb.                       
wb                                                                      

Give the wet bulb temp. in F                                            
85                                                                      



Temperature  Relative Humidity  Wet Bulb Temp.                          
     F                               F                                  
   95.00        0.67050           85.00                                 

H2O Vapor P.  Mass Ratio   Enthalpy   Specific Volume Dew Point         
  psia      H2O/dry air  Btu/lbm DA    ft3/lbm DA      F                
    0.817      0.024174      41.78      14.5780        82.27

NOTES:
The reference temperature is 32F or 491.67R.
The reference state for water is as a liquid.

If you want to give another set of conditions, reply: y

 

 As you can see, this is a very useful program that gives you a lot of information at once. Most of this information can also be obtained through the use of the Matlab humidity functions.


Chapter 2: 2.1-2.5, 2.6, 2.7


[ Go to CENG301 Homepage | CENG301 Notes Table of Contents]
Go to Next Section on Mass and Energy Balances
Last modified August 22, 1997.