tespy.components.turbomachinery package

tespy.components.turbomachinery.base module

Module of class Turbomachine.

This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/components/turbomachinery/base.py

SPDX-License-Identifier: MIT

class tespy.components.turbomachinery.base.Turbomachine(label, **kwargs)[source]

Bases: Component

Parent class for compressor, pump and turbine.

Mandatory Equations

Optional Equations

Inlets/Outlets

  • in1

  • out1

Parameters:
  • label (str) – The label of the component.

  • design (list) – List containing design parameters (stated as String).

  • offdesign (list) – List containing offdesign parameters (stated as String).

  • design_path (str) – Path to the components design case.

  • local_offdesign (boolean) – Treat this component in offdesign mode in a design calculation.

  • local_design (boolean) – Treat this component in design mode in an offdesign calculation.

  • char_warnings (boolean) – Ignore warnings on default characteristics usage for this component.

  • printout (boolean) – Include this component in the network’s results printout.

  • P (float, dict) – Power, \(P/\text{W}\)

  • pr (float, dict) – Outlet to inlet pressure ratio, \(pr/1\)

  • dp (float, dict) – Inlet to outlet pressure difference, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

Example

For an example please refer to:

energy_balance_dependents()[source]
energy_balance_func()[source]

Calculate energy balance of a turbomachine.

Returns:

residual (float) – Residual value of turbomachine energy balance

\[0=\dot{m}_{in}\cdot\left(h_{out}-h_{in}\right)-P\]

entropy_balance()[source]

Calculate entropy balance of turbomachine.

Note

The entropy balance makes the following parameter available:

\[\begin{split}\text{S\_irr}=\dot{m} \cdot \left(s_\text{out}-s_\text{in} \right)\\\end{split}\]
get_bypass_constraints()[source]
get_parameters()[source]
get_plotting_data()[source]

Generate a dictionary containing FluProDia plotting information.

Returns:

data (dict) – A nested dictionary containing the keywords required by the calc_individual_isoline method of the FluidPropertyDiagram class. First level keys are the connection index (‘in1’ -> ‘out1’, therefore 1 etc.).

static inlets()[source]
static outlets()[source]

tespy.components.turbomachinery.compressor module

Module of class Compressor.

This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/components/turbomachinery/compressor.py

SPDX-License-Identifier: MIT

class tespy.components.turbomachinery.compressor.Compressor(label, **kwargs)[source]

Bases: Turbomachine

Class for a basic compressor.

Mandatory Equations

Optional Equations

Inlets/Outlets

  • in1

  • out1

Optional inlets

  • power

Image

flowsheet of the compressor flowsheet of the compressor
Parameters:
  • label (str) – The label of the component.

  • design (list) – List containing design parameters (stated as String).

  • offdesign (list) – List containing offdesign parameters (stated as String).

  • design_path (str) – Path to the components design case.

  • local_offdesign (boolean) – Treat this component in offdesign mode in a design calculation.

  • local_design (boolean) – Treat this component in design mode in an offdesign calculation.

  • char_warnings (boolean) – Ignore warnings on default characteristics usage for this component.

  • printout (boolean) – Include this component in the network’s results printout.

  • P (float, dict) – Power, \(P/\text{W}\)

  • eta_s (float, dict) – Isentropic efficiency, \(\eta_s/1\)

  • pr (float, dict) – Outlet to inlet pressure ratio, \(pr/1\)

  • dp (float, dict) – Inlet to outlet pressure difference, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

  • eta_s_char (tespy.tools.characteristics.CharLine, dict) – Characteristic curve for isentropic efficiency, provide CharLine as function func.

Example

Create an air compressor model and calculate the power required for compression of 50 l/s of ambient air to 5 bars.

>>> from tespy.components import Sink, Source, Compressor
>>> from tespy.connections import Connection
>>> from tespy.networks import Network
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "bar", "pressure_difference": "bar",
...     "temperature": "degC", "volumetric_flow": "l/s", "enthalpy": "kJ/kg"
... })
>>> si = Sink('sink')
>>> so = Source('source')
>>> comp = Compressor('compressor')
>>> inc = Connection(so, 'out1', comp, 'in1')
>>> outg = Connection(comp, 'out1', si, 'in1')
>>> nw.add_conns(inc, outg)

Specify the compressor parameters: nominal efficiency and pressure ratio. For offdesign mode the efficiency characteristic line is selected instead of the isentropic efficiency.

>>> comp.set_attr(pr=5, eta_s=0.8, design=['eta_s'], offdesign=['eta_s_char'])
>>> inc.set_attr(fluid={'air': 1}, p=1, T=20, v=50)
>>> nw.solve('design')
>>> design_state = nw.save(as_dict=True)
>>> round(comp.P.val, 0)
12772.0
>>> round(comp.eta_s.val, 2)
0.8
>>> inc.set_attr(v=45)
>>> nw.solve('offdesign', design_path=design_state)
>>> round(comp.eta_s.val, 2)
0.79
char_map_dependents()[source]
char_map_eta_s_func()[source]

Calculate isentropic efficiency from characteristic map.

Returns:

residual (float) – Residual value of equation.

Note

  • X: speedline index (rotational speed is constant)

  • Y: nondimensional mass flow

  • igva: variable inlet guide vane angle for value manipulation according to [40].

\[\begin{split}X = \sqrt{\frac{T_\text{in,design}}{T_\text{in}}}\\ Y = \frac{\dot{m}_\text{in} \cdot p_\text{in,design}} {\dot{m}_\text{in,design} \cdot p_\text{in} \cdot X}\\ \vec{Y} = f\left(X,Y\right)\cdot\left(1-\frac{igva}{100}\right)\\ \vec{Z}=f\left(X,Y\right)\cdot\left(1-\frac{igva^2}{10000}\right)\\ 0 = \frac{\eta_\text{s}}{\eta_\text{s,design}} - f\left(Y,\vec{Y},\vec{Z}\right)\end{split}\]
char_map_pr_func()[source]

Calculate pressure ratio from characteristic map.

Returns:

residual (float) – Residual value of equations.

Note

  • X: speedline index (rotational speed is constant)

  • Y: nondimensional mass flow

  • igva: variable inlet guide vane angle for value manipulation according to [40].

\[\begin{split}X = \sqrt{\frac{T_\text{in,design}}{T_\text{in}}}\\ Y = \frac{\dot{m}_\text{in} \cdot p_\text{in,design}} {\dot{m}_\text{in,design} \cdot p_\text{in} \cdot X}\\ \vec{Y} = f\left(X,Y\right)\cdot\left(1-\frac{igva}{100}\right)\\ \vec{Z} = f\left(X,Y\right)\cdot\left(1-\frac{igva}{100}\right)\\ 0 = \frac{p_{out} \cdot p_{in,design}} {p_\text{in} \cdot p_\text{out,design}}- f\left(Y,\vec{Y},\vec{Z}\right)\end{split}\]
check_parameter_bounds()[source]

Check parameter value limits.

convergence_check()[source]

Perform a convergence check.

Note

Manipulate enthalpies/pressure at inlet and outlet if not specified by user to match physically feasible constraints.

energy_connector_balance_func()[source]

(optional) energy balance equation connecting the power connector to the component’s power

Returns:

residual (float) – Residual value of equation

\[0=\dot E - \dot{m}_{in}\cdot\left(h_{out}-h_{in}\right)\]

energy_connector_dependents()[source]
eta_s_char_dependents()[source]
eta_s_char_func()[source]

Equation for given isentropic efficiency characteristic.

Returns:

residual (float) – Residual value of equation.

\[0 = \left(h_{out}-h_{in}\right) \cdot \eta_{s,design} \cdot f\left( expr \right) -\left( h_{out,s} - h_{in} \right)\]

eta_s_dependents()[source]
eta_s_deriv(increment_filter, k, dependents=None)[source]

Partial derivatives for isentropic efficiency.

Parameters:
  • increment_filter (ndarray) – Matrix for filtering non-changing variables.

  • k (int) – Position of derivatives in Jacobian matrix (k-th equation).

eta_s_func()[source]

Equation for given isentropic efficiency of a compressor.

Returns:

residual (float) – Residual value of equation.

\[0 = -\left( h_{out} - h_{in} \right) \cdot \eta_{s} + \left( h_{out,s} - h_{in} \right)\]

get_mandatory_constraints()[source]
get_parameters()[source]
static initialise_source(c, key)[source]

Return a starting value for pressure and enthalpy at outlet.

Parameters:
  • c (tespy.connections.connection.Connection) – Connection to perform initialisation on.

  • key (str) – Fluid property to retrieve.

Returns:

val (float) – Starting value for pressure/enthalpy in SI units.

static initialise_target(c, key)[source]

Return a starting value for pressure and enthalpy at inlet.

Parameters:
  • c (tespy.connections.connection.Connection) – Connection to perform initialisation on.

  • key (str) – Fluid property to retrieve.

Returns:

val (float) – Starting value for pressure/enthalpy in SI units.

static powerinlets()[source]

tespy.components.turbomachinery.pump module

Module of class Pump.

This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/components/turbomachinery/pump.py

SPDX-License-Identifier: MIT

class tespy.components.turbomachinery.pump.Pump(label, **kwargs)[source]

Bases: Turbomachine

Class for axial or radial pumps.

Mandatory Equations

Optional Equations

Inlets/Outlets

  • in1

  • out1

Optional inlets

  • power

Image

flowsheet of the pump flowsheet of the pump
Parameters:
  • label (str) – The label of the component.

  • design (list) – List containing design parameters (stated as String).

  • offdesign (list) – List containing offdesign parameters (stated as String).

  • design_path (str) – Path to the components design case.

  • local_offdesign (boolean) – Treat this component in offdesign mode in a design calculation.

  • local_design (boolean) – Treat this component in design mode in an offdesign calculation.

  • char_warnings (boolean) – Ignore warnings on default characteristics usage for this component.

  • printout (boolean) – Include this component in the network’s results printout.

  • P (float, dict) – Power, \(P/\text{W}\)

  • eta_s (float, dict) – Isentropic efficiency, \(\eta_s/1\)

  • eta (float, dict) – Efficiency based on flow work \(v\cdot dp\), \(\eta/1\)

  • frequency (float, dict) – Frequency of the pump, \(\omega/(1/)\)

  • eta_flow_map (tespy.tools.characteristics.CharMap, dict) – Characteristic map for efficiency vs. volumetric flow and frequency

  • head_flow_map (tespy.tools.characteristics.CharMap, dict) – Characteristic map for hydraulic head vs. volumetric flow and frequency

  • pr (float, dict) – Outlet to inlet pressure ratio, \(pr/1\)

  • dp (float, dict) – Inlet to outlet pressure difference, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

  • head (float, dict) – Hydraulic head, \(H/m\)

  • eta_s_char (tespy.tools.characteristics.CharLine, dict) – Characteristic curve for isentropic efficiency, provide CharLine as function func

  • flow_char (tespy.tools.characteristics.CharLine, dict) – Characteristic curve for pressure rise as function of volumetric flow \(x/\frac{\text{m}^3}{\text{s}} \, y/\text{Pa}\)

Example

Below you will find two separate examples. First, a simple pump using a pressure difference to volumetric flow characteristic in both design and offdesign mode. Second, a pump implementing a pump characteristic map for hydraulic head over flow at variable frequencies and a characteristic map for the efficiency over flow at variable frequencies.

A pump with a known pump curve (difference pressure as function of volumetric flow) pumps 1,5 l/s of water in design conditions. E.g. for a given isentropic efficiency it is possible to calculate power consumption and pressure at the pump.

>>> from tespy.components import Sink, Source, Pump
>>> from tespy.connections import Connection
>>> from tespy.networks import Network
>>> from tespy.tools.characteristics import CharLine
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "bar", "pressure_difference": "bar",
...     "temperature": "degC", "volumetric_flow": "l/s", "enthalpy": "kJ/kg"
... })
>>> si = Sink('sink')
>>> so = Source('source')
>>> pu = Pump('pump')
>>> inc = Connection(so, 'out1', pu, 'in1')
>>> outg = Connection(pu, 'out1', si, 'in1')
>>> nw.add_conns(inc, outg)

After that we calculate offdesign performance using the pump curve and a characteristic function for the pump efficiency. We can calculate the offdesign efficiency and the volumetric flow, if the difference pressure changed. The default characteristc lines are to be found in the tespy.data module. Of course you are able to specify your own characteristcs, like done for the flow_char. More information on how to specify characteristic functions are given in the corresponding part of the online documentation.

>>> v = np.array([0, 0.4, 0.8, 1.2, 1.6, 2]) / 1000
>>> dp = np.array([15, 14, 12, 9, 5, 0]) * 1e5
>>> char = CharLine(x=v, y=dp)
>>> pu.set_attr(eta_s=0.8, flow_char={'char_func': char, 'is_set': True},
... design=['eta_s'], offdesign=['eta_s_char'])
>>> inc.set_attr(fluid={'water': 1}, p=1, T=20, v=1.5, design=['v'])
>>> nw.solve('design')
>>> design_state = nw.save(as_dict=True)
>>> round(pu.pr.val, 0)
7.0
>>> round(outg.p.val - inc.p.val, 0)
6.0
>>> round(pu.P.val, 0)
1125.0
>>> outg.set_attr(p=12)
>>> nw.solve('offdesign', design_path=design_state)
>>> round(pu.eta_s.val, 2)
0.71
>>> round(inc.v.val, 1)
0.9

In the second example we model a pump with characteristic maps. These can be retrieved from manufacturers, for example, grundfos [41] provides datatsheets for their pumps. To keep the example simple, the pump maps used below are kept very. To make use of the maps we need the following information:

  • A numpy array of frequency values

  • Per frequency value a numpy array for volumetric flow

  • Per frequency value a corresponding numpy array for hydraulic head and for efficiency

We can use the following data in the example:

>>> import numpy as np
>>> from tespy.tools import CharMap
>>> frequencies = np.array([1500, 1750, 2000, 2250]) / 60  # SI units!
>>> flows = np.array([
...     [0.   , 0.715, 1.431],  # corresponds to 1500
...     [0.   , 1.141, 2.284],  # corresponds to 1750...
...     [0.   , 1.568, 3.137],
...     [0.   , 1.995, 3.772]
... ])

Attention

The values need to be in SI units!

Then we need to have the respective hydraulic head and efficiency for each of those values.

>>> head = np.array([
...     [ 3.229,  3.023,  1.786],
...     [ 8.239,  7.712,  4.559],
...     [15.554, 14.558,  8.602],
...     [20.   , 20.   , 12.431]
... ])
>>> efficiency = np.array([
...     [0. , 0.45, 0.4 ],
...     [0. , 0.5 , 0.45],
...     [0. , 0.52, 0.5 ],
...     [0. , 0.5 , 0.45]
... ])

We can create the maps next:

>>> pump_H_map = CharMap(
...     x=frequencies,
...     y=flows,
...     z=head
... )
>>> pump_eta_map = CharMap(
...     x=frequencies,
...     y=flows,
...     z=efficiency
... )

Now we create the model and impose the maps

>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "bar",
...     "pressure_difference": "bar",
...     "temperature": "degC",
...     "volumetric_flow": "m3/s",
...     "enthalpy": "kJ/kg",
...     "frequency": "1/min"
... })
>>> si = Sink('sink')
>>> so = Source('source')
>>> pu = Pump('pump')
>>> inc = Connection(so, 'out1', pu, 'in1')
>>> outg = Connection(pu, 'out1', si, 'in1')
>>> nw.add_conns(inc, outg)
>>> pu.set_attr(
...     head_flow_map={'char_func': pump_H_map, 'is_set': True},
...     eta_flow_map={'char_func': pump_eta_map, 'is_set': True},
...     frequency=2000
... )

We can impose the inlet volumetric flow, for example, an actual set point on the map.

>>> inc.set_attr(fluid={'water': 1}, p=1, T=20, v=1.568)
>>> nw.solve('design')
>>> round(pu.head.val, 3)
14.558

The process can of course be inverted, e.g., find the volumetric flow corresponding to a specific pressure at the outlet.

>>> inc.set_attr(v=None)
>>> outg.set_attr(p=2.2)
>>> nw.solve("design")
>>> round(inc.v.val, 3)
2.174

Attention

Be aware that if the pump runs outside of the characteristic map it can easily happen that derivatives become zero because the interpolation returns the same values independent of the variables. A good initial guess can (but does not necessarily) help. Instead, we can also re-create the characteristic maps, and this time provide the extrapolate keyword. It will extrapolate beyond the component map and thus produce non-zero derivatives. TODO: Update this docs part, Jacobian is not a problem anymore but non-extrapolation leads to non-convergence.

>>> outg.set_attr(p=1.2)
>>> nw.solve("design")
>>> nw.status  # check status variable of the network, 2: non-convergence
2
>>> pump_H_map = CharMap(
...     x=frequencies,
...     y=flows,
...     z=head,
...     extrapolate=True
... )
>>> pump_eta_map = CharMap(
...     x=frequencies,
...     y=flows,
...     z=efficiency,
... )
>>> pu.set_attr(
...     head_flow_map={'char_func': pump_H_map, 'is_set': True},
...     eta_flow_map={'char_func': pump_eta_map, 'is_set': True},
...     frequency=2000
... )
>>> nw.solve("design")
>>> nw.status == 0  # check if status is successful simulation
True

Finally, it is possible to make the frequency variable to match a certain volumetric flow and pressure increase:

>>> inc.set_attr(v=1.5)
>>> outg.set_attr(p=2)
>>> pu.set_attr(frequency="var")
>>> nw.solve("design")
>>> nw.status == 0  # check if converged
True
>>> round(pu.frequency.val)
1862
calc_hydraulic_head()[source]

Calculate the hydraulic head \(H\)

Returns:

float – Residual value of equation.

\[H = \frac{\left( p_\text{out} - p_\text{in} \right) \cdot v}{g}\]

convergence_check()[source]

Perform a convergence check.

Note

Manipulate enthalpies/pressure at inlet and outlet if not specified by user to match physically feasible constraints.

energy_connector_balance_func()[source]

(optional) energy balance equation connecting the power connector to the component’s power

Returns:

float – Residual value of equation

\[0=\dot E - \dot{m}_{in}\cdot\left(h_{out}-h_{in}\right)\]

energy_connector_dependents()[source]
eta_dependents()[source]
eta_flow_frequency_group_dependents()[source]
eta_flow_frequency_group_func()[source]

Equation for efficiency \(\eta\) over flow and frequency \(\omega\) map

Returns:

float – Residual value of equation.

\[0 = \eta \left(\omega,\dot{V}_\text{in}\cdot v_\text{in} \right) \cdot \left(h_\text{out} - h_\text{in}\right) - v_\text{in}\cdot\left(p_\text{out} - p_\text{in}\right)\]

eta_func()[source]

Equation for efficiency \(\eta\) defined from incompressible pressure change (instead of isentropic efficiency)

Returns:

float – Residual value of equation.

\[0 = \eta \cdot \left(h_\text{out} - h_\text{in}\right) - v_\text{in}\cdot\left(p_\text{out} - p_\text{in}\right)\]

eta_s_char_dependents()[source]
eta_s_char_func()[source]

Equation for given isentropic efficiency characteristic.

Returns:

float – Residual value of equation.

\[0 = \left(h_{out}-h_{in}\right) \cdot \eta_{s,design} \cdot f\left( expr \right) -\left( h_{out,s} - h_{in} \right)\]

eta_s_dependents()[source]
eta_s_deriv(increment_filter, k, dependents=None)[source]

Partial derivatives for isentropic efficiency.

Parameters:
  • increment_filter (ndarray) – Matrix for filtering non-changing variables.

  • k (int) – Position of derivatives in Jacobian matrix (k-th equation).

eta_s_func()[source]

Equation for given isentropic efficiency.

Returns:

float – Residual value of equation.

\[0 = -\left( h_{out} - h_{in} \right) \cdot \eta_{s} + \left( h_{out,s} - h_{in} \right)\]

flow_char_dependents()[source]
flow_char_func()[source]

Equation for given flow characteristic of a pump.

Returns:

float – Residual value of equation.

\[0 = p_{out} - p_{in} - f\left( expr \right)\]

get_mandatory_constraints()[source]
get_parameters()[source]
head_flow_frequency_group_dependents()[source]
head_flow_frequency_group_func()[source]

Equation for hydraulic head \(H\) over flow and frequency \(\omega\) map

Returns:

float – Residual value of equation.

\[0 = H\left(\omega,\dot{V}_\text{in}\right) - \frac{\left( p_\text{out} - p_\text{in} \right) \cdot v}{g}\]

hydraulic_head_dependents()[source]
hydraulic_head_func()[source]

Equation for given hydraulic head \(H\)

Returns:

float – Residual value of equation.

\[0 = \frac{\left(p_\text{out}-p_\text{in}\right)\cdot v}{g}-H\]

static initialise_source(c, key)[source]

Return a starting value for pressure and enthalpy at outlet.

Parameters:
  • c (tespy.connections.connection.Connection) – Connection to perform initialisation on.

  • key (str) – Fluid property to retrieve.

Returns:

val (float) – Starting value for pressure/enthalpy in SI units.

static initialise_target(c, key)[source]

Return a starting value for pressure and enthalpy at inlet.

Parameters:
  • c (tespy.connections.connection.Connection) – Connection to perform initialisation on.

  • key (str) – Fluid property to retrieve.

Returns:

val (float) – Starting value for pressure/enthalpy in SI units.

static powerinlets()[source]

tespy.components.turbomachinery.steam_turbine module

Module of class SteamTurbine.

This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/components/turbomachinery/steam_turbine.py

SPDX-License-Identifier: MIT

class tespy.components.turbomachinery.steam_turbine.SteamTurbine(label, **kwargs)[source]

Bases: Turbine

Class for steam turbines with wet expansion.

Mandatory Equations

Optional Equations

Inlets/Outlets

  • in1

  • out1

Optional outlets

  • power

Image

flowsheet of the turbine flowsheet of the turbine
Parameters:
  • label (str) – The label of the component.

  • design (list) – List containing design parameters (stated as String).

  • offdesign (list) – List containing offdesign parameters (stated as String).

  • design_path (str) – Path to the components design case.

  • local_offdesign (boolean) – Treat this component in offdesign mode in a design calculation.

  • local_design (boolean) – Treat this component in design mode in an offdesign calculation.

  • char_warnings (boolean) – Ignore warnings on default characteristics usage for this component.

  • printout (boolean) – Include this component in the network’s results printout.

  • P (float, dict) – Power, \(P/\text{W}\)

  • eta_s (float, dict) – Isentropic efficiency, \(\eta_s/1\)

  • eta_s_dry (float, dict) – Dry isentropic efficiency, \(\eta_s/1\)

  • alpha (float, dict) – Influence factor on wetness efficiency modifier, \(\alpha/1\)

  • pr (float, dict) – Outlet to inlet pressure ratio, \(pr/1\)

  • dp (float, dict) – Inlet to outlet pressure difference, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

  • eta_s_char (tespy.tools.characteristics.CharLine, dict) – Characteristic curve for isentropic efficiency, provide CharLine as function func.

  • cone (dict) – Apply Stodola’s cone law (works in offdesign only).

Example

A steam turbine expands 10 kg/s of superheated steam at 550 °C and 110 bar to 0,5 bar at the outlet. For example, it is possible to calculate the power output and vapour content at the outlet for a given isentropic efficiency. The SteamTurbine class follows the implementation of the Baumann rule [42]

>>> from tespy.components import Sink, Source, SteamTurbine
>>> from tespy.connections import Connection
>>> from tespy.networks import Network
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "bar", "pressure_difference": "bar",
...     "temperature": "degC", "enthalpy": "kJ/kg"
... })
>>> si = Sink('sink')
>>> so = Source('source')
>>> st = SteamTurbine('steam turbine')
>>> inc = Connection(so, 'out1', st, 'in1')
>>> outg = Connection(st, 'out1', si, 'in1')
>>> nw.add_conns(inc, outg)

In design conditions the isentropic efficiency is specified. >>> st.set_attr(eta_s=0.9) >>> inc.set_attr(fluid={‘water’: 1}, m=10, T=250, p=20) >>> outg.set_attr(p=0.1) >>> nw.solve(‘design’) >>> round(st.P.val, 0) -7471296.0 >>> round(outg.x.val, 3) 0.821

To capture the effect of liquid drop-out on the isentropic efficiency, the dry turbine efficiency is specified >>> st.set_attr(eta_s=None) >>> st.set_attr(eta_s_dry=0.9, alpha=1.0) >>> nw.solve(‘design’) >>> round(st.P.val, 0) -7009682.0 >>> round(outg.x.val, 3) 0.84

eta_s_wet_func()[source]

Equation for given dry isentropic efficiency of a turbine under wet expansion.

Returns:

residual (float) – Residual value of equation.

\[ \begin{align}\begin{aligned}0 = -\left( h_{out} - h_{in} \right) + \left( h_{out,s} - h_{in} \right) \cdot \eta_{s,e}\\\eta_{s,e} = \eta_{s,e}^{dry} \cdot \left( 1 - \alpha \cdot y_m \right)\\y_m = \frac{\left( 1-x_{in}\right)+ \left( 1-x_{out} \right)}{2}\end{aligned}\end{align} \]

get_parameters()[source]
initialise_source(c, key)[source]

Return a starting value for pressure and enthalpy at outlet.

Parameters:
  • c (tespy.connections.connection.Connection) – Connection to perform initialisation on.

  • key (str) – Fluid property to retrieve.

Returns:

val (float) – Starting value for pressure/enthalpy in SI units.

tespy.components.turbomachinery.turbine module

Module of class Turbine.

This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/components/turbomachinery/turbine.py

SPDX-License-Identifier: MIT

class tespy.components.turbomachinery.turbine.Turbine(label, **kwargs)[source]

Bases: Turbomachine

Class for gas or steam turbines.

Mandatory Equations

Optional Equations

Inlets/Outlets

  • in1

  • out1

Optional outlets

  • power

Image

flowsheet of the turbine flowsheet of the turbine
Parameters:
  • label (str) – The label of the component.

  • design (list) – List containing design parameters (stated as String).

  • offdesign (list) – List containing offdesign parameters (stated as String).

  • design_path (str) – Path to the components design case.

  • local_offdesign (boolean) – Treat this component in offdesign mode in a design calculation.

  • local_design (boolean) – Treat this component in design mode in an offdesign calculation.

  • char_warnings (boolean) – Ignore warnings on default characteristics usage for this component.

  • printout (boolean) – Include this component in the network’s results printout.

  • P (float, dict) – Power, \(P/\text{W}\)

  • eta_s (float, dict) – Isentropic efficiency, \(\eta_s/1\)

  • pr (float, dict) – Outlet to inlet pressure ratio, \(pr/1\)

  • dp (float, dict) – Inlet to outlet pressure difference, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

  • eta_s_char (tespy.tools.characteristics.CharLine, dict) – Characteristic curve for isentropic efficiency, provide CharLine as function func.

  • cone (dict) – Apply Stodola’s cone law (works in offdesign only).

Example

A steam turbine expands 10 kg/s of superheated steam at 550 °C and 110 bar to 0,5 bar at the outlet. For example, it is possible to calculate the power output and vapour content at the outlet for a given isentropic efficiency.

>>> from tespy.components import Sink, Source, Turbine
>>> from tespy.connections import Connection
>>> from tespy.networks import Network
>>> from tespy.tools import ComponentCharacteristics as dc_cc
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "bar", "pressure_difference": "bar",
...     "temperature": "degC", "enthalpy": "kJ/kg", "mass_flow": "t/h"
... })
>>> si = Sink('sink')
>>> so = Source('source')
>>> t = Turbine('turbine')
>>> inc = Connection(so, 'out1', t, 'in1')
>>> outg = Connection(t, 'out1', si, 'in1')
>>> nw.add_conns(inc, outg)

In design conditions the isentropic efficiency is specified. For offdesign a characteristic function will be applied, together with Stodola’s cone law coupling the turbine mass flow to inlet pressure.

>>> t.set_attr(eta_s=0.9, design=['eta_s'],
... offdesign=['eta_s_char', 'cone'])
>>> inc.set_attr(fluid={'water': 1}, m=36, T=550, p=110, design=['p'])
>>> outg.set_attr(p=0.5)
>>> nw.solve('design')
>>> design_state = nw.save(as_dict=True)
>>> round(t.P.val, 0)
-10452574.0
>>> round(outg.x.val, 3)
0.914
>>> inc.set_attr(m=28.8)
>>> nw.solve('offdesign', design_path=design_state)
>>> round(t.eta_s.val, 3)
0.898
>>> round(inc.p.val, 1)
88.6
calc_eta_s()[source]
cone_dependents()[source]
cone_func()[source]

Equation for stodolas cone law.

Returns:

residual (float) – Residual value of equation.

\[0 = \frac{\dot{m}_{in,ref} \cdot p_{in}}{p_{in,ref}} \cdot \sqrt{\frac{p_{in,ref} \cdot v_{in}}{p_{in} \cdot v_{in,ref}}} \cdot \sqrt{\frac{1 - \left(\frac{p_{out}}{p_{in}} \right)^{2}} {1 - \left(\frac{p_{out,ref}}{p_{in,ref}} \right)^{2}}} - \dot{m}_{in}\]

convergence_check()[source]

Perform a convergence check.

Note

Manipulate enthalpies/pressure at inlet and outlet if not specified by user to match physically feasible constraints.

energy_connector_balance_func()[source]

(optional) energy balance equation connecting the power connector to the component’s power

Returns:

residual (float) – Residual value of equation

\[0=\dot E + \dot{m}_{in}\cdot\left(h_{out}-h_{in}\right)\]

energy_connector_dependents()[source]
eta_s_char_dependents()[source]
eta_s_char_func()[source]

Equation for given isentropic efficiency characteristic.

Returns:

residual (float) – Residual value of equation.

\[0 = - \left( h_\text{out} - h_\text{in} \right) + \eta_\text{s,design} \cdot f\left( expr \right) \cdot \left(h_\text{out,s}-h_\text{in}\right)\]

eta_s_dependents()[source]
eta_s_deriv(increment_filter, k, dependents=None)[source]

Partial derivatives for isentropic efficiency function.

Parameters:
  • increment_filter (ndarray) – Matrix for filtering non-changing variables.

  • k (int) – Position of derivatives in Jacobian matrix (k-th equation).

eta_s_func()[source]

Equation for given isentropic efficiency of a turbine.

Returns:

residual (float) – Residual value of equation.

\[0 = -\left( h_{out} - h_{in} \right) + \left( h_{out,s} - h_{in} \right) \cdot \eta_{s,e}\]

get_mandatory_constraints()[source]
get_parameters()[source]
static initialise_source(c, key)[source]

Return a starting value for pressure and enthalpy at outlet.

Parameters:
  • c (tespy.connections.connection.Connection) – Connection to perform initialisation on.

  • key (str) – Fluid property to retrieve.

Returns:

val (float) – Starting value for pressure/enthalpy in SI units.

static initialise_target(c, key)[source]

Return a starting value for pressure and enthalpy at inlet.

Parameters:
  • c (tespy.connections.connection.Connection) – Connection to perform initialisation on.

  • key (str) – Fluid property to retrieve.

Returns:

val (float) – Starting value for pressure/enthalpy in SI units.

static poweroutlets()[source]

tespy.components.turbomachinery.turbocompressor module

Module of class TurboCompressor.

This file is part of project TESPy (github.com/oemof/tespy). It’s copyrighted by the contributors recorded in the version control history of the file, available from its original location tespy/components/turbomachinery/turbocompressor.py

SPDX-License-Identifier: MIT

class tespy.components.turbomachinery.turbocompressor.TurboCompressor(label, **kwargs)[source]

Bases: Compressor

Class for a turbocompressor.

Mandatory Equations

Optional Equations

Inlets/Outlets

  • in1

  • out1

Optional inlets

  • power

Image

flowsheet of the compressor flowsheet of the compressor
Parameters:
  • label (str) – The label of the component.

  • design (list) – List containing design parameters (stated as String).

  • offdesign (list) – List containing offdesign parameters (stated as String).

  • design_path (str) – Path to the components design case.

  • local_offdesign (boolean) – Treat this component in offdesign mode in a design calculation.

  • local_design (boolean) – Treat this component in design mode in an offdesign calculation.

  • char_warnings (boolean) – Ignore warnings on default characteristics usage for this component.

  • printout (boolean) – Include this component in the network’s results printout.

  • P (float, dict) – Power, \(P/\text{W}\)

  • eta_s (float, dict) – Isentropic efficiency, \(\eta_s/1\)

  • pr (float, dict) – Outlet to inlet pressure ratio, \(pr/1\)

  • dp (float, dict) – Inlet to outlet pressure difference, \(dp/\text{p}_\text{unit}\) Is specified in the Network’s pressure unit

  • char_map_pr (tespy.tools.characteristics.CharMap, dict) – Characteristic map for pressure ratio vs. nondimensional mass flow.

  • char_map_eta_s (tespy.tools.characteristics.CharMap, dict) – Characteristic map for isentropic efficiency vs. nondimensional mass flow.

  • igva (float, dict, "var") – Inlet guide vane angle, \(igva/^\circ\).

Example

Create an air compressor model and calculate the power required for compression of 50 l/s of ambient air to 5 bars. Using a generic compressor map how does the efficiency change in different operation mode (e.g. 90 % of nominal volumetric flow)?

>>> from tespy.components import Sink, Source, TurboCompressor
>>> from tespy.connections import Connection
>>> from tespy.networks import Network
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "bar", "pressure_difference": "bar",
...     "temperature": "degC", "volumetric_flow": "l/s", "enthalpy": "kJ/kg"
... })
>>> si = Sink('sink')
>>> so = Source('source')
>>> comp = TurboCompressor('compressor')
>>> inc = Connection(so, 'out1', comp, 'in1')
>>> outg = Connection(comp, 'out1', si, 'in1')
>>> nw.add_conns(inc, outg)

Specify the compressor parameters: nominal efficiency and pressure ratio. For offdesign mode the characteristic map is selected instead of the isentropic efficiency. For offdesign, the inlet guide vane angle should be variable in order to maintain the same pressure ratio at a different volumetric flow.

>>> comp.set_attr(
...     pr=5, eta_s=0.8, design=['eta_s'],
...     offdesign=['char_map_pr', 'char_map_eta_s']
... )
>>> inc.set_attr(fluid={'air': 1}, p=1, T=20, v=50)
>>> nw.solve('design')
>>> design_state = nw.save(as_dict=True)
>>> round(comp.P.val, 0)
12772.0
>>> round(comp.eta_s.val, 2)
0.8
>>> inc.set_attr(v=45)
>>> comp.set_attr(igva='var')
>>> nw.solve('offdesign', design_path=design_state)
>>> round(comp.eta_s.val, 2)
0.77
>>> round(comp.igva.val, 2)
8.88

Or, we can fix the inlet guide vane angle and under the given pressure ratio the volumetric flow is a result. Note, that the problem can be very sensitive to changes of igva.

>>> comp.set_attr(igva=10)
>>> inc.set_attr(v=None)
>>> nw.solve('offdesign', design_path=design_state)
>>> nw.assert_convergence()
>>> round(inc.v.val, 2)
44.31
char_map_dependents()[source]
char_map_eta_s_func()[source]

Calculate isentropic efficiency from characteristic map.

Returns:

residual (float) – Residual value of equation.

Note

  • X: speedline index (rotational speed is constant)

  • Y: nondimensional mass flow

  • igva: variable inlet guide vane angle for value manipulation according to [40].

\[\begin{split}X = \sqrt{\frac{T_\text{in,design}}{T_\text{in}}}\\ Y = \frac{\dot{m}_\text{in} \cdot p_\text{in,design}} {\dot{m}_\text{in,design} \cdot p_\text{in} \cdot X}\\ \vec{Y} = f\left(X,Y\right)\cdot\left(1-\frac{igva}{100}\right)\\ \vec{Z}=f\left(X,Y\right)\cdot\left(1-\frac{igva^2}{10000}\right)\\ 0 = \frac{\eta_\text{s}}{\eta_\text{s,design}} - f\left(Y,\vec{Y},\vec{Z}\right)\end{split}\]
char_map_pr_func()[source]

Calculate pressure ratio from characteristic map.

Returns:

residual (float) – Residual value of equations.

Note

  • X: speedline index (rotational speed is constant)

  • Y: nondimensional mass flow

  • igva: variable inlet guide vane angle for value manipulation according to [40].

\[\begin{split}X = \sqrt{\frac{T_\text{in,design}}{T_\text{in}}}\\ Y = \frac{\dot{m}_\text{in} \cdot p_\text{in,design}} {\dot{m}_\text{in,design} \cdot p_\text{in} \cdot X}\\ \vec{Y} = f\left(X,Y\right)\cdot\left(1-\frac{igva}{100}\right)\\ \vec{Z} = f\left(X,Y\right)\cdot\left(1-\frac{igva}{100}\right)\\ 0 = \frac{p_{out} \cdot p_{in,design}} {p_\text{in} \cdot p_\text{out,design}}- f\left(Y,\vec{Y},\vec{Z}\right)\end{split}\]
check_parameter_bounds()[source]

Check parameter value limits.

get_parameters()[source]