Challenge

Project 2 - Rankine cycle Simulator

clear all 
close all
clc



disp('process1-2 :Isentropic Expansion in the Turbine');
disp('Process 2-3 : Constant Pressure Heat Rejection by the condencer');
disp('process 3-4 :Isentropic Expansion in the Pump');
disp('Process 4-1 : Constant Pressure Heat Addition by the Boiler')

%imput parameters
  t1=400;
  p1= 30;
  p2=0.5;

  % stage 1
  h1=XSteam('h_pt',p1 ,t1);
  s1=XSteam('s_pt',p1,t1);

%stage 2
  s2=s1
  gama= 1.4;
  t2=t1*((p2/p1)^(1-(1/gama)));
  h2=XSteam('h_pt',p2 ,t2);
% stage 3
p3=p2;
s3=XSteam('sl_p',p3);
h3=XSteam('hl_p',p3);

%stage 4
s4=s3;
p4=p1;


%turbine Work

turbine_work= h1-h2;
v3=XSteam('vl_p',p3);

%pump Work
pump_work=v3*(p4-p3)*100;
h4=h3+pump_work;


Net_work= turbine_work-pump_work;
Qin=h1-h4;
Qout=h2-h3;

t3=XSteam('tsat_p',p3);

Cp=XSteam('cp_ps',p4,s4);
Cv=XSteam('cv_ps',p4,s4);

k=Cp/Cv;
t4=t3/((p3/p4)^((k-1)/k));

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;
Thermal_efficiency=(Net_work/Qin)*100;
% back Work ratio
bwr=(h4-h3)/(h2-h1);
temp=linspace(1,375,1000);
for i=1:length(temp)
    sf(i)=XSteam('sl_t',temp(i));
    sg(i)=XSteam('sv_t',temp(i));
    hf(i)=XSteam('hl_t',temp(i));
    hg(i)=XSteam('hv_t',temp(i));
end

%ploting T_S
figure(1)
hold on
plot(sf,temp,'color','r','LineWidth',1,'Color','b');
plot(sg,temp,'color','r','LineWidth',1,'Color','b');
plot([s1 s2],[t1 t2],'color','r','LineWidth',2,'Marker','*')
plot([s2 s3],[t2 t3],'color','r','LineWidth',2,'Marker','*')
plot([s3 s4],[t3 t4],'color','r','LineWidth',2,'Marker','*')
plot([s4 s5],[t4 t5],'color','r','LineWidth',2,'Marker','*')
plot([s5 s6],[t5 t6],'color','r','LineWidth',2,'Marker','*')
plot([s6 s1],[t6 t1],'color','r','LineWidth',2,'Marker','*')
xlabel('Entropy')
ylabel('Temperature in C')
legend('Saturation curve at liquid state','Saturated curve at Vapour state','T_S curve')


%ploting h_S
figure(2)
hold on
plot([sg,sf],[hg hf],'linewidth',1,'color','r','LineWidth',1,'Color','b');
plot([s1 s2],[h1 h2],'color','r','LineWidth',2,'Marker','*')
plot([s2 s3],[h2 h3],'color','r','LineWidth',2,'Marker','*')
plot([s3 s4],[h3 h4],'color','r','LineWidth',2,'Marker','*')
plot([s4 s5],[h4 h5],'color','r','LineWidth',2,'Marker','*')
plot([s5 s6],[h5 h6],'color','r','LineWidth',2,'Marker','*')
plot([s6 s1],[h6 h1],'color','r','LineWidth',2,'Marker','*')
xlabel('Enthalpy')
ylabel('Entropy')
title('Enthalpy vs Entropy plot')
legend('Saturation curve','H_S curve')



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.