Project 2 - Rankine cycle Simulator
AIM:
To Plot the TS and PV graph of the Rankine Cycle in Octave
OBJECTIVE:
Calculate The State Points and the PV and TS diagram plots of the Rankine Cycle.
CONCEPT:
The Rankine Cycle is actually used in Steam Power Plants and they work on the basis of the Rankine Cycle.
By the Rankine Cycle, we can find out the conditions required to maintain in the Steam Power plant so that the maximum output can be obtained.
Rankine Cycle converts Thermal Energy to Mechanical energy.
The Rankine Cycle consists of the following processes:
I)1-2 Isentropic Compression in a pump.
II)2-3 Constant Pressure Heat Addition In a pump
III)3-4 Isentropic Expansion In a Turbine
IV)4-1 Constant Pressure Heat Rejection in a condenser
The diagram of the Rankine Cycle can be seen as below:
CODE:
clear all
close all
clc
fprintf('Rankine Cycle Simulator\n\n')
fprintf('1-2 is Isentropic expansion in the turbine \n')
fprintf('2-3 is Constant pressure heat rejection by the condenser \n')
fprintf('3-4 is Isentropic compression in the pump \n')
fprintf('4-1 is Constant pressure heat addition by the boiler \n\n')
%taking the inputs from the user
prompt = 'Enter The Turbine Input Temperature \n';
t1=input(prompt);
prompt = 'Enter The Turbine Input Pressure \n';
p1=input(prompt);
prompt = 'Enter The Turbine Output Pressure \n';
p2=input(prompt);
fprintf('\n\nResultsn\n')
fprintf('At point 1 \n')
%finding parameters at point 1
v1=xsteam('v_pt',p1,t1) %specific volume
t1 %temperature
p1 %pressure
s1=xsteam('s_pt',p1,t1) %specific entropy
h1=xsteam('h_pt',p1,t1) %specific enthalpy
fprintf('At point 2 \n')
%finding parameters at point 2
v2=v1
t2=xsteam('tsat_p',p2)
p2
s2=s1
xa=xsteam('x_ps',p2,s2);
h2=xsteam('h_px',p2,xa)
fprintf('At point 3 \n')
%finding parameters at point 3
v3=xsteam('vl_p',p2)
t3=t2
p3=p2
s3=xsteam('sl_p',p2)
h3=xsteam('hl_p',p2)
fprintf('At point 4 \n')
%finding parameters at point 4
v4=v3
p4=p1
s4=s3
t4=xsteam('t_ps',p4,s4)
h4=xsteam('h_pt',p4,t4)
fprintf('At point 5 \n')
%finding parameters at point 5
t5=xsteam('tsat_p',p1)
v5=xsteam('vl_p',p1)
s5=xsteam('sl_p',p1)
p5=p1
h5=xsteam('hl_p',p1)
fprintf('At point 6 \n')
%finding parameters at point 6
t6=t5
v6=xsteam('vv_p',p1)
s6=xsteam('sv_p',p1)
p6=p1
h6=xsteam('hv_p',p1)
if(t1==0)
fprintf('The cycle cannot have %f as the inlet temperature of the cycle',t1)
end
temp=linspace(0,t1,500);
%finding different parametres for drawing the saturated liquid line and
%saturated vapour line in t-s and h-s plots
for i=1:500
sat_liq_s1(i) =xsteam('sl_t',temp(i)); %saturated liquid entropy
sat_vap_s1(i) =xsteam('sv_t',temp(i)); %saturated vapour entropy
sat_liq_h(i) =xsteam('hl_t',temp(i)); %saturated liquid enthalpy
sat_vap_h(i) =xsteam('hv_t',temp(i)); %saturated vapour enthalpy
psat(i)=xsteam('psat_t',temp(i)); %saturated pressure
sat_liq_s2(i) =xsteam('s_ph',psat(i),sat_liq_h(i)); %saturated liquid entropy at a particular pressure and enthalpy
sat_vap_s2(i) =xsteam('s_ph',psat(i),sat_vap_h(i)); %saturated vapour entropy at a particular pressure and enthalpy
end
%plotting temperature vs specific entropy plot
figure(1)
plot(sat_liq_s1,temp,'color','r') %saturated liquid line
hold on
plot(sat_vap_s1,temp,'color','r') %saturated vapour line
%marking the points
plot(s1,t1,'-O','MarkerSize',6,'MarkerFaceColor','g')
plot(s2,t2,'-O','MarkerSize',6,'MarkerFaceColor','g')
plot(s3,t3,'-O','MarkerSize',6,'MarkerFaceColor','g')
plot(s4,t4,'-O','MarkerSize',6,'MarkerFaceColor','g')
plot(s5,t5,'-O','MarkerSize',6,'MarkerFaceColor','g')
plot(s6,t6,'-O','MarkerSize',6,'MarkerFaceColor','g')
%joining points
plot([s1 s2],[t1 t2],[s2 s3],[t2 t3],[s3 s4],[t3 t4],[s4 s5],[t4 t5],[s5 s6],[t5 t6],[s6 s1],[t6 t1],'linewidth',3,'color','green')
xlabel('Specific Entropy(J/K-Kg)')
ylabel('Temperature(C)')
title('Temperature v/s Specific Entropy')
hold off
%plotting specific enthalpy vs specific entropy plot
figure(2)
plot(sat_liq_s2,sat_liq_h,'color','b') %saturated liquid line
hold on
plot(sat_vap_s2,sat_vap_h,'color','b') %saturated vapour line
%marking the points
plot(s1,h1,'-O','markersize',5,'markerfacecolor','o')
plot(s2,h2,'-O','markersize',5,'markerfacecolor','o')
plot(s3,h3,'-O','markersize',5,'markerfacecolor','o')
plot(s4,h4,'-O','markersize',5,'markerfacecolor','o')
plot(s5,h5,'-O','markersize',5,'markerfacecolor','o')
plot(s6,h6,'-O','markersize',5,'markerfacecolor','o')
%joining points
plot([s1 s2],[h1 h2],[s2 s3],[h2 h3],[s3 s4],[h3 h4],[s4 s5],[h4 h5],[s5 s6],[h5 h6],[s6 s1],[h6 h1],'linewidth',3,'color','blue')
xlabel('Specific Entropy(J/Kg-K)')
ylabel('Specific Enthalpy(J/Kg)')
title('Specific Enthalpy v/s Specific Entropy')
hold off
%Calculating back work ratio and net work output of the Rankine cycle
W_exp = h1-h2; %For mass = 1kg
W_com = h4-h3; %for mass = 1kg
BACK_WORK_RATIO = W_com/W_exp
NET_WORK_OUTPUT = W_exp - W_com
OUTPUT:
The outputs generated are as follows:
CODE EXPLANATION:
)Firstly, I will start with the regular commands that are same for all codes, namely close all, clear all, and clc
2)Then, start taking inputs that are required, from the user, that are, the Input temperature, the input pressure and the output pressure
3)Then, I start calculating the state point variables one after another
4)Then, start plotting the required graphs
5)Finally, find out the Output works.
And yes, this code has to be executed in presence of the xsteam(originally XSteam, renamed xsteam by me) file in the same directory as of this code.
INPUTS:
Input temperature=400 C
Input Pressure=30 bar
Output Pressure=0.05 bar
ERRORS:
No major complicated errors were experienced by me.
REFERENCES:
Pk Nag Basic and Applied Engineering Thermodynamics