Engineering thermodynamics/Steam tables/Superheated Student (large)

From Wikiversity
Jump to navigation Jump to search

This was one of the first steam tables. Perhaps it should be deleted.

Volume v (m^3/kg) versus T in Celsius and P in bars[edit | edit source]

T/P 1.0E-01  1.5E-01  2.0E-01  2.5E-01  3.0E-01  5.0E-01  7.0E-01  1.0E+00  1.5E+00  2.0E+00  2.5E+00  3.0E+00  5.0E+00  7.0E+00  1.0E+01  1.5E+01  2.0E+01  2.5E+01  3.0E+01  5.0E+01  7.0E+01  1.0E+02  1.5E+02  2.0E+02  2.5E+02  3.0E+02 
100 1.72E+01 1.15E+01 8.59E+00 6.86E+00 5.72E+00 3.42E+00 2.43E+00 1.70E+00 1.03E-03 1.03E-03
200 2.18E+01 1.45E+01 1.09E+01 8.72E+00 7.27E+00 4.36E+00 3.11E+00 2.17E+00 1.44E+00 1.08E+00 8.62E-01 7.16E-01 4.25E-01 3.00E-01 2.06E-01 1.32E-01 1.13E-03 1.13E-03
300 2.64E+01 1.76E+01 1.32E+01 1.06E+01 8.81E+00 5.28E+00 3.77E+00 2.64E+00 1.76E+00 1.32E+00 1.05E+00 8.75E-01 5.23E-01 3.71E-01 2.58E-01 1.70E-01 1.26E-01 9.89E-02 8.12E-02 4.53E-02 2.95E-02 1.35E-03 1.33E-03
400 3.11E+01 2.07E+01 1.55E+01 1.24E+01 1.04E+01 6.21E+00 4.43E+00 3.10E+00 2.07E+00 1.55E+00 1.24E+00 1.03E+00 6.17E-01 4.40E-01 3.07E-01 2.03E-01 1.51E-01 1.20E-01 9.94E-02 5.78E-02 4.00E-02 2.64E-02 1.57E-02 9.95E-03 6.01E-03 2.80E-03
500 3.57E+01 2.38E+01 1.78E+01 1.43E+01 1.19E+01 7.13E+00 5.09E+00 3.57E+00 2.38E+00 1.78E+00 1.42E+00 1.19E+00 7.11E-01 5.07E-01 3.54E-01 2.35E-01 1.76E-01 1.40E-01 1.16E-01 6.86E-02 4.82E-02 3.28E-02 2.08E-02 1.48E-02 1.11E-02 8.69E-03
600 4.03E+01 2.69E+01 2.01E+01 1.61E+01 1.34E+01 8.06E+00 5.76E+00 4.03E+00 2.68E+00 2.01E+00 1.61E+00 1.34E+00 8.04E-01 5.74E-01 4.01E-01 2.67E-01 2.00E-01 1.59E-01 1.32E-01 7.87E-02 5.57E-02 3.84E-02 2.49E-02 1.82E-02 1.41E-02 1.14E-02
700 4.49E+01 2.99E+01 2.25E+01 1.80E+01 1.50E+01 8.98E+00 6.41E+00 4.49E+00 2.99E+00 2.24E+00 1.80E+00 1.50E+00 8.97E-01 6.40E-01 4.48E-01 2.98E-01 2.23E-01 1.78E-01 1.48E-01 8.85E-02 6.28E-02 4.36E-02 2.86E-02 2.11E-02 1.66E-02 1.37E-02
800 4.95E+01 3.30E+01 2.48E+01 1.98E+01 1.65E+01 9.90E+00 7.07E+00 4.95E+00 3.30E+00 2.48E+00 1.98E+00 1.65E+00 9.90E-01 7.07E-01 4.94E-01 3.29E-01 2.47E-01 1.97E-01 1.64E-01 9.82E-02 6.98E-02 4.86E-02 3.21E-02 2.39E-02 1.89E-02 1.56E-02

Energy u (kJ/kg) versus T in Celsius and P in bars[edit | edit source]

T/P 1.0E-01  1.5E-01  2.0E-01  2.5E-01  3.0E-01  5.0E-01  7.0E-01  1.0E+00  1.5E+00  2.0E+00  2.5E+00  3.0E+00  5.0E+00  7.0E+00  1.0E+01  1.5E+01  2.0E+01  2.5E+01  3.0E+01  5.0E+01  7.0E+01  1.0E+02  1.5E+02  2.0E+02  2.5E+02  3.0E+02 
100 2.52E+03 2.51E+03 2.51E+03 2.51E+03 2.51E+03 2.51E+03 2.51E+03 2.51E+03 4.12E+02 4.11E+02
200 2.66E+03 2.66E+03 2.66E+03 2.66E+03 2.66E+03 2.66E+03 2.66E+03 2.66E+03 2.66E+03 2.65E+03 2.65E+03 2.65E+03 2.64E+03 2.64E+03 2.62E+03 2.60E+03 8.34E+02 8.31E+02
300 2.81E+03 2.81E+03 2.81E+03 2.81E+03 2.81E+03 2.81E+03 2.81E+03 2.81E+03 2.81E+03 2.81E+03 2.81E+03 2.81E+03 2.80E+03 2.80E+03 2.79E+03 2.78E+03 2.77E+03 2.76E+03 2.75E+03 2.70E+03 2.63E+03 1.30E+03 1.29E+03
400 2.97E+03 2.97E+03 2.97E+03 2.97E+03 2.97E+03 2.97E+03 2.97E+03 2.97E+03 2.97E+03 2.97E+03 2.97E+03 2.97E+03 2.96E+03 2.96E+03 2.96E+03 2.95E+03 2.95E+03 2.94E+03 2.93E+03 2.91E+03 2.88E+03 2.83E+03 2.74E+03 2.62E+03 2.43E+03 2.07E+03
500 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.13E+03 3.12E+03 3.12E+03 3.12E+03 3.11E+03 3.11E+03 3.09E+03 3.07E+03 3.05E+03 3.00E+03 2.95E+03 2.89E+03 2.82E+03
600 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.30E+03 3.29E+03 3.29E+03 3.29E+03 3.29E+03 3.27E+03 3.26E+03 3.24E+03 3.21E+03 3.18E+03 3.14E+03 3.10E+03
700 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.48E+03 3.47E+03 3.47E+03 3.47E+03 3.47E+03 3.46E+03 3.45E+03 3.43E+03 3.41E+03 3.39E+03 3.36E+03 3.33E+03
800 3.67E+03 3.67E+03 3.67E+03 3.67E+03 3.67E+03 3.67E+03 3.67E+03 3.67E+03 3.66E+03 3.66E+03 3.66E+03 3.66E+03 3.66E+03 3.66E+03 3.66E+03 3.66E+03 3.66E+03 3.66E+03 3.65E+03 3.65E+03 3.64E+03 3.63E+03 3.61E+03 3.59E+03 3.57E+03 3.55E+03

Enthalpy h (kJ/kg) versus T in Celsius and P in bars[edit | edit source]

T/P 1.0E-01  1.5E-01  2.0E-01  2.5E-01  3.0E-01  5.0E-01  7.0E-01  1.0E+00  1.5E+00  2.0E+00  2.5E+00  3.0E+00  5.0E+00  7.0E+00  1.0E+01  1.5E+01  2.0E+01  2.5E+01  3.0E+01  5.0E+01  7.0E+01  1.0E+02  1.5E+02  2.0E+02  2.5E+02  3.0E+02 
100 2.69E+03 2.69E+03 2.69E+03 2.69E+03 2.68E+03 2.68E+03 2.68E+03 2.68E+03 4.38E+02 4.42E+02
200 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.87E+03 2.87E+03 2.87E+03 2.87E+03 2.86E+03 2.85E+03 2.83E+03 2.80E+03 8.63E+02 8.65E+02
300 3.08E+03 3.08E+03 3.08E+03 3.08E+03 3.08E+03 3.08E+03 3.08E+03 3.07E+03 3.07E+03 3.07E+03 3.07E+03 3.07E+03 3.06E+03 3.06E+03 3.05E+03 3.04E+03 3.02E+03 3.01E+03 2.99E+03 2.93E+03 2.84E+03 1.33E+03 1.33E+03
400 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.27E+03 3.27E+03 3.26E+03 3.26E+03 3.25E+03 3.24E+03 3.23E+03 3.20E+03 3.16E+03 3.10E+03 2.98E+03 2.82E+03 2.58E+03 2.15E+03
500 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.48E+03 3.48E+03 3.48E+03 3.47E+03 3.47E+03 3.46E+03 3.46E+03 3.43E+03 3.41E+03 3.38E+03 3.31E+03 3.24E+03 3.17E+03 3.08E+03
600 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.70E+03 3.70E+03 3.70E+03 3.70E+03 3.70E+03 3.70E+03 3.69E+03 3.69E+03 3.69E+03 3.68E+03 3.67E+03 3.65E+03 3.63E+03 3.58E+03 3.54E+03 3.49E+03 3.45E+03
700 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.92E+03 3.92E+03 3.92E+03 3.92E+03 3.91E+03 3.90E+03 3.89E+03 3.87E+03 3.84E+03 3.81E+03 3.78E+03 3.74E+03
800 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.15E+03 4.15E+03 4.15E+03 4.15E+03 4.14E+03 4.13E+03 4.11E+03 4.09E+03 4.07E+03 4.04E+03 4.02E+03

Entropy s (kJ/kg) versus T in Celsius and P in bars[edit | edit source]

T/P 1.0E-01  1.5E-01  2.0E-01  2.5E-01  3.0E-01  5.0E-01  7.0E-01  1.0E+00  1.5E+00  2.0E+00  2.5E+00  3.0E+00  5.0E+00  7.0E+00  1.0E+01  1.5E+01  2.0E+01  2.5E+01  3.0E+01  5.0E+01  7.0E+01  1.0E+02  1.5E+02  2.0E+02  2.5E+02  3.0E+02 
100 2.69E+03 2.69E+03 2.69E+03 2.69E+03 2.68E+03 2.68E+03 2.68E+03 2.68E+03 4.38E+02 4.42E+02
200 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.88E+03 2.87E+03 2.87E+03 2.87E+03 2.87E+03 2.86E+03 2.85E+03 2.83E+03 2.80E+03 8.63E+02 8.65E+02
300 3.08E+03 3.08E+03 3.08E+03 3.08E+03 3.08E+03 3.08E+03 3.08E+03 3.07E+03 3.07E+03 3.07E+03 3.07E+03 3.07E+03 3.06E+03 3.06E+03 3.05E+03 3.04E+03 3.02E+03 3.01E+03 2.99E+03 2.93E+03 2.84E+03 1.33E+03 1.33E+03
400 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.28E+03 3.27E+03 3.27E+03 3.26E+03 3.26E+03 3.25E+03 3.24E+03 3.23E+03 3.20E+03 3.16E+03 3.10E+03 2.98E+03 2.82E+03 2.58E+03 2.15E+03
500 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.49E+03 3.48E+03 3.48E+03 3.48E+03 3.47E+03 3.47E+03 3.46E+03 3.46E+03 3.43E+03 3.41E+03 3.38E+03 3.31E+03 3.24E+03 3.17E+03 3.08E+03
600 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.71E+03 3.70E+03 3.70E+03 3.70E+03 3.70E+03 3.70E+03 3.70E+03 3.69E+03 3.69E+03 3.69E+03 3.68E+03 3.67E+03 3.65E+03 3.63E+03 3.58E+03 3.54E+03 3.49E+03 3.45E+03
700 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.93E+03 3.92E+03 3.92E+03 3.92E+03 3.92E+03 3.91E+03 3.90E+03 3.89E+03 3.87E+03 3.84E+03 3.81E+03 3.78E+03 3.74E+03
800 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.16E+03 4.15E+03 4.15E+03 4.15E+03 4.15E+03 4.14E+03 4.13E+03 4.11E+03 4.09E+03 4.07E+03 4.04E+03 4.02E+03

z=pv/(RT) versus T in Celsius and P in bars[edit | edit source]

T/P 1.0E-01  1.5E-01  2.0E-01  2.5E-01  3.0E-01  5.0E-01  7.0E-01  1.0E+00  1.5E+00  2.0E+00  2.5E+00  3.0E+00  5.0E+00  7.0E+00  1.0E+01  1.5E+01  2.0E+01  2.5E+01  3.0E+01  5.0E+01  7.0E+01  1.0E+02  1.5E+02  2.0E+02  2.5E+02  3.0E+02 
100 3.73 3.72 3.72 3.72 3.72 3.70 3.69 3.67 0.56 0.67
200 2.36 2.36 2.36 2.36 2.36 2.36 2.36 2.35 2.35 2.34 2.33 2.33 2.30 2.28 2.23 2.15 0.31 0.37
300 1.91 1.91 1.91 1.91 1.91 1.91 1.91 1.91 1.90 1.90 1.90 1.90 1.89 1.88 1.86 1.84 1.81 1.79 1.76 1.64 1.49 0.24 0.29
400 1.68 1.68 1.68 1.68 1.68 1.68 1.68 1.68 1.68 1.68 1.68 1.68 1.67 1.67 1.66 1.65 1.64 1.63 1.61 1.57 1.52 1.43 1.27 1.08 0.81 0.45
500 1.55 1.55 1.55 1.55 1.55 1.55 1.55 1.55 1.54 1.54 1.54 1.54 1.54 1.54 1.53 1.53 1.52 1.52 1.51 1.49 1.46 1.42 1.35 1.28 1.21 1.13
600 1.46 1.46 1.46 1.46 1.46 1.45 1.45 1.45 1.45 1.45 1.45 1.45 1.45 1.45 1.45 1.45 1.44 1.44 1.43 1.42 1.41 1.39 1.35 1.31 1.28 1.24
700 1.39 1.39 1.39 1.39 1.39 1.39 1.39 1.39 1.39 1.39 1.39 1.39 1.39 1.39 1.39 1.38 1.38 1.38 1.38 1.37 1.36 1.35 1.33 1.31 1.29 1.27
800 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.34 1.33 1.33 1.32 1.32 1.30 1.29 1.28 1.27

Saturation conditions[edit | edit source]

Use this table to interpolate down to saturation at low pressures.

P bar 1.0E-01  1.5E-01  2.0E-01  2.5E-01  3.0E-01  5.0E-01  7.0E-01  1.0E+00  1.5E+00  2.0E+00  2.5E+00  3.0E+00  5.0E+00  7.0E+00  1.0E+01  1.5E+01  2.0E+01  2.5E+01  3.0E+01  5.0E+01  7.0E+01  1.0E+02  1.5E+02  2.0E+02  2.5E+02  3.0E+02 
T °C 45.8 54.0 60.1 65.0 69.1 81.3 89.9 99.6 111.4 120.2 127.4 133.5 151.8 165.0 179.9 198.3 212.4 224.0 233.9 263.9 285.8 311.0 342.2 365.7 NaN NaN
v m3/kg 1.47E+01 1.00E+01 7.65E+00 6.21E+00 5.23E+00 3.24E+00 2.37E+00 1.69E+00 1.16E+00 8.86E-01 7.19E-01 6.06E-01 3.75E-01 2.73E-01 1.94E-01 1.32E-01 9.96E-02 8.00E-02 6.67E-02 3.95E-02 2.74E-02 1.80E-02 1.04E-02 5.90E-03 NaN NaN
u kJ/kg 2.44E+03 2.45E+03 2.46E+03 2.46E+03 2.47E+03 2.48E+03 2.49E+03 2.51E+03 2.52E+03 2.53E+03 2.54E+03 2.54E+03 2.56E+03 2.57E+03 2.58E+03 2.59E+03 2.60E+03 2.60E+03 2.60E+03 2.60E+03 2.58E+03 2.55E+03 2.46E+03 2.30E+03 NaN NaN
h kJ/kg 2.58E+03 2.60E+03 2.61E+03 2.62E+03 2.62E+03 2.65E+03 2.66E+03 2.68E+03 2.69E+03 2.71E+03 2.72E+03 2.73E+03 2.75E+03 2.76E+03 2.78E+03 2.79E+03 2.80E+03 2.80E+03 2.80E+03 2.79E+03 2.77E+03 2.73E+03 2.61E+03 2.42E+03 NaN NaN
s kJ/kg 8.15E+00 8.01E+00 7.91E+00 7.83E+00 7.77E+00 7.59E+00 7.48E+00 7.36E+00 7.22E+00 7.13E+00 7.05E+00 6.99E+00 6.82E+00 6.71E+00 6.59E+00 6.44E+00 6.34E+00 6.26E+00 6.19E+00 5.97E+00 5.82E+00 5.62E+00 5.31E+00 4.94E+00 NaN NaN

code[edit | edit source]

current version of code (under construction)
clear all;close all;clc;
Rwater=461.526/100000;
fout=fopen('student_superheated.txt', 'w+');% creates file
p = xlsread('Pressures.xlsx');Np=size(p,2)
T = xlsread('Temperatures.xlsx');NT=size(T,2)
%PREALLOCATE
psat=-ones(NT)
v=-ones(Np,NT);
u=-ones(Np,NT);
h=-ones(Np,NT);
s=-ones(Np,NT);
z=-ones(Np,NT);%z=pv/(RT)
% Make saturation curve
for np=1:Np
    Tsat(np)=XSteam('Tsat_p',p(np))
end
figure;
plot(p,Tsat);title('Saturation temperature (C)');xlabel('p (bars)');




%% DEFINE ALL THE DATA ARRAYS that go into tables (except sat table)
for np=1:Np
    for nT=1:NT
        if or(T(nT)>XSteam('Tsat_p',p(np)),p(np)>220)
            v(np,nT)=XSteam('v_pT',p(np),T(nT)); %volume
            u(np,nT)=XSteam('u_pT',p(np),T(nT)); %energy
            h(np,nT)=XSteam('h_pT',p(np),T(nT)); %enthalpy
            s(np,nT)=XSteam('s_pT',p(np),T(nT)); %enthalpy
            z(np,nT)=p(np)*v(np,nT)/Rwater/T(nT);%equals 1 if ideal gas
            
        end
    end
end


%% volume uses v_pT
figure;surf(T,p,v); title('v (m^3/kg)');xlabel('T (Celsius)');ylabel('p (bars)');%Print the volumes
fprintf(fout,'%s\n','====Volume v (m^3/kg) versus T in Celsius and P in bars====')
fprintf(fout,'%s\n','{| class="wikitable"');
fprintf(fout,'%s\n','|- '); %Start first line of table:
string = '! T/P';
for np=1:Np % finish the first line with the pressures NOT NEEDED
    text=num2str(p(np),'%10.1E');
    string = [string, ' !! ', text,' '  ];
end
fprintf(fout,'%s\n',string); % prints first line of pressures
fprintf(fout,'%s\n','|-'); %Next line
%print first the temperature then the volumes
for nT=1:NT  % comment out instead just do the first one:
    text=num2str(T(nT),'%10.0f');
    string=['|',text ];
    %CONVERT DATA ARRAY TO STRINGS
    for np =1:Np
        text =num2str(v(np,nT),'%10.2E');
        if v(np,nT)<0
            text='';
        end
        string = [string, ' || ', text];
    end
    fprintf(fout,'%s\n',string);
    fprintf(fout,'%s\n','|-');
end
fprintf(fout,'%s\n','|}'); %Next state variable

%% energy uses u_pT
% To upgrade a section:
%  1. Change section title above
%  2. Change "figure;surf" and  "title" below (DON'T FORGET UNITS)
%  3. Change "fprintf" wikitext heading next line
%  4  Go to inner for and change "TEXT" AND "IF" variables
%
figure;surf(T,p,u); title('u (kJ/kg)');xlabel('T (Celsius)');ylabel('p (bars)');%Print the volumes
fprintf(fout,'%s\n','====Energy u (kJ/kg) versus T in Celsius and P in bars====')
fprintf(fout,'%s\n','{| class="wikitable"');
fprintf(fout,'%s\n','|- '); %Start first line of table:
string = '! T/P';
for np=1:Np % finish the first line with the pressures
    text=num2str(p(np),'%10.1E');
    string = [string, ' !! ', text,'&nbsp;'  ];
end
fprintf(fout,'%s\n',string); % prints first line of pressures
fprintf(fout,'%s\n','|-'); %Next line
%GO TO INNER FOR LOOP AND CHANGE "TEXT" AND "IF"
for nT=1:NT  % comment out instead just do the first one:
    text=num2str(T(nT),'%10.0f');
    string=['|',text ];
    for np =1:Np
        text =num2str(u(np,nT),'%10.2E');  %CHANGE FIRST VARIABLE
        if u(np,nT)<0  %ALSO CHANGE THIS
            text='';
        end
        string = [string, ' || ', text];
    end
    fprintf(fout,'%s\n',string);
    fprintf(fout,'%s\n','|-');
end
fprintf(fout,'%s\n','|}'); %Next state variable

%% enthalpy uses h_pT
% To upgrade a section:
%  1. Change section title above
%  2. Change "figure;surf" and  "title" below (DON'T FORGET UNITS)
%  3. Change "fprintf" wikitext heading next line
%  4  Go to inner for and change "TEXT" AND "IF" variables
%
figure;surf(T,p,h); title('h (kJ/kg)');xlabel('T (Celsius)');ylabel('p (bars)');%Print the volumes
fprintf(fout,'%s\n','====Enthalpy h (kJ/kg) versus T in Celsius and P in bars====')
fprintf(fout,'%s\n','{| class="wikitable"');
fprintf(fout,'%s\n','|- '); %Start first line of table:
string = '! T/P';
for np=1:Np % finish the first line with the pressures
    text=num2str(p(np),'%10.1E');
    string = [string, ' !! ', text,'&nbsp;'  ];
end
fprintf(fout,'%s\n',string); % prints first line of pressures
fprintf(fout,'%s\n','|-'); %Next line
%GO TO INNER FOR LOOP AND CHANGE "TEXT" AND "IF"
for nT=1:NT  % comment out instead just do the first one:
    text=num2str(T(nT),'%10.0f');
    string=['|',text ];
    for np =1:Np
        text =num2str(h(np,nT),'%10.2E');  %CHANGE FIRST VARIABLE
        if h(np,nT)<0  %ALSO CHANGE THIS
            text='';
        end
        string = [string, ' || ', text];
    end
    fprintf(fout,'%s\n',string);
    fprintf(fout,'%s\n','|-');
end
fprintf(fout,'%s\n','|}'); %Next state variable

%% entropy uses s_pT
% To upgrade a section:
%  1. Change section title above
%  2. Change "figure;surf" and  "title" below (DON'T FORGET UNITS)
%  3. Change "fprintf" wikitext heading next line
%  4  Go to inner for and change "TEXT" AND "IF" variables
%
figure;surf(T,p,s); title('s (kJ/kg)');xlabel('T (Celsius)');ylabel('p (bars)');%Print the volumes
fprintf(fout,'%s\n','====Entropy s (kJ/kg) versus T in Celsius and P in bars====')
fprintf(fout,'%s\n','{| class="wikitable"');
fprintf(fout,'%s\n','|- '); %Start first line of table:
string = '! T/P';
for np=1:Np % finish the first line with the pressures
    text=num2str(p(np),'%10.1E');
    string = [string, ' !! ', text,'&nbsp;'  ];
end
fprintf(fout,'%s\n',string); % prints first line of pressures
fprintf(fout,'%s\n','|-'); %Next line
%GO TO INNER FOR LOOP AND CHANGE "TEXT" AND "IF"
for nT=1:NT  % comment out instead just do the first one:
    text=num2str(T(nT),'%10.0f');
    string=['|',text ];
    for np =1:Np
        text =num2str(h(np,nT),'%10.2E');  %CHANGE FIRST VARIABLE
        if h(np,nT)<0  %ALSO CHANGE THIS
            text='';
        end
        string = [string, ' || ', text];
    end
    fprintf(fout,'%s\n',string);
    fprintf(fout,'%s\n','|-');
end
fprintf(fout,'%s\n','|}'); %Next state variable

%% z = pv/RT
% To upgrade a section:
%  1. Change section title above
%  2. Change "figure;surf" and  "title" below (DON'T FORGET UNITS)
%  3. Change "fprintf" wikitext heading next line
%  4  Go to inner for and change "TEXT" AND "IF" variables
%
figure;surf(T,p,s); title('z=pv/(RT)');xlabel('T (Celsius)');ylabel('p (bars)');%Print the volumes
fprintf(fout,'%s\n','==== z=pv/(RT) versus T in Celsius and P in bars====')
fprintf(fout,'%s\n','{| class="wikitable"');
fprintf(fout,'%s\n','|- '); %Start first line of table:
string = '! T/P';
for np=1:Np % finish the first line with the pressures
    text=num2str(p(np),'%10.1E');
    string = [string, ' !! ', text,'&nbsp;'  ];
end
fprintf(fout,'%s\n',string); % prints first line of pressures
fprintf(fout,'%s\n','|-'); %Next line
%GO TO INNER FOR LOOP AND CHANGE "TEXT" AND "IF"
for nT=1:NT  % comment out instead just do the first one:
    text=num2str(T(nT),'%10.0f');
    string=['|',text ];
    for np =1:Np
        text =num2str(z(np,nT),'%10.2f');  %CHANGE FIRST VARIABLE
        if z(np,nT)<0  %ALSO CHANGE THIS
            text='';
        end
        string = [string, ' || ', text];
    end
    fprintf(fout,'%s\n',string);
    fprintf(fout,'%s\n','|-');
end
fprintf(fout,'%s\n','|}'); %Next state variable
%% Saturation conditions
    fprintf(fout,'%s\n','====Saturation conditions====')
fprintf(fout,'%s\n','Use this table to interpolate down to saturation at low pressures.')
%Find maximum pressure for this table
%state variables at that saturation temperature (beginning with T).
%Tmax = T(NT)
fprintf(fout,'%s\n','{| class="wikitable"');
fprintf(fout,'%s\n','|- '); %Start first line of table:
string = '!P bar'; %Pressures
for np=1:Np 
    text=num2str(p(np),'%10.1E');
    string = [string, ' !! ', text,'&nbsp;'  ];
end
fprintf(fout,'%s\n',string); % prints line from prior loop
fprintf(fout,'%s\n','|-'); %Next line

string = '| T &deg;C'; %Temps at saturation
for np=1:Np % Temperatures
    value=Tsat(np)% already caclulated
    text=num2str(value,'%10.1f');
    string = [string, ' || ', text  ];
end
fprintf(fout,'%s\n',string); % prints line from prior loop
fprintf(fout,'%s\n','|-'); %Next line

string = '|v&nbsp;m<sup>3</sup>/kg'; %volumes at saturation
for np=1:Np % volume
    value=XSteam('v_pT',p(np),Tsat(np)+0.1);%volume is discontinous; must be above saturation
    text=num2str(value,'%10.2E');
    string = [string, ' || ', text  ];
end
fprintf(fout,'%s\n',string); % prints line from prior loop
fprintf(fout,'%s\n','|-'); %Next line

string = '|u&nbsp;kJ/kg'; %energy at saturation
for np=1:Np % volume
    value=XSteam('u_pT',p(np),Tsat(np)+0.1);%volume is discontinous; must be above saturation
    text=num2str(value,'%10.2E');
    string = [string, ' || ', text  ];
end
fprintf(fout,'%s\n',string); % prints line from prior loop
fprintf(fout,'%s\n','|-'); %Next line

string = '|h&nbsp;kJ/kg'; %enthalpy at saturation
for np=1:Np % 
    value=XSteam('h_pT',p(np),Tsat(np)+0.1);%volume is discontinous; must be above saturation
    text=num2str(value,'%10.2E');
    string = [string, ' || ', text  ];
end
fprintf(fout,'%s\n',string); % prints line from prior loop
fprintf(fout,'%s\n','|-'); %Next line

string = '|s&nbsp;kJ/kg'; %entropy at saturation
for np=1:Np % 
    value=XSteam('s_pT',p(np),Tsat(np)+0.1);%volume is discontinous; must be above saturation
    text=num2str(value,'%10.2E');
    string = [string, ' || ', text  ];
end
fprintf(fout,'%s\n',string); % prints line from prior loop
fprintf(fout,'%s\n','|-'); %Next line

fprintf(fout,'%s\n','|}'); %Next state variable