Example Regenerative Rankine - Nouman090/ThermoSim GitHub Wiki

Cycle Description

                 Boiler
         7 ──────────────→ 1
         ↑                  ↓
       Pump2            Turbine 1
         ↑                  ↓
         6                  2
    (Mixer/FWH)       Splitter
     ↑       ↑        ↓      ↓
     5      2a       2a     2b
     ↑                       ↓
   Pump1                 Turbine 2
     ↑                       ↓
     4 ←──────────────────── 3
            Condenser

Complete Code

from ThermoSim import (
    ThermodynamicModel, Turbine, Pump,
    Splitter, Mixer, HeatExchanger,
)
from ThermoSim.plotting import CyclePlotter

Model = ThermodynamicModel()
Model.set_dead_state()

wf    = 'water'
eta_t = 0.85
eta_p = 1.0

# Pressures
P1 = 8e6;     P2 = 0.7e6;   P3 = 0.008e6
P4 = P3;      P5 = P2;      P6 = P2;      P7 = P1

# State points
Model.add_point(wf, '1',  P=P1, T=480+273.15, Mass_flowrate=1)
Model.add_point(wf, '2',  P=P2)
Model.add_point(wf, '2a', P=P2)
Model.add_point(wf, '2b', P=P2)
Model.add_point(wf, '3',  P=P3)
Model.add_point(wf, '4',  P=P4, Q=0)
Model.add_point(wf, '5',  P=P5)
Model.add_point(wf, '6',  P=P6, Q=0)
Model.add_point(wf, '7',  P=P7)

# --- First pass to get enthalpies ---
Turbine(Model, 'turbine1', '1', '2', n_isen=eta_t, Calculate=True)
Splitter(Model, 'Splitter', '2', ['2a', '2b'], [0.5, 0.5], Calculate=True)
Pump(Model, 'Pump1', '4', '5', n_isen=eta_p, Calculate=True)

# --- Calculate correct extraction fraction ---
y = (Model.Point['6'].H - Model.Point['5'].H) / \
    (Model.Point['2a'].H - Model.Point['5'].H)
print(f"Extraction fraction y = {y:.4f}")

# --- Re-solve with correct y ---
Splitter(Model, 'Splitter', '2', ['2a', '2b'], [y, 1-y], Calculate=True)
Turbine(Model, 'turbine2', '2b', '3', n_isen=eta_t, Calculate=True)

HeatExchanger(Model, 'Condenser', PPT=5, HEX_type='SimpleHEX',
              HeatAdded=False,
              Hot_In_state='3', Hot_Out_state='4',
              Cold_In_state=None, Cold_Out_state=None,
              Calculate=True)

Pump(Model, 'Pump1', '4', '5', n_isen=eta_p, Calculate=True)
Mixer(Model, 'Mixer', ['5', '2a'], '6', Calculate=True)
Pump(Model, 'Pump2', '6', '7', n_isen=eta_p, Calculate=True)

HeatExchanger(Model, 'Boiler', PPT=5, HEX_type='SimpleHEX',
              HeatAdded=True,
              Hot_In_state=None, Hot_Out_state=None,
              Cold_In_state='7', Cold_Out_state='1',
              Calculate=True)

# Results
print(Model)

# Plots
plotter = CyclePlotter(Model)
plotter.plot_Ts_diagram(['1', '2', '2b', '3', '4', '5', '6', '7', '1'],
                        title='Regenerative Rankine')
plotter.plot_exergy_bar()