Challenge

Project 2 - Rankine cycle Simulator

%rankine cycle
%process 1-2 isentropic expansion in turbine i.e work is done by turbine
%process2-3 constant pressure heat rejection
%process 3-4 isentropic compression from condenser pressure to pump
%process4-1 heat addition at constant pressure i.e isobaric heat heat addition
%process

clear all
close all
clc

% Given data

T1=input('input turbine inlet temp in degree celsius')% T1=400;
P1=input('input turbine inlet Pressure in bar')% P1=30bar P1=P4;
P2=input('input turbine outlet Pressure or condenser pressure in bar ')% P1=0.05bar P3=P2;
if P2>P1
fprintf('invalid input\n')
fprintf('\n condenser pressure should be less then turbine inlet pressure')
else

P3=P2;%equating pressure
P4=P1;
% calculation of enthalpy h3 process
h3=XSteam('hL_P',P3);%calling function to have specific enthalpy at particular pressure)
hg=XSteam('hV_P',P2);%the syntax suggest the call the xsteam func in which we want enthalpy(h) from saturated vapour region(v) for given pressure(p))
hfg3=hg-h3;%enthalpy which lies in wet region


% % calculation of entropy s3
s3=XSteam('sL_P',P3);%similarly we calculate entropy
sg=XSteam('sV_P',P2);
s4=s3;
sfg=sg-s3;%entropy at wet region
%calculation of dryness fraction at end of condenser


%Process 3-4 isentropic expansion process
%h1 is in super heated region as per steam tables
h1=XSteam('h_PT',P1,T1);
s1=XSteam('s_PT',P1,T1);
s2=s1;
x=(s2-s3)/sfg;%dryness fraction-the amount of liquid and gas present at particular instant ,coz if x is less impeller of pump %might get damaged,therefore x value is calculated after condensation of steam

%h4
h2=h3+x*(hfg3);

%work done by pump
%specific volume of water =0.001
Vw=0.001;
%work done by pump
Wp=Vw*(P1-P2)*10^5/1000; %kJ/kgk
%h3+wp=h4
h4=h3+Wp;
%process 4-1
%h4+qin=h1
%heat addition
qin=h1-h4;
%process 1-2 turbine , h1=wt+h2
%work done by turbine
Wt=h1-h2;
%process 2-3 h2=qr+h3
%heat rejection
qr= h2-h3;
%work done/output
work_done=Wt-Wp;
%efficiency
neff=work_done*100/qin;
%temp
T2=XSteam('t_hs',h2,s2);
T3=T2;
%cp value
Cp=XSteam('Cp_ps',P1,s1);%specific heat at constant pressure
Cv=XSteam('Cv_ps',P1,s1);%specific heat at constant volume
k=Cp/Cv;%gamma- it is the slope of how pressure is isentropically expanded with slope of 1.34
%t2=t1*(p2/p1)^0.4/1.4
T4=T3*(P4/P3)^((k-1)/k);%since expansion is isentropic processwe need to find the gamma value i.e specific heats of %vapour and liquid during thies process generally it ranges from 1.32 to 1.59

%entropy
s4_=XSteam('Sl_P',P4);%calculating entropy and temp in liquid and vapour region
s1_=XSteam('Sv_P',P1);
%
T4_=XSteam('t_ps',P4,s4_);
T1_=T4_;
%back work ratio
BWR=Wp/Wt;
%plotting saturation curve
T=linspace(1,500,1000);
for i=1:length(T)
sf(i)=XSteam('sL_T',T(i)); % TO GET ENTOPY/ENTHALPY OF Liquid and gas for the formation of curve through steam tables
sg(i)=XSteam('sV_T',T(i));
hf(i)=XSteam('hL_T',T(i));
hg(i)=XSteam('hV_T',T(i));
end
figure(1)
plot([s1_ s1 s2 s3 s4 s4_ s1_],[T1_ T1 T2 T3 T4 T4_ T1_])
grid on
hold on
plot(sf,T,'r','linewidth',1)

plot(sg,T,'b','linewidth',1)
xlabel('Entropy in Kj/kg k')
ylabel('Temp in degree C')
text(s1+0.1,T1,'1');
text(s2,T2,'2');
text(s3-0.5,T3,'3');
text(s4-0.5,T4,'4');
text(s4_,T4_,'4_')
text(s1_,T1_,'1_');
legend('Working of rankine pbtc','saturation liquid curve','saturation vapour curve')
figure(2)
hold on
plot(sf,hf,'r','linewidth',1)

plot(sg,hg,'b','linewidth',1)
plot([s1 s2 s3 s4 s1] , [h1 h2 h3 h4 h1])
text(s1+0.1,h1,'1');
text(s2-0.5,h2,'2');
text(s3+0.1,h3,'3');
text(s4,h4,'4');
grid on
xlabel('entropy in Kj/kg k');
ylabel('enthalpy in Kj/kg');
legend('saturation liquid curve','saturation vapour curve','Working of rankine pbtc');
%at state point 1
fprintf(' At state point 1\n')
fprintf('\n Pressure :%0.2f bar ;\n Temperature :%0.2f degree celsius; \nEnthalpy :%0.2f kJ/kg ;\n Entropy:%0.2f kJ/kg k \n', P1,T1,h1,s1)
%at state point 1_
fprintf('\n At state point 1_\n')
fprintf('\n Pressure :%0.2f bar ;\n Temperature :%0.2f degree celsius;\n Entropy:%0.2f kJ/kg k \n', P1,T1_,s1_)

%at state point 2
fprintf(' At state point 2\n')
fprintf('\n Pressure :%0.2f bar ;\n Temperature :%0.2f degree celsius; \nEnthalpy :%0.2f kJ/kg ;\n Entropy:%0.2f kJ/kg k \n', P2,T2,h2,s2)
%at state point 3
fprintf(' \nAt state point 3\n')
fprintf('\n Pressure :%0.2f bar ;\n Temperature :%0.2f degree celsius; \nEnthalpy :%0.2f kJ/kg ;\n Entropy:%0.2f kJ/kg k \n', P3,T3,h3,s3)
%at state point 4
fprintf('\n At state point 4\n')
fprintf('\n Pressure :%0.2f bar ;\n Temperature :%0.2f degree celsius; \nEnthalpy :%0.2f kJ/kg ;\n Entropy:%0.2f kJ/kg k \n', P4,T4,h4,s4)
%at state point 4_
fprintf('\n At state point 4_\n')
fprintf('\n Pressure :%0.2f bar ;\n Temperature :%0.2f degree celsius; \n Entropy:%0.2f kJ/kg k \n', P4,T4,s4_)
end

% error faced:

1.most of the errors well eliminated as problem was solve 1st manually and by step by step execution.

2.gamma value was considered as 1.4, was calculated later

%explanation of program

rankine cycle is an ideal cycle for steam power plants. it mainly consists of PBTC cycle, i.e pump , boiler ,turbine,condenser.

process 1-2 :isentropic expansion of gas in turbine providing turbine work.The steam from the boiler enters the turbine and rotates the turbine shaf

process2-3:isobaric condensation of steam with heat rejection.he condenser extracts the heat out of the low pressure steam, this way the steam turns into liquid.

process 3-4:pump : the steam is compressed adibatically by increasing pressure . the steam enters the pump in saturated liquid region.The compressed liquid is forced into the boiler.

process4-1: isothermal heat addition.,The heat is added into the boiler in such a way that the liquid turns into vapour. The heat addition process takes place isothermally that is the temperature does not changes

Back work ratio: ratio of compressor work to shaft or turbine work

%research

rankine cycle is more realistic ideal cycle then carnot cycle.carnot cycle consist of 4 process 2reversibleisotherms and 2reversible adiabats,wheras in rankine there are 4 process ,1 of them are isobaric and 2 of them are isentropic

%notations used by me 1st ly for wo.rking is shown in attached image

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.