Challenge

Project 2 - Rankine cycle Simulator

Aim: To create a Rankine Cycle Smulator using Matlab which shows all state conditions and T-S and H-S plots. Introduction: The Rankine cycle is a process widely used by power plants such as coal-fired power plants or nuclear reactors. In this mechanism, a fuel is used to produce heat within a boiler, converting water into steam which then expands through a turbine producing useful work. The steps in the Rankine Cycle are shown:

Pump: Compression of the fluid to high pressure using a pump

Boiler: The compressed fluid is heated to the final temperature therefore, a phase change occurs—from liquid to vapor.

Turbine: Expansion of the vapor in the turbine

Condenser: Condensation of the vapor in the condenser (where the waste heat goes to the final heat sink ).

% Rankine Cycle Simulator
clc
clear all
close all


%Taking inputs for the pressure and temperature at turbine inlet and the pressure of the condensor
P1 = input('Enter the pressure at the turbine inlet(in bar):')
T1 = input('Enter the temperature at the turbine inlet (in degree celcius):')
P2 = input('Enter the condenser pressure(in bar):')


%Inlet
% According to 'XSteam.m' file h1 and s1 will be calculated for state point 1.
tsat=XSteam('Tsat_p',P1);
sF1=XSteam('sL_P',P1);
sG1=XSteam('sV_P',P1);
if T1>tsat
tsup=T1;
h1=XSteam('h_pt',P1,tsup);
s1=XSteam('s_pt',P1,tsup);
else if t1 == tsat;
h1=XSteam('hL_p',P1);
s1=XSteam('sL_p',P1);
else
disp('Enter Temp greater than Tsat')
end
end

%Inlet of the condenser
%The condenser inlet parameters i.e. T2, H2 and S2 were calcuated based upon state 1 parameters and 'XSteam.m' file.
t2=XSteam('Tsat_p',P2);
hf2=XSteam('hL_p',P2);
hg2=XSteam('hV_p',P2);
s2=s1;
sf2=XSteam('sL_P',P2);
sg2=XSteam('sV_P',P2);
x2=(s2-sf2)/(sg2-sf2);
h2=hf2+(x2*(hg2-hf2));


%Exit of condenser 
% Depending upon the  thermodynamic conditions the state parameters at point 3 and 4 are calculated
t3=t2;
p3=P2;
s3=sf2;
h3=hf2;

%Boiler Inlet
p4=P1;
s4=s3;
cp4=XSteam('Cp_ps',p4,s4);
cv4=XSteam('Cv_ps',p4,s4);
gamma=cp4/cv4;
t4=t3*(p4/p3)^((gamma-1)/gamma);
vf=XSteam('vL_p',p3);
wp=vf*(P1-P2)*100;
h4=wp+h3;

% The Work output, work input,heat input, heat output,net work, thermal efficiency, fuel consumed, etc parameters are calculated based upon values at state 1, 2, 3, 4 .
%Work output from turbine
Wt=h1-h2;
%heat input
Qin=h1-h4;
%heat output
Qout=h2-h3;
%net work
wnet=Wt-wp;
%ThermalEfficiency
TE=(wnet/Qin)*100;
%Heat added in the boiler
q_in=h1-h4;
% heat rejected in the condenser
q_out=h2-h3;
%specific fuel consumption
sfc=3600/wnet;


%Plotting the T-S and H-S curve

%T-S diagram
figure(1)
hold on
%plotting saturation lines
temp = linspace(1, 373, 500);
hl=zeros(1,100);
hv=zeros(1,100);
sl=zeros(1,100);
sv=zeros(1,100);
for i = 1 : length(temp)
hl(i) = XSteam('hL_T', temp(i));
hv(i) = XSteam('hV_T', temp(i));
sl(i) = XSteam('sL_T', temp(i));
sv(i) = XSteam('sV_T', temp(i));
end
title('T-S Diagram');
plot(sl, temp, 'k', 'linestyle','-','linewidth', 1.5)
plot(sv, temp, 'k', 'linestyle','-','linewidth', 1.5)
xlabel('Specific Entropy (kJ/kgK)')
ylabel('Temprature (degC)')
title('T-S diagram');
plot([s1 s2 s3 s4 sF1 sG1],[T1 t2 t3 t4 tsat tsat],'color','r','linewidth', 1.5)
text(s1,T1,'1')
text(s2,t2,'2')
text(s3,t3-10,'3')
text(s4,t4+10,'4')
t=linspace(tsat,tsup,1000);
for j =1:length(t)
sp(j) = XSteam('s_pT',P1,t(j));
end
plot(sp,t,'color','r','linewidth', 1.5);
%H-S diagram
figure(2)
hold on
title('H-S diagram');
plot(sl, hl, 'r','linestyle','-', 'linewidth', 1.5)
plot(sv, hv, 'r','linestyle','-', 'linewidth', 1.5)
plot([s1 s2 s3 s4 s1], [h1 h2 h3 h4 h1], 'color', 'black','linewidth', 1.5);
text(s1,h1,'1')
text(s2,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+100,'4')
ylabel('Specific Enthalpy (kJ/kg)')
xlabel('Specific Entropy (kJ/kgK)')
%output
%at state 1
disp('RESULTS');
disp('At State point 1:');
fprintf('P1 is : %.2f Bar',P1);
fprintf('n T1 is : %.2f Deg Celcius',T1);
fprintf('n H1 is : %.2f kJ/kg',h1);
fprintf('n S1 is : %.2f kJ/kgKrn',s1);
%at state 2
disp(' At State point 2:');
fprintf('P2 is : %.2f Bar',P2);
fprintf('n T2 is : %.2f Deg Celcius',t2);
fprintf('n H2 is : %.2f kJ/kg',h2);
fprintf('n S2 is : %.2f kJ/kgKrn',s2);
%at state 3
disp(' At State point 3:');
fprintf('P3 is : %.2f Bar',p3);
fprintf('n T3 is : %.2f Deg Celcius',t3);
fprintf('n H3 is : %.2f kJ/kg',h3);
fprintf('n S3 is : %.2f kJ/kgKrn',s3);
%at state 4
disp('At State point 4:');
fprintf('P4 is : %.2f Bar',p4);
fprintf('n T4 is : %.2f Deg Celcius',t4);
fprintf('n H4 is : %.2f kJ/kg',h4);
fprintf('n S4 is : %.2f kJ/kgKrn',s4);
fprintf('Work output by the Turbine (Wt) is : %.2f kJ/kg',Wt);
fprintf('n Work input by the pump (Wp) is : %.2f kJ/kg',wp);



fprintf('n Net Work is : %.2f kJ/kg',wnet);
fprintf('n Thermodynamic efficiency is : %.2f Percent',TE);
fprintf('n %s Heat input in Boiler:%.2f ',q_in,' KJ/kg');
fprintf('n %s Heat rejected in condenser:%.2f ',q_out,' KJ/kg');
fprintf('n Specific Fuel Consumption is : %.2f kg/kWh',sfc);

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.