Challenge

Project 2 - Rankine cycle Simulator

AIM: To Create a Rankine Cycle Simulator using MATLAB.

OBJECTIVE:

  • To write a code to calculate the state points of the Rankine Cycle (any type of your choice) based on user inputs.
  • To plot the corresponding T-s and h-s plots for the given set of inputs

INTRODUCTION:

Rankine cycle is nothing but a modified form of Carnot cycle. Actually Carnot cycle is father of all thermodynamic cycles because it can give maximum efficiency for a certain working temperature limit. But since practically it is not possible to build it so engineers/scientists modified it in different ways so that it can work in real life situations. But obliviously it will no longer be a Carnot cycle after modification rather it will be new cycle.

The components of simple Rankine cycle are -

  1. Boiler
  2. Steam Turbine
  3. Condenser
  4. Pump

Apart form above 4, various equipment's like Superheater, Economiser, Air preheater, Steam Separator etc are used.

The simple Rankine cycle consists of 4 processes.

  • 1-2 : Isentropic Expansion in the turbine
  • 2-3 : Isobaric Heat Rejection by the condenser
  • 3-4 : Isentropic Compression in the pump
  • 4-1 : Isobaric Heat Addition by the boiler

First water is converted to steam in Boiler which gives very high pressure and temperature steam. This steam is expanded in a steam turbine (The steam runs the turbine) which in turn rotates generator. The steam, after expansion, comes out of turbine and passes through condenser. Work of condenser is to remove out the Latent heat of vaporisation so that steam will convert into water. This water is now pumped back to boiler where it is heated again further process are repeated.

EQUATIONS:

  • Turbine work (Wt) =H1-H2
  • Pump work (Wp) =H4-H3;
  • Heat addition (Qin) =H1-H4;
  • Heat removal (Qout) =H2-H3;
  • Net work done (Wnet) =Wt-Wp;
  • Efficiency (Ntherm) = (Wnet/Q_in)*100;
  • Specific steam consumption (S.S.C) =3600/Wnet;
  • Back work ratio (BWR) =Wp/Wt;

BODY OF THE CONTENT:

Code for Rankine cycle:

clear all
close all
clc

%Displaying the cycles 
fprintf('%60s', 'RANKINE CYCLE SIMULATOR' );

fprintf('\n');
disp('1-2 is Isentropic Expansion in the Turbine');
disp('2-3 is const Pressure Heat Rejection by the Condenser');
disp('3-4 is Isentropic Compression in the pump');
disp('4-1 is const Pressure Heat Addition by  the Boiler');
fprintf('\n');



%Inputs to get from user
P1=input('Enter the Pressure at the Turbine Inlet (in bar):  ');
T1=input('Enter the Temperature at the Turbine Inlet (in Degree celcius):  ');
P2=input('Enter the pressure at the Condenser (in bar):  ');

%State point 1

H1 = XSteam('h_pt',P1,T1);
S1 = XSteam('s_pt',P1,T1);
hf1 = XSteam('hL_p',P1);
hg1 = XSteam('hV_p',P1);
sf1 = XSteam('sL_p',P1);
sg1 = XSteam('sV_p',P1);
Tsat1 = XSteam('Tsat_p',P1);

fprintf('%40s\n', 'RESULTS' );
disp('At state point 1: ');
fprintf('P1= %f Bar \n',P1);
fprintf('T1 is : %f Deg Celcius \n',T1);
fprintf('H1 is : %f KJ/kg \n',H1);
fprintf('S1 is : %f KJ/kgk \n',S1);


%state point 2
S2=S1;
sf2=XSteam('sL_p',P2);
sg2=XSteam('sV_p',P2);
X2=(S2-sf2)/(sg2-sf2);
hf2=XSteam('hL_p',P2);
hg2=XSteam('hV_p',P2);
H2=hf2+X2*(hg2-hf2);
T2=XSteam('T_ph',P2,H2);
Tsat2=XSteam('Tsat_p',P2);



fprintf('\n');
disp('At state point 2: ');
fprintf('P2= %f Bar \n',P2);
fprintf('T2 is : %f Deg Celcius \n',Tsat2);
fprintf('H2 is : %f KJ/kg \n',H2);
fprintf('S2 is : %f KJ/kgk \n',S2);
fprintf('X2 is : %f \n',X2);

%state point 3
H3=hf2;
S3=sf2;
T3=Tsat2;
P3=P2;

fprintf('\n');
disp('At state point 3: ');
fprintf('P3= %f Bar \n',P3);
fprintf('T3 is : %f Deg Celcius \n',T3);
fprintf('H3 is : %f KJ/kg \n',H3);
fprintf('S3 is : %f KJ/kgk \n',S3);


%state point 4
P4=P1;
S4=S3;
H4=XSteam('h_ps',P4,S4);
CP4=XSteam('CP_PS',P4,S4);
CV4=XSteam('CV_PS',P4,S4);
g4=CP4/CV4;
O=(g4-1)/g4;
T4=T3*((P4/P3)^O);

fprintf('\n');
disp('At state point 4: ');
fprintf('P4= %f Bar \n',P4);
fprintf('T4 is : %f Deg Celcius \n',T4);
fprintf('H4 is : %f KJ/kg \n',H4);
fprintf('S4 is : %f KJ/kgk \n',S4);

%PLOTTING
%Plotting T-s diagram
figure(1)
hold on

%Plot saturation curve
t= linspace(0,373,500);
for i=1:length(t)
    plot(XSteam('sL_T',t(i)),t(i),'color','g');
    plot(XSteam('sV_T',t(i)),t(i),'color','g');
    
end

%joining state points
plot([S1 S2],[T1 T2],'linewidth',2,'color','b')
text(S1,T1,'1')
if X2>1
    T3=Tsat2;
    plot([S2 sg2 S3 S4],[T2 Tsat2 T3 T4],'linewidth',2,'color','b');
    
    T2=Tsat2;
else
    plot([S2 S3 S4],[T2 T3 T4],'linewidth',2,'color', 'b');
end
text(S2,T2,'2')
    text(S3,T3,'3')
    text(S4,T4+10,'4')

plot([S3 S4], [T3 T4], 'linewidth', 2,'color','b')
plot([S4 sf1], [T4 Tsat1], 'linewidth', 2,'color','b')
plot([sf1 sg1], [Tsat1 Tsat1], 'linewidth', 2,'color','b')
plot([sg1 S1], [Tsat1 T1], 'linewidth', 2,'color','b')

xlabel('Entropy(KJ/Kg-K)')
ylabel('Temperature(K)')
title('T-s graph')


%Plotting H-S diagram
figure(2)
hold on;
%plotting saturation curve
for i=1:length(t)
    plot(XSteam('sL_T',t(i)),XSteam('hL_T',t(i)),'color','g');
    plot(XSteam('sV_T',t(i)),XSteam('hV_T',t(i)),'color','g');
    
end

%joining points
plot([S1 S2 S3 S4 S1],[H1 H2 H3 H4 H1],'linewidth',2,'color','r');
 text(S1,H1,'1')
  text(S2,H2,'2')
   text(S3,H3,'3')
    text(S4,H4+90,'4')
 
xlabel('Entropy (KJ/C.kg)');
ylabel('Enthalpy (kJ/Kg)');
title('H-S diagram')



%turbine  work calculation
Wt=H1-H2;
%pump work calculation
Wp=H4-H3;
%heat addition
Q_in=H1-H4;
%Heat removal
Q_out=H2-H3;
%net work done
Wnet=Wt-Wp;
%Efficiency
Ntherm=(Wnet/Q_in)*100;
%specific steam consumption
S.S.C=3600/Wnet;
%back work ratio
BWR=Wp/Wt;

%diplaying results
fprintf('\n')
fprintf('Wt is : %f KJ/Kg \n',Wt);
fprintf('Wp is : %f KJ/Kg \n',Wp);
fprintf('Wnet is : %f KJ/Kg \n',Wnet);
fprintf('Ntherm is : %f Percent \n',Ntherm);
fprintf('S.S.C is : %f Kg/KWh \n',S.S.C);
fprintf('Back work ratio is : %f \n',BWR);



Explanation of code:

  • So the first thing is to write a command to display the various outputs as shown in the output section of the challenge, so for that we use ‘disp( )’ command.
  • Then we need to get the inputs from the user and so we use ‘input ( )’ command to get the different inputs.
  • Then we further to get the values for H ,S ,hf ,sf ,sg and Tsat at various state points we use the XSteam and the command for XSteam helps to extract different values.
  • Then we print the values that we get using the ‘fprintf’ command.
  • Then after getting values at all state points we start plotting, here we first start with plotting the saturation curve for T-s using the plot command and then we again use the plot command to join the different points that we have got for different states.
  • Further we use the similar procedure to plot the H-S diagram as well.
  • Then further we use commands to calculate Turbine work ,Pump work ,Heat addition ,Heat removal ,Net work done ,Efficiency, Specific steam consumption ,Back work ratio
  • Then finally we use the ‘fprintf’ command to print all the calculated values.

ERRORS:

  • Apart from some minor typing errors there were no major errors.

OUTPUTS:

  • T-s plot
  • h-s plot

Outputs on command window:

So from the above outputs ,

Wt is : 1120.862815 KJ/Kg
Wp is : 2.997107 KJ/Kg
Wnet is : 1117.865709 KJ/Kg
Ntherm is : 36.167417 Percent
S.S.C is : 3.220423 Kg/KWh
Back work ratio is : 0.00267

CONCLUSION:

Thus we were able to to calculate the state points of the Rankine Cycle based on user inputs and plot the corresponding T-s and h-s plots.

REFERNCES:

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.