Challenge

Project 2 - Rankine cycle Simulator

OUTPUT in COMMAND WINDOW

RANKINE CYCLE

1-2 reversible adiabatic / isentropic expansion (turbine)
2-3 constant pressure heat addition (condensor)
3-4 reversible adiabtaic / isentropic compression (pump)
4-1 Constant pressure heat rejection (Boiler)

input parameteers
 presssure at inlet to turbine =30

 Temperature at inlet to turbine =400

 presssure at inlet to pump =0.05


Net Work done = 2.640738e+03

Back work ration =1.138889e-03

RESULTS

properties at state 1
Temperatuer = 400
pressure 30
Enthalpy = 3.231571e+03
entropy =6.923259e+00

properties at state 2
Temperatuer = 1.392937e+02
pressure 5.000000e-02
Enthalpy = 5.878220e+02
entropy =6.923259e+00

properties at state 3
Temperatuer = 3.289558e+01
pressure 5.000000e-02
Enthalpy = 1.377651e+02
entropy =4.762538e-01

properties at state 4
Temperatuer = 3.296388e+01
pressure 30
Enthalpy = 1.407761e+02
entropy =4.762538e-01>> 

OUTPUT images were attached to the report!

clc 
clear all
%rankine cycle consists of 
% 1-2 reversible adiabatic / isentropic expansion (turbine)
% 2-3 constant pressure heat addition (condensor)
% 3-4 reversible adiabtaic / isentropic compression (pump)
% 4-1 Constant pressure heat rejection (Boiler)
% we know the inital pressure and temperature and also condensor pressure
fprintf('RANKINE CYCLE')
fprintf('\n\n1-2 reversible adiabatic / isentropic expansion (turbine)')
fprintf('\n2-3 constant pressure heat addition (condensor)')
fprintf('\n3-4 reversible adiabtaic / isentropic compression (pump)')
fprintf('\n4-1 Constant pressure heat rejection (Boiler)')
fprintf('\n\ninput parameteers')

%command “input” will ask data from user
p1=input('\n presssure at inlet to turbine =');
t1=input('\n Temperature at inlet to turbine =');
p3=input('\n presssure at inlet to pump =');

%units of pressure is bar. P1 and P4 are same( cause const pressure heat addition) 
%as we already know Temperature units are degree Centigrade
 %P2 and P3 are same (due to constant pressure heat rejection)

%now we find the enthalpy and entropy at state 1 from XSteam function
h1=XSteam('h_pT',p1,t1);
s1=XSteam('s_pT',p1,t1);

%as state 1 and state 2 have same entropy (isentropic expansion)
s2=s1;
% now we need to find dryness fraction at state 2
%at first find entropy at staurated liquid and saturated vapour at condensor
%pressure

sg2=XSteam('sV_p',p3);
sl2=XSteam('sL_p',p3);

%dryness fractrion x

x=(sg2-s2)/(sg2-sl2);

%enthaply at saturated Liquid and Saturated Vapour at condensor pressure
%to find enthalpy at state 2 we use Hl and Hg and x
%h2=hl+x(hg-hf)

hg2=XSteam('hV_p',p3);
hl2=XSteam('hL_p',p3);

h2=hl2+(x*(hg2-hl2));

%state 3 entropy and enthalpy are equal to saturated liquid entropy and
%enthalpy

h3=hl2;
s3=sl2;
%entropy at 3 and 4 are same
s4=s3;

%state 4 can be found by taking reversible work W=-vdp by equating thsi to W=h4-h3;
%where v=specific volume at saturated liquid 
v=XSteam('vL_p',p3);

Wc=-v*(p3-p1)*100; %as pressures are in bar to convert to Kpa multiplied with 100
h4=h3+Wc; %as it water the specific volume will be low, so enthalpy at 3 and 4 will be almost same

%work done by turbine
Wt=h1-h2;

%heat supplied 
Qs=h1-h4;

%heat rejection
Qr=h2-h3;

Wnet=Wt-Wc; %net work done = turbine work - compressor work
%back work ration = ratio of compressor work to turbine work
Bw=Wc/Wt;

fprintf('\n\nNet Work done = %d',Wnet)

fprintf('\n\nBack work ration =%d',Bw)

%in rankine cycle though the steam is at high temperature, we cannot
%consider super heated vapour as an ideal gas due to high pressures.
% so we cannot apply ideal gas equations in Rankine cycle 
%so we use XSteam function to find temperatures at all locations

p4=p1;
p2=p3;

t2=XSteam('T_ph',p1,h2);
t4=XSteam('T_ph',p1,h4);
t3=XSteam('T_ph',p2,h3);

%saturated enthalpy, entropy and temperatures at p1 which gives the
%values on saturated line 
%for plotting horizontal line inside wet region
t5=XSteam('Tsat_p',p1);
t6=t5;
h5=XSteam('hL_p',p1);
h6=XSteam('hV_p',p1);
s5=XSteam('sL_p',p1);
s6=XSteam('sV_p',p1);

%%
%//plot T-S diagram//
figure (1)
hold on %hold on is to draw all the plots in single graph
plot(s1,t1,'Marker','*')
plot(s2,t2,'Marker','*')
plot(s3,t3,'Marker','*')
plot(s4,t4,'Marker','*')
plot(s5,t5,"Marker","*") %if marker is mentioned in double quotes,
% then symbol also to be mentioned in same quotes
plot(s6,t6,'Marker','*')
plot([s1 s2],[t1 t2],'color','r','LineStyle','-')
plot([s2 s3],[t2 t3], 'color','r','LineStyle','-')
plot( [s3 s4],[t3 t4],'color','r','LineStyle','-')
plot([s4 s5],[t4 t5], 'color','r','LineStyle','-')
plot( [s5 s6],[t5 t6],'color','r','LineStyle','-')
plot([s6 s1],[t6 t1], 'color','r','LineStyle','-')

xlabel('entropy (S)');
ylabel('Temperature (T)');
title('T-S diagram of rankine cycle')

%%
%//plot H-S diagram//
figure (2)
hold on %hold on is to draw all the plots in single graph
plot(s1,h1,'Marker','*')
plot(s2,h2,'Marker','*')
plot(s3,h3,'Marker','*')
plot(s4,h4,'Marker','*')

plot([s1 s2],[h1 h2],'color','r','LineStyle','-')
plot([s2 s3],[h2 h3], 'color','r','LineStyle','-')
plot( [s3 s4],[h3 h4],'color','r','LineStyle','-')
plot([s4 s1],[h4 h1], 'color','r','LineStyle','-')


xlabel('entropy (S)');
ylabel('Enthalpy (h)');
title('H-S diagram of rankine cycle')

%%
%//plot log(P)-H diagram//
figure (3)
hold on
plot(h1,log(p1),'Marker','o')
plot(h2,log(p2),'Marker','o')
plot(h3,log(p3),'Marker','o')
plot(h4,log(p4),'Marker','o')

plot([h1 h2], [log(p1) log(p2)],'color','b','LineStyle','--')
plot([h2 h3], [log(p2) log(p3)],'color','b','LineStyle','--')
plot([h3 h4], [log(p3) log(p4)],'color','b','LineStyle','--')
plot([h4 h1], [log(p4) log(p1)],'color','b','LineStyle','--')

xlabel('enthlpy (h)');
ylabel('pressure (log(p)');
title('log(p)-h diagram of rankine cycle')
hold off 

%%
% //Properties at diffferent states//
%to use for loop for displaying the resultst or properties at each state
%i took all the pressures, temperatures, entropy and enthalpies as an
%array
T=[t1 t2 t3 t4];
P=[p1 p2 p3 p4];
H=[h1 h2 h3 h4];
S=[s1 s2 s3 s4];

fprintf('\n\nRESULTS')
for i=1:4
fprintf('\n\nproperties at state %d',i)
fprintf('\nTemperatuer = %d',T(i))
fprintf('\npressure %d',P(i))
fprintf('\nEnthalpy = %d',H(i))
fprintf('\nentropy =%d',S(i))
end
%for loop is to print the results


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.