Challenge

Project 2 - Rankine cycle Simulator

Rankine Cycle Simulator: Using MATLAB

AIM:

To write a program to calculate the state points of the Rankine Cycle based on user points.Then, plot the corresponding T-s and h-s plots for the given set of inputs with Title and axes labels.

THEORY:

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 idealised thermodynamic cycle of heat engine that converts heat into mechanical work while undergoing a phase change.It is an idealised cycle in which friction loses 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.

The Rankine cycle operates in the following steps:

1-2 Isentropic Expansion(expansion in a steam turbine):- Steam from the boiler expands adiabatically from state1 to state2 in a steam turbine to produce work and then is discharged to the condenser (partially condensed).The steam does work on the surroundings (blades of the turbine) and loses an amount of enthalpy equal to the work that leaves the system.The work done by the turbine is given by Wt=H2-H1.Again the entropy remains unchanged.

2-3 Isobaric Heat Rejection (in a heat exchanger):- In this phase,the cycle completes by a constant-pressure processin which heat is rejected from the partially condensed steam.There is heat transfer from the vapour to cooling water flowing ina cooling circuit.The vapor condenses and the temperature of the cooling water increases.The net heat rejected is given by Q required=H2-H3.

3-4 Isentropic Compression (compression in centrifugal pump):- The kiquid condensate is compressed adiabatically from state3 to state4 by centrifugal pumps (usually by condensate pumps and then by feed water pumps).The liquid condensate is pumped from the condenser into high pressure boiler.In this processs, the surroundings do work on the fluid,increasing its enthalpy (h = u+ p*v) and compressing it (increasing its pressure). On the other hand, the entropy remains unchanged. The work required for the compressor is given by Wp = H4 – H3.

4-1 Isobaric Heat Transfer(in a heat exchanger -boiler):- In this phase (between state 4 and state 1) there is a constant-pressure heat transfer to the liquid condensate from an external source since the chamber is open to flow in and out. The net heat added is given by Qadd = H1 – H4.

MAIN PROGRAM:

% Program for Rankine cycle simulator
clear all
close all
clc
% User Inputs
fprintf('%50 n n','RANKINE CYCLE SIMULATOR');
fprintf(' 1-2 is Isentropic Expansion in the Turbine');
fprintf(' 2-3 is Const Pressure heat rejection by the condensor');
fprintf(' 3-4 is Isentropic compression in the pump');
fprintf(' 4-1 is const pressure heat addition by the boiler');
% 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 condensor(in bar):');
% Inlet of the turbine
s1=XSteam('s_pT',p1,t1);
h1=XSteam('h_pT',p1,t1);
% Inlet of the condensor
s2=s1;
sf2=XSteam('sL_p',p2);
sg2=XSteam('sV_p',p2);
hf2=XSteam('hL_p',p2); % Enthalpy at liquid state
hg2=XSteam('hV_p',p2); % Enthalpy at gaseous state
x2=((s2-sf2)/(sg2-sf2)); % Dryness fraction factor
h2=hf2+(x2*(hg2-hf2));
% Exit of the condensor
p3=p2;
t3=XSteam('Tsat_p',p3);
s3=XSteam('sL_p',p3);
h3=XSteam('hL_p',p3);
v3=XSteam('vL_p',p3);
t2=t3;
% Inlet to the boiler
p4=p1;
s4=s3;
h4=XSteam('h_ps',p4,s4);
cp4=XSteam('Cp_ps',p4,s4);
cv4=XSteam('Cv_ps',p4,s4);
g4=(cp4/cv4);
o=(1-g4)/g4;
% To calculate the f4
% p4^(1-gamma)*t4^gamma=p3^(1-gamma)*t3^gamma
t4=(t3*((p3/p4)^((1-g4)/g4)));
% Calculation
% Work done by the turbine
wt=h1-h2;
% Work done by the pump
wp=h4-h3;
% Net work done
w_net=wt-wp;
% Heat injected in boiler
q_in=h1-h4;
% Heat rejected in condensor
q_out=h2-h3;
% Thermal Efficiency
n=w_net/q_in;
np=n*100;
% Plot for temp vs entropy
figure(1)
% Plot for liquid & vapour saturation curves
t=linspace(0,550,600);
for i=1:length(t)
s_l(i)=XSteam('sL_T',t(i));
end
for i=1:length(t)
s_v(i)=XSteam('sV_T',t(i));
end
plot(s_l,t,'linewidth',2,'color','r')
hold on
plot(s_v,t,'linewidth',2,'color','r')
grid on
% Plot for work done by the turbine
plot([s1,s2],[t1,t2],'linewidth',2,'color','k');
hold on
title('T-s DIAGRAM OR IDEAL RANKINE CYCLE')
xlabel('Entropy(kJ/kgK)')
ylabel('Temperature(k)')
% Plot for heat rejected in condensor
plot([s2,s3],[t2,t3],'linewidth',2,'color','k')
hold on
% Plot for work done by pump
plot([s4,s4],[t3,t4],'linewidth',2,'color','k')
hold on
% Plot for heat injected by boiler
tp=XSteam('Tsat_p',p4);
sp=XSteam('sL_T',tp);
plot([s4,sp],[t4,tp],'linewidth',2,'color','k')
hold on
tq=tp;
sq=XSteam('sV_T',tq);
plot([sp,sq],[tp,tq],'linewidth',2,'color','k')
hold on
plot([sq,s1],[tq,t1],'linewidth',2,'color','k')
hold on
% Indicate state with numbers
text(s1,t1,' 1');
text(s2,t2,' 2');
text(s3,t3,' 3');
text(s4,t4,' 4');
% Plot for enthalpy vs entropy
figure(2)
plot([s1,s2],[h1,h2],'linewidth',2,'color','k')
grid on
title('h-s DIAGRAM')
xlabel('Entropy(kJ/kgK)')
ylabel('Enthalpy(kJ/kgK)')
hold on
plot([s2,s3],[h2,h3],'linewidth',2,'color','k')
hold on
plot([s3,s4],[h3,h4],'linewidth',2,'color','k')
hold on
plot([s4,s1],[h4,h1],'linewidth',2,'color','k')
hold on
% Plot for liquid & vapour saturation curve
t=linspace(0,550,600);
for j = 1:length(t)
h_l(j)=XSteam('hL_T',t(j));
end
for j = 1:length(t)
h_v(j)=XSteam('hV_T',t(j));
end
plot(s_l,h_l,'linewidth',2,'color','r')
hold on
plot(s_v,h_v,'linewidth',2,'color','r')
% Indicate state with numbers
text(s1,h1,'1');
text(s2,h2,'2');
text(s3,h3,'3');
text(s4,h4,'4');
% Results output
fprintf('n %40s nn','RESULT');
frintf('%10s %54s n','AT STATE POINT1','AT STATE POINT2');
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 %.2fn n','X2:',x2);
fprintf('%10s %54s n','AT STATE POINT3','AT STATE POINT4');
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 Celsius' );
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):',w_net,'kJ/kg');
fprintf('%40S %.2f %s n','Thermodynamic Efficiency(Ntherm):',np,'Percent');
fprintf('%40s %.2f %s n','Heat input in boiler:',q_in,'kJ/kg');
fprintf('%40s %.2f %s n','Heat rejected in condensor:',q_out,'kJ/kg');
fprintf('%40s %.2f %s n','S.S.C.:',p3,'kg/kWh');
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.