Challenge

Project 2 - Rankine cycle Simulator

CANT RESOLVE ERROE 


% A program for writing state points of a rankine cylce

clear all
close all
clc

% Inputs
t1 = input('temperature at turbine inlet(c) : ');
p1 = input('pressure at turbine inlet(bar) : ');
p2 = input('pressure at condenser : ');


fprintf('n rankine cycle stimulator');
fprintf('n 1-2 Isentropic Expansion in turbine');
fprintf('n 2-3 Constsnt pressure heat rejection in condenser');
fprintf('n 3-4 Isentropic compression in pump');
fprintf('n 4-1 Constant pressure heat addition in boiler');

% at state 1
% p1 & t1 are given
h1 = XSteam('h_pT', p1,t1);
s1 = XSteam('s_pT', p1,t1);


% at state 2
% 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 );

% at atate 3
p3 = p2;
h3=XSteam('hL_p',p3 );
s3=XSteam('sV_p', p3 );
t3=XSteam('Tsat_p', p3 );
t2=t3;

% at state 4
p4=p1;
s4=s3;
t5= XSteam('h_ps',p4,s4);
t6=t5;
s5= XSteam('h_ps',p1);
s6= XSteam('h_ps',p1);
h5= XSteam('h_ps',p1);
h6= XSteam('h_ps',p1);

% turbine work
wt=h1-h2;

% pump work
wp=h4-h3;

% net work in kj/kg
w=wt-wp;

% heat in and heat out
Q_in=h1-h4;
Q_out=h2-h3;

%thermal eff
nthe=(w/Q_in)*100;

% steam rate in kg/wh
ssc=3600/w;

%back work ratio
BWR=(h1-h4)/(h2-h3);

% 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
plot('T S diagram')
plot([s1 s2],[t1 t2], 'linwidth', 3,color,'b');
plot([s2 s3],[t2 t3], 'linwidth', 3,color,'b');
plot([s3 s4],[t3 t4], 'linwidth', 3,color,'b');
plot([s4 s5],[t4 t5], 'linwidth', 3,color,'b');
xlabel('entropy in kj/kgK')
ylabel('temperature in deg c')

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 , 'linwidth', 3,color,'b')
plot(s_l, T, 'linwidth', 1.5,color,'r')
plot(s_V, T, 'linwidth', 1.5,color,'r')

text(s1,t1,'1','FontSize',15)
text(s2,t2,'1','FontSize',15)

text(s3,t3,'1','FontSize',15,'VerticalAlignment','top')
text(s4,t4,'1','FontSize',15,'VerticalAlignment','bottom')
text(s5,t5,'1','FontSize',15,'VerticalAlignment','bottom')
text(s6,t6,'1','FontSize',15,'VerticalAlignment','bottom')

figure(2);
hold on
plot('H S diagram')
plot([s1 s2],[h1 h2], 'linwidth', 2,color,'b');
plot([s2 s3],[h2 h3], 'linwidth', 2,color,'b');
plot([s3 s4],[h3 h4], 'linwidth', 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=length(h_6);
s_6(m)=XSteam('s_ph',p1,h_6(m));
end

plot(s_4, h_4 , 'linwidth', 2,color,'b')
plot([s6 h6],[h5 h6], 'linwidth',2,color,'b')
plot(s_6, h_6, 'linwidth', 1.5,color,'b')
xlabel('specific entropy in kj/kgK')
ylabel('specific enthalpy in kj/kg')
plot(s_1, h_1 , 'linwidth', 2,color,'r')
plot(s_v, h_v , 'linwidth', 2,color,'r')

text(s1,h1,'1','FontSize',15)
text(s2,h2,'1','FontSize',15)

text(s3,h3,'1','FontSize',15,'VerticalAlignment','top')
text(s4,h4,'1','FontSize',15,'VerticalAlignment','bottom')
text(s5,h5,'1','FontSize',15,'VerticalAlignment','bottom')
text(s6,h6,'1','FontSize',15,'VerticalAlignment','bottom')

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.