Challenge

Project 2 - Rankine cycle Simulator

                                                                                      RANKINE CYCLE

Rankine cycle is the most used thermodyanmic cycle in power industries which utilise steam to drive steam turbine and convert the mechan ical enrgy of steam in to electrical energy in generator.

 The rankine cycle consists of the followign processes:

1. isentriopic expansion in turbine. (1-2)

2.isobaric heat rejection in condensor(2-3)

3.isentropic compression in Condensate and feedwater pumps,

4.Heat addition in steam generator.

CODE:

%function definition
function y=rankine(IP,IT,CP)
p=linspace(0.03,250,3000);
%using XSteam to get the sATURATION CURVE
for i=1:length(p)
    pall=p(i);
t(i)=XSteam('Tsat_p',pall);
sl(i)=XSteam('sL_p',pall);
sv(i)=XSteam('sV_p',pall);
vl(i)=XSteam('vL_p',pall);
vv(i)=XSteam('vV_p',pall);
hl(i)=XSteam('hL_p',pall);
hv(i)=XSteam('hV_p',pall);
end

%point 1
t1=IT;
p1=IP;
d1=XSteam('rho_PT',p1,t1);
h1=XSteam('h_pT',p1,t1);
s1=XSteam('s_pT',p1,t1);
v1=XSteam('v_pT',p1,t1);
text(s1,t1,'point1');
%point 2
s2=s1;
p2=CP;
t2=XSteam('T_ps',p2,s2);
tsat2=XSteam('Tsat_p',p2);
vl2=XSteam('vL_p',p2);
vv2=XSteam('vV_p',p2);
text(s2,t2,'point2');
h2=XSteam('h_ps',p2,s2);
hl2=XSteam('hL_p',p2);
hv2=XSteam('hV_p',p2);
dryness=(h2-hl2)/(hv2-hl2)
v2=vl2+dryness*(vv2-vl2);
string=sprintf('dryness is %f',dryness)

%point 3
p3=p2;
t3=XSteam('Tsat_p',p3);
h3=XSteam('hL_p',p3);
s3=XSteam('sL_p',p3);
v3=XSteam('vL_p',p3);
%point 4
p4=p1;
s4=s3;
t4=XSteam('T_ps',p4,s4);
h4=XSteam('h_ps',p4,s4);
v4=XSteam('v_pT',p4,t4);

%point 5
p5=p4;
v5=XSteam('vL_p',p4);
h5=XSteam('hL_p',p4);
t5=XSteam('Tsat_p',p4);
s5=XSteam('sL_p',p4);
%point 6
p6=p4;
v6=XSteam('vV_p',p4);
h6=XSteam('hV_p',p4);
t6=XSteam('Tsat_p',p4);
s6=XSteam('sV_p',p4);

%PLOTTING THE ts DIAGRAM
figure(1)
plot(sl,t,'color','b')
hold on
plot(sv,t,'color','r')
axis([0 10 0 500]);
plot([s1 s2 s3 s4 ],[t1 t2 t3 t4]);
s45=linspace(s4,s5,100);
for i=1:length(s45)
    t45(i)=XSteam('T_ps',p4,s45(i));
end
plot(s45,t45);
s56=linspace(s6,s1,100);
for i=1:length(s56)
    t56(i)=XSteam('T_ps',p4,s56(i));
end
plot(s56,t56);
plot([s5 s6],[t5 t6]);
text(s2,t2,string);
xlabel('entropy')
ylabel('temperature')
title('T-S diagram') 
text(s1,t1,'point 1')
text(s2,t2,'point 2')
text(s3,t3,'point 3')
text(s4,t4,'point 4')
text(s5,t5,'point 5')
text(s6,t6,'point 6')

%PLOTIING THE HS DIAGRAM'
figure(2)
plot(sl,hl,'color','b')
hold on
plot(sv,hv,'color','r')
plot([s1 s2 s3 s4 ],[h1 h2 h3 h4]);
s45=linspace(s4,s5,100);
for i=1:length(s45)
    h45(i)=XSteam('h_ps',p4,s45(i));
end
plot(s45,h45);
s56=linspace(s6,s1,100);
for i=1:length(s56)
    h56(i)=XSteam('h_ps',p4,s56(i));
end
plot(s56,h56);
plot([s5 s6],[h5 h6]);

xlabel('entropy')
ylabel('temperature')
title('enthalpy vs entropy diagram')
text(s1,h1,'point 1')
text(s2,h2,'point 2')
text(s3,h3,'point 3')
text(s4,h4,'point 4')
text(s5,h5,'point 5')
text(s6,h6,'point 6')


% displaying the workdone and the efficiency
sprintf('workdone=%f',h1-h2)
sprintf('efficiency=%f',(h1-h2)/(h1-h4))

In the above code state points are fetched using the XSteam library offered by skill lync. Each state can be easily found out using state relation ships. In isentropic expansion entropy remains constant at point 1 and 2.How ever the dryness fraction changes.In isobaric heat rejection pressure remainsconstant across condensation.Isentropic pumping process entropy is same .Finally in steam generator it is isobaricheat adition.

Dryness fraction can be found out using the relationship:

x=xl +dryness*(xg-xl);

Finally the work done in expansion process is  h2-h3;

the efficiency is work done /heat added

efficiency = h2-h3/(h1-4);

RESULTS:

The results are obtained and plotted below.

The program also displays out the work done by the rankine cycle and the fiiciency

 ERROR:

Following error popped up because of spelling error usinf Xsteam for XSteam

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.