Challenge

Project 2 - Rankine cycle Simulator

Aim-Create a Rankine Cycle Simulator using OCTAVE/MATLAB

Rankine Cycle-The Rankine cycle is an idealized thermodynamic cycle describing the process by which certain heat engine, such as steam turbine or reciprocating steam engines, allow mechanical work to be extracted from a fluid as it moves between a heat source and heat sink.

Process in Rankine cycle-

There are four processes in the Rankine cycle. The states are identified by numbers (in brown) in the .

  • Process 1–2: The working fluid is pumped from low to high pressure. As the fluid is a liquid at this stage, the pump requires little input energy. Process 1-2 is isentropic compression.
  • Process 2–3: The high-pressure liquid enters a boiler, where it is heated at constant pressure by an external heat source to become a dry saturated vapour. The input energy required can be easily calculated graphically, using an enthalpy chart (h-s diagram, or Mollier diagram), or numerically, using steam table or software. Process 2-3 is constant pressure heat addition in boiler.
  • Process 3–4: The dry saturated vapour expands through a turbine, generating power. This decreases the temperature and pressure of the vapour, and some condensation may occur. The output in this process can be easily calculated using the chart or tables noted above. Process 3-4 is isentropic expansion.
  • Process 4–1: The wet vapour then enters a conensor, where it is condensed at a constant pressure to become a saturated liquid. Process 4-1 is constant pressure heat rejection in condenser.

Program:

clear all 
close all
clc

%Info

fprintf('\n Rankine cycle simulator');
fprintf('\n\n1-2 Isentropic expansion in turbine');
fprintf('\n2-3 Constant presuure heat rejection in condensor');
fprintf('\n3-4 Isentropic compression in the pump ');
fprintf('\n4-1 constant pressure heat addition by the boilor\n');

%Inputs

p1=input('Pressure at turbine inlet (bar):');
t1=input('Temprature at turbine inlet (celsius):');
p2=input('Pressure at condensor :');

% @stage1 Turbine Inlet
%p1 & t1 are given
h1=XSteam('h_pT',p1,t1);
s1=XSteam('s_pT',p1,t1);

%@stage2 condenson Inlet
%p2 is given
s2=s1;
sf2=XSteam('sL_p',p2);
sg2=XSteam('sV_p',p2);
hf2=XSteam('hL_p',p2);
hg2=XSteam('hV_p',p2);
x2=(s2-sf2)/(sg2-sf2);
h2=hf2+(x2*(hg2-hf2));

% @stage 3 pump inlet

p3=p2;
h3=XSteam('hl_p',p3);
s3=XSteam('sl_p',p3);
t3=XSteam('Tsat_p',p3);
t2=t3;

% @stage 4 boiler Inlet

p4=p1;
s4=s3;
h4=XSteam('h_ps',p4,s4);

cp4=XSteam('Cp_ps',p4,s4);
cv4=XSteam('cv_ps',p4,s4);
lambda=cp4/cv4;
t4=t3/((p3/p4)^((lambda-1)/lambda));

t5=XSteam('Tsat_p',p1);
t6=t5;
s5=XSteam('sL_p',p1);
s6=XSteam('sV_p',p1);
h5=XSteam('hL_p',p1);
h6=XSteam('hV_p',p1);

%Turbine work
Wt=h1-h2;

%Pump work
Wp=h4-h3;

%Net work

W=Wt-Wp;

%Heat in & out of system

Q_in=h1-h4;
Q_out=h2-h3;

%Thermal Efficiency

ntherm=(W/Q_in)*100;

%Steam rate
SSC=3600/W;

%Back work Ratio
BWR=(h1-h4)/(h2-h3);

%To plot saturation curve

T=linspace(1,400,500);
for i=1:length(T)
    h_l(i)=XSteam('hL_T',T(i));
    h_V(i)=XSteam('hV_T',T(i));
    s_L(i)=XSteam('sL_T',T(i));
    s_v(i)=XSteam('sV_T',T(i));
end

%Plotting T-S diagram

figure(1)
hold on
title('T-S diagram')
plot([s1 s2],[t1 t2],'linewidth',3,'color','b')
plot([s2 s3],[t2 t3],'linewidth',3,'color','b')
plot([s3 s4],[t3 t4],'linewidth',3,'color','b')
plot([s4 s5],[t4 t5],'linewidth',3,'color','b')
plot([s5 s6],[t5 t6],'linewidth',3,'color','b')

xlabel('Entropy');
ylabel('Temprature');
s_1=linspace(s6,s1,500);
for j=1:length(s_1)
    t_1(j)=XSteam('T_ps',p1,s_1(j));
end
plot(s_1,t_1,'linewidth',3,'color','b')
plot(s_L,T,'linewidth',1.5,'color','r')
plot(s_v,T,'linewidth',1.5,'color','r')

% Annotations
text(s1,t1,'1','fontsize',15);
text(s2,t2,'2','fontsize',15);
text(s3,t3,'3','fontsize',15,'verticalalignment','top');
text(s4,t4,'4','fontsize',15,'verticalalignment','bottom');
text(s5,t5,'5','fontsize',15,'verticalalignment','bottom');
text(s6,t6,'6','fontsize',15,'verticalalignment','bottom');

figure(2)

hold on
title('H-S diagram')
plot([s1 s2],[h1 h2],'linewidth',2,'color','b')
plot([s2 s3],[h2 h3],'linewidth',2,'color','b')
plot([s3 s4],[h3 h4],'linewidth',2,'color','b')

h_4=linspace(h4,h5,500);
for k=1:length(h_4);
    s_4(k)=XSteam('s_ph',p1,h_4(k));
end

h_6=linspace(h6,h1,500)
for m=1:length(h_6);
    s_6(m)=XSteam('s_ph',p1,h_6(m));
end

plot(s_4,h_4,'LineWidth',2,'Color','b')
plot([s5 s6],[h5 h6],'linewidth',2,'Color','b')
plot(s_6,h_6,'linewidth',2,'Color','b')
xlabel('Specific Entropy (kJ/KgK)');
ylabel('Specific Enthalpy (kJ/Kg)');
plot(s_L,h_l,'linewidth',1.5,'color','r')
plot(s_v,h_V,'linewidth',1.5,'color','r')

% Annotations
text(s1,h1,'1','fontsize',15);
text(s2,h2,'2','fontsize',15);
text(s3,h3,'3','fontsize',15,'verticalalignment','top');
text(s4,h4,'4','fontsize',15,'verticalalignment','bottom');
text(s5,h5,'5','fontsize',15,'verticalalignment','bottom');
text(s6,h6,'6','fontsize',15,'verticalalignment','bottom');

%Results

fprintf('\nRESULTS\n\n');
fprintf('At State Point 1 :\n');
fprintf('P1=%f Bar\n',p1);
fprintf('T1=%f Deg Celsius\n',t1);
fprintf('H1=%f kJ/Kg\n',h1);
fprintf('S1=%f kJ/KgK\n\n',s1);

fprintf('At State Point 2 :\n');
fprintf('P2=%f Bar\n',p2);
fprintf('T2=%f Deg Celsius\n',t2);
fprintf('H2=%f kJ/Kg\n',h2);
fprintf('S2=%f kJ/KgK\n\n',s2);

fprintf('At State Point 3 :\n');
fprintf('P3=%f Bar\n',p3);
fprintf('T3=%f Deg Celsius\n',t3);
fprintf('H3=%f kJ/Kg\n',h3);
fprintf('S3=%f kJ/KgK\n\n',s3);

fprintf('At State Point 4 :\n');
fprintf('P4=%f Bar\n',p4);
fprintf('T4=%f Deg Celsius\n',t4);
fprintf('H4=%f kJ/Kg\n',h4);
fprintf('S4=%f kJ/KgK\n\n',s4);

fprintf('Work done by Turbine is : %f kJ/Kg\n',Wt);
fprintf('Work done by Pump is : %f kJ/Kg\n',Wp);
fprintf('Net Work done on the System : %f kJ/Kg\n',W);
fprintf('Specific Steam Consumption is : %f kg/kWh\n',SSC);
fprintf('The Net Thermal Efficiency of the System is : %f\n',ntherm);
fprintf('The BWR of the Rankine Cycle is found to be : %f\n',BWR);

Code Explanation:

  • Information on Rankine Cycle is processed to Comand window using fprintf command.
  • Input variables P1,T1,P2 are given by input comand values are entered in command window during executing the Program.
  • data required for rankine cycle is extracted from XSteam.m file
  • Pressure, Temperature, Enthalpy, Entropy forall the State Variables are Extracted as a function of dependent variable from the XSteam File.
  • State2:High pressure steam is converted into low pressure water.(Condensor inlet)
  • State3:water is condensed back to its Saturation Temperature and fed to the Pump.
  • State4:constant pressure heat addition,temprature increases on heating at constant pressure & constant volume.
  • cp/cv=lambda is conidered to find temprature T4.
  • Temprature range is defined using linespace command.
  • Plotting T-S & h-S diagram.

Plots:


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.