Challenge

Project 2 - Rankine cycle Simulator

Aim :

Creation of rankine cycle from the given inputs

Description :

The rankine cycle is one of the vapour powered cycle.This is somewhat different than gas powered cycle in which working fluid remained gas throughout the entrie cycle.In vapour powered cycle the working fluid is steam because of its many desirable characteristics such as low cost production,availability and high enthalapy of vapouration.There are many impracticalities assosiated with carnot cycle which can be eliminated by superheating the steam and condense in condenser which makes it best for nuclear power plants and other steam realated power generation sources.

The process in rankine cycle :

1.Isentropic Compression in pump.

2.Constant pressure heat addition in boiler.

3.Isentropic expansion in a turbine.

4.Constant pressure heat rejection in condensor.

Water enters the pump at state 1 as saturated liquid and is compressed isentropically to the operating pressure of the boiler.The water temperature increases due to a slight decrease in the specific volume of water .The vertical distance betweeen states 1 and 2 on the T-s diagram is greatly exggerated for clarity.

When water enters the boiler as a compressed liquid as state 2 and leaves as a superheated vapour at state 3.The boiler is basically as large heat exchanger where the heat originating from combustion gases,nuclear reactors or other power sources is transfered to the water essentiallyat constant pressure.The boiler together with the section where the steam is superheated is often called the steam generator.

The superheated vapour at state 3 enters the turbine,where it expands isentropically and produces work by rotating the shaft connected to an electric genrator.The pressure and the temprature of steam drop during this process to the values at state 4,where the steam enters the condensor.At this state,steam is usually a saturated liquid-vapor mixture with a high quality.Steam is condensed at constant pressure in the condensor,which is basically a large heat exchager,by rejecting heat to a cooling medium such as like,river,or the atmosphere.Steam leaves the condesor as saturated liquid and enters the pump,completing the cycle,In areas where water is precious,the power plants are cooled by air instead of water.This method of cooling which is also used in car engiens,is called dry cooling.

(Qin-Qout)+(Win-Wout)=he-hi

The boiler and condensor are not involved in any mechanical work whereas pump and turbine are ssumed to isentropuc in nature while working throughtout the cycle,then conservation of energy relation for each device can be expressed as:

Wpump=h3-h1

where,

h1=hfatP1 and v1 = vfatP1

Heat added in boiler given as

Qin = h3-h2

The work which can be taken out of cycle from turbine

Wout = h3-h4

The heat removed from the condesor

Wout = h4-h1

The thermal efficiency of rankine cycle is

Wnet/Qin = 1-Qnet/Qin

Code explanation:

1.The creation of Rankine cycle simulator starts with some input value which are requried to calculate the other state point in the cycle eventually.

2.The rankine cycle process is displayed in the command window and then inputs are entered which are inlet pressure for tubine, temperature at turbine inlet and pressure at condensor.

3.Then we are using XSteam function file for reading state point.First,we get the value of enthaply and entrophy at state point 1 from the XSteam function file.

4.As process from 1-2 is isentropic compression the entropy at point 1 is equal to point 2.The term (s_pT,p1,t1)'refers to entropy at pressure and temperature point 1.

5.The term 'sg' and 'sf' are reffered ti saturated liquid and saturated vapour entropy respectively.This value is used to calculate other function according to mathematical realtions.

6.Similarly other points are taken from XSteam function file which are necesary to calculate other parameters.After that work is done in turbine and pump are calculated for further getting the net work done rankine cycle.

7. Similarly now calculate the heat added and heat rejected with these values calcualte the thermal efficiency.

8.Now plot the liquid and vapour curves by using the saturated liquid and saturated vapour 's_l' and 's_v' give the color and linewidth.

9.Now plot the work done by turbine(1-2 process) give linewidth and color.

10.In the same way plot the curves for remaining 3 other process and give color and linewidths.

11.Now take XSteam of saturated vapour temperatures and tq and plot sq,sp,tp,tq and hold on.

12.In the same way plot sq,s1 and tp ,t1 and hold n now indicate the states with numbers as s1,t1 has state 1 so on till state 4.

13.Now plot the graph for enthalapy and entrophy in figure 2 and label the x and y axis and give the title has h-s diagram.

14. Now plot the entrophy and temperature values respectively s1,s2,s3,s4 and t1,t2,t3,t4 and give color and linewidth.

15.Again plot liquid and vapour saturation curves for the figure 2 and give color and linewidth.

16. Now indicate the states of entropy and enthalapy with numbers 1 to 4 .

17.Finally result out puts from state 1 to 4 is given from the command fprintf pressure is denoted has bar and temperature is denoted from degree

18.And also the out put of work output ,themal efficiency and net work and heat input in boiler is also printed usinfg printf.

ERRORS FACED WHILE PROGRAMMING:

1. Unable to read the file XSteam.

2.error in results showing different variable name.

STEPS TAKEN TO OVERCOME:

1. Take XSteam has a function not has a file.

2.Input entropy enthalpy anf temperature values correctly in the result while printing.

RESULTS:

OUTPUT:

ERROR:

clear all
close all
clc

% user inputs
fprintf('75s','Rankine Cycle Simulator');
fprintf('\n \n \n')
fprintf('1-2 is isentropic expsnsion in the turbine \n');
fprintf('2-3 is constant pressure heat rejectiom by the condensor \n');
fprintf('3-4 is isentropic compresion in the pump \n')
fprintf('4-1 is constant pressure heat addition by the boiler \n \n');

% inputs 
p1 = input('Enter the pressure(in bar) at the inlet of the turbine(at point 1):');
t1 = input('Enter the temperature(in degree) at the inlet of the turbine(at point 1):');
p2 = input('Enter the pressure(in bar) at the inlet of the condensor(at point2):');

%asp =d('XSteam.m');

% inputs to the turbine
s1 = XSteam('s_pT',p1,t1);
h1 = XSteam('h_pt',p1,t1);

% condensor inlet
s2 = s1;          %1-2 is an isentropic expansion process
sf2 = XSteam('sL_p',p2);
sg2 = XSteam('sV_p',p2);
hf2 = XSteam('hL_p',p2);
hg2 = XSteam('hV_p',p2);

% calculating the dryness fraction
if(s2<=sg2)
    x2 = ((s2 - sf2) / (sg2-sf2));  %dryness fraction at state point 2
else
    x2 = 1;
end
h2 = hf2+(x2*(hg2-hf2));

% condensor exit
p3 = p2;
t3 = XSteam('Tsat_p',p3);
s3 = XSteam('sL_p',p3);
h3 = XSteam('hL_p',p3);
v3 = XSteam('vL_p',p3);
t2 = t3;

% boiler inlet
p4 = p1;    % constant pressure heat addition
s4 = s3;    % isentropic compression in the pump
h4 = XSteam('h_ps',p4,s4);
cp4 = XSteam('Cp_ps',p4,s4);
cv4 = XSteam('Cv_ps',p4,s4);
g4 = (cp4/cv4);

% calculation for t4
%p4^(1-gamma)*t4^gamma=p3^(1-gamma)*t3^gamma;
t4 = (t3*((p3/p4)^((1-g4)/g4)));


%calculations
%work done by ther turbine
Wt = h1-h2;


% work done by the pump
Wp = h4-h3;

% net work done
W_net = Wt-Wp;

% heat added in the boiler
q_in = h1-h4;

% heat rejected in the condensor
q_out = h2-h3;

% thermal efficiency 
n = (W_net/q_in)*100;

% plotting the results

figure(1)

% plotting liquid and vapour curves
t = linspace(1,t1,1000);
for i = 1:length(t)
    s_l(i) = XSteam('sL_T',t(i));
end

for i = 1:length(t)
    s_v(i) = XSteam('sV_T',t(i));
end

hold on 
plot(s_l,t,'linewidth',2,'linestyle','--','Color','r')
plot(s_v,t,'LineWidth',2,'LineStyle','--','Color','r')
grid on 

% plotting for the work done by the turbine(process 1-2)
plot([s1,s2],[t1,t2],'LineWidth',2,'Color','k')
hold on
title('T-s Diagram of ideal rankine Cycle')
xlabel('Entrophy(KJ/Kg K)')
ylabel('Temperature(k)')


% plotting for the heat rejection in the condensor(process 2-3)
plot([s2,s3],[t2,t3],'LineWidth',2,'Color','k')
hold on 

% plotting for work done by the pump(process 3-4)
plot([s3,s4],[t3,t4],'linewidth',2,'Color','k')
hold on 

%plotting for heat added by the boiler (process 4-1)
tp =  XSteam('TSat_p',p4);
sp = XSteam('sL_T',tp);
plot([s4,sp],[t4,tp],'LineWidth',2,'Color','k')
hold on 

tq = tp;
sq = XSteam('sV_T',tq);
plot([sp,sq],[tp,tq],'linewidth',2,'color','k')
hold on 

plot([sq,s1],[tp,t1],'linewidth',2,'color','k')
hold on

% Indicate states with numbers
text(s1,t1,'1');
text(s2,t2,'2');
text(s3,t3,'3');
text(s4,t4,'4');

% plot for enthalapy and entrophy 
figure(2)


plot([s1,s2],[h1,h2],'linewidth',2,'color','k')
grid on 
title('h-s DIAGRAM')
xlabel('Entrophy(KJ/KgK)')
ylabel('Enthalapy(KJ/Kg)')
hold on 

plot([s2,s3],[t3,t4],'LineWidth',2,'color','k')
hold on 
plot([s3,s4],[h3,h4],'linewidth',2,'color','k')
hold on 
plot([s4,s1],[h4,h1],'linewidth',2,'color','k')

% plot for liquid and vapour saturation curve

t = linspace(1,t1,1000);
for j = 1:length(t)
    h_l(j) = XSteam('hL_T',t(j));
end

for j = 1:length(t)
    h_v(j)  = XSteam('hV_T',t(j));
end

plot(s_l,h_l,'linewidth',2,'color','r')
hold on 
plot(s_v,h_v,'linewidth',2,'color','r')

% indicate states with numbers
text(s1,h1,'1');
text(s2,h2,'2');
text(s3,h3,'3');
text(s4,h4,'4');

% results output 
fprintf('%40s  \n \n \n','RESULT');
fprintf('%10s %54s \n','At State  Point 1','At State point 2');
fprintf('%s %.2f%s %44s %.2f%s \n','P1:',p1,'bar','P2:',p2,'bar');
fprintf('%s %.2f%s %35s %.2f%s \n','T1:',t1,'bar','T2:',t2,'bar');
fprintf('%s %.2f%s %40s %.2f%s \n','H1:',h1,'bar','H2:',h2,'bar');
fprintf('%s %.2f%s %42s %.2f%s \n','S1:',s1,'bar','S2:',s2,'bar');
fprintf('%58s  %.2f \n \n','X2:',x2);
fprintf('%10s %54s \n','At State Pt 3','At State Point 4');
fprintf('%s %s.2f%s %45s %.2f%s \n','P3:',p3,'bar','P4:',p4,'bar');
fprintf('%s %s.2f%s %35s %.2f%s \n','T3:',t3,'Deg Celcius','T4:',t4,'Deg Celcius');
fprintf('%s %s.2f%s %41s %.2f%s \n','H3:',h3,'bar','H4:',h4,'bar');
fprintf('%s %s.2f%s %42s %.2f%s \n \n','S3:',s3,'KJ/KgK','S4:',s4,'KJ/KgK');

fprintf('%40s %.2f %s \n','Work output by Turbine(Wt):',Wt,' KJ/Kg');
fprintf('%40s %.2f %s \n','Work input by Pump(Wp):',Wp,' KJ/Kg');
fprintf('%40s %.2f %s \n','Net Work(Wnet):',W_net,' KJ/Kg');
fprintf('%40s %.2f %s \n','Thermodynamic Efficiency(Ntherm):',n,' Percent');
fprintf('%40s %.2f %s \n','Heat input in Boiler:',q_in, 'KJ/Kg');
fprintf('%40s %.2f %s \n','Heat rejected in condenser:',q_out,'KJ/Kg');
fprintf('%40s %.2f %s \n','S.S.C.:):',p3, 'Kg/KWh');





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.