Project

rankine cycle

Objective :

Program to simulate Rankine cycle.

Theory:

Rankine cycle is an ideal vapour cycle. It plays a major role in steam power plants.This cycle is mainly based on thr conversion of inputs heat energy into output power using turbine.The working fluid at the inlet repeatedly undergoes change of phase and in successive operation, wnergy is transmitted and output power is produced Rankine cycle consits of the followin procesess.

  • Process 1-2 [Isentropic compression in pump] : 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 2-3 [Constant pressure heat addition in boiler] :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 eazily calculated graphically, using an enthalpy-entropy chart using steam table.
  • Process 3-4 [Isentropic expansion in turbine] : The dry saturated vapour expands through a turbine generating power . This decresses the temperature and pressure of vapour and some condensation may occur. The output in this process can be eazily calculated using the chart or tables noted above.
  • Process 4-1 [Constant pressure heat rejection in condenser] : The wet vapour then enters a condenser, where it is condensed at a constant pressure to become a saturated liquid.

Main code:

%Rankine cycle simulation 
close all
clear all
clc

%description 
fprintf(\'1-2 Isobaric heat transfer\\n\')
fprintf(\'2-3 Isentropic expansion\\n\')
fprintf(\'3-4 Isobaric heat rejection\\n\')
fprintf(\'4-1 Isentropic compression\\n\')

%reading the inputs 
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):\');

%calculate state point values
%state point 1
h1=XSteam(\'h_pt\',p1,t1);
s1=XSteam(\'s_pt\',p1,t1);

%state point 2
s2=s1;
sf2=XSteam(\'sL_p\',p2);
sg2=XSteam(\'sV_p\',p2);
hf2=XSteam(\'hL_p\',p2);
hg2=XSteam(\'hV_p\',p2);
s2=sg2;
h2=hg2;30
t2=XSteam(\'T_hs\',h2,s2);

%state point 3
t3=t2;
p3=p2;
s3=XSteam(\'sL_T\',t3);
h3=XSteam(\'hL_T\',t3);
v3=XSteam(\'vL_p\',p2);

%state point 4
p4=p1;
s4=s3;
cp4=XSteam(\'Cp_ps\',p4,s4);
cv4=XSteam(\'Cv_ps\',p4,s4);

%calculating gamma
g=cp4/cv4;

r=(g-1)/g;
t4=t3*(p4/p3)^r;

%work done by turbine 
w_turbine=h1-h2;
%work obsorbed by pump
w_pump=v3*(p1-p2)*100;
h4=w_pump+h3;
%net work
w_net=w_turbine-w_pump;
% heat input
qi=h1-h4;  
%Efficiency
n=(w_net/qi)*100;
%steam rate
sr=3600/(w_net);

%state point 5 and 6
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);

%printing the output
fprintf(\'\\n---------------RESULT---------------\\n\')
fprintf(\'At state point 1-\\nP1 is : %4.2f Bar\\nT1 is : %4.2f Degree celcius\\nH1 is : %4.2f kj/kg\\nS1 is : %4.2f kj/kgk\\n\\n\',p1,t1,h1,s1) 
fprintf(\'At state point 2-\\nP2 is : %4.2f Bar\\nT2 is : %4.2f Degree celcius\\nH2 is : %4.2f kj/kg\\nS2 is : %4.2f kj/kgk\\n\\n\',p2,t2,h2,s2) 
fprintf(\'At state point 3-\\nP3 is : %4.2f Bar\\nT3 is : %4.2f Degree celcius\\nH3 is : %4.2f kj/kg\\nS3 is : %4.2f kj/kgk\\n\\n\',p3,t3,h3,s3) 
fprintf(\'At state point 4-\\nP4 is : %4.2f Bar\\nT4 is : %4.2f Degree celcius\\nH4 is : %4.2f kj/kg\\nS4 is : %4.2f kj/kgk\\n\\n\',p4,t4,h4,s4)
fprintf(\'work done by turbine is : %4.2f kj/kg\\nNet work is : %4.2f kj/kg\\nEfficiency is : %4.2f percent\\nS.S.C is : %4.2f kg/kwh\',w_turbine,w_net,n,sr)

%plot T-S diagram
subplot(1,2,1)
T=linspace(t5,t1,500);
for i=1:length(T)
S(i)=XSteam(\'s_pT\',p1,T(i));
end
plot([s1 s2 s3 s4 s5 s6 S],[t1 t2 t3 t4 t5 t6 T],\'linewidth\',3,\'color\',\'r\');
grid on
text(s1,t1,\'1\',\'Fontsize\',15)
text(s2,t2,\'2\',\'Fontsize\',15)
text(s3,t3,\'3\',\'Fontsize\',15,\'HorizontalAlignment\',\'right\',\'VerticalAlignment\',\'top\')
text(s4,t4,\'4\',\'Fontsize\',15,\'HorizontalAlignment\',\'right\',\'VerticalAlignment\',\'bottom\')
text(s5,t5,\'5\',\'Fontsize\',15)
text(s6,t6,\'6\',\'Fontsize\',15)
hold on
T2=linspace(1,400,500);
for i=1:length(T2)
sl(i)=XSteam(\'sL_T\',T2(i));
sv(i)=XSteam(\'sV_T\',T2(i));
hl(i)=XSteam(\'hL_T\',T2(i));
hv(i)=XSteam(\'hV_T\',T2(i));
end
plot(sl,T2);
plot(sv,T2);
xlabel(\'Entropy\')
ylabel(\'Temperature\');

%for H-S diagram
subplot(1,2,2)
plot([s1 s2 s3 s4 s1],[h1 h2 h3 h4 h1 ],\'linewidth\',3)
text(s1,h1,\'1\',\'Fontsize\',15)
text(s2,h2,\'2\',\'Fontsize\',15)
text(s3,h3,\'3\',\'Fontsize\',15,\'HorizontalAlignment\',\'right\',\'VerticalAlignment\',\'top\')
text(s4,h4,\'4\',\'Fontsize\',15,\'HorizontalAlignment\',\'right\',\'VerticalAlignment\',\'bottom\')
hold on 
plot (sv,hv)
plot(sl,hl)
xlabel(\'Entropy\');
ylabel(\'Enthalpy\');
grid on
hold off

Code Explanation:

  • Before programming make sure that \'XSteam.m\' file is saved in same folder where the program is saved.
  • For discription purpose, we are using fprintf command and printing all process.
  • To scan the inputs given by user we are using \'input\' command and storing the values in a variable.
  • Then we are taking reading values of enthalpy and entropy from \'XSteam.m\' file by using standard syntax.
  • After getting the values state points for all process are calculated.
  • All variables are printed in command window using \'fprintf\' command.
  • After that some other factores like efficiency,net work done and SSC are also calculated and printed.
  • After that to plot T-S diagram we use \'linspace\' command and generating 500 values between the limites.
  • Using plot command curves are plotted.
  • To label numbers to it, we used \'text\' command and alligned them in their position.

Outputs screenshot:

Error faced:

Giving file name incorrectly, thrown an error saying-

error was rectified and corrected.

Result:

The rankine cycle plots were generated by calculating the state points.

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.