Challenge

Project 2 - Rankine cycle Simulator

The following code gives the Ideal Rankine Cycle Simulator

Aim: To create a ideal Rankine Cycle Simulator using OCTAVE/MATLAB.

PLATFORM USED :-

  1. Software – MATLAB R2019a
  2. Programming Language – C/C++

SYSTEM SPECIFICATIONS :-

  1. Manufacturer - DELL
  2. Model – Vostro 3478
  3. Operating System - Windows 10
  4. Processor - Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz 1.80GHz
  5. RAM – 8 GB

OBJECTIVE :-

  1. To plot H-S and T-S diagram of Ideal Rankine Cycle.
  2. Evaluate the Net Work Done and Cycle Efficiency.

THEORY :-

The Rankine cycle is a model used to predict the performance of steam turbine systems. It was also used to study the performance of reciprocating steam engines. The Rankine cycle is an idealized thermodynamic cycle of a heat engine that converts heat into mechanical work while undergoing phase change. It is named after William John Macquorn Rankine, a Scottish polymath and Glasgow University professor.

There are four process in Rankine Cycle,

  1. Process 1-2 : Isentropic Compression in Pump
  2. Process 2-3 : Constant Pressure Heat Addition by the Boiler
  3. Process 3-4 : Isentropic Expansion in Turbine
  4. Process 4-1 : Constant Pressure Heat Rejection by the Condenser

PROCESS 1-2 :-

In this process the water is pumped to the boiler where the entropies remain constant (S1 = S2).

PROCESS 2-3 :-

In this process the boiler heats the pumped water and the state gets converted into steam at constant pressure (P2 = P3).

PROCESS 3-4 :-

In this process the steam gets expanded in the turbine to generate power where the entropies remain constant (S3 = S4).

PROCESS 4-1 :-

In this process the steam gets converted back into water by removing the heat from the steam at constant pressure (P4 = P1).

NOTE :-

Here I had considered that the Ideal Rankine Cycle starts from Turbine and ends in Boiler for easy calculations and plotting graphs. And also the formulae subject to change as the state points vary.

Energy Analysis

All four componenets of the Rankine cycle are steady-state staedy flow devices. The potentia and kinetic energy effects are neglected. The first law per unit mass of steam can be written as:

Pump q=0

W(pump.in)=h2-h1

Boiler w=0 q(in)=h3-h2
Turbine q=0 W(turbine.out)=h3-h4
Condenser w=0 q(out)=h4-h1

Governing Equations

GOVERNING EQUATIONS :-

i.Efficiency of Rankine Cycle,

ƞRank=TWDHeat_SuppliedƞRank=TWDHeat_Supplied

Where,

ii.Work Done by the Turbine,

WTurb=H1–H2WTurb=H1–H2

Where,

iii.Work Done by the Pump,

WPump=H4–H3WPump=H4–H3

Where,

iv.Net Work Done,

TWD=WTurb−WPumpTWD=WTurb-WPump

Where,

v.Heat Supplied,

Qadd=H1–H4Qadd=H1–H4

Where,

vii.Heat Rejected,

Qout=H2–H3Qout=H2–H3

Where,

viii.Back Work Ratio,

BWR=WPumpWTurbBWR=WPumpWTurb

Where,

ix.Specific Steam Consumption,

SSC=3600WTurbSSC=3600WTurb

Where,

Main code

%%A program for simulate Rankine cycle
clear all
close all
clc
fprintf('\n RANKINE CYCLE SIMULATOR');
fprintf('\n\n1-2 Isentropic Expansion in Turbine');
fprintf('\n2-3 Constant Pressure Heat Rejection in the Condenser');
fprintf('\n3-4 Isentropic Compression in the Pump');
fprintf('\n4-1 Constant Pressure Heat Addition by the Boiler\n');
%Inputs
p1=30;('Pressure at the turbine inlet (bar):')
t1=400;('Temperature at the turbine inlet (celcius):')
p2=0.05;('Pressure at the condensor')
% @ stage 1 Turbine Inlet
% p1 & t1 are given
h1=XSteam('h_pT',p1,t1);
s1=XSteam('s_pT',p1,t1);
% @ stage 2 Condenser Inlet
%p2 is given
s2=s1;
sf2=XSteam('sL_p',p2);
sg2=XSteam('sV_p',p2);
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_p',p2);
x2=(s2-sf2)/(sg2-sf2);
h2=hf2+(x2*(hg2-hf2));
% @ stage 3 Pump Inlet
p3=p2;
h3=XSteam('hL_p',p3);
s3=XSteam('sL_p',p3);
t3=XSteam('Tsat_p',p3);
t2=t3;
% @ stage 4 Boiler Inlet
p4=p1;
s4=s3;
h4=XSteam('h_ps',p4,s4);
cp4=XSteam('Cp_ps',p4,s4);
cv4=XSteam('Cv_ps',p4,s4);
lambda=cp4/cv4;
t4=t3/((p3/p4)^((lambda-1)/lambda));
t5=XSteam('Tsat_p',p1);
t6=t5;
s5=XSteam('sL_p',p1);
s6=XSteam('sV_p',p1);
h5=XSteam('hL_p',p1);
h6=XSteam('hV_p',p1);
% Turbine Work
Wt=h1-h2;
% Pump Work
Wp=h4-h3;
% Net Work (kJ/Kg)
W=Wt-Wp;
% Heat in & out of the System
Q_in=h1-h4;
Q_out=h2-h3;
% Thermal Efficiency
ntherm=(W/Q_in)*100;
% Steam rate (kg/kWh)
SSC=3600/W;
% Back Work Ratio
BWR=(h1-h4)/(h2-h3);
% to plot Saturation Curve
T=linspace(1,400,500);
for i=1:length(T)
h_l(i)=XSteam('hL_T',T(i));
h_v(i)=XSteam('hV_T',T(i));
s_l(i)=XSteam('sL_T',T(i));
s_v(i)=XSteam('sV_T',T(i));
end
% plotting TS diagram
figure(1)
hold on
title('T-S Diagram')
plot([s1 s2],[t1 t2],'linewidth',3,'color','b')
plot([s2 s3],[t2 t3],'linewidth',3,'color','b')
plot([s3 s4],[t3 t4],'linewidth',3,'color','b')
plot([s4 s5],[t4 t5],'linewidth',3,'color','b')
plot([s5 s6],[t5 t6],'linewidth',3,'color','b')
xlabel('Entropy (kJ/KgK');
ylabel('Temperature (deg C)');
s_1=linspace(s6,s1,500);
for j=1:length(s_1)'
t_1(j)=XSteam('T_ps',p1,s_1(j));
end
plot(s_1,t_1,'linewidth',3,'color','b')
plot(s_l,T,'linewidth',1.5,'color','r')
plot(s_v,T,'linewidth',1.5,'color','r')
% Annotations
text(s1,t1,'1','fontsize',15);
text(s2,t2,'2','fontsize',15);
text(s3,t3,'3','fontsize',15,'verticalalignment','top');
text(s4,t4,'4','fontsize',15,'verticalalignment','bottom');
text(s5,t5,'5','fontsize',15,'verticalalignment','bottom');
text(s6,t6,'6','fontsize',15,'verticalalignment','bottom');
figure(2)
hold on
title('H-S Diagram');
plot([s1 s2],[h1 h2],'linewidth',2,'color','b')
plot([s2 s3],[h2 h3],'linewidth',2,'color','b')
plot([s3 s4],[h3 h4],'linewidth',2,'color','b')
h_4=linspace(h4,h5,500);
for k=1:length(h_4);
s_4(k)=XSteam('s_ph',p1,h_4(k));
end
h_6=linspace(h6,h1,500);
for m=1:length(h_6);
s_6(m)=XSteam('s_ph',p1,h_6(m));
end
plot(s_4,h_4,'linewidth',2,'color','b')
plot([s5 s6],[h5 h6],'linewidth',2,'color','b')
plot(s_6,h_6,'linewidth',2,'color','b')
xlabel('Specific Entropy (kJ/KgK)');
ylabel('Specific Enthalpy (kJ/Kg)');
plot(s_l,h_l,'linewidth',1.5,'color','r')
plot(s_v,h_v,'linewidth',1.5,'color','r')
% Annotations
text(s1,h1,'1','fontsize',15);
text(s2,h2,'2','fontsize',15);
text(s3,h3,'3','fontsize',15,'verticalalignment','top');
text(s4,h4,'4','fontsize',15,'verticalalignment','bottom');
text(s5,h5,'5','fontsize',15,'verticalalignment','bottom');
text(s6,h6,'6','fontsize',15,'verticalalignment','bottom');
% Results Window
fprintf('\nRESULTS\n\n');
fprintf('At State Point 1 :\n');
fprintf('P1=%f Bar\n',p1);
fprintf('T1=%f Deg Celsius\n',t1);
fprintf('H1=%f kJ/Kg\n',h1);
fprintf('S1=%f kJ/KgK\n\n',s1);
fprintf('At State Point 2 :\n');
fprintf('P2=%f Bar\n',p2);
fprintf('T2=%f Deg Celsius\n',t2);
fprintf('H2=%f kJ/Kg\n',h2);
fprintf('S2=%f kJ/KgK\n\n',s2);
fprintf('At State Point 3 :\n');
fprintf('P3=%f Bar\n',p3);
fprintf('T3=%f Deg Celsius\n',t3);
fprintf('H3=%f kJ/Kg\n',h3);
fprintf('S3=%f kJ/KgK\n\n',s3);
fprintf('At State Point 4 :\n');
fprintf('P4=%f Bar\n',p4);
fprintf('T4=%f Deg Celsius\n',t4);
fprintf('H4=%f kJ/Kg\n',h4);
fprintf('S4=%f kJ/KgK\n\n',s4);
fprintf('Work done by Turbine is : %f kJ/Kg\n',Wt);
fprintf('Work done by Pump is : %f kJ/Kg\n',Wp);
fprintf('Net Work done on the System : %f kJ/Kg\n',W);
fprintf('Specific Steam Consumption is : %f kg/kWh\n',SSC);
fprintf('The Net Thermal Efficiency of the System is : %f\n',ntherm);
fprintf('The BWR of the Rankine Cycle is found to be : %f\n',BWR);

PROGRAM PROCESS :-

  1. The compiler starts the program.
  2. The Rankine Cycle process chart is printed
  3. The values of P1,T1 and P2 are obtained from the user.
  4. Next the H1 and S1 for state point 1 are calculated.
  5. Then H2,T2 and S2 for state point 2 are calculated.
  6. Next P3,T3,H3 and S3 for state point 3 are calculated.
  7. Next P4,T4,H4 and S4 for state point 4 are calculated
  8. Next T5,T6,S5 and S6 values are calculated.
  9. Turbine and Pump work done are evaluated.
  10. Net work done is evaluated.
  11. Heat added and rejected are evaluated.
  12. Thermal Efficiency, back work ratio and specific steam consumption are evaluated.
  13. Next the values of S, T, P and H are displayed for all the four state points.
  14. Also, the Rankine Cycle parameters are displayed in the command window.
  15. Next the H-S and T-S diagram are plotted.
  16. The compiler terminates the program.

Step-wise explanation:

Function X-steam is used, which is the steam table

  • Clearing the command window, workspace, and closing all plots
  • Print description of all processes in the command window.
  • Give the required inputs p1, T1, and p2.
  • Defining the specific heat(Cp) for values for liquid and vapour using the Xsteam function (steam table).
  • Defining the saturation temperature Tsat using Xsteam.
  • Defining saturation properties specific Enthalpy an Entropy at states 1, 2, 3, 4 using the Xsteam function and required inputs.
  • Starting with the calculation of properties at states 1, 2, 3, 4 using Xstaem and required inputs.
  • Calculate enthalpies H1, H2, H3, H4 at states 1, 2, 3, 4 using Xsteam.
  • Calculate entropies S1, S2, S3, S4 at states 1, 2, 3, 4.
  • Calculate the values of T2, T3, and Wp(pump work), to calculate H and S at different states.
  • Now define a range of temperature using the linspace command required to plot the graph.
  • Now define the values of enthalpy and entropy of liquid and vapour lines.
  • Now coming to plotting, start with the T-S diagram plot all the property lines
  • Plot the H-S diagram.
  • Then calculate net work done, thermal efficiency, and SSC.

Results from Command Window

Results from Workspace

Errors faced

  • The error will arise if we do not properly define the correct variables while giving the input.

This can be corrected by properly defining the input variable.

Plots are attached below (by running the rankine cycle simulator)

Results

Specific enthalpy and entropy values are calculated for different states and T-S and H-S diagrams are plotted

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.