Challenge

Project 2 - Rankine cycle Simulator

AIM- Rankine cycle simulator which takes 3 inputs and gives all the state point, amount of heat added, amount of heat rejected, work done by pump and work done by the turbine. Also, calculate thermal efficiency and back work ratio.

INTRODUCTION- The Rankine cycle is the 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.

Steps of Rankine cycle-

Step 1: Isentropic compression (Process 3-4).

The working fluid is pumped from low to high pressure. As the fluid is a liquid at this stage, the pump requires little input energy.

Wpump = h4-h3

Step 2: Constant pressure heat addition in the boiler (Process 4-1).

The high-pressure liquid enters a boiler, where it is heated at constant pressure by an external heat source to become a dry saturated vapour.

Qin=h1-h4

Step 3: Isentropic expansion (Process 1-2).

The dry saturated Vapour expands through a turbine, generating power. This decreases the temperature and pressure of the vapour, and some condensation may occur.

Wturbine = h1-h2

Step 4: Constant pressure heat rejection in a condenser (Process 2-3).

The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid.

Qout = h2-h3

The thermal efficiency of the cycle-

NThermal = (Wturbine – Wpump)/Qin

Back work ratio-

BWR= Wpump/Wturbine

Main Code-

clear all
close all
clc
fprintf( '            Rankine Cycle Simulator \n')
fprintf('1-2 is Isentropic expansion in the Turbine \n')
fprintf('2-3 is Isobaric Heat Rejection by the condenser \n')
fprintf('3-4 is Isentropic compression in the Pump \n')
fprintf('4-1 is Isobaric heat Addition By the Boiler \n')

 %Input
  p1=input('Enter the Pressure at turbine inlet ( in bar): ');
  T1=input('Enter the temperature at turbine inlet(in degree celcius): ');
  p2=input('Enter the pressure at condenser inlet(in bar): ');
  fprintf('           RESULTS \n')
 
 %getting cp and cv calues for liquid and vapour
%for vapour
high_cpV=XSteam('CpV_p',p1);         %Cp value at point 1
low_cpV= XSteam('CpV_P',p2);         %Cp value at point 2
high_cvV=XSteam('CvV_p',p1);         %Cv value at point 1
low_cvVcpV= XSteam('CvV_p',p2);       %Cv value at point 2

%for liquid
high_cpL=XSteam('CpL_p',p1);         %Cp value at point 1
low_cpL= XSteam('CpL_P',p2);         %Cp value at point 2
high_cvL=XSteam('CvL_p',p1);         %Cv value at point 1
low_cvL= XSteam('CvL_p',p2);         %Cv value at point 2
 
 %state point 1
  fprintf('At State Point 1 \n')
 fprintf('T1 is : %f deg celcius \n' , T1) 
 fprintf('p1 is : %f bar \n',p1)
 T1s=XSteam('Tsat_p',p1);
 sg1=XSteam('sV_p',p1);
 sf1=XSteam('sL_p',p1);
 h1= XSteam('h_pT',p1,T1);      %enthalpy at point 1
 fprintf('h1 is : %f KJ/Kg \n', h1)
 s1=XSteam('s_pT',p1,T1) ;      %entropy at turbine inlet
 fprintf('s1 is : %f KJ/KgK \n',s1)
 %state point 2
 fprintf('At State Point 2 \n')
 T2s=XSteam('Tsat_p',p2);    %temperature at turbine exit
 
 s2=s1;                         %entropy at turbine exit
 fprintf('s2 is : %f KJ/KgK \n',s2)
 sf2=XSteam('sL_p',p2);
 sg2=XSteam('sV_p',p2);
 hf2=XSteam('hL_p',p2);
 hg2=XSteam('hV_p',p2);
 if(s2<=sg2)
   
    x2=((s1-sf2)/(sg2-sf2));
  else
    x2=1;
 end
fprintf('x2 is : %f \n',x2)
 if (x2<1)
 
 T2=T2s;     
else
 %for T2 s2=s2g+low_cpV*(log(T2/T2s))
 T2= (T2s+273)*(exp((s2-sg2)/low_cpV));
 T2=T2-273;
 end
fprintf('T2 is : %f deg celcius \n',T2)      %temperature at state point 2

if(x2<1)
h2=hf2+x2*(hg2-hf2);
else
h2= hg2+low_cpV*(T2s-T2);
end
fprintf('h2 is %f KJ/Kg \n',h2)           %enthalpy at state point 2

%state point 3
fprintf('At State Point 3 \n')
T3=T2s;
fprintf('T3 is : %f deg celcius \n',T3)    %temperature at state point 3
p3=p2;
fprintf('p3 is : %f bar \n',p3)            %pressure at state point 3
s3=XSteam('sL_p',p3);
fprintf('s3 is : %f KJ/KgK \n',s3)         %specific entropy at state point 3
h3=XSteam('hL_p',p3);
fprintf('h3 is : %f KJ/Kg \n',h3)          %enthalpy at point 3
v3=XSteam('vL_p',p3);

%state point 4
fprintf('At State Point 4 \n')
s4=s3;
fprintf('s4 is : %f  KJ/KgK \n',s4)     %entropy at state point 4
p4=p1;
fprintf('p4 is : %f bar \n',p4)         %pressure at state point 4
Wp= v3*(p4-p3)*100;         %workdone by pump
h4 =h3+Wp;
fprintf('h4 is %f KJ/Kg \n',h4)        %enthalpy at point 4
%for T4  s3=sf1-high_cpL*log(T1s/T4)
sf1=XSteam('sL_p',p1);
T4= (T1s+273)/exp((sf1-s3)/high_cpL);
T4=T4-273;
fprintf('T4 is : %f K \n',T4)      %temperature at state point 4

%values of heat in and heat output
Qin = h1-h4          % heat added in boiler
Qout = h2-h3         %heat rejected in condensor

%values of work done by the turbine and pump
Wp=h4-h3;      %work done by pump
Wt= h1-h2;     %work generated by turbine
fprintf('Wt is : %f KJ/Kg \n',Wt)
fprintf('Wp is : %f KJ/Kg \n',Wp)

%Net Work output
Wnet = Wt-Wp;
fprintf('Wnet is : %f  KJ/Kg \n',Wnet)   %net work output

%Thermal efficiency
Ntherm=Wnet/Qin;         %thermal efficiency of cycle
fprintf('Ntherm is : %f \n',Ntherm)

%back work ratio
BWR= Wp/Wt

%work ratio
WR = 1-BWR

%specific steam consumption
S.S.C = 3600/Wt;
fprintf('S.S.C is : %f kJ/KWh \n',S.S.C)

%plotting Liquid and Vapour line 
Temp = linspace(0,373,1000);       
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

figure(1) %T-S diagram
hold on
plot([s1 s2],[T1 T2],'color','b');
text(s1,T1,'1')
plot([s2 sg2],[T2 T2s],'color','b');
text(s2,T2,'2')
plot([sg2 s3],[T2s T3],'color','b');
text(sg2,T2s,'2S')
plot([s3 s4],[T3 T4],'color','b');
text(s3,T3,'3')
plot([s4 sf1],[T4 T1s],'color','b');
text(s4,T4,'4')
plot([sf1 sg1],[T1s T1s],'color','b');
text(sf1,T1s,'4S')
plot([sg1 s1],[T1s T1],'color','b');
text(sg1,T1s,'1S')
plot(SL,Temp ,'color','r','linewidth',1.5);
plot(SV,Temp ,'color','r','linewidth',1.5);
title('T-S Diagram','FontSize',10)
xlabel('Specific Entropy(KJ/KgK)')
ylabel('Temperature(in deg celcius)')
figure(2) %H-S diagram
hold on 
plot([s1 s2],[h1 h2] ,'color','b','linewidth',1);
text(s1,h1,'1')
plot([s2 s3],[h2 h3] ,'color','b','linewidth',1);
text(s2,h2,'2')
plot([s3 s4],[h3 h4] ,'color','b','linewidth',1);
text(s3,h3,'3')
plot([s4 s1],[h4 h1] ,'color','b','linewidth',1);
text(s4,h4,'4')
plot(SL,HL ,'color','r','linewidth',1.5);
plot(SV,HV ,'color','r','linewidth',1.5);
title('H-S Diagram','FontSize',10)
xlabel('Specific Entropy(KJ/KgK)')
ylabel('Specific Enthalpy(KJ/Kg)')
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.