Challenge

Project 2 - Rankine cycle Simulator

clear all
close all
clc

disp('               RANKINE CYCLE'); % spsce bar is used to positioning the title
disp('1-2 Isentropic expansion in the turbine');
disp('2-3 Constant pressure heat removal in the condensor');
disp('3-4 Isentropic compression in the pump');
disp('4-1 Constant pressure heat addition in the boiler');


p1= input('Enter turbine pressure in bar:');
t1= input('Enter turbine temperature in degree:');
p2= input('Enter condensor pressure in bar:');

% In Turbine, statepoint 1
s1=XSteam('s_pt',p1,t1)
h1=XSteam('h_pt',p1,t1)

% In condensor, statepoint 2

s2=s1
t2=XSteam('Tsat_p',p2); % tsaturation with help of pressure
sf2=XSteam('sL_p',p2);
sg2=XSteam('sV_p',p2);
hf2=XSteam('hL_p',p2);% enthapy of liquid under pressure
hg2=XSteam('hV_p',p2);
x2=((s2-sf2)/(sg2-sf2));% dryness fraction,usually it value is around 1
h2=hf2+(x2*(hg2-hf2));

% In pump and boiler, statepoints 3&4

p4=p1
p3=5.83 % from the PV diagram p2=p3
t3=XSteam('Tsat_p',p3)
s3=XSteam('sL_p',p3)
s4=s3
h3=XSteam('h_ps',p3,s3)
h4=XSteam('h_ps',p4,s4)
cp4=XSteam('cpL_p',p3)
cv4=XSteam('cvL_p',p3)
gamma=(cp4/cv4)

% to calculate t4
% p4^(1-gamma)*t4^gamma= p3^(1-gamma)*t3^gamma,   its a constant equation

t4=(t3*((p3/p4)^((1-gamma)/gamma)))

% workdone by the turbibe be calculated by

wt= h1-h2 % h1 is after boiler and h2 is after turbine

% Workdone by the pump be calculated by

wp= h4-h3

% Net workdone

w_net= wt-wp

% Heat produced by the boiler

Q_in= h1-h4;

% Heat rejected by the condensor by the process of cooling

Q_out= h2-h3;

% Thermal efficiency

yeta = w_net/Q_in;
Final_Efficiency = yeta*100;

% Back work ratio is the ratio of compressor work to turbine work

Back_workratio=Q_out/wt

% calculation of temperature,entropy and enthapy for liquid and vapour line

t6 = XSteam('Tsat_p',p1)
s5 = XSteam('sL_p',p1)
s6 = XSteam('sV_p',p1)
h5 = XSteam('hL_p',p1)
h6 = XSteam('hV_p',p1)
t5 = t6

% saturation curves generation

t = linspace(1,550,800) % here 550 is standard ideal temp of power plant,we can use t1 also
for i =  1:length(t)

sf(i) = XSteam('sL_T',t(i)) % entropy of fluid 
sg(i) = XSteam('sV_T',t(i)) % entropy of gas
hf(i) = XSteam('hL_T',t(i)) % enthalpy of fluid
hg(i) = XSteam('hV_T',t(i)) % enthapy of gas

end


% plot t-s diagram
figure(1)
hold on
% plots to get the saturation curves
plot(sf,t,'linewidth',2,'r')
plot(sg,t,'linewidth',2,'r')
plot([s1 s2], [t1 t2],'linewidth',3,'k')
plot([s2 s3], [t2 t3],'linewidth',3,'k')
plot([s3 s4], [t3 t4],'linewidth',3,'k')
plot([s4 s5], [t4 t5],'linewidth',3,'k')
plot([s5 s6], [t5 t6],'linewidth',3,'k')
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.