Challenge

Rankine cycle Simulator

AIM-Write a program of a Rankine cycle simulator and plot its T-s and h-s diagram using MATLAB.

OBJECTIVE:

  • Calculate each 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.
  • Calculate its Efficiency.

THEORY-

The Rankine cycle is an idealized thermodynamic cycle of a constant pressure heat engine that converts part of heat into mechanical work. In this cycle the heat is supplied externally to a closed loop, which usually uses water (in a liquid and vapor phase) as the working fluid. In contrast to the Brayton cycle, the working fluid in the Rankine cycle undergo the phase change from a liquid to vapor phase and vice versa.

While many substances could be used as the working fluid in the Rankine cycle (inorganic or even organic), water is usually the fluid of choice due to its favorable properties, such as its non-toxic and unreactive chemistry, abundance, and low cost, as well as its thermodynamic properties. For example, water has the highest specific heat of any common substance – 4.19 kJ/kg K. Moreover it has very high heat of vaporization, which makes it an effective coolant and medium in thermal power plants and other energy industry. In case of the Rankine cycle, thei ideal gas law almost cannot be used (steam do not follow pV=nRT), therefore all important parameters of water and steam are tabulated in so called “steam tables“.

There are four processes in Rankine cycle-

  1. Pump : Compression of the fluid to high pressure using a pump
  2. Boiler : The compressed fluid is heated to the final temperature(which is at boiling point), therefore, a phase change occurs from liquid to vapor.
  3. Turbine: Expansion of the vapor in the turbine.
  4. Condenser: Condensation of the vapor in the condenser (where the waste heatgoes to the final heat sink (the atmosphere or a large body of water.
  • Four processes of the Rankine cycle:

1-2: Isentropic Expansion

Turbine (1-2): Superheated steam enters into the Turbine and expands isentropically resulting in the production of work. The shaft of the turbine is connected to the generator. This results in the production of electricity i.e Mechanical energy gets converted into electric energy. Work produced by the turbine, WT = m(hi – h2)K

2-3: Constant Pressure Heat Rejection

Condenser (2-3): The expanded vapour is then passed through a condenser, where it gets condensed and converts into liquid again. This liquid is again pumped to the boiler. Qr = m(h2 - h3)K

3-4: Isentropic Compression by the Pump

Pump (3-4): The water enters into the pump in a saturated state. Then the liquid is compressed isentropically until it meets the boiler pressure. Work done by the pump is, Wp = m(h3 – h4)K

4-1: Constant Pressure Heat Addition

Boiler (4-1): The water enters into the boiler as compressed and leaves as superheated from the boiler. Thus the phase changes from liquid to vapour. The heat supplied by the boiler is

Qb = m(hı – h4)K

Here we take mass flow rate m =1 for this code.

Code-Xsteam function to get steam data.

Main code-

%Rankine cycle simulator
clear all
close all
clc
% Displaying all the simulator process
fprintf(' RANKINE CYCLE SIMULATORn')
fprintf('1-2 Icentropic compression in turbinen')
fprintf('2-3 Constant pressure heat rejection n')
fprintf('3-4 Icentropic compression in the pump n')
fprintf('4-1 Constant pessure heatr 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')
% State point 1
h1=XSteam('h_pT',P1,T1); %extracting enthalpy
s1=XSteam('s_pT',P1,T1); %extracting entropy
fprintf('At state point 1n');
fprintf('P1:%f barn',P1);
fprintf('T1:%f Cn',T1);
fprintf('h1:%f KJ/Kgn',h1);
fprintf('s1:%f KJ/kgKn',s1);
% State point 2
s2=s1;
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));
T2=XSteam('Tsat_p',P2);
fprintf('At state point 2n');
fprintf('P2:%f barn',P2);
fprintf('T2:%f Cn',T2);
fprintf('h2:%f KJ/kgn',h2);
fprintf('s2:%f KJ/kgKn',s2);
fprintf('x2:%f n',x2);
%state point 3
P3=P2;
s3=XSteam('sL_p',P3);
h3=XSteam('hL_p',P3);
T3=T2;
fprintf('At state point 3n');
fprintf('P3:%f barn',P3);
fprintf('T3:%f Cn',T3);
fprintf('h3:%f KJ/Kgn',h3);
fprintf('s3:%f KJ/KgKn',s3);
% State point 4
s4=s3;
P4=P1;
Wt=h1-h2; %Work done by turbine
v3=XSteam('vL_p',P3);
Wp=v3*(P4-P3)*100; % Work done by pump
h4=h3+Wp;
T4=XSteam('T_hs',h4,s4);
fprintf('At state point 4n');
fprintf('P4:%f barn',P4);
fprintf('T4:%f Cn',T4);
fprintf('h4:%f KJ/Kgn',h4);
fprintf('s4:%f KJ/KgKn',s4);
%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);
%Calculating temperatures at the state points
Cp4=XSteam('Cp_ps',P4,s4);
Cv4=XSteam('Cv_ps',P4,s4);
k=Cp4/Cv4;
%calculating temperature,entropy,and enthalpy at the vapour and liquid
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;
% Plotting the saturation curve
T=linspace(0,400,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
% Plotting T-s diagram
figure(1)
hold on
plot(sf,T,'r:','linewidth',2)
plot(sg,T,'r:','linewidth',2)
plot([s1 s2],[T1 T2],'b','linewidth',2)
plot([s2 s3],[T2 T3],'b','linewidth',2)
plot([s3 s4],[T3 T4],'b','linewidth',2)
plot([s4 s5],[T4 T5],'b','linewidth',2)
plot([s5 s6],[T5 T6],'b','linewidth',2)
sc1=linspace(s6,s1,1000);
for j=1:length(sc1)
Tc1(j)=XSteam('T_ps',P1,sc1(j));
end
plot(sc1,Tc1,'b','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('bf T-s Diagram')
xlabel('bf Entropy,s[KJ/KgK]')
ylabel('bf Temperature[Degree C]')
grid on
% Plot h-s diagram
figure(2)
hold on
plot(sf,hf,'r:','linewidth',2)
plot(sg,hg,'r:','linewidth',2)
plot([s1 s2],[h1 h2],'b','linewidth',2)
plot([s2 s3],[h2 h3],'b','linewidth',2)
plot([s3 s4],[h3 h4],'b','linewidth',2)
hc=linspace(h4,h5,100);
for k=1:length(hc)
sch(k)=XSteam('s_ph',P1,hc(k));
end
plot(sch,hc,'b','linewidth',2)
plot([s5 s6],[h5 h6],'b','linewidth',2)
for l=1:length(sc1)
hc1(l)=XSteam('h_ps',P1,sc1(l));
end
plot(sc1,hc1,'b','linewidth',2)
text(s1,h1,'1')
text(s2,h2,'2')
text(s3,h3-100,'3')
text(s4,h4+200,'4')
title('bf h-s Diagram')
xlabel('bf Entropy,s[KJ/KgK]')
ylabel('bf Enthalpy,h[KJ/Kg]')
grid on
fprintf('Turbine work:%f KJ/Kgn',Wt);
fprintf('pump work:%f KJ/Kgn',Wp);
fprintf('Wnet:%f KJ/Kgn',Wnet);
fprintf('Efficiency:%f percentn',eff);
fprintf('S.S.C:%f KJ/KWh',SSC);

CODE EXPLANATION-

1.First of all we will start from clear all,close all,clc.

2.Print all simulator process from fprintf command.

3.The program requires the input of P1,T1,P2 from input command.

4.Put XSteam.m file in same directory to call the XSteam function.

5.using fprintf command to print values of variable we found.

6.find net work output and back work ratio with suitable equation.

7.The net work ,work done by turbine,work done by pump,heat in and heat out are calculated using standard thermodynamics data.

8.Efficiency and specific steam consumption (SSC) of the Rankine cycle is calculated.

9.plot the T-s and h-s diagram using all the values we found in different states.

10.Plot saturation line using the values we found by for loop.

OUTPUTS

We got variables as following-

we got T-s and h-s diagram as following-

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.