Challenge

Project 2 - Rankine cycle Simulator

Error1

earlier i have used small t but then faced problem

sol-i changed small t with capital T so it is easier me to find temperature.

error 2

again same mistake not changed small t with capital T

here i have not used the command fprintf i have written frintf so correct it

clear all
close all
clc


% displaying process of rankine cycle
disp('rankine cycle simulator')
disp('process 1-2: isentropic expansion in the turbine work done by turbine')
disp('process 2-3: heat rejection from condensor at constant pressure')
disp('process 3-4: isentropic compression work done by feed water pump')
disp('process 4-1: heat addition at constant pressure')
disp('h=enthaplphy' )
disp('s=entropy')
disp('hL=enthalphy at liquid phase')
disp('hV=enthalphy at vapour phase')
disp('sL=entropy at liquid phase')
disp('sV=entropy at vapour phase')
disp('cp=specific heat at constant pressure')
disp('cp=specific heat at constant volume')
disp('gamma=cp/cv')


% feeding inputs
T1=input('entre the turbine inlet temp=     c')
p1=input('entre the turbine inlet pressure=    bar')
p2=input('entre the condensate inlet pressure=     bar')

% state variables 1
h1=XSteam('h_pt',p1,T1);
s2=XSteam('s_pt',p1,T1);
Tsat=XSteam('tsat_p',p1);

%state variable 2
% as entropy1=entropy2(both state points entropy is equal)
s1=s2;
%entropy at sub-cooled region
sL=XSteam('sL_p',p2);
% entropy at superheated region
sV=XSteam('sV_p',p2)
% difference of entropy between subcooled and superheated region
sLV2=sV-sL;
% s2=sL+x2*sLV2 Using formula
% calculating dryness fraction
x2=(s2-sL)/sLV2;
% enthalphy at sub-cooled region
hL=XSteam('hL_p',p2);
% enthalphy at superheated region
hV=XSteam('hV_p',p2)
% difference of enthalpy between subcooled and superheated region
hLV2=hV-hL;
%finding enthalpy at state variable 2
h2=hL+x2*hLV2;
% finding temperature at state variable 2
T2=XSteam('Tsat_p',p2);

% finding variable at state point 3
T3=T2
p3=p2
specific_volume=XSteam('vL_p',p2);
% calculating pump work
work_pump=specific_volume*(p1-p2)*100
h3=XSteam('hL_p',p3);
s3=XSteam('sL_p',p3);

% calculating state variable at point 4
p4=p1;
h4=h3+work_pump;
s4=s3;
% calculating  heat at constant pressure
cp=XSteam('Cp_ps',p4,s4);
%specific heat at constant volume 
cv=XSteam('Cv_ps',p4,s4);
gamma=cp/cv;
% T4/T3=(p4/p3)^(gamma-1)/gamma;
T4=T3*((p4/p3)^(gamma-1)/gamma);

% calculating at state variable 5
h5=XSteam('hL_p',p1)
s5=XSteam('sL_p',p1)
T5=Tsat;

% calculating at state variable 6
T6=T1;
h6=XSteam('hV_p',p1)
s6=XSteam('sV_p',p1)

work_turbine=h1-h2;
% calculating work_net

work_net=work_turbine+work_pump;

% thermal_efficiency=(work_turbine+work_pump)/heat_input(Q1)

thermal_efficiency=((work_turbine+work_pump)/(h1-h4))*100;

% calculating  back work ratio

backwork_ratio=work_pump/work_turbine;

T=linspace(0,400,500)
for i=1:length(T)
    sL(i)=XSteam('sL_T',T(i));
    hL(i)=XSteam('hL_T',T(i));
    sV(i)=XSteam('sV_T',T(i));
    hV(i)=XSteam('hV_T',T(i));
end
% plotting T-s graph
figure(1)
hold on
grid on
plot(sL,T,'color','b');
plot(sV,T,'color','r');
plot([s1 s1],[T1 T2],'color','m');
text(s1,T1,'state 1')
plot([s2 s3],[T2 T3],'color','m');
text(s2,T2,'state 2')
plot([s3 s4],[T3 T4],'color','m');
text(s3,T3,'state 3')
plot([s4 s5],[T4 T5],'color','m');
text(s4,T4,'state 4')
plot([s5 s6],[T5 Tsat],'color','m')
text(s5,T5,'state 5')
plot([s6 s1],[T6 T1],'color','m')
text(s6,T6,'state 6')
xlabel('entropy(KJ/KG K)')
ylabel('Temperature c')
title('temperature vs entropy curve')
legend('saturated liquid curve','saturated vapour curve','turbine work','heat rejection','pump work','sensible heat','latent heat','superheating')


% plotting T-h graph
figure(2)
hold on
grid on
plot(hL,T,'color','b');
plot(hV,T,'color','r');
plot([h1 h2],[T1 T2],'color','m');
text(h1,T1,'state 1')
plot([h2 h3],[T2 T3],'color','m');
text(h2,T2,'state 2')
plot([h3 h4],[T3 T4],'color','m');
text(h3,T3,'state 3')
plot([h4 h5],[T4 T5],'color','m');
text(h4,T4,'state 4')
plot([h5 h6],[T5 Tsat],'color','m')
text(h5,T5,'state 5')
plot([h6 h1],[T6 T1],'color','m')
text(h6,T6,'state 6')
xlabel('enthalphy(KJ/KG)')
ylabel('Temperature c')
title('temperature vs enthalphy curve')
legend('saturated liquid curve','saturated vapour curve','turbine work','heat rejection','pump work','sensible heat','latent heat','superheating')

% print all results

fprintf('                  RESULT\n                              ')
% at state 1
fprintf('at state point 1\n')
fprintf('pressure at turbine inlet p1= %f bar\n',p1)
fprintf('temperature at turbine inlet T1= %f degree celcius\n',T1)
fprintf('enthalphy at turbine inlet h1= %f KJ/KG\n',h1)
fprintf('entropy at turbine inlet s1= %f KJ/KG-K\n',s1)

% at state 2
fprintf('at state point 2\n')
fprintf('pressure at condensor inlet p2= %f bar\n',p2)
fprintf('temperature at condensor inlet T2= %f degree celcius\n',T2)
fprintf('enthalphy at condensor inlet h2= %f KJ/KG\n',h2)
fprintf('entropy at condensor inlet s2= %f KJ/KG-K\n',s2)
fprintf('dryness fraction of steam x2=%f\n',x2)

% at state 3
fprintf('at state point 3\n')
fprintf('pressure at feed water pump inlet p3= %f bar\n',p3)
fprintf('temperature at feed water pump inlet T3= %f degree celcius\n',T3)
fprintf('enthalphy at feed water pump inlet h3= %f KJ/KG\n',h3)
fprintf('entropy at feed water pump inlet s3= %f KJ/KG-K\n',s3)

% at state 4
fprintf('at state point 4\n')
fprintf('pressure at boiler inlet p4= %f bar\n',p4)
fprintf('temperature at boiler inlet T4= %f degree celcius\n',T4)
fprintf('enthalphy at boiler inlet h4= %f KJ/KG\n',h4)
fprintf('entropy at boiler inlet s4= %f KJ/KG-K\n',s4)

fprintf('thermal efficiency=%f\n',thermal_efficiency)
fprintf('work_net=%f\n',work_net)
fprintf('backwork_ratio=%f\n',backwork_ratio)








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.