Challenge

Project 2 - Rankine cycle Simulator

AIM: create a Rankine Cycle Simulator using Matlab.

OBJECTIVE:

  • calculate each state point of the Rankine cycle based on code (user) inputs.
  • plot the corresponding T-S and H-S plots for a given set of inputs.
  • calculate efficiency.

THEORY:

The Rankine cycle is an idealized thermodynamics cycle of a heat engine that converts heat into mechanical work while undergoing a phase change. It is an idealized cycle in which losses in each of the four components are neglected. The heat is supplied externally to a closed loop. Which usually uses water as the working fluid.

*four components of the Rankine-Cycle*

  1. pump
  2. boiler
  3. Turbine
  4. condenser

four processes of the Rankine cycle:-

process (1-2) isentropic expansion

super heated steam enters 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 converted into electrical energy. Work produced by the turbine.

Wt = m(h-h2)K

process(2-3):constant pressure heat rejection

condenser(2-3): The expanded vapour is then passed though a condenser where it gets condensed and convert into liquid is compressed liquid agian. This liquid is again oumped into 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 satursated state. then the liquid is compressed isentropically until it meets the boiler pressure. Work done by the pump is,

Wp=m(h3-h4)

process (4-1): constant pressure heat addition

boiler:the water enrters into the boiler as compressed and leaves as superheated from the boiler.Thus the heat supplied by the boiler is

Qb = m(h1-h4)K

ere take mass flow rate m=1 for this code

The efficiency of the Steam Cycle is given by.

η=Wn/Q1=Wt-Wp/Q1

***applyibg the study flow energy equation(SFEE) to all process neglecting the friction losses and change in kinetic &potential Energy.

  • Q1=h1-h4@boiler
  • Wt=h1-h2@Turbine
  • Q2=h2-h3@condenser
  • Wp=h4-h3@pump

The capacity of the Steam plant is often expressed in terms of Steam rate or Specific Steam Consumption(ssc)

SSC=3600/W kg/kwh

Required inputs:

Turbine Inlet temperature = 400 C

Turbine Inlet pressure =30 bars

Turbine outlet pressure = 0.05bars (consdenser inlet pressure)

MATLAB CODE

clear all
close all
clc
%print process description
disp('1-2 isobaric heat transfer');
disp('2-3 isentropic expansion');
disp('3-4 isenbaric heat rejection');
disp('4-1 isentropic compression')
%obtaining the input data
%step(1);input points
p1 =input('Enter the pressure at the turbine inlet(in bar):');
t1 = input('Enter the temperature at the turbine inlet(in degree celcius):');
p2 = input('Enter the pressure at the condenser(in bar):');
% calculaye each state points
%state point 1
h1=XSteam('h_pT', p1, t1'); %extracting enthalpy at state pt 1
s1=XSteam('s_pT', p1, t1'); %similarly for entropy
%state 3 : state point 2
s2 = s1; %isentropic expansion
sf2= XSteam('sL_p',p2); %saturatedliquid Entropy
sg2= XSteam('sV_p',p2); %saturated vapour entropy
hf2= XSteam('hL_p',p2);
hg2= XSteam('hV_p',p2); %hf2=(x2+(hg2-hf2);
t2=XSteam('Tsat_p',p2);
%splitting the formulae
x2=((s2-sf2)/(sg2-sf2));
h2=hf2+(x2*(hg2-hf2));
%step 4:Statepoint 3(pump inlet)
p3=p2;
t3=XSteam('Tsat_p',p2); %constant pressure hear rejection in condenser
s3=XSteam('sL_P',p3);
h3=XSteam('hL_p',p3);
%v3 = XSteam('vL_p',p2);
%step 5: state point 4
p4 = p1;
s4 = s3;
Cp4 = XSteam('CpL_p',p3);
Cv4 = XSteam('CvL_p',p3);
gamma = Cp4/Cv4;
r = (gamma-1)/gamma;
t4 = t3*((p4/p3)^r);
h4=XSteam('h_ps',p4,s4);
%step6 : calculate the other output values;
Wt = h1-h2; %turbine work
Wp = h4-h3; %pump work
h4 = Wp+h3;
W_net = Wt-Wp; %net work output in kj/kg
Qs = h1-h4; % heat supplied
Qr = h2-h3;
N_per = (W_net/Qs)*100; %efficiency
SSC = 3600/(W_net); %steam rate per second
%step 7 :state 5 and 6 which help in plotting
tf_sat = XSteam('Tsat_p',p1);
sf_sat = XSteam('sL_p',p1);
sg_sat = XSteam('sV_p',p1);
hf_sat = XSteam('hL_p',p1);
hg_sat = XSteam('hV_p',p1);
%polt figure (1)
figure(1)
hold on
temp=linspace(0,400,1000);
for i=1:length(temp)
aa(i)= XSteam('sL_T',temp(i));
end
for j=1:length(temp)
bb(j)=XSteam('sV_T',temp(j));
end
plot(aa,temp,'Color','g')
plot(bb,temp,'Color','g')
temp=(XSteam('Tsat_p',p1));
t0=linspace(temp,t1,300);
for i=1:length(t0)
c11(i)=XSteam('s_pt',p1,t0(i));
end
t5=XSteam('Tsat_p',p4);
s5=XSteam('sL_T',t5);
plot([s1 s2],[t1 t2],'Color','r')
plot([s2 s3],[t2 t3],'Color','r')
plot([s3 s4],[t3 t4],'Color','r')
plot([s4 s5],[t4 t5],'color','r')
plot([sf_sat sg_sat],[tf_sat tf_sat],'Color','r');
plot(c11,t0,'Color','r');
title('T-s diagram')
xlabel('entropy (kj/kgk)')
ylabel('Temperature(K)')
text(s1,t1,'1');
text(s2,t2,'2');
text(s3,t3,'3');
text(s4,t4,'4');
text(s5,t5,'4s');
text(sg_sat,tf_sat,'1s')
%plotting fig 2
figure(2)
hold on
temp1=linspace(0,400,1000);
for i = 1:length(temp1)
cc(i) = XSteam('hL_T',temp1(i));
end
for j = 1:length(temp1)
dd(j) = XSteam('hV_T',temp1(j));
end
plot(aa,cc,"Color",'b')
plot(bb,dd,"Color",'b')
plot([s1 s2],[h1 h2],'Color','r')
plot([s2 s3],[h2 h3],'Color','r')
plot([s3 s4],[h3 h4],'Color','r')
plot([s4 s1],[h4 h1],'Color','r')
title('H-S Diagram')
xlabel('entropy(kj/kgk)')
ylabel('enthalpy(kj/kg)')
text(s1,h1,'1')
text(s2,h2,'2')
text(s3,h3,'3')
text(s4,h4,'4')
%printing the output
fprintf('At stage point 1:\n')
fprintf('P2 is: %f barn',p1)
fprintf('T1 is : %f deg celsiu\n',t1)
fprintf('H1 is :%f kj/kg\n',h1)
fprintf('S1 is :%f kj/kgkrn',s1)
disp('at point 2:')
fprintf('P2 is: %f bar\n',p2)
fprintf('T2 is : %f deg celsiu\n',t2)
fprintf('H2 is :%f kj/kgn',h2)
fprintf('S1 is :%f kj/kgKn',s2)
fprintf('X is : %f rn',x2)
disp('at point 3:')
fprintf('P3 is: %f bar\n',p3)
fprintf('T3 is : %f deg celsiu\n',t3)
fprintf('H3 is :%f kj/kgk',h3)
fprintf('S3 is :%f kj/kgkrn',s3)
disp( 'at point 4:')
fprintf('P4 is: %f bar\n',p4)
fprintf('T4 is : %f deg celsiu\n',t4)
fprintf('H4 is :%f kj/kgk',h4)
fprintf('S4 is :%f kj/kgkrn',s4)
fprintf('Wt is : %f kj/kg\n',Wt)
fprintf('WP is: %f kj/kg\n',Wp)
fprintf('Wnet is : %f kj/kg\n',W_net)
fprintf('Ntherm is :%f %%\n',N_per)
fprintf('SSC is :%f kj/kWhB\n',SSC)
EXPLANATION:-
  • The program begins with clear all, alose all,clc to erase the workspace and plots.
  • input varaibles p1,T1,p2 are given by input command those values are enterd in command window while excuting the program.
  • @state(1): Variables for entropy, enthapy are extracted as a function of pressure & temperature
  • h_pT,s_pT,hL_p,sV_p etc... are the default variables stored in XSteam file.
  • similalrly all the variables for all state are extracted using suitable format
  • note: [**The formulae for the factors are reffered frompower plant Reference Books.]
  • Pressure,Temperature,Entropy,enthalpy for all the state varaiables are extracted from Xsteam file/
  • @state(2): condenser inlet where the high pressure steam is converted into low pressure water and hence dryness fraction, Enethalpy&Entropy for saturated vapour&Saturated water are consideredto calculate specific Enthalpy.
  • @state(3): the water is condensed back to its saturation Temperature and fed to the pump,This temperature of water at the exist of the condenser and entry of pump is the same.
  • @state (4):- This is constant pressure heat addition hence pressure is equal to p1,but the temperature increase on heating at constant pressure temperature and volume as our Entropy remains same and hence Cp/Cv=gamma to find T4
  • define two more points 5 and 6 to plot cycle in details.
  • finally, workdoen and Heat Evolved&SSC are calculated by basic formulae
  • to plot the saturation Curve,aTemperature range is defined using linspace command and for the over all length of this Temperature value enthalpy& entropy are calculated at every temperature point.The Break in the saturation curve separates the Liquid phase &Vapour Phase.
  • Now all the neccesary data is found out,Plotting is done for both T-S & H-S curves using the plot commands annovations are assigned to text command
  • result of the Cycle simulation is displayed over Command window using fprintf command.

RESULTS:-

The RAnkine cycle plots have generated by calculating the state poinnts, efficiency and the output is printed in the command

COMMAND WINDOW

WORKSPACE

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.