Challenge

Project 2 - Rankine cycle Simulator

AIM:

To write a program in MATLAB/OCTAVE to create a Rankine Cycle Simulator.

OBJECTIVE:

  • code should calculate the state points of the Rankine Cycle (any type of your choice) based on user inputs.
  • plot the corresponding T-s and h-s plots for the given set of inputs.
  • Required Inputs:

Turbine Inlet temperature = 400° C

Turbine Inlet Pressure = 30 bars

Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure

  • Calculate the followings,
  • Net work output
  • Back work ratio

THEORY:

The Rankine cycle or Rankine Vapor Cycle is the process widely used by power plants such as coal-fired power plants or nuclear reactors. In this mechanism, a fuel is used to produce heat within a boiler, converting water into steam which then expands through a turbine producing useful work. This process was developed in 1859 by Scottish engineer William J.M. Rankine. This is a thermodynamics cycle which converts heat into mechanical energy—which usually gets transformed into electricity by electrical generation.

Figure 1. A simple schematic with components for the Rankine Cycle.

Figure 2. The pressure-volume diagram of the Rankine cycle. This illustrates the changes in pressure and volume the working fluid (water) undergoes to produce work.

The steps in the Rankine Cycle as shown in Figure 1 and the corresponding steps in the pressure-volume diagram (figure 2) are outlined below:

Pump: Compression of the fluid to high pressure using a pump (this takes work) (Figure 2: Steps 3 to 4)

Boiler: The compressed fluid is heated to the final temperature (which is at boiling point), therefore, a phase change occurs—from liquid to vapour. (Figure 2: Steps 4 to 1)

Turbine: Expansion of the vapour in the turbine. (Figure 2: Steps 1 to 2)

Condenser: Condensation of the vapour in the condenser (where the waste heat goes to the final heat sink (the atmosphere or a large body of water (ex. lake or river). (Figure 2: Steps 2 to 3)

The efficiency of the Rankine cycle is limited by the high heat of vaporization by the fluid. The fluid must be cycled through and reused constantly, therefore, water is the most practical fluid for this cycle. This is not why many power plants are located near a body of water—that's for the waste heat.

As the water condenses in the condenser, waste heat is given off in the form of water vapour—which can be seen billowing from a plant's cooling towers. This waste heat is necessary for any thermodynamic cycle. Due to this condensation step, the pressure at the turbine outlet is lowered. This means the pump requires less work to compress the water—resulting in higher overall efficiencies.

FIGURE 1:

FIGURE 2:

FIGURE 3:

BODY:

Code:

clear all
close all
clc

fprintf('------------------------RANKINE CYCLE SIMULATOR---------------------\n\n')
fprintf('1-2 is Isentropic expansion in the turbine \n')
fprintf('2-3 is Constant pressure heat rejection by the condenser \n')
fprintf('3-4 is Isentropic compression in the pump \n')
fprintf('4-1 is Constant pressure heat addition by the boiler \n\n')

%taking the inputs from the user
prompt = 'ENTER THE TURBINE INLET TEMPERATURE \n';
t1=input(prompt);
prompt = 'ENTER THE TURBINE INLET PRESSURE \n';
p1=input(prompt);
prompt = 'ENTER THE TURBINE OUTLET PRESSURE \n';
p2=input(prompt);

fprintf('\n\n-----------------------------RESULTS----------------------------\n\n')

fprintf('At state point 1 \n')
%finding parameters at point 1
v1=XSteam('v_pt',p1,t1)              %specific volume
t1                                   %temperature
p1                                   %pressure
s1=XSteam('s_pt',p1,t1)              %specific entropy
h1=XSteam('h_pt',p1,t1)              %specific enthalpy

fprintf('At state point 2 \n')
%finding parameters at point 2
v2=v1
t2=XSteam('tsat_p',p2)
p2
s2=s1
xa=XSteam('x_ps',p2,s2);
h2=XSteam('h_px',p2,xa)

fprintf('At state point 3 \n')
%finding parameters at point 3
v3=XSteam('vl_p',p2)
t3=t2
p3=p2
s3=XSteam('sl_p',p2)
h3=XSteam('hl_p',p2)

fprintf('At state point 4 \n')
%finding parameters at point 4
v4=v3
p4=p1
s4=s3
t4=XSteam('t_ps',p4,s4)
h4=XSteam('h_pt',p4,t4)

fprintf('At state point 5 \n')
%finding parameters at point 5
t5=XSteam('tsat_p',p1)
v5=XSteam('vl_p',p1)
s5=XSteam('sl_p',p1)
p5=p1
h5=XSteam('hl_p',p1)

fprintf('At state point 6 \n')
%finding parameters at point 6
t6=t5
v6=XSteam('vv_p',p1)
s6=XSteam('sv_p',p1)
p6=p1
h6=XSteam('hv_p',p1)

if(t1==0)
    fprintf('The cycle cannot have %f as the inlet temperature of the cycle',t1)
end

temp=linspace(0,t1,500);

%finding different parametres for drawing the saturated liquid line and
%saturated vapour line in t-s and h-s plots
for i=1:500
sat_liq_s1(i) =XSteam('sl_t',temp(i));               %saturated liquid entropy
sat_vap_s1(i) =XSteam('sv_t',temp(i));               %saturated vapour entropy
sat_liq_h(i) =XSteam('hl_t',temp(i));                %saturated liquid enthalpy
sat_vap_h(i) =XSteam('hv_t',temp(i));                %saturated vapour enthalpy
psat(i)=XSteam('psat_t',temp(i));                    %saturated pressure 
sat_liq_s2(i) =XSteam('s_ph',psat(i),sat_liq_h(i));  %saturated liquid entropy at a particular pressure and enthalpy
sat_vap_s2(i) =XSteam('s_ph',psat(i),sat_vap_h(i));  %saturated vapour entropy at a particular pressure and enthalpy
end

%plotting temperature vs specific entropy plot
figure(1)
plot(sat_liq_s1,temp,'color','b')                        %saturated liquid line
hold on
plot(sat_vap_s1,temp,'color','b')                        %saturated vapour line
%marking the points
plot(s1,t1,'-O','MarkerSize',5,'MarkerFaceColor','k')
plot(s2,t2,'-O','MarkerSize',5,'MarkerFaceColor','k')
plot(s3,t3,'-O','MarkerSize',5,'MarkerFaceColor','k')
plot(s4,t4,'-O','MarkerSize',5,'MarkerFaceColor','k')
plot(s5,t5,'-O','MarkerSize',5,'MarkerFaceColor','k')
plot(s6,t6,'-O','MarkerSize',5,'MarkerFaceColor','k')
%joining points
plot([s1 s2],[t1 t2],[s2 s3],[t2 t3],[s3 s4],[t3 t4],[s4 s5],[t4 t5],[s5 s6],[t5 t6],[s6 s1],[t6 t1],'linewidth',2,'color','cyan')
xlabel('SPECIFIC ENTROPY(J/K-Kg)')
ylabel('TEMPERATURE(celsius)')
title('temperature vs specific entropy')
hold off

%plotting specific enthalpy vs specific entropy plot
figure(2)
plot(sat_liq_s2,sat_liq_h,'color','b')                    %saturated liquid line
hold on
plot(sat_vap_s2,sat_vap_h,'color','b')                    %saturated vapour line
%marking the points
plot(s1,h1,'-O','markersize',5,'markerfacecolor','k')
plot(s2,h2,'-O','markersize',5,'markerfacecolor','k')
plot(s3,h3,'-O','markersize',5,'markerfacecolor','k')
plot(s4,h4,'-O','markersize',5,'markerfacecolor','k')
plot(s5,h5,'-O','markersize',5,'markerfacecolor','k')
plot(s6,h6,'-O','markersize',5,'markerfacecolor','k')
%joining points
plot([s1 s2],[h1 h2],[s2 s3],[h2 h3],[s3 s4],[h3 h4],[s4 s5],[h4 h5],[s5 s6],[h5 h6],[s6 s1],[h6 h1],'linewidth',2,'color','green')
xlabel('SPECIFIC ENTROPY(J/Kg-K)')
ylabel('SPECIFIC ENTHALPY(J/Kg)')
title('specific enthalpy vs specific entropy')
hold off

%Calculating back work ratio and net work output of the Rankine cycle
W_exp = h1-h2;       %For mass = 1kg
W_com = h4-h3;       %for mass = 1kg
BACK_WORK_RATIO = W_com/W_exp
NET_WORK_OUTPUT__joule = W_exp - W_com

STEP-WISE EXPLANATION OF THE CODE:

STEP-WISE EXPLANATION OF THE CODE:

  • This program is written and executed using MATLAB.
  • Starting with all the general command e. clear all, close all & clc.
  • Inputting all the code comment at all the required location starting with %
  • Displaying the input parameter lines using the fprintf command.
  • Then code is written to take the input from the users.
  • Its time to print the result.
  • Then writing code for state point 2 followed by 3, 4, 5 and 6.
  • If the loop is given for if the cycle cannot have %f as the inlet temperature of the cycle.
  • Temperature is distributed using linspace command.
  • Then the code is written for the saturated liquid line and saturated vapour line.
  • Then code is written for plotting temperature vs specific entropy plot followed by marking the point and joining the points.
  • Then code is written for plotting specific enthalpy vs specific entropy plot followed by marking the point and joining the points.
  • Then calculating the back work and network output of the Rankine cycle.

ERROR FACED WHILE PROGRAMMING:

My octave got crashed.

STEP TAKEN TO OVERCOME THOSE ERROR:

I took help from my friend who had a MatLab licence.

OUTPUTS:

RESULT:

Hence, we have successfully done all the calculation and also successfully plotted the graph.

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.