Challenge

Project 2 - Rankine cycle Simulator

Aim: - To solve a Rankine cycle simulator using MATLAB.

Objective:-

  • To calculate the state point of the rankine cycle based on user input.
  • Plotting the corresponding T-s and h-s plot for the given set of input.

Theory:-

The Rankine cycle or Rankine Vapour 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.

The Rankine cycle makes practical use of the increase in pressure that occurs when a condensed fluid is forced to evaporate within a contained vessel. The cycle begins when a fluid, such as water, is compressed and put under high pressure. When the liquid is heated, the compressed fluid becomes a vapour that can be used to generate mechanical energy. When the heat is reduced, the vapour cools and condenses back to liquid form. The cycle then begins again.

The process of an Ideal Rankine Cycle:

  • 1-2 = Isentropic Compression in a pump.
    Here the working fluid is pumped from low to high pressure.
  • 2-3 = Constant Pressure Heat addition in the boiler.
    In this process, the high-pressure liquid is added to the boiler and heated at constant pressure to become a dry saturated vapour.
  • 3-4 = Isentropic expansion in a turbine.
    The dry saturated vapour expands through the turbine resulting in the generation of power.
  • 4-1 = constant Pressure heat rejection in a condenser.
    Wet vapour is condensed at a constant pressure to become a saturated liquid.

Given Data:

Turbine Inlet Temperature = 400 deg C

Turbine Inlet Pressure = 30 bars

Turbine Outlet Pressure = 0.05 bar = Condenser inlet pressure

Main Code:

clear all
close all
clc

fprintf('SIMULATOR OF RANKINE CYCLE \n')
fprintf('1-2 Isentropic expansion in the turbine \n')
fprintf('2-3 constant pressure heat rejection by the condenser \n')
fprintf('3-4 isentropic compression in the pump \n')
fprintf('4-1 constant pressure heat addition by the boiler \n')

% Inputs
p1 = input('enter the pressure at the turbine inlet(in bar):');
t1 = input('enter the temperature at the turbine inlet(in degree celsius):');
p2 = input('enter the pressure at the condenser(in bar):');
disp('results:')

% Getting cp & cv values from xsteam
% For vapour
high_cpV = XSteam('CpV_p',p1);
low_cpV = XSteam('CpV_p',p2);
high_cvV = XSteam('CvV_p',p1);
low_cvV = XSteam('CvV_p',p2);
%for liquid
high_cpL = XSteam('cpL_p',p1);
low_cpL = XSteam('cpL_p',p2);
high_cvL = XSteam('cvL_p',p1);
low_cvL = XSteam('cvL_p',p2);

% Getting important parameters from XSteam
% For high pressure
t1s = XSteam('tsat_p',p1);
s1g = XSteam('sV_p',p1);
s1f = XSteam('sL_p',p1);
s1fg = s1g-s1f;
h1f = XSteam('hL_p',p1);
h1g = XSteam('hV_p',p1);
h1fg = h1g-h1f;

% For low pressure
s2g = XSteam('sV_p',p2);
s2f = XSteam('sL_p',p2);
s2fg = s2g-s2f;
t2s = XSteam('tsat_p',p2);
h2f = XSteam('hL_p',p2);
h2g = XSteam('hV_p',p2);
h2fg = h2g-h2f;

% State point 1
disp('At State Point 1:')
fprintf('p1 is :%f bar \n',p1)
fprintf('t1 is :%f deg celsius',t1)
h1 = XSteam('h_pt',p1,t1);
fprintf('h1 is :%f kJ/kg \n',h1)
s1 = XSteam('s_pt',p1,t1);
fprintf('s1 is :%f kJ/kg \n',s1)

% State point 2
disp('At State Point 2:')
fprintf('p2 is :%f bar \n',p2)
s2 = s1;
fprintf('s2 is :%f kJ/kgk \n',s2)

% predicting location of point 2 in T-S
if(s2<=s2g)
    x2=(s2-s2f)/(s2fg);
else
    x2 = 1;
end
fprintf('x2 is :%f \n',x2)
% calculating t2
if(x2<1)
    t2 = t2s;
else
    % t2 calculate by s2=s2g+low_cpV*(log(t2/t2s))
    t2 = (t2s+273.15)*exp((s2-s2g)/low_cpV);
    t2 = t2-273.15;
end
fprintf('t2 is : %f deg celsius \n',t2)
if(x2<1)
    h2 = h2f+x2*h2fg;
else
    h2 = h2g+low_cpV*(t2-t2s);
end
fprintf('h2 is : %f kJ/kg \n',h2)

% State point 3
disp('At State Point 3:')
p3 = p2;
fprintf('p3 is : %f bar \n',p3)
v3=XSteam('vL_p',p3);
t3 = t2s;
fprintf('t3 is : %f deg celsius \n', t3)
h3 = h2f;
fprintf('h3 is : %f kJ/kg \n', h3)
s3 = s2f;
fprintf('s3 is : %f kJ/kg \n', s3)

% State point 4
disp('At State Point 4:')
p4 = p1;
fprintf('p4 is : %f bar \n',p4)
s4 = s3;
fprintf('s4 is : %f kJ/kgk \n', s4)
wp = v3*(p4-p3)*100;
h4 = wp+h3;
fprintf('h4 is : %f kJ/kg \n', h4)

% To calculate t4 s4=s3=sf1-high_cpL*ln/t1s?t4
term=exp((s1f-s4)/high_cpL);
t4 = t1s/term;
fprintf('t4 is : %f deg celsius \n',t4)

% Work Done, Heat, SSC & Efficiency Calculation
wt = h1-h2;
fprintf('Work done by turbine is : %f kJ/kg \n', wt)
fprintf('Work done by compressor is : %f kJ/kg \n', wp)
wnet = wt-wp;
fprintf('Net work done is : %f kJ/kg \n', wnet)
qin = h1-h4;
eff_thermal = wnet/qin;
fprintf('Thermal Efficiency s : %f ',eff_thermal);
ssc = 3600/wt;
fprintf('s.s.c is : %f kg/kwh', ssc)

% Calculating for plotting liquid & vapour lies
temperature=linspace(1,373,500);
for i = 1:length(temperature)
    h_L(i) = XSteam('hL_t',temperature(i));
    h_V(i) = XSteam('hV_t',temperature(i));
    s_L(i) = XSteam('sL_t',temperature(i));
    s_V(i) = XSteam('sV_t',temperature(i));
end

% Plotting T-S & H-S diagram
% T-S
figure(1) 
hold on

plot(s_L,temperature,'b','linestyle','--','linewidth',1.5)
plot(s_V,temperature,'b','linestyle','--','linewidth',1.5)

plot([s1 s2],[t1 t2],'r','linewidth',2)
plot([s1g s1],[t1s t1],'r','linewidth',2)
text(s1,t1,'1')
text(s2,t2,'2')
plot([s2 s2g],[t2 t2s],'r','linewidth',2)
text(s2g,t2s,'2s')
plot([s2g s3],[t2s t3],'r','linewidth',2)
text(s3,t3,'3')
plot([s3 s4],[t3 t4],'r','linewidth',2)
text(s4,t4,'4')
plot([s4 s1f],[t4 t1s],'r','linewidth',2)
text(s1f,t1s,'4s')
plot([s1f s1g],[t1s t1s],'r','linewidth',2)
text(s1g,t1s,'1s')

% Marking direction
text(s1,(t1+t2)/2,'\vee','color','r')
text((s2g+s2f)/2,t3,'\angle','color','r')
text(s3,(t3+t4)/2,'\wedge','color','r')
text((s1f+s1g)/2,t1s,'\angle','color','r')

title('T-S diagram of Ideal Rankine cycle')
legend('Saturation Curve')
xlabel('Specific Entropy(kJ/kgk)')
ylabel('Temperature(deg c)')

% Plot for H-S
figure(2)
hold on

plot(s_L,h_L,'b','linestyle','--','linewidth',1.5)
plot(s_V,h_V,'b','linestyle','--','linewidth',1.5)

plot([s1 s2],[h1 h2],'r','linewidth',2);
text(s1,h1,'1')
plot([s2 s3],[h2 h3],'r','linewidth',2);
text(s2,h2,'2')
plot([s3 s4],[h3 h4],'r','linewidth',2);
text(s3,h3,'3')
plot([s4 s1],[h4 h1],'r','linewidth',2);
text(s4,h4,'4')

title('H-s diagram','fontsize',15)
legend('Saturation Curve')
xlabel('Specific Entropy(kJ/kgk)')
ylabel('Specific Enthalpy(kJ/kg)')

Command Window output:

SIMULATOR OF RANKINE CYCLE 
1-2 Isentropic expansion in the turbine 
2-3 Constant pressure heat rejection by the condenser 
3-4 Isentropic compression in the pump 
4-1 Constant pressure heat addition by the boiler 
Enter the pressure at the turbine inlet(in bar):30
Enter the temperature at the turbine inlet(in degree celsius):400
Enter the pressure at the condenser(in bar):0.05

Results:

At State Point 1:
p1 is :30.000000 bar 
t1 is :400.000000 deg celsiush1 is :3231.571027 kJ/kg 
s1 is :6.923259 kJ/kg 

At State Point 2:
p2 is :0.050000 bar 
s2 is :6.923259 kJ/kgk 
x2 is :0.814256 
t2 is : 32.875490 deg celsius 
h2 is : 2110.708212 kJ/kg 

At State Point 3:
p3 is : 0.050000 bar 
t3 is : 32.875490 deg celsius 
h3 is : 137.765119 kJ/kg 
s3 is : 0.476254 kJ/kg 

At State Point 4:
p4 is : 30.000000 bar 
s4 is : 0.476254 kJ/kgk 
h4 is : 140.776056 kJ/kg 
t4 is : 147.599058 deg celsius 

Work done by turbine is : 1120.862815 kJ/kg 

Work done by compressor is : 3.010937 kJ/kg 

Net work done is : 1117.851878 kJ/kg 

Thermal Efficiency s : 0.361671 s.s.c is : 3.211811 kg/kwh 

Back work ratio is : 0.002686

Code Explanation:

  • We start with clear all, close all and clc to clear all the previous data in the workspace.
  • XSteam data is used to extract the steam and water properties of entropy and enthalpy and specific pressure and temperature for saturation liquid and saturated vapour conditions.
  • Now we have to start with inputting the input pressure at state point 1, Temperature at state point 1 and condenser inlet temperature at state point 2.
  • Then all the state points are calculated with the help of XSteam data file and the inputs provided.
  • XSteam data work as, h1 = XSteam (‘h_pt’, p1, T1) which return the enthalpy of water at given pressure and temperature in bar and degree C respectively.
  • With the help of thermodynamic relation we find future state points and extract the data from the XSteam data file.
  • f stands for saturated liquid and g stands for saturated vapour.
  • Now we calculate the efficiency and Specific steam consumption of the rankine cycle from the thermodynamic relations.
  • T, s and h are extracted at vapour are liquid lines for plotting after 4thpoint for the variation in the plot.
  • Saturation curve is plotted in red for saturated liquid and saturated gas in T-s and in H-s it is black.
  • Plot for temperature vs entropy and enthalpy vs entropy is plotted with all the points obtained in the program.
  • Results of the program are displayed in command windows using sprint commands.

Output:

  • Figure for T-s diagram of ideal rankine cycle.
  • Figure for H-s diagram

Result:

  • Thus with the help of matlab rankine cycle simulator is obtained where the values are extracted from XSteam data file and the result is obtained from the given value of inputs.
  • Net work done by turbine is: 1120.862815 kJ/kg.
  • Work done by compressor is: 3.010937 kJ/kg.
  • Net work done is: 1117.851878 kJ/kg
  • Thermal efficiency is 0.361671 s.s.c is: 3.211811 kg/kwh or 36.16%.
  • Back work ratio is 0.002686.

Reference:

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.