Project

To simulate the Rankine Cycle using Matlab/Octave programming and plot the T-S and H-S graphs

AIM

To simulate the rankine cycle using Matlab/Octave programming and calculate the efficiency and back work ratio for the given set of data.

GOVERNING EQUATIONS

`eta=W/Q`

where,

`eta`=Thermal efficiency

W = Input work

Q = Input heat

`Q/M = h3-h2`

`(Qout)/M=h4-h1`

`(Wpump)/M=h2-h1`

`W/M = h3-h4`

where,

W = work input

M = Mass flow rate

h1 h2 h3 h4 = Enthalpy

OBJECTIVE

The main objective of this project is to determine the code for simulating the rankine cycle and plot the T-S graph and H-S graph and ultimately calculate the efficiency and back work ratio. The values of steam at different ranges are given by the function ‘XSteam’.

RANKINE CYCLE

The Rankine cycle is a model used to predict the performance of turbine systems. It was also used to study the performance of reciprocating steam engines. The Rankine cycle is an idealized thermodynamic cycle of heat engines that converts heat into mechanical work while undergoing phase change. It is an idealized cycle in which friction losses in each of the four components are neglected. The heat is supplied externally to a closed loop, which usually uses water as the working fluid. The following schematic diagram represents the rankine cycle.

The four processes in rankine cycle are as follows:

The states are identified by numbers in the T-S diagram.

  • Process 1–2: The working fluid is pumped from low to high pressure. As the fluid is a liquid at this stage, the pump requires little input energy.

In other words Process 1-2 is [Isentropic compression]

  • Process 2–3: The high-pressure liquid enters a boiler, where it is heated at constant pressure by an external heat source to become a dry saturated vapour. The input energy required can be easily calculated graphically, using an H-S chart or numerically, using steam tables.

In other words Process 2-3 is [Constant pressure heat addition in boiler]

  • Process 3–4: The dry saturated vapour expands through a turbine, generating power. This decreases the temperature and pressure of the vapour, and some condensation may occur. The output in this process can be easily calculated using the chart or tables noted above.

In other words Process 3-4 is [Isentropic expansion]

  • Process 4–1: The wet vapour then enters a condensor, where it is condensed at a constant pressure to become a saturated liquid.

EXPLANATION OF THE CODE

The following code is written in OCTAVE.

% Rankine Cycle Simulation

fprintf('Rankine Cycle Simulator\n')

fprintf('Process 1-2 Isobaric heat transfer\n')

fprintf('Process 2-3 Isentropic expansion\n')

fprintf('Process 3-4 Isobaric heat rejection\n')

fprintf('Process 4-1 Isentropic compression\n') – The following statements are simple explanations of the processes that occur at each step which appears in the command window for the reader to understand.

% Standard Inputs

p1 = input('Enter the Turbine Inlet Pressure in bar');

t1 = input('Enter Inlet Tepmerature in degree celcius');

p2 = input('Enter Condensor pressure in bar'); - The standard inputs given in the question are input by the user at the time of running the program.

% Input Conditions

t = XSteam('Tsat_p',p1);

h1 = XSteam('h_pT',p1,t1);

s1 = XSteam('s_pT',p1,t1); - The values of temperature, enthalpy and entropy are extracted from the function ‘XSteam’ which is already provided.

% Evaluation of individual State Points

p4=p1;

p3=p2;

t3= XSteam('Tsat_p',p3);

h3= XSteam('hL_p',p3);

s3= XSteam('sL_p',p3);

t2=t3;

s2=s1;

sg2 = XSteam('sV_p',p2);

sf2= XSteam('sL_p',p2);

x2 = (s2-sf2)/(sg2-sf2);

hg2= XSteam('hV_p',p2);

hf2= XSteam('hL_p',p2);

s4=s3;

h2 = hf2+(x2*(hg2-hf2));

h4= XSteam('h_ps',p4,s4);

cp4= XSteam('Cp_ps',p4,s4);

cv4= XSteam('Cv_ps',p4,s4);

g4=cp4/cv4;

a=(g4-1)/g4;

t4=t3*((p4/p3)^a);

s5= XSteam('sL_p',p1);

s6= XSteam('sV_p',p1);

t5= XSteam('Tsat_p',p1); - The following statements are the theoretical formulae which are used to calculate the various parameters asked for. All values are extracted from the already provided function.

% Work calculations of Turbine and Pump

w_t=h1-h2;

w_p=h4-h3;

wnet= w_t-w_p; - Calculation of net work done

q=h1-h4;

% Efficiency calculation

eff= (wnet/q)*100; - Calculation of efficiency

steam_rate = 3600/(w_t-w_p);

% Output Prints

fprintf('\n RESULT \n') – prints RESULT on the command window.

fprintf('State point 1:\n P1 = :%f Bar\n T1 = : %f Degree Celcius\n H1 = : %f Kj/kg\n S1 = :%f Kj/kgK\n\n',p1,t1,h1,s1)

fprintf('State point 2:\n P2 = :%f Bar\n T2 = : %f Degree Celcius\n H2 = : %f Kj/kg\n S2 = :%f Kj/kgK\n\n',p2,t2,h2,s2)

fprintf('State point 3:\n P3 = :%f Bar\n T3 = : %f Degree Celcius\n H3 = : %f Kj/kg\n S3 = :%f Kj/kgK\n\n',p3,t3,h3,s3)

fprintf('State point 4:\n P4 = :%f Bar\n T4 = : %f Degree Celcius\n H4 = : %f Kj/kg\n S4 = :%f Kj/kgK\n\n',p4,t4,h4,s4)

fprintf('WT = :%f Kj/kg \n WP = :%f Kj/kg\n Wnet = :%f Kj/kg\n Efficiency = :%f percent\n SSC = :%f kg/kWH',w_t,w_p,wnet,eff,steam_rate) – The following statements are used to print the values of all parameters with their SI units in the command window. \n is used to take the individual values to the next line so that the values are clearly displayed.

% Vapour Lines

temp = linspace(1,300,100); - Varying the given temperature ranges with 100 equal values in between them.

for i=1:length(temp)

e_l(i)=XSteam('sL_T',temp(i));

e_v(i)=XSteam('sV_T',temp(i));

en_l(i)=XSteam('hL_T',temp(i));

en_v(i)=XSteam('hV_T',temp(i));

end – The for loop is used here in order to extract the values from the ‘XSteam’ function with respect to the varying values of temperature in the main code.

% Plotting the graphs

subplot(1,2,1) – The subplot command is used to obtain multiple plots on the same page. Here, the page is divided into 2 portions and we define the plot for the first portion.

plot([s1,s2,s3,s4,s5,s6,s1],[t1,t2,t3,t4,t5,t5,t1],'b','marker','o')

hold on

plot(e_l,temp,'r')

hold on

plot(e_v,temp,'r')

axis([0 20 1 500])

text(s1,t1,'1')

text(s2,t2,'2')

text(s3,t3,'3','HorizontalAlignment','right')

text(s4,t4,'4','HorizontalAlignment','right')

xlabel('Entropy')

ylabel('Temperature')

title(' T-S graph')– plotting T-S graph

subplot(1,2,2)

plot([s1,s2,s3,s4,s1],[h1,h2,h3,h4,h1],'b','marker','o')

hold on

plot(e_v,en_v,'r')

hold on

plot(e_l,en_l,'r')

axis([0 20 200 5000])

text(s1,h1,'1')

text(s2,h2,'2')

text(s3,h3,'3','HorizontalAlignment','right','VerticalAlignment','top')

text(s4,h4,'4','HorizontalAlignment','right','VerticalAlignment','bottom')

xlabel('Entropy')

ylabel('Enthalpy')

title(' H-S graph') – Plotting H-S graph

ERRORS

The following error appears when the values of temperature are not adequately defined in the T-S graph. The error can be rectified by typing the plot as follows:

plot([s1,s2,s3,s4,s5,s6,s1],[t1,t2,t3,t4,t5,t5,t1],'b','marker','o')

OUTPUTS

CONCLUSION

The efficiency of the given system is 36.167%

The net work done is 1117.865 Kj/kg

CODE

% Rankine Cycle Simulation

fprintf('Rankine Cycle Simulator\n')
fprintf('Process 1-2 Isobaric heat transfer\n')
fprintf('Process 2-3 Isentropic expansion\n')
fprintf('Process 3-4 Isobaric heat rejection\n')
fprintf('Process 4-1 Isentropic compression\n')


% Standard Inputs


p1 = input('Enter the Turbine Inlet Pressure in bar');
t1 = input('Enter Inlet Tepmerature in degree celcius');
p2 = input('Enter Condensor pressure in bar');

% Input Conditions

t = XSteam('Tsat_p',p1);
h1 = XSteam('h_pT',p1,t1);
s1 = XSteam('s_pT',p1,t1);

% Evaluation of individual State Points

p4=p1;
p3=p2;
t3= XSteam('Tsat_p',p3);
h3= XSteam('hL_p',p3);
s3= XSteam('sL_p',p3);
t2=t3;
s2=s1;
sg2 =  XSteam('sV_p',p2);
sf2= XSteam('sL_p',p2);
x2 = (s2-sf2)/(sg2-sf2);
hg2= XSteam('hV_p',p2);
hf2= XSteam('hL_p',p2);
s4=s3;
h2 = hf2+(x2*(hg2-hf2));
h4= XSteam('h_ps',p4,s4);
cp4= XSteam('Cp_ps',p4,s4);
cv4= XSteam('Cv_ps',p4,s4);
g4=cp4/cv4;
a=(g4-1)/g4;
t4=t3*((p4/p3)^a);
s5= XSteam('sL_p',p1);
s6= XSteam('sV_p',p1);
t5= XSteam('Tsat_p',p1);


% Work calculations of Turbine and Pump

w_t=h1-h2;
w_p=h4-h3;

wnet= w_t-w_p;
q=h1-h4;

% Efficiency calculation

eff= (wnet/q)*100;
steam_rate = 3600/(w_t-w_p);


% Output Prints

fprintf('\n RESULT \n')
fprintf('State point 1:\n P1 = :%f Bar\n T1 = : %f Degree Celcius\n H1 = : %f Kj/kg\n S1 = :%f Kj/kgK\n\n',p1,t1,h1,s1)
fprintf('State point 2:\n P2 = :%f Bar\n T2 = : %f Degree Celcius\n H2 = : %f Kj/kg\n S2 = :%f Kj/kgK\n\n',p2,t2,h2,s2)
fprintf('State point 3:\n P3 = :%f Bar\n T3 = : %f Degree Celcius\n H3 = : %f Kj/kg\n S3 = :%f Kj/kgK\n\n',p3,t3,h3,s3)
fprintf('State point 4:\n P4 = :%f Bar\n T4 = : %f Degree Celcius\n H4 = : %f Kj/kg\n S4 = :%f Kj/kgK\n\n',p4,t4,h4,s4)
fprintf('WT = :%f Kj/kg \n WP = :%f Kj/kg\n Wnet = :%f Kj/kg\n Efficiency = :%f percent\n SSC = :%f kg/kWH',w_t,w_p,wnet,eff,steam_rate)


% Vapour Lines

temp = linspace(1,400,2000);
for i=1:length(temp)
  e_l(i)=XSteam('sL_T',temp(i));
  e_v(i)=XSteam('sV_T',temp(i));
  en_l(i)=XSteam('hL_T',temp(i));
  en_v(i)=XSteam('hV_T',temp(i));
end


% Plotting the graphs

subplot(1,2,1)
plot([s1,s2,s3,s4,s5,s6,s1],[t1,t2,t3,t4,t5,t5,t1],'b','marker','o')
hold on
plot(e_l,temp,'r')
hold on
plot(e_v,temp,'r')
axis([0 20 1 500])
text(s1,t1,'1')
text(s2,t2,'2')
text(s3,t3,'3','HorizontalAlignment','right')
text(s4,t4,'4','HorizontalAlignment','right')
xlabel('Entropy')
ylabel('Temperature')
title(' T-S graph')

subplot(1,2,2)
plot([s1,s2,s3,s4,s1],[h1,h2,h3,h4,h1],'b','marker','o')
hold on
plot(e_v,en_v,'r')
hold on
plot(e_l,en_l,'r')
axis([0 20 200 5000])
text(s1,h1,'1')
text(s2,h2,'2')
text(s3,h3,'3','HorizontalAlignment','right','VerticalAlignment','top')
text(s4,h4,'4','HorizontalAlignment','right','VerticalAlignment','bottom')
xlabel('Entropy')
ylabel('Enthalpy')
title(' H-S graph')



  
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.