Challenge

Project 2 - Rankine cycle Simulator

|| BASIC RANKINE CYCLE SIMULATOR ||

OBJECTIVE :

To make a simple Rankine Cycle Simulator which would calculate the state points and plot T-S and H-S diagram based on user input.

INTRODUCTION :

The Rankine cycle is the fundamental operating cycle of all power plants where an operating fluid is continuously evaporated and condensed.

The Rankine cycle operates in the following steps:

  • 2-3 Isobaric Heat Transfer. High pressure liquid enters the boiler from the feed pump (1) and is heated to the saturation temperature (2). Further addition of energy causes evaporation of the liquid until it is fully converted to saturated steam (3).

  • 3-4 Isentropic Expansion. The vapor is expanded in the turbine, thus producing work which may be converted to electricity. In practice, the expansion is limited by the temperature of the cooling medium and by the erosion of the turbine blades by liquid entrainment in the vapor stream as the process moves further into the two-phase region. Exit vapor qualities should be greater than 90%.

  • 4-1 Isobaric Heat Rejection. The vapor-liquid mixture leaving the turbine (4) is condensed at low pressure, usually in a surface condenser using cooling water. In well designed and maintained condensers, the pressure of the vapor is well below atmospheric pressure, approaching the saturation pressure of the operating fluid at the cooling water temperature.

  • 1-2 Isentropic Compression. The pressure of the condensate is raised in the feed pump. Because of the low specific volume of liquids, the pump work is relatively small and often neglected in thermodynamic calculations.

MAIN CODE :

%=========================SIMULATION OF A BASIC RANKINE CYCLE================================%
clc
close all
clear all

%=====INPUT PARAMETERS=====%
P1 = input('Enter the pressure at the inlet of the turbine (in bars): ');
T1 = input('Enter the temperature at the inlet of the turbine (in degree celsius): ');
P2 = input('Enter the pressure at the turbine outlet or condenser inlet (on bars): ');
t = linspace(0,380,200);
disp(' ')

%=====CALCULATING AND DISPLAYING THE VALUES OF P, T, H AND S FOR EACH STATES USING 'XSTEAM' LIBRARY=====%
%At state 1:
h1 = XSteam('h_pT',P1,T1);
s1 = XSteam('s_pT',P1,T1);

%At State 2:
s2 = s1;
h2 =  XSteam('h_ps',P2,s2);        
T2 = XSteam('T_ps',P2,s2);      
Tsat2 = XSteam('Tsat_p',P2);

%At State 3:
T3 = Tsat2;
P3 = P2;
h3 = XSteam('hL_p',P3);
s3 = XSteam('sL_p',P3);


%At State 4:
s4 = s3;
P4 = P1;
h4 = XSteam('h_ps',P4,s4);
T4 = XSteam('T_ps',P4,s4);

% Work done by turbine
W_turbine = h1 - h2;

% Work done by pump
W_pump = h4 - h3;

% Net work dome
W_net = W_turbine - W_pump;

% Thermal efficiency
therm_eff = (1 - ((h2 - h3)/(h1 - h4)))*100;

% Back work ratio
back_wr = W_pump/W_turbine;

% Specific Steam Consumption
ssc = 3600/W_turbine;

%===Plotting T-s graph===%
figure(1), clf
hold on
% Saturation curve
for i = 1:length(t)
  plot(XSteam('sL_T',t(i)),t(i),'g.','markersize',10)
  plot(XSteam('sV_T',t(i)),t(i),'g.','markersize',10)
end
% Cycle
if s2 <= XSteam('sV_p',P2)
  plot([s1 s2 s3 s4],[T1 T2 T3 T4],'linewidth',3)
  text(s1,T1,'1','FontSize',15)
  text(s2,T2,'2','FontSize',15)
  text(s3,T3,'3','FontSize',15)
  text(s4,T4,'4','FontSize',15)
  n = linspace(T1,T3,500);
  for i = 1:length(n)
    plot(XSteam('s_pT',P1,n(i)),n(i),'b.','markersize',10)
  end
  plot([XSteam('sL_p',P1) XSteam('sV_p',P1)],[XSteam('Tsat_P',P1) XSteam('Tsat_P',P1)],'linewidth',3,'color','b')
else
  plot([s1 s2],[T1 T2],'linewidth',3)
  q = linspace(Tsat2,T2,100);
  for i = 1:length(q)
    plot(XSteam('s_pT',P2,q(i)),q(i),'b.','markersize',10)
  end
  plot([XSteam('sV_p',P2) s3 s4],[Tsat2 T3 T4],'linewidth',3,'color','b')
  text(s1,T1,'1','FontSize',15)
  text(s2,T2,'2','FontSize',15)
  text(s3,T3,'3','FontSize',15)
  text(s4,T4,'4','FontSize',15)
  n = linspace(T1,T3,300);
  for i = 1:length(n)
    plot(XSteam('s_pT',P1,n(i)),n(i),'b.','markersize',10)
  end
  plot([XSteam('sL_p',P1) XSteam('sV_p',P1)],[XSteam('Tsat_P',P1) XSteam('Tsat_P',P1)],'linewidth',3,'color','b')
end
xlabel('Entropy(kJ/kg-K)')
ylabel('Temperature(k)')
title('T-s graph')

%===Plotting h-s graph===%
figure(2), clf
hold on
%Saturation Curve
for i = 1:length(t)
  plot(XSteam('sL_T',t(i)),XSteam('hL_T',t(i)),'r.','markersize',10)
  plot(XSteam('sV_T',t(i)),XSteam('hV_T',t(i)),'r.','markersize',10)
endfor
%cycle
if s2 <= XSteam('sV_p',P2)
  plot([s1 s2 s3 s4],[h1 h2 h3 h4],'linewidth',3)
  text(s1,h1,'1','FontSize',15)
  text(s2,h2,'2','FontSize',15)
  text(s3,h3,'3','FontSize',15)
  text(s4,h4,'4','FontSize',15)
  k = linspace(h4,h1,500);
  for i = 1:length(k)
    plot(XSteam('s_ph',P1,k(i)),k(i),'b.','markersize',10)
  endfor
else
  plot([s1 s2],[h1 h2],'linewidth',3)
  c = linspace(h2,XSteam('hV_p',P2),100);
  for i = 1:length(c)
    plot(XSteam('s_ph',P2,c(i)),c(i),'b.','markersize',10)
  end
  plot([XSteam('sV_p',P2) s3 s4],[XSteam('hV_p',P2) h3 h4],'linewidth',3,'color','b')
  text(s1,T1,'1','FontSize',15)
  text(s2,T2,'2','FontSize',15)
  text(s3,T3,'3','FontSize',15)
  text(s4,T4,'4','FontSize',15)
  k = linspace(h4,h1,500);
  for i = 1:length(k)
    plot(XSteam('s_ph',P1,k(i)),k(i),'b.','markersize',10)
  endfor
endif
xlabel('Entropy(kJ/kg-K)')
ylabel('Enthalpy(kJ/kg)')
title('h-s graph')

%AT STATE POINT 1:
disp('At state point 1: ')
fprintf('P1 = %.2f bar\n',P1)
fprintf(['T1 = %.2f C\n'],T1)
fprintf('h1 = %.2f kJ/kg\n',h1)
fprintf('s1 = %.2f kJ/kgK\n',s1)
disp(' ')

%AT STATE POINT 2:

disp('At state point 2: ')
fprintf('P2 = %.2f bar \n',P2)
fprintf(['T2 = %.2f C \n'],T2)
fprintf('h2 = %.2f kJ/kg \n',h2)
fprintf('s2 = %.2f kJ/kgK \n',s2)
disp(' ')


%AT STATE POINT 3:

disp('At state point 3: ')
fprintf('P3 = %.2f bar \n',P3)
fprintf(['T3 = %.2f C\n'],T3)
fprintf('h3 = %.2f kJ/kg \n',h3)
fprintf('s3 = %.2f kJ/kgK \n',s3)
disp(' ')


%AT STATE POINT 4:

disp('At state point 4: ')
fprintf('P4 = %.2f bar \n',P4)
fprintf(['T4 = %.2f C \n'],T4)
fprintf('h4 = %.2f kJ/kg \n',h4)
fprintf('s4 = %.2f kJ/k33gK \n',s4)
disp(' ')


fprintf('Work done by turbine = %.2f kJ/kg \n', W_turbine)
fprintf('Work done by pump = %.2f kJ/kg \n', W_pump)
fprintf('Net work done = %.2f kJ/kg \n', W_net)
fprintf('Thermal efficiency = %.2f %% \n', therm_eff)
fprintf('Back-work ratio = %f \n', back_wr)
fprintf('Specific Steam Conductivity = %.2f kg/kWh \n',ssc)

STEP-WISE EXPLANATION OF THE PROGRAM :

  • The programme starts with 'clc', 'close all' and 'clear all'. 'clc' command is used to clear the command window. 'close all' command closes all the plots and figures which are opened in different windows of MATLAB and 'clear all' command clears all the variables stored in the workplace.
  • Then, input are defined which are to be asked to the user.
  • And, An array of Temeperature are made using linspace command.
  • Using the provided "XSteam" library the values of various physical parameters like Enthalpy and Entropy are calculated at different state points.
  • After that some basic formulas are used to caluclate Turbine Work, Pump Work, etc.
  • After that, Temperature-Entropy diagram is plotted with reference to the inputs using 'XSteam' Library.
  • Similarly, Enthaply- Entropy diagram is plotted.
  • Finally, 'fprintf' and 'disp' commands are used to display the required outputs.

SAMPLE INPUT :

P1 = 30 bars

T1 = 400 C

P2 = 0.05 bars

OUTPUT :

References :

======================Thankyou=====================

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.