Challenge

Project 2 - Rankine cycle Simulator

AIM: To write a MATLAB program to plot the T-S and H-S diagram of a Rankine cycle and determine the thermal efficiency of the cycle.

THEORY AND GOVERNING EQUATIONS:

Rankine cycle consists of four processes, two isentropic and two isobaric.

1-2: Isentropic Expansion in the Turbine

2-3: Isobaric Heat Rejection by the Condenser

3-4: Isentropic Compression in the Pump

4-1: Isobaric Heat Addition by the Boiler

Work produced by the Turbine: `w_T = h1 - h2` kJ/kg

Work consumed by the Pump: `w_P = h4-h3` kJ/kg

Heat added in the Boiler: `q_(i n)=h1 - h4` kJ/kg

Net work: `w_(n et)=w_T-w_P` kJ/kg

Thermal efficiency: `eta = (w_(n et))/q_(i n)`

Back work ratio: `r_(bw) = w_P/w_T`

Specific Steam Consumption: `ssc=3600/w_(n et)` kg/kWh

OBJECTIVES:

OBJECTIVES:

  1. To determine the steam properties at different states of a Rankine cycle.
  2. To plot the T-S and H-S diagram of a Rankine cycle.
  3. To determine the net work output of the cycle.
  4. To determine the thermal efficiency of the Rankine cycle.
  5. To determine the back work ratio and specific steam consumption of the cycle

MATLAB CODE:

%% Rankine Cycle Simulator
clear all
close all
clc

fprintf('RANKINE CYCLE SIMULATOR\n\n')
fprintf('1-2 : Isentropic Expansion in the Turbine\n');
fprintf('2-3 : Isobaric Heat Rejection by the Condenser\n');
fprintf('3-4 : Isentropic Compression in the Pump\n');
fprintf('4-1 : Isobaric Heat Addition by the Boiler\n\n');

%% Input Sates variables

p1 = input('Enter the Pressure at the Turbine Inlet (in bar): ');
t1 = input('Enter the Temperature at the Turbine Inlet (in Degree Celsius): ');
p2 = input('Enter the Pressure at the Condenser (in bar): ');

%% Calculating State Properties
% State point 1
h1 = XSteam('h_pt', p1, t1);
s1 = XSteam('s_pt', p1, t1);

Tsat1 = XSteam('Tsat_p', p1);

% State point 2
s2 = s1;
sL2 = XSteam('sL_p', p2);
sV2 = XSteam('sV_p', p2);

%dryness fraction
d = (s2 - sL2) / (sV2 - sL2);

t2 = XSteam('T_ps', p2, s2);
h2 = XSteam('h_ps', p2, s2);

% State point 3
p3 = p2;
t3 = XSteam('Tsat_p', p3);
s3 = XSteam('sL_p', p3);
h3 = XSteam('hL_p', p3);

% State point 4
p4 = p1;
s4 = s3;
t4 = XSteam('T_ps', p4, s4);
h4 = XSteam('h_ps', p4, s4);

% State point 5
t5 = Tsat1;
h5 = XSteam('hL_p', p1);
s5 = XSteam('sL_p', p1);

% properties inbetween 4 and 5
t4_5 = linspace(t4, t5, 200);
s4_5 = zeros(size(t4_5));
h4_5 = zeros(size(t4_5));
for i = 2:(length(t4_5) - 1)
    h4_5(i) = XSteam('h_pt', p1, t4_5(i));
    s4_5(i) = XSteam('s_pt', p1, t4_5(i));
end
h4_5(1) = h4;
s4_5(1) = s4;
h4_5(end) = h5;
s4_5(end) = s5;

% State point 6
t6 = Tsat1;
h6 = XSteam('hV_p', p1);
s6 = XSteam('sV_p', p1);

% properties inbetween 6 and 1
t6_1 = linspace(t6, t1, 200);
s6_1 = zeros(size(t6_1));
h6_1 = zeros(size(t6_1));
for i = 2:(length(t6_1) - 1)
    h6_1(i) = XSteam('h_pt', p1, t6_1(i));
    s6_1(i) = XSteam('s_pt', p1, t6_1(i));
end
h6_1(1) = h6;
s6_1(1) = s6;
h6_1(end) = h1;
s6_1(end) = s1;


if t1<= Tsat1
    fprintf('\nThe cycle cannot have %f as inlet temperature \n', t1);
elseif d> 1
    fprintf('\nThe cycle cannot have %f bar as condenser pressure \n', p2);
else
    %% Calculating Cycle Performance
    % Turbine work
    Wt = h1 - h2;
    
    % Pump work
    Wp = h4 - h3;
    
    % Net work done by the cycle
    Wnet = Wt - Wp;
    
    % heat input
    Qin = h1 - h4;
    
    % Thermal Efficiency
    eff = Wnet / Qin * 100;
    
    % Back work ratio
    r_bw = Wp/Wt;
    
    % Specific Steam Consumption
    ssc = 3600/Wnet;
    
    %% Displaying Results
    fprintf('\nRESULTS\n');
    
    fprintf('\nAt State point 1:\n');
    fprintf('P1 is : %.2f bar\n', p1);
    fprintf('T1 is : %.2f Deg Celcius\n', t1);
    fprintf('H1 is : %.2f kJ/kg\n', h1);
    fprintf('S1 is : %.2f kJ/kgK\n', s1);
    
    fprintf('\nAt State point 2:\n');
    fprintf('P2 is : %.2f bar\n', p2);
    fprintf('T2 is : %.2f Deg Celcius\n', t2);
    fprintf('H2 is : %.2f kJ/kg\n', h2);
    fprintf('S2 is : %.2f kJ/kgK\n', s2);
    
    fprintf('\nAt State point 3:\n');
    fprintf('P3 is : %.2f bar\n', p3);
    fprintf('T3 is : %.2f Deg Celcius\n', t3);
    fprintf('H3 is : %.2f kJ/kg\n', h3);
    fprintf('S3 is : %.2f kJ/kgK\n', s3);
    
    fprintf('\nAt State point 4:\n');
    fprintf('P4 is : %.2f bar\n', p4);
    fprintf('T4 is : %.2f Deg Celcius\n', t4);
    fprintf('H4 is : %.2f kJ/kg\n', h4);
    fprintf('S4 is : %.2f kJ/kgK\n', s4);
    
    fprintf('\nWt is : %.2f kJ/kg\n', Wt);
    fprintf('Wp is : %.2f kJ/kg\n', Wp);
    fprintf('Wnet is : %.2f kJ/kg\n', Wnet);
    fprintf('Qin is : %.2f kJ/kg\n', Qin);
    fprintf('Thermal Efficiency is : %.2f %%\n', eff);
    fprintf('Back Work Ratio is : %.4f \n', r_bw);
    fprintf('Specific Steam Consumption is : %.4f kg/kWh \n',ssc);
    
    %% Plotting
    % T-s diagram
    figure(1)
    plot([s1, s2, s3, s4, s4_5, s5, s6, s6_1],[t1, t2, t3, t4, t4_5, t5, t6, t6_1], 'linewidth', 3);
    
    text(s1, t1,'1', 'fontsize', 14);
    text(s2, t2,'2', 'fontsize', 14);
    text(s3, t3,'3', 'fontsize', 14);
    text(s4, t4,'4', 'fontsize', 14);
    
    % h-s diagram
    figure(2)
    plot([s1, s2, s3, s4, s4_5, s5, s6, s6_1],[h1, h2, h3, h4, h4_5, h5, h6, h6_1], 'linewidth', 3);
    
    text(s1, h1,'1', 'fontsize', 14);
    text(s2, h2,'2', 'fontsize', 14);
    text(s3, h3,'3', 'fontsize', 14);
    text(s4, h4,'4', 'fontsize', 14);
    
    %% Saturation Curve
    
    % initializing
    t = linspace(0, 373.94, 500);
    sL = zeros(size(t));
    sV = zeros(size(t));
    hL = zeros(size(t));
    hV = zeros(size(t));
    
    % Calculating Enthalpy and Entropy at saturated points
    
    for i = 1:length(t)
        sL(i) = XSteam('sL_T', t(i));
        sV(i) = XSteam('sV_T',t(i));
        hL(i) = XSteam('hL_T',t(i));
        hV(i) = XSteam('hV_T',t(i));
    end
    
    % Plotting Saturation curve of T-S diagram
    
    figure(1)
    hold on
    plot(sL, t,'r', sV,t, 'r', 'linewidth', 2);
    xlabel('Entropy(s) [kJ/kg-K]', 'fontsize', 14);
    ylabel('Temperature(t) [K]', 'fontsize', 14);
    title('T-s diagram of a Rankine Cycle', 'fontsize', 16);
    grid on;
    
    % Plotting Saturation curve of H-S diagram
    
    figure(2)
    hold on
    plot(sL, hL,'r', sV,hV, 'r', 'linewidth', 2);
    xlabel('Entropy(s) [kJ/kg-K]', 'fontsize', 14);
    ylabel('Enthalpy(h) [kJ/kg]', 'fontsize', 14);
    title('h-s diagram of a Rankine Cycle', 'fontsize', 16);
    grid on;
    
end

GRAPHS AND OUTPUTS:

a) T-S diagram

b) H-S diagram

c) Output Screens

CONCLUSION:

The Work generated in the Turbine, heat input to the boiler, work consumed by the pump, overall work produced in the cycle and the thermal efficiency of the cycle is calculated.

Also, the back work ratio and specific steam consumption are calculated.

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.