Challenge

Project 2 - Rankine cycle Simulator

AIM : Create a Rankine Cycle Simulator using MATLAB and calculate the state points of the Rankine Cycle.

OBJECTIVE : calculate the state points of the Rankine Cycle based on user inputs and plot the corresponding T-s and h-s plots for the given set of inputs.

EXPLANATION : A Rankine cycle is a steam-based thermodynamic cycle which essentially converts heat into mechanical work. This mechanical work is then converted to electrical energy through the means of a generator. The basic (or ideal) Rankine cycle employs 4 processes. Water is pumped from a low to a high pressure by the means of a pump. Then it is heated at constant pressure in a boiler, which creates steam. This steam is then expanded in a Turbine, which converts the thermal energy into mechanical work through the shaft. The steam then proceeds to a condenser, where it rejects heat at constant pressure. A process diagram, along with its temperature-entropy (T-s) diagram is shown below.

Figure 1: Process and T-s Diagram of Ideal Rankine Cycle

  • Isentropic compression (compression in centrifugal pumps) :The liquid condensate is compressed adiabatically from state 1 to state 2 by centrifugal pumps (usually by condensate pumps and then by feedwater pumps). The liquid condensate is pumped from the condenser into the higher pressure boiler. In this process, the surroundings do work on the fluid, increasing its enthalpy (h = u+pv) and compressing it (increasing its pressure). On the other hand the entropy remains unchanged. The work required for the compressor is given by WPumps = H2 – H1.
  • Isobaric heat addition (in a heat exchanger – boiler) : In this phase (between state 2 and state 3) there is a constant-pressure heat transfer to the liquid condensate from an external source, since the chamber is open to flow in and out. The feedwater (secondary circuit) is heated from to the boiling point of that fluid and then evaporated in the boiler . The net heat added is given by Qadd = H3 – H2
  • Isentropic expansion (expansion in a steam turbine) : Steam from the boiler expands adiabatically from state 3 to state 4 in a steam turbine to produce work and then is discharged to the condenser (partially condensed). The steam does work on the surroundings (blades of the turbine) and loses an amount of enthalpy equal to the work that leaves the system. The work done by turbine is given by WT = H4 – H3. Again the entropy remains unchanged.
  • Isobaric heat rejection (in a heat exchanger) : In this phase the cycle completes by a constant-pressure process in which heat is rejected from the partially condensed steam. There is heat transfer from the vapor to cooling water flowing in a cooling circuit. The vapor condenses and the temperature of the cooling water increases. The net heat rejected is given by Qre = H4 – H1

In general, the efficiency of a simple rankine cycle can be written as

`etatherm = (dotW(thermal)-dotW)/(dot(Q)i n ) ~~(dotWturb)/(dotWi n)`

Each of the next four equations is derived from the energy and mass balance for a control volume. defines the thermodynamic efficiency of the cycle as the ratio of net power output to heat input. As the work required by the pump is often around 1% of the turbine work output, it can be simplified.

`(dotQi n)/dot m = h3 - h2,`

`(dotQi n)/dot m = h4- h1,`

`(dotWpump)/dot m = h2 - h1,`

`(dotQturb i n e)/dot m = h3- h4`

Applying steady flow energy equation(S.F.E.E) to boiler,turbine,condenser and pump:

(i) For boiler (as control volume),we get

f4+Q1 = h1

Q1 = h1-hf4

(ii) For Turbine(as control volume),We get

h1 = WT+h2,Where WT = turbine Work

Wt = h1 -h2

(iii) For condenser,we get

h2 = Q2 + hf3

Q2 = h2 - hf3

(iv)For the feed pump,we get

hf3 +Wp = hf4,where,WP = pump work

WP = hf4 -hf3=v3(p1 -p2)

Efficiency of Rankine cycle is given by

`eta = W/(Q n et1) = (WT-WP)/(Q1)`

PROGRAM :

clear all
close all
clc

fprintf('SIMULATOR OF RANKINE CYCLE \n')%printing the title)
fprintf('1-2 Isentropic Expansion in the Turbine\n')
fprintf('2-3 Constant Presuure heat rejection by the condenser\n')
fprintf('3-2 Isentropic Compression in the Pump\n')
fprintf('4-1 Constant Pressure heat addition by the boiler\n')

%inputs for turbine inlet pressure and temp,inlet pressure

P1 = input('Enter the pressure at the Turbine Inlet (in bar): ');%storing poping message
T1 = input('Enter the Temperature at the Turbine inlet (in Degree celsius): ');
P2 = input('Enter the pressure at the condenser (in bar): ');
disp('RESULTS')

%getting Cp and cv values from Xstream
%Cp and Cv assumed to not change with temperature to make problem simple 
%for vapour

High_CpV = XSteam('CpV_p',P1);
Low_CpV = XSteam('CpV_p',P2);
High_CvV = XSteam('CvV_p',P1);
Low_CvV = XSteam('CvV_p',P2);

%for liquid
High_CpL = XSteam('CpL_p',P1);
Low_CpL = XSteam('CpL_p',P2);
High_CvL = XSteam('CvL_p',P1);
Low_CvL = XSteam('CvL_p',P2);

%Getting important parameters from Xstream
%for high pressure
T1s = XSteam('Tsat_p',P1);
S1g = XSteam('sV_p',P1);
S1f = XSteam('SL_p',P1);
S1fg = S1g - S1f;
H1f = XSteam('hL_p',P1);
H1g = XSteam('hV_p',P1);
H1fg = H1g - H1f;

%for low pressure
S2g = XSteam('sV_p',P2);
S2f = XSteam('SL_p',P2);
S2fg = S2g - S2f;
T2s = XSteam('Tsat_p',P2);
H2f = XSteam('hL_p',P2);
H2g = XSteam('hV_p',P2);
H2fg = H1g - H1f;

%% state point 1

disp('At state point 1:')

fprintf('P1 is : %f Bar\n', P1)

fprintf('T1 is : %f Deg celsius\n',T1)

H1 = XSteam('h_pt',P1,T1);
fprintf('H1 is : %f KJ/kg\n',H1)

S1 = XSteam('s_pt',P1,T1);
fprintf('S1 is : %f KJ/kgk\n',S1)

%% state point 2

disp('At state point 2 :')

fprintf('P2 is : %f Bar\n', P2) %P2 input already taken

S2 = S1;
fprintf('S2 is : %f KJ/kgk\n',S2)
%predicting location of point 2 in T-S
if (S2<=S2g)
    X2 = (S2 - S2f)/(S2fg); %Dryness fraction at state point 2
else
    X2=1;
end
fprintf('X2 is :%f \n',X2)
%calculating T2 for spuperheat or wet or dry whenever it lies
if(X2<1)
    T2 = T2s;
else
    %t2 cal by s2 = s2g+low_CpV*(log(T2/T2s))
    T2 =(T2s+273.15)*exp((S2-S2g)/Low_CpV); %2 in superheated region
    T2 = T2 -273.15;
end
fprintf('T2 is : %f Deg celsius \n',T2)

if(X2<1)
    H2 = H2f + X2*H2fg;
else
    H2 = H2g + Low_CpV*(T2-T2s);
end
fprintf('H2 is : %f KJ/kg\n',H2)

%%state point 3
%Assuming no subcooling in condenser
disp('At state point 3:')

P3 = P2;
fprintf('P3 is : %f Bar\n',P3)

V3 = XSteam('VL_p',P3);

T3 = T2s;  %no subcooling assumed
fprintf('T3 is : %f deg Celsius\n',T3)

H3 = H2f;
fprintf('T3 is : %f KJ/kg\n',H3)

S3 = S2f;
fprintf('T3 is : %f KJ/Kgk\n',S3)

%%state point 4
disp('At state point 4:')

P4 = P1;
fprintf('p4 is : %f Bar\n',P4)

S4 = S3;
fprintf('S4 is : %f KJ/Kgk\n',S4)

Wp = V3 *(P4-P3)*100;
H4 = Wp +H3;
fprintf('H4 is : %f KJ/kg\n',H4)

% to cal T4 S4=S3=sf1-high_CpL*ln(t1s/t4)
term = exp((S1f-S4)/High_CpL); %Use exp instead of Exp to take input as double
T4 = T1s/term;
fprintf('T4 is : %f Deg celsius \n',T4)

%% Work done ,heat,SSC and efficiency calculations
Wt = H1-H2;
fprintf('Work by turbine is : %f KJ/kg\n', Wt)
fprintf('Work by compressor is : %f KJ/Kgk\n',Wp)
Wnet = Wt-Wp;
fprintf('Net Work done is : %f KJ/kg\n', Wnet)
Qin = H1-H4;
eff_thermal = (Wnet/Qin)*100; %Efficiency
fprintf('Thermal efficiency is : %f',eff_thermal); disp('%')
SSC = 3600/Wt; %specific steam consuption
fprintf('S.S.C is : %f Kg/KWh\n',SSC)

%% Calculations for plotting liquid and vapour lines
temp = linspace(1,373,1000);
for i= 1:length(temp)
    H_L(i) = XSteam('hL_T',temp(i));
    H_V(i) = XSteam('hV_T',temp(i));
    S_L(i) = XSteam('sL_T',temp(i));
    S_V(i) = XSteam('sV_T',temp(i));
end

%%ploting T - S
hold on
plot([S1 S2],[T1 T2],'r','linewidth',1)
text(S1,T1,' 1')
text(S2,T2,' 2')
plot([S2 S2g],[T2 T2s],'r','linewidth',1)
text(S2g,T2s,' 2s')
plot([S2g S3],[T2s T3],'r','linewidth',1)
text(S3,T3,' 3')
plot([S3 S4],[T3 T4],'r','linewidth',1)
text(S4,T4,' 4')
plot([S4 S1f],[T4 T1s],'r','linewidth',1)
text(S1f,T1s,' 4s')
plot([S1f S1g],[T1s T1s],'r','linewidth',1)
text(S1g,T1s,' 1s')
plot([S1g S1],[T1s T1],'r','linewidth',1)
plot(S_L,temp,'b','linestyle','--','linewidth',1)
plot(S_V,temp,'b','linestyle','--','linewidth',1)

title('T-S Diagram of Ideal Rankine Cycle')
xlabel('Specific Entropy (KJ/kgK)')
ylabel('Temperature (degC)')

figure(2) %H-S
hold on
plot([S1 S2],[H1 H2],'r','linewidth',1)
text(S1,H1,' 1')
plot([S2 S3],[H2 H3],'r','linewidth',1)
text(S2,H2,' 2')
plot([S3 S4],[H3 H4],'r','linewidth',1)
text(S3,H3,' 3')
plot([S4 S1],[H4 H1],'r','linewidth',1)
text(S4,H4,' 4')
plot(S_L,H_L,'b','linestyle','--','linewidth',1.5)
plot(S_V,H_V,'b','linestyle','--','linewidth',1.5)
title('H-S Diagram','FontSize',15)
xlabel('Specific Entropy (KJ/kgk)')
ylabel('Specific Enthalpy (KJ/kg)')

PROCEDURE :

For Writing this program,We are XSteam.m which is basically steam table

  1. Clearing workspace,command window and closing all plots
  2. print discription of all process in command window
  3. taking all inputs arguments
  4. calulation of Cp value at P1 & P2 for saturated liquid &vapour
  5. calculations of saturations temperatures at P1 & P2
  6. calculations od saturation properties at state 1,2,3,4
  7. calculations of process properties at sate 1,2,3,4
  8. calculations & plotting saturation liquid and vapour lines
  9. plotting T-s and H-S
  10. calculations of work done,heat,SSc and efficiency

ERRORS : Input parameters are wrong

OUTPUT :

Inputs:

Turbine Inlet temperature = 538° C

Turbine Inlet Pressure = 44 bars

Turbine Outlet Pressure = 5.38 bars = Condenser Inlet Pressure

SIMULATOR OF RANKINE CYCLE 
1-2 Isentropic Expansion in the Turbine
2-3 Constant Presuure heat rejection by the condenser
3-2 Isentropic Compression in the Pump
4-1 Constant Pressure heat addition by the boiler
Enter the pressure at the Turbine Inlet (in bar): 44
Enter the Temperature at the Turbine inlet (in Degree celsius): 538
Enter the pressure at the condenser (in bar): 5.83
RESULTS
At state point 1:
P1 is : 44.000000 Bar
T1 is : 538.000000 Deg celsius
H1 is : 3528.828574 KJ/kg
S1 is : 7.153990 KJ/kgk
At state point 2 :
P2 is : 5.830000 Bar
S2 is : 7.153990 KJ/kgk
X2 is :1.000000 
T2 is : 230.448598 Deg celsius 
H2 is : 2934.463454 KJ/kg
At state point 3:
P3 is : 5.830000 Bar
T3 is : 157.712349 deg Celsius
T3 is : 665.638034 KJ/kg
T3 is : 1.919867 KJ/Kgk
At state point 4:
p4 is : 44.000000 Bar
S4 is : 1.919867 KJ/Kgk
H4 is : 669.834038 KJ/kg
T4 is : 212.117201 Deg celsius 
Work by turbine is : 594.365120 KJ/kg
Work by compressor is : 4.196004 KJ/Kgk
Net Work done is : 590.169116 KJ/kg
Thermal efficiency is : 20.642541%
S.S.C is : 6.056883 Kg/KWh

PLOTS :

Inputs:

Turbine Inlet temperature = 400° C

Turbine Inlet Pressure = 30 bars

Turbine Outlet Pressure = 0.05 bars = Condenser Inlet Pressure

SIMULATOR OF RANKINE CYCLE 
1-2 Isentropic Expansion in the Turbine
2-3 Constant Presuure heat rejection by the condenser
3-2 Isentropic Compression in the Pump
4-1 Constant Pressure heat addition by the boiler
Enter the pressure at the Turbine Inlet (in bar): 30
Enter the Temperature at the Turbine inlet (in Degree celsius): 400
Enter the pressure at the condenser (in bar): 0.05
RESULTS
At state point 1:
P1 is : 30.000000 Bar
T1 is : 400.000000 Deg celsius
H1 is : 3231.571027 KJ/kg
S1 is : 6.923259 KJ/kgk
At state point 2 :
P2 is : 0.050000 Bar
S2 is : 6.923259 KJ/kgk
X2 is :0.814256 
T2 is : 32.875490 Deg celsius 
H2 is : 1599.268419 KJ/kg
At state point 3:
P3 is : 0.050000 Bar
T3 is : 32.875490 deg Celsius
T3 is : 137.765119 KJ/kg
T3 is : 0.476254 KJ/Kgk
At state point 4:
p4 is : 30.000000 Bar
S4 is : 0.476254 KJ/Kgk
H4 is : 140.776056 KJ/kg
T4 is : 147.599058 Deg celsius 
Work by turbine is : 1632.302608 KJ/kg
Work by compressor is : 3.010937 KJ/Kgk
Net Work done is : 1629.291671 KJ/kg
Thermal efficiency is : 52.714324%
S.S.C is : 2.205473 Kg/KWh

PLOTS :

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.