Modelling the Rankine Cycle in Python

The Rankine cycle is the heart of any thermal power plant. A basic Rankine cycle has four processes: reversible adiabatic work interactions in turbine and pump, and isobaric heat interactions in boiler and condenser.

A schematic of a thermal power plant is shown in the figure given below ?

Boiler Turbine Condenser Pump 1 2 3 4

To increase the efficiency of a Rankine cycle, regeneration has been used i.e. bleeding steam from turbine and mixing it with feed water in feed water heater. Different processes in the cycle have to be modelled with the help of data from steam tables. Therefore, it becomes very essential to have data in the code itself.

To our rescue, the Pyromat module provides steam data for both saturated and superheated states. Let us take an example to demonstrate the use of Pyromat and its capability to model the cycle.

Problem Statement

Consider a regenerative cycle using steam as the working fluid. Steam leaves the boiler and enters the turbine at 4 MPa, 400°C. After expansion to 400 kPa, some of the steam is extracted from the turbine to heat the feedwater in an open FWH. The pressure in the FWH is 400 kPa, and the water leaving it is saturated liquid at 400 kPa. The steam not extracted expands to 10 kPa. Determine the cycle efficiency.

Process Schematic

SH (Super heater) Turbine FWH (Feed Water Heater) Condenser CEP BFP Extraction 1 2 5

Here:

  • SH Super heater

  • CEP Condensate extraction pump

  • FWH Feed water heater

  • BFP Boiler feed pump

Python Program to Model the Rankine Cycle

The Python program to model the regenerative Rankine cycle is as follows ?

# Importing the pyromat module
import pyromat as pm

# configuring the pressure unit and fluid
pm.config["unit_pressure"] = "kPa"
prop_water = pm.get('mp.H2O')

# Input data
# Boiler exit pressure and temperature
p1 = 4000  # kPa
T1 = 400 + 273  # K

# Steam extraction pressure
p5 = 400  # kPa

# Condenser pressure
p2 = 10  # kPa

# Setting pressures for other points
p8 = p1  # Economiser exit pressure
p7 = p1  # Economiser inlet pressure
p6 = p5  # Inlet pressure from BFP
p4 = p5  # Exit pressure from CEP
p3 = p2  # Condenser exit pressure
p9 = p8  # Boiler exit pressure

# Turbine calculations
# POINT-1 (Turbine inlet)
h1 = prop_water.h(p=p1, T=T1)
s1 = prop_water.s(p=p1, T=T1)
s5 = s1  # Isentropic expansion to extraction point
s2 = s1  # Isentropic expansion to condenser

# POINT-5 (Extraction point)
T5, x5 = prop_water.T_s(p=p5, s=s5, quality=True)
h5 = prop_water.h(p=p5, x=x5)

# POINT-2 (Turbine exit)
T2, x2 = prop_water.T_s(p=p2, s=s2, quality=True)
h2 = prop_water.h(p=p2, x=x2)

# Condenser calculations
# POINT-3 (Condenser exit - saturated liquid)
h3 = prop_water.hs(p=p3)[0]
T3 = prop_water.Ts(p=p3)
s3 = prop_water.ss(p=p3)[0]

# CEP (Condensate Extraction Pump)
v3 = 1/prop_water.ds(p=p3)[0]
w_cep = v3 * (p4 - p3)

# POINT-4 (CEP exit)
s4 = s3
h4 = h3 + w_cep
T4 = prop_water.T_s(s=s4, p=p4)

# FWH calculations
# POINT-6 (FWH exit - saturated liquid)
h6 = prop_water.hs(p=p6)[0]
s6 = prop_water.ss(p=p6)[0]
T6 = prop_water.Ts(p=p6)
v6 = 1/prop_water.ds(p=p6)[0]

# BFP (Boiler Feed Pump)
# POINT-7 (BFP exit)
s7 = s6
w_bfp = v6 * (p7 - p6)
h7 = h6 + w_bfp
T7 = prop_water.T_s(s=s7, p=p7)

# POINT-8 (Economiser exit)
h8 = prop_water.hs(p=p8)[0]
s8 = prop_water.ss(p=p8)[0]
T8 = prop_water.Ts(p=p8)

# POINT-9 (Superheater inlet)
s9 = prop_water.ss(p=p8)[1]
T9 = T8

# Final Calculations
# Calculation of extracted mass fraction
m = (h6 - h4) / (h5 - h4)

# Work calculations
w_turbine = h1 - h5 + (1 - m) * (h5 - h2)
w_net = w_turbine - w_cep - w_bfp

# Heat calculations
q1 = h1 - h7  # Heat input
q2 = (1 - m) * (h2 - h3)  # Heat rejected

# Efficiency calculations
efficiency = (w_net / q1) * 100  # Method 1
efficiency2 = (1 - q2 / q1) * 100  # Method 2

print('The efficiency of Rankine Cycle (Method 1):', round(efficiency[0], 2), '%')
print('The efficiency of Rankine Cycle (Method 2):', round(efficiency2[0], 2), '%')
print('Extraction mass fraction:', round(m[0], 3))
        
Updated on: 2026-03-27T00:48:52+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements