Challenge

Project 2 - Rankine cycle Simulator

PROGRAM:

% RANKINE CYCLE PROGRAM

clear all
close all
clc

fprintf('RANKINE CYCLE SIMULATOR PROGRAM ')
fprintf('1-2: Isentropic Expansion in the Turbine ')
fprintf('2-3: Constant Expansion Heat rejection in the Condensor ')
fprintf('3-4: Isentropic Compression in the Pump ')
fprintf('4-1: Constant Pressure Heat Addition in the Boiler ')

% INPUTS
P1=input('Enter the pressure at the Turbine Inlet (in bar):');
T1=input('Enter the tempereture at the Turbine Inlet (in Degree Celcius):');
P2=input('Enter the Pressure at the Condensor (in bar):');

% HIGH PRESSURE LINE
Tsat1 = XSteam('Tsat_p',P1);
Cpv1 = XSteam('CpV_p',P1);
Cpl1 = XSteam('CpL_p',P1);
Cpv4 = XSteam('CpV_p',P1);
Cpl4 = XSteam('CpL_p',P1);

% POINT1
hg1 = XSteam('hV_p',P1);
Sg1 = XSteam('SV_p',P1);

% POINT4
hf1 = XSteam('hL_p',P1);
Sf1 = XSteam('SL_p',P1);

% LOW PRESSURE LINE
Tsat2 = XSteam('Tsat_p',P2);
Cpv2 = XSteam('CpV_p',P2);
Cpl2 = XSteam('CpL_p',P2);
Cpv3 = XSteam('CpV_p',P2);
Cpl3 = XSteam('CpL_p',P2);

% POINT2

hg2 = XSteam('hV_p',P2);
Sg2 = XSteam('SV_p',P2);

% POINT3

hf2 = XSteam('hL_p',P2);
Sf2 = XSteam('SL_p',P2);

% STATING VARIABLES

% POINT1

h1 = XSteam('h_pT',P1,T1);
S1 = XSteam('S_pT',P1,T1);

% POINT2

S2 = S1;
if (S2 <= Sg2)
    x2 = (S2-Sf2)/(Sg2-Sf2);
else
    x2 = 1;
end
if(x2 < 1)
    T2 = Tsat2;
    h2 = hf2 + x2*(hg2-hf2);
else
    % S2 = Sg2 + Cpv2*ln(T2+273/Tsat+273)
    T2 = ((Tsat2 + 273)*exp((S2-Sg2)/Cpv2)) - 273;
    h2 = hg2 + Cpv2*(T2 - Tsat2);
end

% POINT3

P3 = P2;
T3 = Tsat2;
h3 = hf2;
S3 = Sf2;
V3 = XSteam('vL_p',P3);

% POINT4

P4 = P1;
S4 = S3;
Wp = (P4-P3)*V3*100;
% Wp = h4-h3
h4 = h3+Wp;
% S4 = Sf1 + Cpl4*ln(T4/Tsat1)
T4 = (Tsat1*exp((S4-Sf1)/Cpl4));
Wt = h1-h2;
Wnet = Wt-Wp;
Qin = h1-h4;
Qout = h2-h3;
Ntherm = Wnet/Qin;
S.S.C = 3600/Wt;

% SATURATION CURVE

T = linspace(1,373,50);
for i = 1:length(T)
    hl(i) = XSteam('hL_T',T(i));
    hv(i) = XSteam('hV_T',T(i));
    Sl(i) = XSteam('SL_T',T(i));
    Sv(i) = XSteam('SV_T',T(i));
end

% OUTPUT

fprintf('    RESULTS ')
fprintf('nAt state point 1: n')
fprintf('P1 = %f bar n' ,P1)
fprintf('T1 = %f Degree Celcius n' ,T1)
fprintf('h1 = %f KJ/Kg n' ,h1)
fprintf('S1 = %f KJ/KgK n' ,S1)
fprintf('nAt state point 2: n')
fprintf('P2 = %f bar n' ,P2)
fprintf('T2 = %f Degree Celcius n' ,T2)
fprintf('h2 = %f KJ/Kg n' ,h2)
fprintf('S2 = %f KJ/KgK n' ,S2)
fprintf('nAt state point 3: n')
fprintf('P3 = %f bar n' ,P3)
fprintf('T3 = %f Degree Celcius n' ,T3)
fprintf('h3 = %f KJ/Kg n' ,h3)
fprintf('S3 = %f KJ/KgK n' ,S3)
fprintf('nAt state point 4: n')
fprintf('P4 = %f bar n' ,P4)
fprintf('T4 = %f Degree Celcius n' ,T4)
fprintf('h4 = %f KJ/Kg n' ,h4)
fprintf('S4 = %f KJ/KgK n' ,S4)
fprintf('nOther parameters: n')
fprintf('Wt = %f KJ/Kg n', Wt)
fprintf('Wp = %f KJ/Kg n', Wp)
fprintf('Wnet = %f Kj/Kg n', Wnet)
fprintf('Ntherm = %f percent n', Wp)
fprintf('S.S.C = %f Kg/Kwhr n', S.S.C)

% PLOT

figure(1)
hold on
plot(Sl,T,'linewidth',2,'linestyle','--','color','b')
plot(Sv,T,'linewidth',2,'linestyle','--','color','k')
plot([S1 S2],[T1 T2],'linewidth',2,'color','r')
plot([Sg2 S3],[Tsat2 T3],'linewidth',2,'color','g')
plot([S3 S4],[T3 T4],'linewidth',2,'color','c')
plot([Sf1 Sg1],[Tsat1 Tsat1],'linewidth',2,'color','m')
plot([S2 Sg2],[T2 Tsat2],[Sg2 S3],[Tsat2 T3],'linewidth',2,'color','g')
plot([S4 Sf1],[T4 Tsat1],'linewidth',2,'color','m')
plot([Sg1 S1],[Tsat1 T1],'linewidth',2,'Color','m')
text(S1,T1,' 1'); text(S2,T2,' 2'); text(Sg2, Tsat2,' 2*')
text(S3,T3,'3','HorizontalAlignment','right','VerticalAlignment','bottom')
text(S4,T4,'4','HorizontalAlignment','right','VerticalAlignment','bottom')
text(Sf1,Tsat1,' 4*','HorizontalAlignment','right','VerticalAlignment','bottom')
text(Sg1,Tsat1,' 1*')
xlabel('ENTROPY')
ylabel('TEMPERATURE')
title('T-S DIAGRAM')
legend('Liquid Curve','Vapour Curve','Turbine','Condenser','Pump','Boiler')
hold off

figure(2)
hold on
plot(S1,hl,'linewidth',2,'linestyle','--','color','b')
plot(Sv,hv,'linewidth',2,'linestyle','--','color','k')
plot([S1 S2],[h1 h2],'linewidth',2,'color','r')
plot([S2 S3],[h2 h3],'linewidth',2,'color','g')
plot([S3 S4],[h3 h4],'linewidth',2,'color','c')
plot([S4 S1],[h4 h1],'linewidth',2,'color','m')
text(S1,h1,' 1'); text(S2,h2,' 2')
text(S3,h3,' 3','HorizontalAlignment','right','VerticalAlignment','top')
text(S4,h4,' 4','HorizontalAlignment','right','VerticalAlignment','bottom')
xlabel('ENTROPY')
ylabel('ENTHALPY')
title('h-s DIAGRAM')
legend('Liquid Curve','Vapour Curve','Turbine','Condenser','Pump','Boiler')
hold off

Explanation:

Step 1: First in the beginning of the program include 'clear all','close all' and 'clc' commands.

Step 2: Give the appropriate inputs for running the program in a smoother manner.

Step 3: Give the inputs for high pressure line.

Step 4: Give the inputs for low pressure line.

Step 5: After that give the stating variable inputs.

Step 6: Then give the saturation curve inputs.

Step 7: Give the input for the output of the program.

Step 8: Now, Give proper inputs for plotting the graph.

Step 9: Give inputs for plotting the figure 1.

Step 10: Give the inputs for plotting the figure 2.

Errors:

No major errors occured during the programming of Rankine Cycle.

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.