Challenge

Project 2 - Rankine cycle Simulator

i have tried to do this rankine projects. just i have done the codings for the rakine cycle

and i have understand how to get the file from the data source.

clear all
close all
clc

% Displaying
disp('RANKINE CYCLE ');
disp('1-2 is isentropic expansion in turbine');
disp('2-3 is constant pressure heat removal in condenser');
disp('3-4 is isentropic compression');
disp('4-1 is constant pressure heat addition in boiler')

% obtaining the input data

p1= input('nvaue of pressure at turbine inlet, p1(in bar)n =c');
T1= input('nvalue of temperature at turbine inlet, T1(in degree.c) =');
p2= input('nvalue of temperature at condenser inlet,p2(in bar) =');

% extracting the data
% state 1
h = xsteam('h_pT' ,p1,T1); % extracting enthalpy at state point 1
s1=xsteam('s_pT',p1,T1);

%state 2
s2=s1; % isentropic expansion
sf2=xstaem('sL_p',p2); %saturated liquid entropy
sg2=xsteam('sV_p',p2);
x2=(s2-sf2)/(sg2-sf2);
hf2=xsteam('hL_p',p2);
hg2=xsteam('hV_p',p2);
h2=hf2+(x2*(hg2-hf2));

%state 3 constant pressure heat rejection in condenser
p3=p2;
s3=xstem('sL_p',p3);
h3=xsteam('hL_p',p3);

%state 4
s4=s3;
p4=p1;

% worke done by turbine
Wt =h1-h2;

%work done to pump
v3=xsteam('vL_p',p3);
Wp=v3*(p4-p3)*100;
h4=h3+Wp;
%haet out the sysyem
Qout =h2-h3;
% thermal efficiency
eff=(Wnet/Qin)*100;
% specific steam consumption
% ssc = mass flow rate/power
ssc=(3600/Wnet);

%calculating temperature
T3 =xsteam('Tsat_p',p3);
T2=T3;
Cp4=xsteam('Cp_ps',p4,s4);
cV4=xsteam('Cv_ps',p4,s4);
k=Cp4/Cv4;
T4=T3/((p3/p4)^((k-1)/K));

%calculating temp, entropy and enthalpy
%line for plotting
T6=xsteam('Tsat_p',p1);
s5=xsteam('sL_p',p1);
s6=xsteam('sV_p',p1);
h5=xsteam('hL_p',p1);
h6=xsteam('hV_p',p1);
T5=T6;
%plotting
T =linspace(1,375,1000);
for i =1:length(T)
sf(i) =xsteam('sL_T',T(i));
sg(i)=xsteam('sV_T',T(i));
hf(i) =xsteam('hL_T',T(i));
hg(i)=xsteam('hV_T',T(i));
end
%plotting T-S diagram
figure (1)
hold on
plot(sf, T, 'r','linewidth',2)
plot(sg, T, 'r','linewidth',2)
plot([s1 s2],[T1 T2], 'k','linewidth',3)
plot([s2 s3],[T2 T3], 'k','linewidth',3)
plot([s3 s4],[T3 T4], 'k','linewidth',3)
plot([s4 s5],[T4 T5], 'K','linewidth',3)
plot([s5 s6],[T5 T6], 'K','linewidth',3)
sc1=linspace(s6,s1,1000);
for i=1:length(sc1)
Tc1(1) = xsteam('T_ps' ,p1,sc1(1));
end

plot(sc1,Tc1, 'k', 'linewidth',3)
text(s1+0.1, T1, '1')
text(s2+0.1,T2, '2')
text(s3,T3-20, '3')
text(s4,T4+20, '4')
title('temp vs entropy point')
xlabel('entopy ,s')
ylabel('temperature C ')
legend('saturation curve')

%plotting h-s diagram
figure(2)
hold on
plot(sf, hf,'r','linewidth',1)
plot(sg,hg, 'r','linewidth',1)
plot([s2 s2],[h1h2], 'k','linewidth',2)
plot([s2 s3],[h2 h3], 'k','linewidth',2)
plot([s3 s4],[h3 h4], 'k','linewidth',2)
hc = linspace(h4,h5,100);
for k =1:length(hc)
sch(k) = xsteam('s_ph',p1,hc(k));
end
plot(sch,hc, '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('enthalpy vs entropy plot')
xlabel('entropy ,S')
ylabel('enthalpy,H')
legend('saturation curve','location','northwest')

% displaying the results
disp('results')
fprintf('At state point 1:n');
fprintf('p1: %8.3f barn',p1);
fprintf('T1: %8.3f Cn',T1);
fprintf('h1: %8.3f kj/kgn',h1);
fprintf('s1: %8.3f kj/kgknn',s1);
fprintf('At state point 2:n');
fprintf('p2: %8.3f barn',p2);
fprintf('T2: %8.3f Cn',T2);
fprintf('h2: %8.3f kj/kgn',h2);
fprintf('s2: %8.3f kj/kgkn',s2);
fprintf('x2: %8.3fnn',x2);
fprintf('At state point 3:n');
fprintf('p3: %8.3f barn',p3);
fprintf('T3: %8.3f Kn',T3);
fprintf('h3: %8.3f kj/kgn',h3);
fprintf('s3: %8.3f kj/kgknn',s3);
fprintf('At state point 4:n');
fprintf('p4: %8.3f barn',p4);
fprintf('T4: %8.3f Kn',T4);
fprintf('h4: %8.3f kj/kgn',h4);
fprintf('s4: %8.3f kj/kgknn',s4);
fprintf('turbine work: %8.3f kj/kgn',Wt);
fprintf('pump work: %8.3f kj/kgn',Wp);
fprintf('Wnet: %8.3f kj/kgn',Wnet);
fprintf('Efficiency: %8.3f percent n',eff);
fprintf('S.S.C: %8.3f kj/kwh', SSC);

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.