+ All Categories
Home > Engineering > Jean-Paul Gibson: Analysis Of An Open Feedwater Heater System

Jean-Paul Gibson: Analysis Of An Open Feedwater Heater System

Date post: 18-Jan-2017
Category:
Upload: jean-paul-gibson
View: 301 times
Download: 2 times
Share this document with a friend
40
Paul Gibson “Analysis of Open Feedwater Heater System” Thermodynamics II Project December 5, 2001
Transcript

Paul Gibson

“Analysis of Open Feedwater Heater System”

Thermodynamics II Project

December 5, 2001

Table of Contents

I. Abstract 3

II. Introduction 3

III. Results

a. Turbine with 85% efficiency 6

b. Turbine with 90% efficiency 10

IV. Conclusion 12

V. Discussion 13

VI. Computer Code 13

VII. References 30

2

Abtract

The purpose of this research is to determine the optimum operating pressure for the

feedwater heater for a power cycle. This was accomplished by writing a computer code in C+

+ and then using the program to input various pressures. The program than calculated

variables with the inputted pressure such work of the turbines, thermal efficiency, heat

addition and many others. The values of these parameters are provided in the results section

of this report.

Introduction

Figure 1 (Moran 396) provides a pictorial representation of the open feedwater system

in question. The system includes a dual stage turbine with each stage operating at the same

isentropic efficiency, two pumps operating ideally, a condenser, steam generator or boiler and

lastly, the feedwater heater. Computer code allows the user to vary the pressure through the

open feedwater heater and the isentropic efficiency of the turbines. All other components are

assumed to be ideal.

Figure 1

3

The purpose of including a

feedwater heater is to improve

thermal efficiency. Without the

feedwater heater, liquid would be

entering the boiler stage of the cycle

at a lower temperature than if the

feedwater heater were present.

Generally speaking, when the

temperature of liquid entering the boiler is higher, the temperature of the created steam

exiting the boiler and entering the turbine is higher. Although the work created by the turbine

decreases slightly, the heat addition decreases more. This is shown graphically in the figure to

the right. Clearly, heat addition to the boiler drops quicker than work output from the turbine.

Because the heat addition grows smaller quicker, the denominator becomes an increasingly

lower number, creating a higher thermal efficiency. Thermal efficiency is defined by the

following formula:

The first step in determining the ideal operating pressure for the feedwater heater is to

calculate the work and of all the other components of the system. is the entropy rate of

production and is a measurement of the irreversibility of a component. A device is working at

100% efficiency when its is equal to zero, so obviously, this number is to be kept to a

minimum if possible. For the purpose of these calculations, a pressure through the feedwater

heater will be assumed to be 7 bar while the isentropic efficiency of the turbine will be 85%. If

one were running the computer program, these would be the values that would be inputted.

Using the diagram provided on page 4, enough information is known about states one,

two and four to find the enthalpy directly from steam tables. Also, once is known, the

entropy can be found through interpolation of the steam table. These aforementioned

values are: , , and .

4

An isentropic analysis is needed to find the quality at state 3s. This means .

The quality can be found using the formula

. Using this value, can then be calculated

Using the calculated value for , the value of can be found

. From the T-s diagram, it is known that state six is a saturated liquid

at 0.7 MPa. This enthalpy can read from the steam table, thus . Since

pumps operate at states five and seven, there enthalpies can be determined as

and . The mass flow fraction, y, must also be

determined to calculate power of each device. The mass flow fraction is used to determine the

work per unit mass of steam passing through the first stage of the turbine.

. With the mass fraction known the work of the turbine as well as the other

devices can be calculated.

5

The total heat addition to the boiler can be found as

Finally, the thermal efficiency can be found from

Turbine with 85% Efficiency

The results from the program are given below in tabular format. Unfortunately, the

text size had to be reduced in order to fit it across the page. For all results, a value of .85 was

used for an efficiency for both turbines. The table also includes an exergy analysis by

providing the rate of exergy destruction, . All exergy analysis was done using a dead state

temperature of 300K.

6

Pressure Sum of Sigma Work Turbine (KJ/kg) Work Pump (KJ/kg) Q (KJ/kg) Thermal Efficiency % Mass Flow Rate (kg/hour) Ed Turbine (MW) Ed Condenser (MW) Ed Boiler (MW) Ed Heater (MW)

0.04 2.3815 1066.75 -8.02385 -3218.91 32.9 340032 18.8855 204.037 480.741 11.9748

0.06 2.34688 1072.49 -8.04312 -3188.82 33.3892 338203 17.7423 199.575 472.555 14.6836

0.08 2.32401 1075.72 -8.05913 -3166.46 33.7227 337186 16.9478 196.58 467.027 16.6513

0.1 2.30733 1077.68 -8.0735 -3148.5 33.9774 336572 16.343 194.36 462.907 18.2113

0.15 2.28314 1079.6 -8.1013 -3118.69 34.3649 335978 15.4343 191.059 456.75 20.7368

0.2 2.26198 1080.3 -8.12893 -3088.88 34.7206 335767 14.5492 188.096 451.127 23.2798

0.25 2.25034 1080.03 -8.1489 -3069.95 34.9261 335857 14.0411 186.407 447.917 24.852

0.3 2.23976 1079.32 -8.16877 -3051.02 35.1081 336088 13.5398 184.837 444.89 26.436

0.35 2.23254 1078.49 -8.18501 -3036.84 35.2537 336353 13.186 183.736 442.767 27.6061

0.4 2.22588 1077.42 -8.2017 -3022.65 35.3813 336693 12.8352 182.96 440.737 28.7844

0.45 2.22097 1076.37 -8.2145 -3011.19 35.4751 337030 12.5677 181.905 439.19 29.7273

0.5 2.21641 1075.17 -8.22778 -2999.72 35.5766 337413 12.3017 181.152 437.7 30.6764

0.6 2.2094 1072.84 -8.25104 -2980.34 35.7243 338160 11.8687 179.953 435.318 32.2745

0.7 2.20432 1070.37 -8.27257 -2963.39 35.8453 338953 11.5165 179.014 433.427 33.6664

0.8 2.19996 1068.12 -8.28685 -2948.52 35.9511 339675 11.5963 178.205 431.786 34.8986

0.9 2.199666 1065.83 -8.30892 -2935.02 36.0316 340417 10.9241 177.536 430.415 36.0132

1 2.19402 1063.58 -8.32456 -2922.7 36.1143 341148 10.683 176.965 429.23 37.0315

1.2 2.1904 1059.69 -8.35123 -2902.83 36.228 342421 10.3153 176.108 427.447 38.6649

1.5 2.18655 1053.16 -8.39042 -2873.03 36.3653 344572 9.7667 174.99 425.022 41.1648

3 2.18465 1028.29 -8.51301 -2778.67 36.709 353019 8.22929 172.181 419.181 49.1813

5 2.19279 1003.66 -8.60193 -2699.98 36.8676 361789 7.05187 171.339 415.991 56.0982

7 2.20295 984.257 -8.64902 -2643.09 36.9129 369001 6.21615 170.917 414.41 61.2601

10 2.21726 961.015 -8.67494 -2577.7 36.9554 378016 5.1806 170.67 413.053 67.3718

15 2.24192 929.864 -8.64334 -2496.06 36.9079 390786 3.9244 170.951 412.403 75.3889

20 2.26579 904.335 -8.55002 -2432.55 36.8333 401882 2.94635 171.555 412.589 81.9637

Table 1

he graph below, figure 2, is the pressure of the feedwater heater versus the thermal

efficiency of the entire system. The efficiency appears to flatten out after 5 bar and begins to

drop steadily after 20 bar. It is not known what happens to the efficiency after 20 bar because

pressures beyond that were not studied. The graph suggests that the efficiency will continue

to slowly drop after 20 bar to some unknown value.

7

Figure 2

In order to obtain the closest possible equation for this graph, only a small portion of it

was considered. Looking at figure 2, it

is not difficult to see that the highest

possible efficiency occurs at

approximately 10 bar. A close up of

the values between 5 and 20 bar were

considered to obtain the equation of

the line shown to the right. With the

equation known, one can calculate the

maximum pressure by differentiating

the function and setting it equal to

zero.

8

Setting this derivative equal to zero and solving for x, three possible values for x are

obtained. They are x=21.703, x=10.235 and x=1.812. Since figure 2 suggests that the value

is approximately 10, x=10.235 can immediately be taken as the correct answer. In summary,

using the thermal efficiency yields an optimum pressure for the feedwater heater of 10.235

bar with a maximum efficiency of 36.95% for the system.

One can also use the sum of the irreversibilities to find the optimum operating

pressure for the feedwater heater. By adding all the individual and plotting versus the

pressure, a graph like the one shown in figure 2 can be obtained. The sum of the is

Figure 3

Once again, only a portion of the graph will be used to obtain the closest possible

match for the equation of the line. This portion of the graph is depicted in the graph to the

right. By comparing figure

2 and figure 3, it is not

difficult to see that the

optimum pressure that both

predict are completely

different. While the thermal

efficiency predicts a value

of 10.235 bar, the sum of

9

the irreversibilities predicts a value of a little more than 2 bar. The exact value can be

obtained by differentiating the equation of the line in the graph above and setting it equal to

zero.

After solving for x, a value of 2.10 bar is obtained. This value is much lower than the

one obtained using thermal efficiency. This is because the thermal efficiency only considers

the work of the turbines and pumps and the total heat addition to the system. Using takes

into account every component of the system. Which pressure should be used depends on

what is needed. If the highest possible efficiency is required than 10.235 bar should be used.

If the is to be kept to a minimum, than 2.10 bar should be used for most favorable

operating conditions.

Figure 3 is a comparison of the rate of exergy destruction, , compared to the

pressure. All four apparatus are shown on one graph; furthermore, for clarity, a logarithmic

scale was used on both axes. Interestingly enough, the only component whose exergy

destruction rate increases as the pressure rises is the feedwater heater. The boiler accounts

for the largest portion of exergy destruction. This can be confirmed by referring to table 1.

10

Figure 4

Turbine with 90% Efficiency

The following data is for a turbine operating at 90% efficiency. All exergy analysis was

done with a dead state temperature of 300K.

11

Pressure Sum of Sigma Work Turbine (KJ/kg) Work Pump (KJ/kg) Q (KJ/kg) Thermal Efficiency % Mass Flow Rate (kg/hour) Ed Turbine (MW) Ed Condenser (MW) Ed Boiler (MW) Ed Heater (MW)

0.04 2.20543 1132.01 -8.02384 -3218.91 34.928 320240 11.8584 186.385 452.824 11.2795

0.06 2.17661 1136.59 -8.04312 -3188.82 35.3998 318994 11.1571 182.56 445.715 13.8496

0.08 2.15755 1139 -8.05913 -3166.46 35.7213 318320 10.6659 179.986 440.896 15.7197

0.1 2.14366 1140.32 -8.0735 -3148.5 35.9672 317952 10.291 178.075 437.298 17.2038

0.15 2.1235 1141.25 -8.10129 -3118.69 36.3422 317699 9.72893 175.223 431.901 19.6086

0.2 2.10601 1140.96 -8.12892 -3088.88 36.6848 317789 9.18013 172.67 426.973 22.0333

0.25 2.09635 1140.11 -8.14888 -3069.45 36.8836 318033 8.86427 171.207 424.146 23.5331

0.3 2.08765 1138.81 -8.16874 -3051.02 37.058 318403 8.5522 169.849 421.481 25.045

0.35 2.08169 1137.57 -8.18497 -3036.84 37.1998 318757 8.3309 168.893 419.604 26.1619

0.4 2.07623 1136.1 -8.20112 -3022.65 37.3228 319179 8.11127 167.99 417.81 27.287

0.45 2.07221 1134.72 -8.21444 -3011.19 37.4131 319572 7.94413 167.303 416.44 28.1875

0.5 2.06849 1133.2 -8.22771 -2999.72 37.5116 320008 7.77787 166.648 415.121 29.0939

0.6 2.06279 1130.35 -8.25095 -2980.34 37.6542 320828 7.50605 165.605 413.007 30.6203

0.7 2.05873 1127.43 -8.27245 -2963.39 37.7712 321670 7.28808 164.787 411.327 31.9497

0.8 2.05523 1124.81 -8.2867 -2948.52 37.8739 322430 7.08439 164.08 409.864 33.1269

0.9 2.05261 1122.18 -8.30876 -2935.02 37.9514 323196 6.91326 163.496 408.641 34.1914

1 2.05054 1119.63 -8.32437 -2922.7 38.0323 323944 6.76201 162.997 407.584 35.164

1.2 2.04775 1115.26 -8.35049 -2902.83 38.1431 325229 6.53118 162.246 405.986 36.7237

1.5 2.04497 1108.04 -8.39011 -2873.03 38.2752 327378 6.18644 161.268 403.814 39.1106

3 2.04496 1081.13 -8.51232 -2778.67 38.6113 335626 5.21525 159.054 398.529 46.7582

5 2.05465 1054.49 -8.60077 -2699.98 38.7509 344205 4.51512 158.152 395.774 53.3718

7 2.06535 1033.72 -8.64743 -2643.09 38.7844 351195 4.00324 157.845 394.413 58.3041

10 2.07916 1009.24 -8.67278 -2577.7 38.8268 359796 3.2957 157.624 393.144 64.1244

15 2.10212 976.707 -8.64036 -2496.06 38.7847 371875 2.40997 157.84 392.446 71.7407

20 2.12413 950.136 -8.54638 -2432.55 38.7167 382332 1.70639 158.345 392.518 77.9765

Table 2

Obviously, a higher efficiency will yield more work from the turbine and thus, increase

the thermal efficiency. Although the efficiency of the turbine was increased by 5%, this did not

yield a 5% increase in thermal efficiency. In fact, the maximum possible thermal efficiency

went up slightly more than 5% from the maximum value obtained from the 85% efficient

turbine. Figure 5 is plot of pressure against the thermal efficiency. The plot looks very similar

to the graph obtained at 85% efficiency, except the peak pressure is slightly higher.

12

Figure 5

A plot of values between 5 and 15 bar was considered to obtain the equation of the

line through the highest point. This plot is shown to the right. Once again, with the equation

known, the coordinates of the

highest point can be obtained.

After some derivation, a

maximum thermal efficiency

of 38.87% occurs at a

pressure of 13.437 bar. This

is certainly not a huge

increase in thermal efficiency,

but an improvement

nonetheless.

Figure 6 is a plot of the and pressure. Not surprising, it resembles the figure 3. In

order to obtain the closest possible fit, only pressures directly adjacent to the lowest point

were considered. It is not difficult to tell from figure 6 that the ideal pressure is approximately

2.5 bar.

13

Figure 6

However, to be more accurate the graph to the right will be used to determine the

equation of the line

through that point. After

differentiating the

equation, setting it equal to

zero and solving for x, an

ideal pressure of 2.03 bar

is found. This pressure

occurs at a =2.043

MW/K. These values are

not too much different than

those found when the

turbine has 85% efficiency.

Conclusion

14

Which pressure value that one would consider “ideal” would depend on what is

needed. Table 3 below shows the calculated values for both possible pressures for both

turbine efficiencies.

Ideal Pressure for Highest η (bar) η (%) Ideal Pressure for Lowest Σσ (bar) Σσ (MW/K)

85% Efficiency 10.235 36.95 2.1 2.185890% Efficiency 13.437 38.87 2.03 2.043

% Difference 31.28 5.19 3.45 6.99

Table 3

Discussion

One might wonder which of the above pressures in Table 3 are the most effective and

ideal. Although having the highest thermal efficiency is certainly nice, it is not always the most

practical decision. For example, using the turbine with 85% efficiency, the two pressures

calculated are 10.235 bar and 2.1 bar. The former is for highest possible efficiency and the

latter is for the lowest possible . However, when the thermal efficiency is determined at the

point of lowest , it is not terribly much lower than that of the highest point achieved. Using

figure 2 to determine the efficiency at 2.1 bar required a linear regression that will not be

shown, but, its value is 36.53 %. That value is only 1.13% lower than the highest possible

value of 36.95 % reached at that turbine efficiency. That kind of difference can be taken as

negligible. In conclusion, the pressure that yields the lowest possible should be used since

that value represents work that is being loss, certainly a value that should be kept to a

minimum.

Computer Code

//*************************************************************************************//Program for Thermodynamics II 10/12/01***********************************************//Paul Gibson**************************************************************************//copyright 2001***********************************************************************//*************************************************************************************//*************************************************************************************

#include <stdio.h>#include <math.h>#include <conio.h>#include <ctype.h>

15

//all pressures are in bars//all temperatures are in kelvin

#define PI 3.14159265358 //included for no reason at all other than completeness#define P1 80#define P3 .08#define P7 80#define T1 480#define X4 0#define T6 0#define P4 .08

//***********************************************************************************//data needed for steam tabletypedef struct TABLE{

double P;double vf;double vg;double hf;double hfg;double hg;double sf;double sg;

}tab_t; //new data type for one row of the table#define N 50 //number of rows in the table

//**********************************************************************************

//data needed for superheated tabletypedef struct SUPERHEAT06{ //.06 bar superheated table

double h2;double s2;

}tab_a; //new data type for one row of the table#define A 12 //number of rows in the table

//***********************************************************************************

//data needed for superheated tabletypedef struct SUPERHEAT35{ //.35 bar superheated table

double h2;double s2;

}tab_b; //new data type for one row of the table#define B 12 //number of rows in the table

//**********************************************************************************

//data needed for superheated tabletypedef struct SUPERHEAT07{ //.7 bar superheated table

double h2;double s2;

}tab_c; //new data type for one row of the table

16

#define C 12 //number of rows in the table

//***********************************************************************************//data needed for superheated tabletypedef struct SUPERHEAT1{ //1 bar superheated table

double h2;double s2;

}tab_d; //new data type for one row of the table#define D 12 //number of rows in the table

//***********************************************************************************//data needed for superheated tabletypedef struct SUPERHEAT15{ //1.5 bar superheated table

double h2;double s2;

}tab_e; //new data type for one row of the table#define E 12 //number of rows in the table

//***********************************************************************************//data needed for superheated tabletypedef struct SUPERHEAT3{ //3 bar superheated table

double h2;double s2;

}tab_f; //new data type for one row of the table#define F 11 //number of rows in the table

//***********************************************************************************//data needed for superheated tabletypedef struct SUPERHEAT5{ //5 bar superheated table

double h2;double s2;

}tab_g; //new data type for one row of the table#define G 12 //number of rows in the table

//***********************************************************************************//data needed for superheated tabletypedef struct SUPERHEAT{ //7 bar superheated table

double h2;double s2;

}tab_s; //new data type for one row of the table#define S 12 //number of rows in the table

//***********************************************************************************

//data needed for superheated tabletypedef struct SUPERHEAT10{ //10 bar superheated table

double h2;double s2;

17

}tab_r; //new data type for one row of the table#define R 12 //number of rows in the table

//***********************************************************************************

//data needed for superheated tabletypedef struct SUPERHEAT15bar{ //15 bar superheated table

double h2;double s2;

}tab_j; //new data type for one row of the table#define J 12 //number of rows in the table

//***********************************************************************************

//data needed for superheated tabletypedef struct SUPERHEAT20{ //20 bar superheated table

double h2;double s2;

}tab_m; //new data type for one row of the table#define M 12 //number of rows in the table

//**********************************************************************************//function calls for tables//***********************************************************************************

double vf_use_P(tab_t Tab[], double P);double vg_use_P(tab_t Tab[], double P);double hf_use_P(tab_t Tab[], double P);double hfg_use_P(tab_t Tab[], double P);double hg_use_P(tab_t Tab[], double P);double sf_use_P(tab_t Tab[], double P);double sg_use_P(tab_t Tab[], double P);double s_use_h(tab_s Tab[], double h1);double s_use_h(tab_r Tab[], double h1);double s_use_h(tab_a Tab[], double h1);double s_use_h(tab_b Tab[], double h1);double s_use_h(tab_c Tab[], double h1);double s_use_h(tab_d Tab[], double h1);double s_use_h(tab_e Tab[], double h1);double s_use_h(tab_f Tab[], double h1);double s_use_h(tab_g Tab[], double h1);double s_use_h(tab_j Tab[], double h1);double s_use_h(tab_m Tab[], double h1);//***********************************************************************************

void main(void)

{double P5, P6, P2;double hf[12], hfg[12], hg[12];double sf[12], sg[12], ss[12];double vf[12], vg[12];double h[12], s[12], v[12];double y;double etta_t; //efficiency of turbines

18

double etta_thermal;double work_t1, work_t2; //work of both turbinesdouble work_p1, work_p2; //work of both pumpsdouble q_in; //heat addition in boilerdouble hs[12];double X3, X2s, X2, X3s;double h2; //just a value needed to find s2 because it is superheateddouble work_total_turbine;double work_total_pump;int error;double m_dot; //mass flow of steam entering turbine 1double work_cycle;double sigma_dot_t1, sigma_dot_t2;double sigma_dot_condenser;double sigma_dot_heater;double sigma_dot_boiler;double m_dot_t1, m_dot_t2, m_dot_condenser, m_dot_boiler;double exergy_t1, exergy_t2, exergy_condenser, exergy_heater, exergy_boiler;double sum_sigma; //sum of all sigma dots

//******************************************************************

tab_t Tab[N]={ //p vf vg hf hfg hg sf sg{.04, 1.0040e-3, 34.800, 121.46, 2432.9, 2554.4, .4226, 8.4746}, {.06, 1.0064e-3, 23.739, 151.53, 2415.9, 2567.4, .5210, 8.3304},{.08, 1.0084e-3, 18.103, 173.88, 2403.1, 2577.0, .5926, 8.2287},{.10, 1.0102e-3, 14.674, 191.83, 2392.8, 2584.7, .6493, 8.1502},{.20, 1.0172e-3, 7.649, 251.40, 2358.3, 2609.7, .8320, 7.9085},{.30, 1.0223e-3, 5.229, 289.23, 2336.1, 2625.3, .9439, 7.7686},{.40, 1.0265e-3, 3.993, 317.58, 2319.2, 2636.8, 1.0259, 7.6700},{.50, 1.0300e-3, 3.240, 340.49, 2305.4, 2645.9, 1.0910, 7.5939}, //took a {.60, 1.0331e-3, 2.732, 359.86, 2293.6, 2653.5, 1.1453, 7.5320}, //very long{.70, 1.0360e-3, 2.365, 376.79, 2283.3, 2660.0, 1.1919, 7.4797}, //time{.80, 1.0380e-3, 2.087, 391.66, 2274.1, 2665.8, 1.2329, 7.4346},{.90, 1.0410e-3, 1.869, 405.15, 2265.7, 2670.9, 1.2695, 7.3949},{1.0, 1.0432e-3, 1.694, 417.46, 2258.0, 2675.5, 1.3026, 7.3594},{1.5, 1.0528e-3, 1.159, 467.11, 2226.5, 2693.6, 1.4336, 7.2233},{2.0, 1.0605e-3, .8857, 504.49, 2529.4, 2706.7, 1.5301, 7.1271},{2.5, 1.0672e-3, .7187, 535.37, 2181.5, 2716.9, 1.6072, 7.0527},{3.0, 1.0732e-3, .6058, 561.47, 2163.8, 2725.3, 1.6718, 6.9919},{3.5, 1.0786e-3, .5243, 584.33, 2148.1, 2732.4, 1.7275, 6.9405},{4.0, 1.0836e-3, .4625, 604.74, 2133.8, 2738.6, 1.7766, 6.8959},{4.5, 1.0882e-3, .4140, 623.25, 2120.7, 2743.9, 1.8207, 6.8565},{5.0, 1.0926e-3, .3749, 640.23, 2108.5, 2748.7, 1.8607, 6.8212},{6.0, 1.1006e-3, .3157, 670.56, 2086.3, 2756.8, 1.9312, 6.7600},{7.0, 1.1080e-3, .2729, 697.22, 2066.3, 2763.5, 1.9922, 6.7080},{8.0, 1.1148e-3, .2404, 721.11, 2048.0, 2769.1, 2.0462, 6.6628},{9.0, 1.1212e-3, .2150, 742.83, 2031.1, 2773.9, 2.0946, 6.6226},{10 , 1.1273e-3, .1944, 762.81, 2015.3, 2778.1, 2.1387, 6.5863},{15 , 1.1539e-3, .1318, 844.84, 1947.3, 2792.2, 2.3150, 6.4448},{20 , 1.1767e-3, .09963, 908.79, 1890.7, 2799.5, 2.4474, 6.3409},{25 , 1.1973e-3, .07998, 962.11, 1841.0, 2803.1, 2.5547, 6.2575},{30 , 1.2165e-3, .06668, 1008.4, 1795.7, 2804.2, 2.6457, 6.1869},{35 , 1.2347e-3, .05707, 1049.8, 1753.7, 2803.4, 2.7253, 6.1253},{40 , 1.2522e-3, .04978, 1087.3, 1714.1, 2801.4, 2.7964, 6.0701},{45 , 1.2692e-3, .04406, 1121.9, 1676.4, 2798.3, 2.8610, 6.0199},{50 , 1.2859e-3, .03944, 1154.2, 1640.1, 2794.3, 2.9202, 5.9734},{60 , 1.3187e-3, .03244, 1213.4, 1571.0, 2784.3, 3.0267, 5.8892},

19

{70 , 1.3513e-3, .02737, 1267.0, 1505.1, 2772.1, 3.1211, 5.8133},{80 , 1.3842e-3, .02352, 1316.6, 1441.3, 2758.0, 3.2068, 5.7432},{90 , 1.4178e-3, .02048, 1363.3, 1378.9, 2742.1, 3.2858, 5.6772},{100, 1.4524e-3, .01803, 1407.6, 1317.1, 2724.7, 3.3596, 5.6141},{110, 1.4886e-3, .01599, 1450.1, 1255.5, 2705.6, 3.4295, 5.5527},{120, 1.5267e-3, .01426, 1491.3, 1193.6, 2684.9, 3.4962, 5.4924},{130, 1.5671e-3, .01278, 1531.5, 1130.7, 2662.2, 3.5606, 5.4323},{140, 1.6107e-3, .01149, 1571.1, 1066.5, 2637.6, 3.6232, 5.3717},{150, 1.6581e-3, .01034, 1610.5, 1000.0, 2610.5, 3.6848, 5.3098},{160, 1.7107e-3, .009306, 1650.1, 930.6, 2580.6, 3.7461, 5.2455},{170, 1.7702e-3, .008364, 1690.3, 856.9, 2547.2, 3.8079, 5.1777},{180, 1.8397e-3, .007489, 1732.0, 777.1, 2509.1, 3.8715, 5.1044},{190, 1.9243e-3, .006657, 1776.5, 688.0, 2464.5, 3.9388, 5.0228},{200, 2.036e-3, .005834, 1826.3, 583.4, 2409.7, 4.0139, 4.9269},{220.9, 3.155e-3, .003155, 2099.3, 0, 2099.3, 4.4298, 4.4298}

};

//******************************************************************

tab_a SUPERHEAT06_Tab[A]={ //this is superheated table for .06 bars//h2 s2{2567.4, 8.3304},{2650.1, 8.5804}, {2726.0, 8.7840},

{2802.7, 8.9693},{2879.7, 9.1398},{2957.8, 9.2982},{3036.8, 9.4464},{3116.7, 9.5859},{3197.7, 9.7180},{3279.6, 9.8435},{3362.6, 9.9633},{3489.1, 10.1336},

};

//******************************************************************

tab_b SUPERHEAT35_Tab[B]={ //this is superheated table for .35 bars//h2 s2{2631.4, 7.7158},{2645.6, 7.7564}, {2723.1, 7.9644},{2800.6, 8.1519},{2878.4, 8.3237},{2956.8, 8.4828},{3036.0, 8.6314},{3116.1, 8.7712},{3197.1, 8.9034},{3279.2, 9.0291},{3362.2, 9.1490},{3488.8, 9.3194},

};

//******************************************************************

tab_c SUPERHEAT07_Tab[C]={ //this is superheated table for .07 bars//h2 s2{2660.0, 7.4797},

20

{2680.0, 7.5341}, {2719.6, 7.6375},{2798.2, 7.8279},{2876.7, 8.0012},{2955.5, 8.1611},{3035.0, 8.3162},{3115.3, 8.4504},{3196.5, 8.5828},{3278.6, 8.7086},{3361.8, 8.8286},{3488.5, 8.9991},

};//******************************************************************tab_d SUPERHEAT1_Tab[D]={ //this is superheated table for 1 bars

//h2 s2{2675.5, 7.3594},{2676.2, 7.3614}, {2716.6, 7.4668},{2796.2, 7.6597},{2875.3, 7.8343},{2954.5, 7.9949},

{3034.2, 8.1445},{3114.6, 8.2849},{3195.9, 8.4175},{3278.2, 8.5435},{3361.4, 8.6636},{3488.1, 8.8342},

};

//******************************************************************tab_e SUPERHEAT15_Tab[E]={ //this is superheated table for 1.5 bars

//h2 s2{2693.6, 7.2233},{2711.4, 7.2693}, {2792.8, 7.4665},{2872.9, 7.6433},{2952.7, 7.8052},{3032.8, 7.9555},{3113.5, 8.0964},{3195.0, 8.2293},{3277.4, 8.3555},{3360.7, 8.4757},{3487.6, 8.6466},{3704.3, 8.9101},

};//******************************************************************tab_f SUPERHEAT3_Tab[F]={ //this is superheated table for 3 bars

//h2 s2{2725.3, 6.9919},{2782.3, 7.1276}, {2865.5, 7.3115},{2947.3, 7.4774},{3028.6, 7.6299}, //note onlt 11 rows of information{3110.1, 7.7722},{3192.2, 7.9061},{3275.0, 8.0330},{3358.7, 8.1538},{3486.0, 8.3251},{3703.2, 8.5892},

21

};

//******************************************************************tab_g SUPERHEAT5_Tab[G]={ //this is superheated table for 5 bars

//h2 s2{2748.7, 6.8213},{2812.0, 6.9656}, {2855.4, 7.0592},{2939.9, 7.2307},{3022.9, 7.3865},{3105.6, 7.5308},{3188.4, 7.6660},{3271.9, 7.7938},{3356.0, 7.9152},{3483.9, 8.0873},{3701.7, 8.3522},{3925.9, 8.5952},

};

//******************************************************************

tab_s SUPERHEAT_Tab[S]={ //this is superheated table for 7 bars//h2 s2{2763.5, 6.7080},{2799.1, 6.7880}, {2844.8, 6.8865},{2932.2, 7.0641},{3017.1, 7.2233},{3100.9, 7.3697},{3184.7, 7.5063},{3268.7, 7.6350},{3353.3, 7.7571},{3481.7, 7.9299},{3700.2, 8.1956},{3924.8, 8.4391},

};

//************************************************************************

tab_r SUPERHEAT10_Tab[R]={ //this is superheated table for 10 bars//h2 s2{2778.1, 6.5865},{2827.9, 6.6940}, {2920.4, 6.8817},{3008.2, 7.0465},{3093.9, 7.1962},{3178.9, 7.3349},{3263.9, 7.4651},{3349.3, 7.5883},{3478.5, 7.7622},{3565.6, 7.8720},{3697.9, 8.0290},{3787.2, 8.1290},

};

//******************************************************************tab_j SUPERHEAT15bar_Tab[J]={ //this is superheated table for 15 bars

22

//h2 s2{2792.2, 6.4448},{2796.8, 6.4546}, {2899.3, 6.6628},{2992.7, 6.8381},{3081.9, 6.9938},{3169.2, 7.1363},{3255.8, 7.2690},{3342.5, 7.3940},{3473.1, 7.5698},{3560.9, 7.6805},{3694.0, 7.8385},{3783.8, 7.9391},

};

//******************************************************************tab_m SUPERHEAT20_Tab[M]={ //this is superheated table for 20 bars

//h2 s2{2799.5, 6.3409},{2876.5, 6.4952}, {2976.4, 6.6828},{3069.5, 6.8452},{3159.3, 6.9917},{3247.6, 7.1271},{3335.5, 7.2540},{3467.6, 7.4317},{3556.1, 7.5434},{3690.1, 7.7024},{3780.4, 7.8035},{3917.4, 7.9487},

};

//****************************************************************************printf("\n ------------------------------------------------------------");printf("\a\n| Welcome. |");printf("\n| This program will analize example 8.5 on page 396. |");printf("\n| All values are to be entered in SI units. |");printf("\n ------------------------------------------------------------");printf("\n\n\nPlease enter the efficiency of the turbine, not as a percentage: ");scanf("%lg",&etta_t);

while (etta_t > 1 || etta_t <=0 ){

printf("\nThat is not a valid number.");printf("\n\n\nPlease enter the efficiency of the turbine: ");scanf("%lg",&etta_t);

}

printf("\nYou entered %g.",etta_t);

do{

char c;

printf("\n\n\nPlease select the desired feedwater heater pressure to work with: ");

printf("\n\nA - .04 bar M - .60 bar");printf("\nB - .06 bar N - .70 bar");

23

printf("\nC - .08 bar O - .80 bar");printf("\nD - .10 bar P - .90 bar");printf("\nE - .15 bar Q - 1.0 bar");printf("\nF - .20 bar R - 1.2 bar");printf("\nG - .25 bar S - 1.5 bar");printf("\nH - .30 bar T - 3.0 bar");printf("\nI - .35 bar U - 5.0 bar");printf("\nJ - .40 bar V - 7.0 bar");printf("\nK - .45 bar W - 10 bar");printf("\nL - .50 bar X - 15 bar");printf("\n\t\tY - 20 bar");

printf("\n\nYour choice:");

error=0;

c=toupper(getch()); //get the inputswitch(c) //find key that was pressed{case 'A':

printf("\nYou selected .04 bar.");P2=.04;break;

case 'B':printf("\nYou selected .06 bar.");P2=.06;break;

case 'C':printf("\nYou selected .08 bar.");P2=.08;break;

case 'D':printf("\nYou selected .10 bar.");P2=.10;break;

case 'E':printf("\nYou selected .15 bar.");P2=.15;break;

case 'F':printf("\nYou selected .20 bar.");P2=.20;break;

case 'G':printf("\nYou selected .25 bar.");P2=.25;break;

case 'H':printf("\nYou selected .30 bar.");P2=.30;break;

case 'I':printf("\nYou selected .35 bar.");P2=.35;break;

case 'J':printf("\nYou selected .40 bar.");P2=.40;break;

case 'K':

24

printf("\nYou selected .45 bar.");P2=.45;break;

case 'L':printf("\nYou selected .50 bar.");P2=.50;break;

case 'M':printf("\nYou selected .60 bar.");P2=.60;break;

case 'N':printf("\nYou selected .70 bar.");P2=.70;break;

case 'O':printf("\nYou selected .80 bar.");P2=.80;break;

case 'P':printf("\nYou selected .90 bar.");P2=.90;break;

case 'Q':printf("\nYou selected 1 bar.");P2=1;break;

case 'R':printf("\nYou selected 1.2 bar.");P2=1.2;break;

case 'S':printf("\nYou selected 1.5 bar.");P2=1.5;break;

case 'T':printf("\nYou selected 3 bar.");P2=3;break;

case 'U':printf("\nYou selected 5 bar.");P2=5;break;

case 'V':printf("\nYou selected 7 bar.");P2=7;break;

case 'W':printf("\nYou selected 10 bar.");P2=10;break;

case 'X':printf("\nYou selected 15 bar.");P2=15;break;

case 'Y':printf("\nYou selected 20 bar.");P2=20;break;

default:printf("\n\aYou made an invalid selection.");

25

error=error+1; //error equals one so loop continues

} //this ends swich case loop

} //ends do statement

while(error > 0); //loop will continue until error equals zero

//******************************************************************************

printf("\n\n*************************************************************"); printf("\nYou entered the following data:\n\n"); printf("Turbine efficiency: %g\n", etta_t); printf("Pressure through feedwater heater: %g bars\n", P2); printf("\n\nResults:\n\n");//******************************************************************************

P5=P6=P2; //pressure throughout heater is constantwork_cycle=100;h[1]=3348.4;s[1]=6.6586;sf[3]=sf_use_P(Tab, P3);sg[3]=sg_use_P(Tab, P3);sf[2]=sf_use_P(Tab, P2);sg[2]=sg_use_P(Tab, P2);hf[2]=hf_use_P(Tab, P2);hg[2]=hg_use_P(Tab, P2);hf[3]=hf_use_P(Tab, P3);hg[3]=hg_use_P(Tab, P3);hfg[2]=hfg_use_P(Tab, P2);hfg[3]=hfg_use_P(Tab, P3);ss[2]=s[1];X2s=(ss[2]-sf[2])/(sg[2]-sf[2]);hs[2]=hf[2]+X2s*hfg[2];work_t1=etta_t*(h[1]-hs[2]);h[2]=h[1]-(work_t1);X2=(h[2]-hf[2])/(hg[2]-hf[2]);h2=h[2];

if(X2>1) {

if(P2==.06){s[2]=s_use_h(SUPERHEAT06_Tab, h2);

}if(P2==.35){

s[2]=s_use_h(SUPERHEAT35_Tab, h2);}if(P2==.7){

s[2]=s_use_h(SUPERHEAT07_Tab, h2);}if(P2==1){

s[2]=s_use_h(SUPERHEAT1_Tab, h2);}if(P2==1.5){

s[2]=s_use_h(SUPERHEAT15_Tab, h2);}if(P2==3){

26

s[2]=s_use_h(SUPERHEAT3_Tab, h2); }if(P2==5){

s[2]=s_use_h(SUPERHEAT5_Tab, h2);}if(P2==7){

s[2]=s_use_h(SUPERHEAT_Tab, h2);}if(P2==10){

s[2]=s_use_h(SUPERHEAT10_Tab, h2);}if(P2==15){

s[2]=s_use_h(SUPERHEAT15bar_Tab, h2);}if(P2==20){

s[2]=s_use_h(SUPERHEAT20_Tab, h2);}

}

else s[2]=sf[2]+X2*(sg[2]-sf[2]);

ss[3]=s[2];X3s=(ss[3]-sf[3])/(sg[3]-sf[3]);hs[3]=hf[3]+X3s*hfg[3];h[3]=h[2]-etta_t*(h[2]-hs[3]);X3=(h[3]-hf[3])/(hg[3]-hf[3]);h[4]=hf_use_P(Tab, P4);v[4]=vf_use_P(Tab, P4);h[5]=h[4]+v[4]*(P5/10-P4/10)*1e3;v[6]=vf_use_P(Tab, P6);h[6]=hf_use_P(Tab, P6);h[7]=h[6]+v[6]*(P7/10-P6/10)*1e3;y=(h[6]-h[5])/(h[2]-h[5]);work_total_turbine=(h[1]-h[2])+(1-y)*(h[2]-h[3]);work_total_pump=(h[6]-h[7])+(1-y)*(h[4]-h[5]);q_in=h[7]-h[1];etta_thermal=((work_total_turbine+work_total_pump)/abs(q_in))*100;m_dot=(work_cycle*3600*1e3)/(work_total_turbine+work_total_pump);s[3]=sf[3]+X3*(sg[3]-sf[3]);s[4]=sf_use_P(Tab, P4);s[5]=s[4]; //pump one is isentropic so s5-s4=0s[6]=sf_use_P(Tab, P6);s[7]=s[6]; //pump two is isentropicm_dot_t1=m_dot;m_dot_t2=m_dot*(1-y);m_dot_condenser=m_dot*(1-y);m_dot_boiler=m_dot; sigma_dot_t1=(((s[2]-s[1])*m_dot_t1)/1000)/3600;sigma_dot_t2=(((s[3]-s[2])*m_dot_t2)/1000)/3600;sigma_dot_condenser=((((h[3]-h[4])/300)*m_dot_condenser)/1000)/3600;sigma_dot_boiler=(((m_dot_boiler*((s[1]-s[7])*300-q_in))/300)/1000)/3600;sigma_dot_heater=((-s[2]*y-s[5]*(1-y)+s[6]*m_dot)/1000)/3600;exergy_t1=300*sigma_dot_t1;exergy_t2=300*sigma_dot_t1;exergy_condenser=300*sigma_dot_condenser;exergy_boiler=300*sigma_dot_boiler;exergy_heater=300*sigma_dot_heater;sum_sigma=sigma_dot_t1+sigma_dot_t2+sigma_dot_condenser+sigma_dot_boiler+sigma_dot_heater;

27

printf("The total work of the turbines: %g KJ/kg\n", work_total_turbine);printf("The total work of the pumps: %g KJ/kg\n", work_total_pump);printf("The total heat addition is: %g KJ/kg\n", q_in);printf("The mass flow rate of steam entering turbine one: %g kg/hour\n", m_dot);printf("The thermal efficiency of the system is: %g%%\n\n", etta_thermal);printf("The entropy rate of production for turbine one: %g MW/K\n", sigma_dot_t1);printf("The entropy rate of production for turbine two: %g MW/K\n", sigma_dot_t2);printf("The entropy rate of production for condenser: %g MW/K\n", sigma_dot_condenser);printf("The entropy rate of production for boiler: %g MW/K\n", sigma_dot_boiler);printf("The entropy rate of production for feedwater heater: %g MW/K\n\n", sigma_dot_heater);printf("The exergy destruction rate for turbine one: %g MW\n", exergy_t1);printf("The exergy destruction rate for turbine two: %g MW\n", exergy_t2);printf("The exergy destruction rate for condenser: %g MW\n", exergy_condenser);printf("The exergy destruction rate for boiler: %g MW\n", exergy_boiler);printf("The exergy destruction rate for feedwater heater: %g MW\n\n", exergy_heater);printf("The sum of the irreversibilities: %g MW/K\n\n", sum_sigma);

//printf("Flow fraction y: %g\n", y);//printf("h1: %g KJ/kg\n", h[1]);//printf("h2: %g KJ/kg\n", h[2]);//printf("h3: %g KJ/kg\n", h[3]);//printf("h4: %g KJ/kg\n", h[4]);//printf("h5: %g KJ/kg\n", h[5]);//printf("h6: %g KJ/kg \n", h[6]);//printf("h7: %g KJ/kg\n", h[7]);//printf("The quality X3: %g\n", X3);//printf("v4: %g\n", vf_use_P(Tab, P4));//printf("h2s: %g KJ/kg\n", hs[2]);//printf("hs3: %g KJ/kg\n", hs[3]);//printf("The work of turbine one: %g\n", work_t1);

//printf("The quality X2s: %g\n", X2s);//printf("hs2: %g\n", hs[2]);//printf("hf2: %g\n", hf[2]);//printf("hg2: %g\n", hg[2]);//printf("The quality X2: %g\n", X2);//printf("The quality X3s: %g\n", X3s);//printf("hs3: %g\n", hs[3]);//printf("hf3: %g\n", hf[3]);//printf("hg3: %g\n", hg[3]);//printf("s1: %g KJ/kg K\n", s[1]);//printf("s2: %g KJ/kg K\n", s[2]);//printf("s3: %g KJ/kg K\n", s[3]);//printf("s4: %g KJ/kg K\n", s[4]);//printf("s5: %g KJ/kg K\n", s[5]);//printf("s6: %g KJ/kg K\n", s[6]);//printf("s7: %g KJ/kg K\n", s[7]);

}//this ends main

//================================================================//************function for finding hf****************************

28

double hf_use_P(tab_t Tab[], double P){int k; //loop counterfor (k=0; k<N; ++k){

if (Tab[k].P==P) return Tab[k].hf; //interpolation

if (Tab[k].P>P)return (Tab[k].hf-Tab[k-1].hf)*(P-Tab[k-1].P)/(Tab[k].P-Tab[k-1].P)

+Tab[k-1].hf;

}

return Tab[N].hf;}

//================================================================//************function for finding sf****************************

double sf_use_P(tab_t Tab[], double P){int k;for (k=0; k<N; ++k){

if (Tab[k].P==P) return Tab[k].sf;//interpolate

if (Tab[k].P>P)return (Tab[k].sf-Tab[k-1].sf)*(P-Tab[k-1].P)/(Tab[k].P-Tab[k-1].P)

+Tab[k-1].sf;

} return Tab[N].sf;}

//================================================================//************function for finding sg****************************

double sg_use_P(tab_t Tab[], double P){int k;for (k=0; k<N; ++k){

if (Tab[k].P==P) return Tab[k].sg;//interpolation

if (Tab[k].P>P)return (Tab[k].sg-Tab[k-1].sg)*(P-Tab[k-1].P)/(Tab[k].P-Tab[k-1].P)

+Tab[k-1].sg;

} return Tab[N].sg;}

29

//================================================================//************function for finding hg****************************

double hg_use_P(tab_t Tab[], double P){int k;for (k=0; k<N; ++k){

if (Tab[k].P==P) return Tab[k].hg;//interpolation

if (Tab[k].P>P)return (Tab[k].hg-Tab[k-1].hg)*(P-Tab[k-1].P)/(Tab[k].P-Tab[k-1].P)

+Tab[k-1].hg;

} return Tab[N].hg;}

//================================================================//************function for finding hfg****************************

double hfg_use_P(tab_t Tab[], double P){int k;for (k=0; k<N; ++k){

if (Tab[k].P==P) return Tab[k].hfg;//interpolation

if (Tab[k].P>P)return (Tab[k].hfg-Tab[k-1].hfg)*(P-Tab[k-1].P)/(Tab[k].P-Tab[k-1].P)

+Tab[k-1].hfg;

} return Tab[N].hfg;}

//================================================================//************function for finding vf****************************

double vf_use_P(tab_t Tab[], double P){int k;for (k=0; k<N; ++k){

if (Tab[k].P==P) return Tab[k].vf;//interpolation

if (Tab[k].P>P)return (Tab[k].vf-Tab[k-1].vf)*(P-Tab[k-1].P)/(Tab[k].P-Tab[k-1].P)

+Tab[k-1].vf;

} return Tab[N].vf;}

30

//************function for finding s2 using h2****************************

double s_use_h(tab_s Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[S].s2;}

//================================================================

//************function for finding s2 using h2****************************

double s_use_h(tab_r Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[R].s2;}

//************function for finding s2 using h2****************************

double s_use_h(tab_a Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[A].s2;}

//************function for finding s2 using h2****************************

double s_use_h(tab_b Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

}

31

return Tab[B].s2;}

//************function for finding s2 using h2****************************

double s_use_h(tab_c Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[C].s2;}

//************function for finding s2 using h2****************************

double s_use_h(tab_d Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[D].s2;}

//************function for finding s2 using h2****************************

double s_use_h(tab_e Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[E].s2;}

//************function for finding s2 using h2****************************

double s_use_h(tab_f Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[F].s2;

32

}

//************function for finding s2 using h2****************************

double s_use_h(tab_g Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[G].s2;}

//************function for finding s2 using h2****************************

double s_use_h(tab_j Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[J].s2;}

//************function for finding s2 using h2****************************

double s_use_h(tab_m Tab[], double h2){int k;for (k=0; k<N; ++k){

if (Tab[k].h2==h2) return Tab[k].s2;//interpolation

if (Tab[k].h2>h2)return (Tab[k].s2-Tab[k-1].s2)*(h2-Tab[k-1].h2)/(Tab[k].h2-Tab[k-

1].h2)+Tab[k-1].s2;

} return Tab[M].s2;}

References

1. Moran, Michael and Shapiro, Howard. Fundamentals of Engineering Thermodynamics

4th Edition. New York: John Wiley & Sons, Inc., 2000.

2. Rolle, Kurt. Thermodynamics and Heat Power 4th Edition. Merrill, 1996.

3. Ritchie, Dennis. The C Programming Language. Bell Telephone Laboratores, Inc.,

1978.

33

4. Fischer, Alice and Eggert, David. Applied Introductory C Programming. University of

New Haven, September 1999.

5. Gookin, Dan. C for Dummies Volume One. New York: IDG Books Worldwide, Inc.,

1994

34


Recommended