Challenge

Project 2 - Rankine cycle Simulator

AIM: Create a Rankine Cycle Simulator using OCTAVE/MATLAB.

OBJECTIVE:

  • calculate the state points of the Rankine Cycle (any type of your choice) based on user inputs.
  • plot the corresponding T-s and h-s plots for the given set of inputs.
  • Net work output
  • Back work ratio

INTRODUCTION:

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 a phase change. Reference (en.wikipedia.org)

There are four processes in the Rankine cycle. Reference (en.wikipedia.org)

  • Process 1-2 is [Isentropic compression]: 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.
  • Process 2-3 is [Constant pressure heat addition in boiler]: 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. The input energy required can be easily calculated graphically, using an enthalpy–entropy chart (h–s chart, or Mollier diagram), or numerically, using steam tables.
  • Process 3-4 is [Isentropic expansion]: The dry saturated vapour expands through a turbine, generating power. This decreases the temperature and pressure of the vapour, and some condensation may occur. The output in this process can be easily calculated using the chart or tables noted above.
  • Process 4-1 is [Constant pressure heat rejection in condenser]: The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid.

FORMULA:

In general, the efficiency of a simple Rankine cycle can be written as

When dealing with the efficiencies of the turbines and pumps, an adjustment to the work terms must be made:

Where

Heat flow rate to or from the system (energy per unit time)
Mass flow rate (mass per unit time)
Mechanical power consumed by or provided to the system (energy per unit time)
Thermodynamic efficiency of the process (net power output per heat input, dimensionless)
Isentropic efficiency of the compression (feed pump) and expansion (turbine) processes, dimensionless
The "specific enthalpies" at indicated points on the T–s diagram
The final "specific enthalpy" of the fluid if the turbine were isentropic
The pressures before and after the compression process

Reference (en.wikipedia.org)

GIVEN DATA:

Turbine Inlet temperature = 400° C

Turbine Inlet Pressure = 30 bars

Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure

The link for the standard Xsteam library to get the steam table data for water is given below. It must be used to calculate the points in between the state variables.

Click here to download the Xsteam Library.

CODING SECTION:

%Rankine Cycle Simulator
clear all
close all
clc
 
disp(' RANKINE CYCLE '); % Displaying
disp('1-2 is Isentropic Expansion in the turbine');
disp('2-3 is constant pressure heat removal in the condenser');
disp('3-4 is Isentropic compression in the pump');
disp('4-1 is Constant pressure heat addition in the boiler');
 
% input data
p1 = input('nValue of pressure at turbine inlet, p1(in bar) = ');
T1 = input('nValue of temperature at turbine inlet, T1(in degree.C) = ');
p2 = input('nValue of temperature at condenser inlet, p2(in bar) = ');
 
% defining variables
% State 1
h1 = XSteam('h_pT', p1, T1); % extracting enthalpy at state pt 1
s1 = XSteam('s_pT', p1, T1); % similarly
% State 2
s2 = s1; % Isentropic expansion
sf2= XSteam('sL_p', p2); % Saturated liquid Entropy
sg2 = XSteam('sV_p', p2); % Saturated Vapour Entropy
x2 = (s2-sf2)/(sg2-sf2);
hf2 = XSteam('hL_p', p2);
hg2 = XSteam('hV_p', p2);
h2 = hf2 + (x2*(hg2-hf2));
% State 3
p3 = p2; % Constant pressure Heat rejection in condenser
s3= XSteam('sL_p', p3);
h3 = XSteam('hL_p', p3);
% State 4
s4 = s3;
p4 = p1;
 
% Work done by turbine
Wt = h1 - h2;
% pump work
v3 = XSteam('vL_p', p3);
Wp = v3*(p4 - p3)*100;
h4 = h3 + Wp;
%Net work
Wnet = Wt - Wp;
%Heat in the system
Qin = h1 - h4;
%Heat out of the system
Qout = h2 - h3;
%Thermal efficiency
eff = (Wnet/Qin)*100;
%Specific Steam Consumption
%SSC = mass flow rate/power
SSC = (3600/Wnet);
 
%Calculation temperatures at the state points
T3 = XSteam('Tsat_p', p3);
T2 = T3;
Cp4 = XSteam('Cp_ps', p4, s4);
Cv4 = XSteam('Cv_ps', p4, s4);
k = Cp4/Cv4;
T4 = T3/((p3/p4)^((k-1)/k));
%Calculating temperature, entropy and enthalpy at the vapour and liquid
%line for plots
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;
 
%Plot the saturation curve
T = linspace(1,375,1000);
for i = 1:length(T)
sf(i) = XSteam('sL_T', T(i));
sg(i) = XSteam('sV_T', T(i));
hf(i) = XSteam('hL_T', T(i));
hg(i) = XSteam('hV_T', T(i));
end
%Plot T-s diagram
figure(1)
hold on
plot(sf, T, 'g','linewidth',1)
plot(sg, T, 'g','linewidth',1)
plot([s1 s2], [T1 T2], 'm', 'linewidth', 2)
plot([s2 s3], [T2 T3] ,'m', 'linewidth', 2)
plot([s3 s4], [T3 T4], 'm', 'linewidth', 2)
plot([s4 s5], [T4 T5], 'm', 'linewidth', 2)
plot([s5 s6], [T5 T6], 'm', 'linewidth', 2)
sc1 = linspace(s6, s1, 1000);
for l = 1:length(sc1)
 Tc1(l) = XSteam('T_ps', p1, sc1(l));
end
plot(sc1, Tc1, 'm', 'linewidth', 2)
text(s1+0.1, T1, '1')
text(s2+0.1, T2, '2')
text(s3, T3-20, '3')
text(s4, T4+20, '4')
title('Temp(T) vs Entropy(s) plot')
xlabel('Entropy(S) [Kj/kgk]')
ylabel('Temperature [degree C] ')
legend('Sat','location','northwest')

%Plot h-s diagram
figure(2)
hold on
plot(sf, hf, 'g', 'linewidth', 1)
plot(sg, hg, 'g', 'linewidth', 1)
plot([s1 s2], [h1 h2], 'm', 'linewidth', 2)
plot([s2 s3], [h2 h3], 'm', 'linewidth', 2)
plot([s3 s4], [h3 h4], 'm', 'linewidth', 2)
hc = linspace(h4, h5, 100);
for k = 1:length(hc)
sch(k) = XSteam('s_ph', p1, hc(k));
end
plot(sch,hc, 'm', 'linewidth', 2)
plot([s5 s6], [h5 h6], 'm', 'linewidth', 2)
for m = 1:length(sc1)
hc1(m) = XSteam('h_ps', p1, sc1(m));
end
plot(sc1, hc1, 'm', 'linewidth', 2)
text(s1+0.1, h1, '1')
text(s2+0.1, h2, '2')
text(s3, h3-100, '3')
text(s4, h4 +200, '4')
title('Enthalpy vs Entropy plot')
xlabel('Entropy(S),[KJ/kgk] ')
ylabel('Enthalpy(H),[KJ/kg]')
legend('Saturation curve','location','southeast')
 
%Results output
fprintf('%40s \n \n \n','RESULT');
fprintf('%10s %54s \n','At State Point 1','At State Point 2');
fprintf('%s %.2f%s %44s %.2f%s \n','P1:',p1,' bar','P2:',p2,' bar');
fprintf('%s %.2f%s %35s %.2f%s \n','T1:',T1,' Deg Celcius','T2:',T2,' Deg Celcius');
fprintf('%s %.2f%s %40s %.2f%s \n','H1:',h1,' KJ/kg','H2:',h2,' KJ/kg');
fprintf('%s %.2f%s %42s %.2f%s \n','S1:',s1,' KJ/kgK','S2:',s2,' KJ/kgK');
fprintf('%58s %.2f \n \n','X2:',x2);
fprintf('%10s %54s \n','At State Point 3','At State Point 4');
fprintf('%s %.2f%s %45s %.2f%s \n','P3:',p3,' bar','P4:',p4,' bar');
fprintf('%s %.2f%s %35s %.2f%s \n','T3:',T3,' Deg Celcius','T4:',T4,' Deg Celcius');
fprintf('%s %.2f%s %41s %.2f%s \n','H3:',h3,' KJ/kg','H4:',h4,' KJ/kg');
fprintf('%s %.2f%s %42s %.2f%s \n \n','S3:',s3,' KJ/kgK','S4:',s4,' KJ/kgK');
fprintf('%40s %.2f %s \n','Work output by Turbine(Wt): ',Wt,' KJ/kg');
fprintf('%40s %.2f %s \n','Work input by Pump(Wp): ',Wp,' KJ/kg');
fprintf('%40s %.2f %s \n','Net Work(Wnet): ',Wnet,' KJ/kg');
fprintf('%40s %.2f %s \n','Efficiency: ',eff,'Percent');
 

OUTPUT:

ERRORS:

Error-1-This type of error comes because I forget the underscore '_'

Error-2:- it is also a silly mistake because I forgot to put a small bracket '()' in the formula

References:

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.