Challenge

Project 2 - Rankine cycle Simulator

  1. The code is uploaded and explained .
  2. the output images are uploaded in jpg format.
  3. the errors faced while executing the program are uploaded as image format.
  4. the output results also printed in the result window

Rankine cycle:

The Rankine cycle or Rankine Vapor Cycle is the process widely used by power plants such as coal fired power plants or neuclear reactor. In this mechanism, a fuel is used to produce heat within a boiler, converting water into steam which then expands through a turbine producing useful work. This process was developed in 1859 by Scottish engineer William J.M. Rankine. This is a thermodynamic cycle cycle which converts heat into mechanical energy—which usually gets transformed into electricty by electrical generation.

The process in the Rankine Cycle :

process 1-2 Turbine: Expansion of the vapor in the turbine.

process 2-3 Pump: Compression of the fluid to high pressure using a pump

process 3-4 Condenser: Condensation of the vapor in the condenser (where the waste heat goes to the final heat sink

process 4-1 Boiler: The compressed fluid is heated to the final temperature (which is at boiling point), therefore, a phase change occurs—from liquid to vapor.

working:

The efiiciency of the Rankine cycle is limited by the high heat of vaporization by the fluid. The fluid must be cycled through and reused constantly, therefore, water is the most practical fluid for this cycle.

As the water condenses in the condenser, waste heat is given off in the form of water —which can be seen billowing from a plant's cooling towers. This waste heat is necessary in any thermodynamic cycle. Due to this condensation step, the pressure at the turbine outlet is lowered. This means the pump requires less work to compress the water—resulting in higher overall efficiencies.

clear all 
close all
clc
%%
%Input data
p1=30; %Turbine inlet pressure
p2= 0.05; %Turbine outlet pressure
T1=400; %turbine inlet temperature
%% 
disp('Rankine cycle Process');
disp('1-2 is isentropic expansion process in turbine');
disp('2-3 is constant pressure heat rejection in the condenser');
disp('3-4 is isentropic compression in the pump');
disp('4-1 is const pressure heat addition in the boiler')
%%
%obtaining vaues from Xsteam for state 1
h1=Xsteam('h_pT',p1,T1); %obtain enthalphy from p1 and T1
S1=Xsteam('S_pT',p1,T1); %obtain entrophy from p1 and T1
%values at state 2 
S2=S1;  %isentropic expansion process
hf2=Xsteam('hL_p',p2); %saturated liquid enthalphy at p2 
hg2=Xsteam('hV_p',p2); % saturated vapour enthalphy at p2
Sf2=Xsteam('SL_p',p2); %saturated liquid entropy at p2
Sg2=Xsteam('SV_p',p2); %saturated vapour entropy at p2
x2=(S2-Sf2)/(Sg2-Sf2); %vapour fraction at state2
h2=hf2+(x2*(hg2-hf2)); %enthalphy at state 2
%values at state 3
p3=p2;  % constant pressure heat rejection process.
S3=Xsteam('SL_p',p3); %saturated liquid entropy at p3
h3=Xsteam('hL_p',p3); %saturated liquid enthalphy at p3
%values at state 4
 S4=S3; % isentropic compression process
 p4=p1;  % constant process heat rejection
 %%
 % formulae to calculate
 %work done by turbine
 wt=h1-h2;
 %work done by run pump
 V3=Xsteam('vL_p',p3);
 wp=V3*(p4-p3)*100;
 h4=h3+wp;
 %net work
 wnet=wt-wp;
 %heat into 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);
 back_work_ratio= (wnet/wt);
 %%
 %calculating the temp at state points
 T3=Xsteam('Tsat_p',p3); %saturation temperature at pressure 3
 T2=T3;                 %constant pressure heat addition
 cp4=Xsteam('cp_ps',p4,S4); % isobaric heat
 cv4=Xsteam('cv_ps',p4,S4);  % isochoric heat
 k=cp4/cv4;
 T4=T3/((p3/p4)^((k-1)/k)); %Temperature at point 4
 %calculating temp,entropy,and enthalphy at the vapour and liquid line for
 %plotting
 T6=Xsteam('Tsat_p',p1); % saturated temperature at pressure 1
 S5=Xsteam('SL_p',p1);   %saturated liquid entropy at pressure 1
 S6=Xsteam('SV_p',p1);   % saturated vapour entropy at pressure 1
 h5=Xsteam('hL_p',p1);   % saturated liquid enthalphy at pressure 1
 h6=Xsteam('hV_p',p1);  %saturated vapour enthalphy at presssure 1 
 T5=T6;
 %plotting the saturation curve.
 T=linspace(1,375,1000);
 for i=1:length(T)
     Sf(i)=Xsteam('SL_T',T(i)); %saturated liquid entropy
     Sg(i)=Xsteam('SV_T',T(i)); % saturated vapour entropy
     hf(i)=Xsteam('hL_T',T(i)); % saturated liquid enthalphy
     hg(i)=Xsteam('hV_T',T(i)); %saturated vapour enthalphy
 end
 %plotting T-s diagram
 figure(1)
 hold on
 plot(Sf,T,'r','linewidth',1) % saturation curve is drawn
 plot(Sg,T,'r','linewidth',1)  % saturation curve is drawn
 plot([S1 S2],[T1 T2],'k','linewidth',2) % plots are made for all the points of S and T
 plot([S2 S3],[T2 T3],'k','linewidth',2)
 plot([S3 S4],[T3 T4],'k','linewidth',2)
 plot([S4 S5],[T4 T5],'k','linewidth',2)
 plot([S5 S6],[T5 T6],'k','linewidth',2)
 Sc1=linspace(S6,S1,1000);
 for l=1:length(Sc1)
     Tc1(l)=Xsteam('T_ps',p1,Sc1(l));
 end
 plot(Sc1,Tc1,'k','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('Temperature vs Entropy graph') % Displays title for graph
    xlabel('Entropy,S(kj/kgk)')   %displays xlabel
    ylabel('Temperature(deg C)')   %displays y label
    legend('Saturation Curve')     %displays legend
    %% 
    % plotting h_s diagram
    figure(2)
    hold on
 plot(Sf,hf,'r','linewidth',1) % saturation curve is drawn
 plot(Sg,hg,'r','linewidth',1)  %Saturation curve is drawn
 plot([S1 S2],[h1 h2],'k','linewidth',2) 
 plot([S2 S3],[h2 h3],'k','linewidth',2)
 plot([S3 S4],[h3 h4],'k','linewidth',2)

 hc=linspace(h4,h5,1000);
 for k=1:length(hc)
     Sch(k)=Xsteam('S_ph',p1,hc(k));
 end
 plot(Sch,hc,'k','linewidth',2)
plot([S5 S6],[h5 h6],'k','linewidth',2) 
for m=1:length(Sc1)
    hc1(m)=Xsteam('h_ps',p1,Sc1(m));
end
plot(Sc1,hc1,'k','linewidth',2)
 text(S1+0.1,h1,'1')
  text(S2+0.1,h2,'2')
   text(S3,h3-100,'3')
    text(S4,h4+200,'4')
    title('Enthalphy vs Entropy graph')
    xlabel('Entropy,S(kj/kgk)')   %displays xlabel
    ylabel('Enthalphy,H(kj/kg)') %displays y label
    legend('Saturation Curve')  %displays legend
    %%
 %displaying results
 disp('Results');
 fprintf('At state point 1:\n'); 
  fprintf('p1: %9f bar\n', p1); %Displays p1 value % \n for new line
   fprintf('T1: %9f C \n', T1); % Displays T1 value
   fprintf('h1: %9f kj/kg \n', h1); % Displays h1 value
    fprintf('S1: %9f kj/kgkn \n', S1); % Displays S1 value 
 fprintf('At state point 2: \n');
  fprintf('p2: %9f bar \n',p2);  % Displays p2 value
   fprintf('T2: %9f c\n',T2);    % Displays T2 value
   fprintf('h2: %9f kj/kg\n',h2); % Displays h2 value
    fprintf('S2: %9f kj/kgkn\n',S2); % Displays S2 value
    fprintf('X2: %9f n\n',x2);   % Displays x2 value
   fprintf('At state point 3: \n');
  fprintf('p3: %9f bar\n',p3); % Displays p3 value
   fprintf('T3: %9f c\n',T3);   % Displays T3 value
   fprintf('h3: %9f kj/kg\n',h3); % Displays h3 value
    fprintf('S3: %9f kj/kgkn\n',S3); % Displays S3 value
  fprintf('At state point 4: \n');
  fprintf('p4: %9f bar \n',p4);   % Displays p4 value
   fprintf('T4: %9f c\n',T4);     % Displays T4 value
   fprintf('h4: %9f kj/kg\n',h4);  % Displays h4 value
    fprintf('S4: %9f kj/kgkn\n',S4); % Displays S4 value
 fprintf('Turbine work: %10f kj/kg\n',wt); % Displays Turbine work value
 fprintf('Pump work: %10f kj/kg\n',wp);  % Displays pump work
 fprintf('wnet: %10f kj/kg\n',wnet);   % displays wnet
 fprintf('Efficiency: %10f percent\n',eff); %displays efficiency
 fprintf('Back work ratio: %10f\n',back_work_ratio);
 fprintf('S.S.C: %10f kj/kwh',ssc); %displays ssc value.

Rankine cycle Process
1-2 is isentropic expansion process in turbine
2-3 is constant pressure heat rejection in the condenser
3-4 is isentropic compression in the pump
4-1 is const pressure heat addition in the boiler
Results
At state point 1:
p1: 30.000000 bar
T1: 400.000000 C
h1: 3231.571027 kj/kg
S1: 6.923259 kj/kgkn
At state point 2:
p2: 0.050000 bar
T2: 32.875490 c
h2: 2110.708212 kj/kg
S2: 6.923259 kj/kgkn
X2: 0.814256 n
At state point 3:
p3: 0.050000 bar
T3: 32.875490 c
h3: 137.765119 kj/kg
S3: 0.476254 kj/kgkn
At state point 4:
p4: 30.000000 bar
T4: 36.935287 c
h4: 140.776056 kj/kg
S4: 0.476254 kj/kgkn
Turbine work: 1120.862815 kj/kg
Pump work: 3.010937 kj/kg
wnet: 1117.851878 kj/kg
Efficiency: 36.167131 percent
Back work ratio: 0.997314
S.S.C: 3.220462 kj/kwh

Rankine cycle Process
1-2 is isentropic expansion process in turbine
2-3 is constant pressure heat rejection in the condenser
3-4 is isentropic compression in the pump
4-1 is const pressure heat addition in the boiler
Results
At state point 1:
p1: 30.000000 bar
T1: 400.000000 C 
h1: 3231.571027 kj/kg 
S1:  6.923259 kj/kgkn 
At state point 2: 
p2:  0.050000 bar 
T2: 32.875490 c
h2: 2110.708212 kj/kg
S2:  6.923259 kj/kgkn
X2:  0.814256 n
At state point 3: 
p3:  0.050000 bar
T3: 32.875490 c
h3: 137.765119 kj/kg
S3:  0.476254 kj/kgkn
At state point 4: 
p4: 30.000000 bar 
T4: 36.935287 c
h4: 140.776056 kj/kg
S4:  0.476254 kj/kgkn
Turbine work: 1120.862815 kj/kg
Pump work:   3.010937 kj/kg
wnet: 1117.851878 kj/kg
Efficiency:  36.167131 percent
Back work ratio:   0.997314
S.S.C:   3.220462 kj/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.