Challenge

Project 2 - Rankine cycle Simulator

%Rankine Cycle

%sTeam condiTion At The inleT of Turbine
% consider pressure in bar 
% Where, p1=p4, p2=p3
close all
clear all
clc

% To displying
disp('RANKINE CYCLE SIMULAtOR')
disp('1-2 is isentropic expansion in Turbine')
disp('2-3 is constant pressure heat rejection in condenser')
disp('3-4 is isentropic compression in pump')
disp('4-1 is constant pressure heat addition in boiler')

%Obtaining the input data
p1=input('enter the pressure at the inlet of Turbine (in bar)= ');
T1=input('enter the Temp at the inlet of Turbine (in degree C)= ');
p2=input('enter the pressure at The inlet of condenser (in bar)= ');
%p1=30;  % given
%p2=0.05; %given
%p3=0.05; %p1=p4; p2=p3
%p4=30;
%T1=400;

% Finding The required dAta using The XSteam Table 
%At point 1
h1= XSteam('h_pT',p1,T1);
s1= XSteam('s_pT',p1,T1);

%At point 2
h2=XSteam('hV_p',p2);
s2=s1;

%At point 3
p3=p2;
T3=XSteam('TsAt_p',p3);
T2=T3;
h3=XSteam('hL_p',p3);
s3=XSteam('sL_p',p3);

%At point 4
s4=s3;
p4=p1;
h4=XSteam('hL_p',p4);
Cp4=XSteam('Cp_ps', p4, s4);
Cv4=XSteam('Cv_ps', p4, s4);
k=Cp4/Cv4;
T4=T3/((p3/p4)^((k-1)/k));
vf=XSteam('vL_p',p3)
%Pump work
Wp= vf*(p1-p2)*100

%At point 
p5=p4;
h5=XSteam('hL_p', p5);
s5=XSteam('sL_p', p5);
T5=XSteam('TsAt_p', p1);

%At point 6
p6=p5;
T6=T5;
h6=XSteam('hV_p',p6);
s6=XSteam('sV_p',p6);

%HeAt supplied 
Qs=h1-h4;

%HeAt rejecTed 
Qr=h2-h3;

%Workdone by Turbine

WT=h1-h2;


%NeT workdone
Wnet= WT-Wp;

%Back Work RAtio
Bw_rAtio = Wp/WT;

%Efficiency 
eff= (Wnet/Qs)*100;

%Specific sTeam consumpTion
%SSC = mass flow rAte/power
SSC = (3600/Wnet);

%plotTing The sAturAtion curve
T= linspace(1,375,1000);
for i=1:length(T)
    sf(i)=XSteam('sL_T',T(i));
    sg(i)=XSteam('sV_T',T(i));
    hf(i)=XSteam('hL_T',T(i));
    hg(i)=XSteam('hV_T',T(i));
    
end

%plotTing The T vs s
figure(1)
hold on
plot(sf, T, 'r')
plot(sg, T, 'r')
plot([s1 s2], [T1 T2], 'b', 'linewidTh', 3)
plot([s2 s3], [T2 T3], 'b', 'linewidTh', 3)
plot([s3 s4], [T3 T4], 'b', 'linewidTh', 3)
plot([s4 s5], [T4 T5], 'b', 'linewidTh', 3)
plot([s5 s6], [T5 T6], 'b', 'linewidTh', 3)
plot([s6 s1], [T6 T1], 'b', 'linewidTh', 3)
title('T-s Diagram')
xlabel('EnTropy')
ylabel('TemperAture')
text(s1+0.1,T1,'1')
text(s2+0.1,T2,'2')
text(s3,T3-20,'3')
text(s4,T4+20,'4')
title('EnTROPY, S (KJ/kgk)')
title('T-s Diagram)')
legend('SAturAtion curve','locAtion','norThwesT')

%plotTing The h vs s
figure(2)
hold on
plot(sf, hf, 'r')
plot(sg, hg, 'r')
plot([s1 s2], [h1 h2], 'b', 'linewidTh', 3)
plot([s2 s3], [h2 h3], 'b', 'linewidTh', 3)
plot([s3 s4], [h3 h4], 'b', 'linewidTh', 3)
plot([s4 s5], [h4 h5], 'b', 'linewidTh', 3)
plot([s5 s6], [h5 h6], 'b', 'linewidTh', 3)
plot([s6 s1], [h6 h1], 'b', 'linewidTh', 3)
title('h-s Diagram')
xlabel('EnTropy')
ylabel('EnThalpy')
text(s1+0.1,h1,'1')
text(s2+0.1,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+200,'4')
title('EnTROPY, S (KJ/kgk)')
title('h-s Diagram')
legend('SAturAtion curve','locAtion','norThwesT')
%%
% Displaying ResulTs
disp('RESULTS');
fprintf('At state point 1:\n');
fprintf('p1:%8.3f bar\n',p1);
fprintf('T1:%8.3f C\n',T1);
fprintf('h1:%8.3f KJ/kg\n',h1);
fprintf('s1:%8.3f KJ/kgK\n',s1);

fprintf('At state point 2:\n');
fprintf('p2:%8.3f bar\n',p2);
fprintf('T2:%8.3f C\n',T2);
fprintf('h2:%8.3f KJ/kg\n',h2);
fprintf('s2:%8.3f KJ/kgK\n',s2);


fprintf('At state point 3:n');
fprintf('p3:%8.3f barn',p3);
fprintf('T3:%8.3f Kn',T3);
fprintf('h3:%8.3f KJ/kgn',h3);
fprintf('s3:%8.3f KJ/kgKnn',s3);

fprintf('At state point 4:\n');
fprintf('p4:%8.3f bar\n',p4);
fprintf('T4:%8.3f K\n',T4);
fprintf('h4:%8.3f KJ/kg\n',h4);
fprintf('s4:%8.3f KJ/kgK\n',s4);

fprintf('At state point 5:\n');
fprintf('p5:%8.3f bar\n',p5);
fprintf('T5:%8.3f K\n',T5);
fprintf('h5:%8.3f KJ/kg\n',h5);
fprintf('s5:%8.3f KJ/kgK\n',s5);

fprintf('At state point 6:\n');
fprintf('p6:%8.3f bar\n',p6);
fprintf('T6:%8.3f K\n',T6);
fprintf('h6:%8.3f KJ/kg\n',h6);
fprintf('s6:%8.3f KJ/kgK\n',s6);

fprintf('Turbine Work:%8.3f kJ/kg\n',WT);
fprintf('Pump Work:%8.3f kJ/kg\n',Wp);
fprintf('Wnet:%8.3f kJ/kg\n',Wnet);
fprintf('Efficiency:%8.3f PercenT \n',eff);
fprintf('S.S.C: %8.3f kJ/kWh\n',SSC)







Exipilination :


              This is rankine cycle it has four process those are.

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. 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 enthalpy–entropy chart (h–s chart, or Mollier diagram), or numerically, using steam tables or software. 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. Process 3-4 is isentropic expansion.

Process 4–1: The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid. Process 4-1 is constant pressure heat rejection in condenser.


* XStrem data are used to extract steam and water properties of enthalpy,entropy at a specific temperature and pressure at sat liquid and sat vapour conditions etc.

* The program requires the input of pressure at sate point1,Temperature at same point and Temperature at condenser inlet.

* With the help on these inputs and XStrem data the program calculates all the state points of the cycle.

* In XSteam data there are sf and sg,hf and hg where s and f stands for saturated liquid and saturated vapour.

* The net work,work done by turbine,work done to run the pump,heat in and heat out are calculated by standard thermodynamic relation.

*Efficiency and Specific stam consumption(s.s.c) of Rankine cycle is caliculated.

*T,s and h are extracted at vapour and liquid line for ploting purpose.

*Saturation curve is ploted in Red for saturated liquid and saturated gas.

*Plot f T vs h and h vs s are created from  all points obtained from  the program.

*Results are displayed in the command window.
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.