Challenge

Project 2 - Rankine cycle Simulator

Aim: To simulate Rankine cycle in Matlab

Introduction:
The Rankine cycle is a thermodynamic cycle used in steam power plants to convert heat into mechanical work, typically for generating electricity. It consists of four key processes:
1. Isentropic expansion in Turbine
2. Constant pressure heat addition in Boiler
3. Isentropic compression in Pump
4. Constant pressure heat rejection in Condenser.
Initially, high-pressure steam expands isentropically in a turbine, performing work and lowering its temperature and pressure. This steam then enters a condenser where it rejects heat at constant pressure, converting into a liquid state. The liquid is subsequently pumped isentropically to a higher pressure before entering the boiler, where it absorbs heat at constant pressure, vaporizing back into high-pressure steam to repeat the cycle.
The Rankine cycle operates under several assumptions for simplicity:
1. Negligible pressure drop in boiler, condenser and pipes
2. Internally reversible and Adiabatic processes in Turbine and Pumps.
In practice, the Rankine cycle is significant because it forms the basis for most steam-based power generation systems, including those in fossil fuel and nuclear power plants. It provides an efficient method for converting thermal energy into useful mechanical energy, contributing to the generation of electricity. Despite its idealized assumptions, real-world systems closely follow this cycle, with modifications and optimizations made to enhance performance and efficiency.


Calculations:

We use Steady Flow Energy Equation to calculate key parameters of the RANKINE CYCLE

Steady Flow Energy Equation:

(Rate of Energy)in = (Rate of Energy)out

((dQ/dt) + dW/dt + dm/dt(h + V2/2 + gz))in = ((dQ/dt) + dW/dt + dm/dt(h + V2/2 + gz))out [W]

1. Isentropic Expansion in Turbine

Applying Steady Flow Energy Equation we get

W_turbine = Δ(Enthalpy) = h1 - h2 [Kj/Kg]

2. Constant Pressure Heat Rejection in Condenser

Applying Steady Flow Energy Equation we get

q_out = Δ(Enthalpy) = h3- h2 [Kj/Kg]

3. Isentropic Compression in Pump

Applying Steady Flow Energy Equation we get

W_pump = Δ(Enthalpy) = h3 - h2 [Kj/Kg]

2. Constant Pressure Heat Addition in Boiler

Applying Steady Flow Energy Equation we get

q_in = Δ(Enthalpy) = h3- h2 [Kj/Kg]

Thermal Efficiency = Desired Effect/ Required input

= W_net/qin

For any cyclic device Ein = Eout => qin = W_net + qout => W_net = qin - qout

= (qin - qout)/qin

= 1 - qout/qin

Back Work Ratio

It is the ratio of work used in running the pump to net work generated by turbine

rbw = W_pump/W_turbine


Code Explanation


Initialization and Setup
The MATLAB code begins by clearing any previous data, closing all figures, and resetting the command window. It then introduces the Rankine cycle, describing its main processes: isentropic expansion in the turbine, constant pressure heat removal, isentropic compression in the pump, and constant pressure heat addition in the boiler. These steps outline the sequence of thermodynamic transformations within the cycle.

Input Data and Calculations
The code then initializes the pressure and temperature for the turbine inlet and the condenser. It calculates the thermodynamic properties at various state points using the XSteam library, which provides functions for steam table data. For example, it determines enthalpy and entropy at the turbine inlet and calculates properties at the condenser pressure by considering isentropic expansion and the vapor fraction.

Calculation of State Properties
Further calculations involve determining properties for additional state points. The temperature at the condenser and pump stages is calculated, with specific heat capacities used to adjust temperature estimates based on pressure changes. Enthalpy values are adjusted to account for work done in the turbine and pump, including calculations for heat addition and rejection, net work done, and thermal efficiency.

Plotting the T-S and H-S Diagrams
The code proceeds to plot the T-S (Temperature-Entropy) and H-S (Enthalpy-Entropy) diagrams. It generates saturation lines and plots the cycle’s various processes on these diagrams. For the T-S diagram, it plots the saturation curves and cycle paths, including isentropic processes and heat addition/removal. For the H-S diagram, it similarly plots the saturation curves and cycle processes, with special attention given to isentropic lines.

Displaying Results
Finally, the code prints a detailed summary of the results to the command window. It includes values for each state point, such as pressure, temperature, enthalpy, and entropy, as well as calculated performance metrics like turbine work, pump work, net work, thermal efficiency, and specific steam consumption. This output provides a comprehensive view of the cycle's performance and efficiency.

Matlab Code

clear all

close all

clc

% Rankine Cycle Simulator

fprintf(' Rankine Cycle\n ')

fprintf('1-2 is Isentropic Expansion in Turbine\n')

fprintf('2-3 is constant pressure heat removal\n')

fprintf('3-4 is Isentropic Compression in Pump\n')

fprintf('4-1 Constant pressure Heat addition in Boiler\n')

% Input data for calculation of state points

p_high = 50; % Pressure at Turbine Inlet (bar)

T_high = 500; % Temperature at Turbine Inlet (deg Celsius)

p_low = 5; % Pressure at Condenser (bar)

% State point 1

h1 = XSteam('h_pT', p_high, T_high); % Enthalpy at state point 1

s1 = XSteam('s_pT', p_high, T_high); % Entropy at state point 1

% State point 2 (isentropic expansion)

s2 = s1; % Entropy remains constant

sf2 = XSteam('sL_p', p_low); % Saturated liquid entropy at pressure 2

sg2 = XSteam('sV_p', p_low); % Saturated vapour entropy at pressure 2

x2 = (s2-sf2)/(sg2-sf2); % Vapour fraction at state point 2

hf2 = XSteam('hL_p', p_low); % Saturated liquid enthalpy at pressure 2

hg2 = XSteam('hV_p', p_low); % Saturated vapour enthalpy at pressure 2

h2 = hf2 + (x2*(hg2-hf2)); % Enthalpy at state point 2

% State point 3 (constant pressure heat removal)

p3 = p_low; % Constant pressure

s3 = XSteam('sL_p', p3); % Saturated liquid entropy at pressure 3

h3 = XSteam('hL_p', p3); % Saturated liquid enthalpy at pressure 3

% State point 4 (isentropic compression)

s4 = s3; % Entropy remains constant

p4 = p_high; % Pressure at state point 4

% Work done by the turbine

W_turbine = h1 - h2;

% Work required by the pump

v3 = XSteam('vL_p', p3); % Specific volume at state point 3

W_pump = v3 * (p4 - p3) * 100; % Work done by the pump

h4 = h3 - W_pump; % Enthalpy at state point 4

% Net work done by the Rankine cycle

W_net = W_turbine - W_pump;

% Heat addition to the system

Q_in = h1 - h4;

% Heat rejection from the system

Q_out = h2 - h3;

% Thermal efficiency of the Rankine cycle

thermal_efficiency = (W_net / Q_in) * 100;

% Specific steam consumption

specific_steam_consumption = 3600 / W_net;

% Back work ratio

rbw = (W_pump / W_turbine);

% Temperatures at state points 2, 3, and 4

T3 = XSteam('Tsat_p', p3); % Saturation temperature at pressure 3

T2 = T3; % Constant pressure heat addition

Cp4 = XSteam('Cp_ps', p4, s4); % Specific heat capacity at constant pressure

Cv4 = XSteam('Cv_ps', p4, s4); % Specific heat capacity at constant volume

k = Cp4 / Cv4;

T4 = T3 / ((p3 / p4)^((k - 1) / k)); % Temperature at state point 4

% Additional properties for plotting

T6 = XSteam('Tsat_p', p_high); % Saturation temperature at pressure 1

s5 = XSteam('sL_p', p_high); % Saturated liquid entropy at pressure 1

s6 = XSteam('sV_p', p_high); % Saturated vapour entropy at pressure 1

h5 = XSteam('hL_p', p_high); % Saturated liquid enthalpy at pressure 1

h6 = XSteam('hV_p', p_high); % Saturated vapour enthalpy at pressure 1

T5 = T6;

% Plotting for Saturation Line

T = linspace(1, 560, 1000);

for i = 1:length(T)

sf(i) = XSteam('sL_T', T(i)); % Saturated liquid entropy

sg(i) = XSteam('sV_T', T(i)); % Saturated vapour entropy

hf(i) = XSteam('hL_T', T(i)); % Saturated liquid enthalpy

hg(i) = XSteam('hV_T', T(i)); % Saturated vapour enthalpy

end

% Plotting T-S Diagram for Rankine Cycle

figure(1)

hold on

plot(sf, T, 'color', 'b', 'linewidth', 2)

plot(sg, T, 'color', 'b', 'linewidth', 2)

plot([s1 s2], [T_high T2], 'color', 'r', 'linewidth', 3)

plot([s2 s3], [T2 T3], 'color', 'r', 'linewidth', 3)

plot([s3 s4], [T3 T4], 'color', 'r', 'linewidth', 3)

plot([s4 s5], [T4 T5], 'color', 'r', 'linewidth', 3)

plot([s5 s6], [T5 T6], 'color', 'r', 'linewidth', 3)

s_cycle = linspace(s6, s1, 1000);

for j = 1:length(s_cycle)

T_cycle(j) = XSteam('T_ps', p_high, s_cycle(j));

end

plot(s_cycle, T_cycle, 'color', 'r', 'linewidth', 3)

text(s1+0.1, T_high, '1')

text(s2+0.1, T2, '2')

text(s3, T3-20, '3')

text(s4, T4+20, '4')

title('Temperature Vs Entropy')

xlabel('Entropy (kJ/kg-K)')

ylabel('Temperature (Deg. Celsius)')

legend('Saturation Curve')

hold off

% Plotting H-S Diagram for Rankine Cycle

figure(2)

hold on

plot(sf, hf, 'color', 'b', 'linewidth', 2)

plot(sg, hg, 'color', 'b', 'linewidth', 2)

plot([s1 s2], [h1 h2], 'color', 'r', 'linewidth', 3)

plot([s2 s3], [h2 h3], 'color', 'r', 'linewidth', 3)

plot([s3 s4], [h3 h4], 'color', 'r', 'linewidth', 3)

h_cycle = linspace(h4, h5, 100);

for k = 1:length(h_cycle)

s_cycle_h(k) = XSteam('s_ph', p_high, h_cycle(k));

end

plot(s_cycle_h, h_cycle, 'color', 'r', 'linewidth', 3)

plot([s5 s6], [h5 h6], 'color', 'r', 'linewidth', 3)

for l = 1:length(s_cycle)

h_cycle_s(l) = XSteam('h_ps', p_high, s_cycle(l));

end

plot(s_cycle, h_cycle_s, 'color', 'r', 'linewidth', 3)

text(s1+0.1, h1, '1')

text(s2+0.1, h2, '2')

text(s3, h3-100, '3')

text(s4, h4+200, '4')

title('Enthalpy Vs Entropy')

xlabel('Entropy (kJ/kg-K)')

ylabel('Enthalpy (kJ/kg)')

legend('Saturation Curve')

hold off

% Displaying Results in Command window

disp('Results of Rankine Cycle')

fprintf('At state point 1\t\t\t\t\t')

fprintf('At state Point 2\n')

fprintf('P1 = %10f in Bar\t\t\t\t', p_high);

fprintf('P2 = %10f in Bar\n', p_low);

fprintf('T1 = %11f in Deg.Celsius\t\t', T_high);

fprintf('T2 = %11f in Deg.Celsius\n', T2);

fprintf('H1 = %12f in kJ/kg\t\t\t', h1);

fprintf('H2 = %12f in kJ/kg\n', h2);

fprintf('S1 = %9f in kJ/kg-K\t\t\t', s1);

fprintf('S2 = %9f in kJ/kg-K\n', s2);

fprintf('\n')

fprintf('At state point 3\t\t\t\t\t')

fprintf('At state Point 4\n')

fprintf('P3 = %10f in Bar\t\t\t\t', p3);

fprintf('P4 = %10f in Bar\n', p4);

fprintf('T3 = %11f in Deg.Celsius\t\t', T3);

fprintf('T4 = %11f in Deg.Celsius\n', T4);

fprintf('H3 = %12f in kJ/kg\t\t\t', h3);

fprintf('H4 = %12f in kJ/kg\n', h4);

fprintf('S3 = %9f in kJ/kg-K\t\t\t', s3);

fprintf('S4 = %9f in kJ/kg-K\n', s4);

fprintf('\n')

fprintf('Turbine Work Done = %14f in kJ/kg\n', W_turbine)

fprintf('Pump Work Done = %15f in kJ/kg\n', W_pump)

fprintf('Net Work Done = %17f in kJ/kg\n', W_net)

fprintf('Thermal Efficiency = %13f in percent\n', thermal_efficiency)

fprintf('Back work ratio of rankine cycle = %4f\n', rbw)

fprintf('Specific Steam Consumption = %f in kg/kWh\n', specific_steam_consumption)

Results and Outputs

1. T-s Diagram

2. H-s Diagram

3. The Thermal Efficiency of the Rankine cycle is = 21.96%

4. The back work ratio of the rankine cycle is = 0.008

5. The specific steam consumption of the rankine cycle is = 5.86 kg/kWhr



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.