ENGR 200 SPRING 2018 P5: CARNOT EFFICIENCY OF POWER PLANTS (if statements, loops
ID: 3727278 • Letter: E
Question
ENGR 200 SPRING 2018 P5: CARNOT EFFICIENCY OF POWER PLANTS (if statements, loops) DUE: March 6, 2018, at 11:59 p.m. U.S. Central Time POINTS: 55 INTRODUCTION: In thermodynamics, energy can be neither created nor destroyed (1 law): it is either converted to usable work or lost as waste heat. The second law of thermodynamics states that the total entropy (disorder) of a system will never decrease over time; that is, systems can only be at constant entropy or have increasing entropy. This may be restated by saying that there is an upper limit to the efficiency of the conversion of heat to work, as in a heat engine. From these principles of thermodynamics, it is clear that there is an upper limit to how efficient power generation can be at most power plants. Many power plants, including those fueled by fossil fuels, nuclear sources, geothermal sources, biomass, and solar thermal, operate by generating a source of heat (burning fossil fuels, reacting nuclear materials, using the sun's rays, etc.), using this heat source to heat water to steam, and passing this steam through a turbine. When the turbine spins, power is generated. The maximum thermodynamic efficiency of a power plant is dictated by the temperatures of the hot reservoir (that is, the steam) and the cold reservoir (the cooling fluid in place). Ideally, the thermodynamic efficiency of the plant would be based on these temperatures, as in the Carnot cycle: Tc where is the efficiency (unitless), TL is the temperature of the cold stream(either in Kelvin or in Rankine), and TH is the temperature of the hot stream, that is, the steam (either in Kelvin or in Rankine). You have a data file called power.txt which shows the temperatures in Kelvin of the steam (TH) and of the cooling fluid (Tc) for several different power plants. This data file has a control number and is space delimited. ASSIGNMENT Write a C program that calculates the Carnot efficiency of power plants with the provided TH and Te streams as shown in the power.txt file. The output should print as a table to the screen and to an output file called efficiencv.txt Use the "Code Sections.c" template on Blackboard to write your code. Your program output will look like the illustration shown below. Use your PC's cursor to determine the horizontal and vertical spacing for the output format.Explanation / Answer
The C program for the problem is:
# include<stdio.h>
# include<conio.h>
int main(void)
{
FILE *myfile;
int n;
double ct,st,eff;
int i;
int j;
myfile=fopen("power.txt", "r");
fscanf(myfile,"%d",&n);
printf(" Total number of factories are: %d", n);
printf(" *************************************************************");
printf(" Steam Temp Cooling Temp Efficiency");
for(i = 0; i < n; i++)
{
fscanf(myfile,"%lf",&st);
printf(" %.15f ",st);
fscanf(myfile,"%lf",&ct);
printf(" %.15f ",ct);
eff=(1-(ct/st));
printf(" %.15f", eff);
printf(" ");
}
printf(" **************************************************************");
fclose(myfile);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.