Project

Rankine Cycle Simuator

AIM

To create a Rankine Cycle using matlab

THEORY

To create a rankine cycle in matlab I use the basic formula and method used in thermodynamics in rankine cycle.Using the method, I tried to find out all the enthalpies and entropies at every points to get the required work output like pump work and turbine work and also to find out efficiency of rankine cycle.

OBJECTIVE

To find out net work output and efficiency of rankine cycle under given pressures and temperature and draw its TS and HS diagram.

BODY

Main Code

Terminology used:

p-presssure

h-enthalpy

s-entropy

t-temperature

x2-dryneess factor

sf-entropy at saturated fluid

sg-entropy at saturated gas

Rbw-back work ratio

Wp=pump work

Wt-turbine work

clc;
clear all;
close all;

fprintf('     RANKINE CYCLE SIMULATOR\n');
fprintf('1-2 is Isentropic expansion in Turbine\n');
fprintf('2-3 is Constant pressure heat rejection in condenser\n');
fprintf('3-4 is Isentropic compression in a pump\n');
fprintf('4-1 is Constant pressure heat addition by Boiler\n');

%Input variables

p1=input('enter the pressure at turbine inlet(in bar): ');
t1=input('enter the temperature at turbine inlet(in deg Celcius): ');
p2=input('enter the pressure at condenser inlet(in bar): ');


%At State point 1

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

%At State point 2

s2=s1;
sf=XSteam('sL_p',p2);
sg=XSteam('sV_p',p2);
sfg=sg-sf;
x2=(s2-sf)/sfg;

hf=XSteam('hL_p',p2);
hg=XSteam('hV_p',p2);
hfg=hg-hf;
h2=hf+x2*hfg;

%State point 3

p3=p2;
s3=sf;
h3=hf;
v3=XSteam('vL_p',p3);
t3=XSteam('T_hs',h3,s3);
t2=t3;

%State point 4

p4=p1;
s4=s3;
wp=v3*(p4-p3);
Wp=wp*100;
h4=Wp+h3;
Cp4=XSteam('Cp_ps',p4,s4);
Cv4=XSteam('Cv_ps',p4,s4);
g4=Cp4/Cv4;
c=(g4-1)/g4;
t4=t3*((p4/p3)^c);

%Work, Efficiency..

Wt=h1-h2;
Wnet=Wt-Wp;
Qin=h1-h4;
Efficiency=(Wnet/Qin)*100;
Rbw=Wp/Wt;

% for constant pressure heat addition line i.e 4-5-6-1 line

s5=XSteam('sL_p',p1);
s6=XSteam('sV_p',p1);
t5=XSteam('T_ps',p1,s5);
t6=XSteam('T_ps',p1,s6);

p=[p1 p2 p3 p4];
s=[s1 s2 s3 s4];
h=[h1 h2 h3 h4];
t=[t1 t2 t3 t4];

%Result

fprintf('     Results\n');
for i=1:4
   fprintf('At State point %i\n',i);
   fprintf('P%i is: %.2fbar\n',i,p(i));
   fprintf('S%i is: %.2fKJ/KgK\n',i,s(i));
   fprintf('H%i is: %.2fKJ/Kg\n',i,h(i));
   fprintf('T%i is: %.2fdeg Celcius\n',i,t(i));
   fprintf('\n')
end

%for saturation line
temp=linspace(1,400,600);
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

%plot for T-S diagram

hold on
plot(SL,temp,'--b','linewidth',2)
plot(SV,temp,'--b','linewidth',2)
plot([s1 s2],[t1 t2],'r','linewidth',2)
text(s1,t1,'1')
plot([s2 s3],[t2 t3],'r','linewidth',2)
text(s2,t2,'2')
plot([s3 s4],[t3 t4],'r','linewidth',2)
text(s3,t3,'3')
plot([s4 s5],[t4 t5],'r','linewidth',2)
text(s4,t4,'4')
plot([s5 s6],[t5 t6],'r','linewidth',2)
text(s5,t5,'5')
plot([s6 s1],[t6 t1],'r','linewidth',2)
text(s6,t6,'6')
xlabel('Entropy');
ylabel('Temperature');
title('T-S diagram of Rankine Cycle')

%plot of H-S diagram

figure(2)
hold on
plot(SL,HL,'--b','linewidth',2)
plot(SV,HV,'--b','linewidth',2)
plot([s1 s2],[h1 h2],'r','linewidth',2)
text(s1,h1,'1')
plot([s2 s3],[h2 h3],'r','linewidth',2)
text(s2,h2,'2')
plot([s3 s4],[h3 h4],'r','linewidth',2)
text(s3,h3,'3')
plot([s4 s1],[h4 h1],'r','linewidth',2)
text(s4,h4,'\rightarrow 4')
xlabel('Entropy');
ylabel('Enthalpy');
title('H-S diagram of Rankine Cycle')

EXPLANATION

After taking input as pressure and temperature at first point, I use the XSteam function to find out enthalpy and entropy at 1st point. At second point First usig entropy I find out dryness factor and then I use this factor to get enthalpy at that point.At point 3,since it lies on the saturated line I use the XSteam function to determine entropy and enthalpy and temperature at the point. Similarly I use adiabatic formula to get temp. at point 4.

After finding all the points , I use the enthalpies to find out heat input, pump work and turbine work.In the plotting, I use for loop to create saturated lines and also to print the values of every quantity at every point.

OUTPUT

Command window output

T-S plot

H-S plot

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.