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:

bus_deriv(bus)[source]

Calculate partial derivatives of the bus function.

Parameters:

bus (tespy.connections.bus.Bus) – TESPy bus object.

Returns:

deriv (ndarray) – Matrix of partial derivatives.

bus_func(bus)[source]

Calculate the value of the bus function.

Parameters:

bus (tespy.connections.bus.Bus) – TESPy bus object.

Returns:

residual (float) – Value of energy transfer \(\dot{E}\). This value is passed to tespy.components.component.Component.calc_bus_value() for value manipulation according to the specified characteristic line of the bus.

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

calc_parameters()[source]

Postprocessing parameter calculation.

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 follwing parameter available:

\[\begin{split}\text{S\_irr}=\dot{m} \cdot \left(s_\mathrm{out}-s_\mathrm{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
>>> import os
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "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')
>>> nw.save('tmp.json')
>>> 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='tmp.json')
>>> round(comp.eta_s.val, 2)
0.79
>>> os.remove('tmp.json')
calc_parameters()[source]

Postprocessing parameter calculation.

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 [32].

\[\begin{split}X = \sqrt{\frac{T_\mathrm{in,design}}{T_\mathrm{in}}}\\ Y = \frac{\dot{m}_\mathrm{in} \cdot p_\mathrm{in,design}} {\dot{m}_\mathrm{in,design} \cdot p_\mathrm{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_\mathrm{s}}{\eta_\mathrm{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 [32].

\[\begin{split}X = \sqrt{\frac{T_\mathrm{in,design}}{T_\mathrm{in}}}\\ Y = \frac{\dot{m}_\mathrm{in} \cdot p_\mathrm{in,design}} {\dot{m}_\mathrm{in,design} \cdot p_\mathrm{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_\mathrm{in} \cdot p_\mathrm{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)\]

exergy_balance(T0)[source]

Calculate exergy balance of a compressor.

Parameters:

T0 (float) – Ambient temperature T0 / K.

Note

\[ \begin{align}\begin{aligned}\begin{split}\dot{E}_\mathrm{P} = \begin{cases} \dot{E}_\mathrm{out}^\mathrm{PH} - \dot{E}_\mathrm{in}^\mathrm{PH} & T_\mathrm{in}, T_\mathrm{out} \geq T_0\\ \dot{E}_\mathrm{out}^\mathrm{T} + \dot{E}_\mathrm{out}^\mathrm{M} - \dot{E}_\mathrm{in}^\mathrm{M} & T_\mathrm{out} > T_0 \leq T_\mathrm{in}\\ \dot{E}_\mathrm{out}^\mathrm{M} - \dot{E}_\mathrm{in}^\mathrm{M} & T_0 \geq T_\mathrm{in}, T_\mathrm{out}\\ \end{cases}\end{split}\\\begin{split}\dot{E}_\mathrm{F} = \begin{cases} P & T_\mathrm{in}, T_\mathrm{out} \geq T_0\\ P + \dot{E}_\mathrm{in}^\mathrm{T} & T_\mathrm{out} > T_0 \leq T_\mathrm{in}\\ P + \dot{E}_\mathrm{in}^\mathrm{T} -\dot{E}_\mathrm{out}^\mathrm{T} & T_0 \geq T_\mathrm{in}, T_\mathrm{out}\\ \end{cases}\end{split}\\\dot{E}_\mathrm{bus} = P\end{aligned}\end{align} \]
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.polynomial_compressor module

tespy.components.turbomachinery.polynomial_compressor.calc_EN12900(c: list, t_evap: float, t_cond: float) float[source]
tespy.components.turbomachinery.polynomial_compressor.fit_EN12900(t_evap: array, t_cond: array, data: array) array[source]
tespy.components.turbomachinery.polynomial_compressor.generate_eta_polys_from_data(df_power, df_cooling, fluid: str, reference_state: dict) tuple[source]
tespy.components.turbomachinery.polynomial_compressor.generate_eta_polys_from_power_and_cooling_polys(power_poly: list, cooling_poly: list, t_evap: array, t_cond: array, fluid: str, reference_state: dict) tuple[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\)

  • 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.

  • 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

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
>>> import os
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "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 calulate 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')
>>> nw.save('tmp.json')
>>> 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='tmp.json')
>>> round(pu.eta_s.val, 2)
0.71
>>> round(inc.v.val, 1)
0.9
>>> os.remove('tmp.json')
calc_parameters()[source]

Postprocessing parameter calculation.

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.

Returns:

residual (float) – Residual value of equation.

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

exergy_balance(T0)[source]

Calculate exergy balance of a pump.

Parameters:

T0 (float) – Ambient temperature T0 / K.

Note

\[ \begin{align}\begin{aligned}\begin{split}\dot{E}_\mathrm{P} = \begin{cases} \dot{E}_\mathrm{out}^\mathrm{PH} - \dot{E}_\mathrm{in}^\mathrm{PH} & T_\mathrm{in}, T_\mathrm{out} \geq T_0\\ \dot{E}_\mathrm{out}^\mathrm{T} + \dot{E}_\mathrm{out}^\mathrm{M} - \dot{E}_\mathrm{in}^\mathrm{M} & T_\mathrm{out} > T_0 \leq T_\mathrm{in}\\ \dot{E}_\mathrm{out}^\mathrm{M} - \dot{E}_\mathrm{in}^\mathrm{M} & T_0 \geq T_\mathrm{in}, T_\mathrm{out}\\ \end{cases}\end{split}\\\begin{split}\dot{E}_\mathrm{F} = \begin{cases} P & T_\mathrm{in}, T_\mathrm{out} \geq T_0\\ P + \dot{E}_\mathrm{in}^\mathrm{T} & T_\mathrm{out} > T_0 \leq T_\mathrm{in}\\ P + \dot{E}_\mathrm{in}^\mathrm{T} -\dot{E}_\mathrm{out}^\mathrm{T} & T_0 \geq T_\mathrm{in}, T_\mathrm{out}\\ \end{cases}\end{split}\\\dot{E}_\mathrm{bus} = P\end{aligned}\end{align} \]
flow_char_dependents()[source]
flow_char_func()[source]

Equation for given flow characteristic of a pump.

Returns:

residual (float) – Residual value of equation.

\[0 = p_{out} - p_{in} - f\left( expr \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.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 calulate the power output and vapour content at the outlet for a given isentropic efficiency. The SteamTurbine class follows the implementation of the Baumann rule [33]

>>> 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", "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 calulate 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
>>> import os
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "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')
>>> nw.save('tmp.json')
>>> 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='tmp.json')
>>> round(t.eta_s.val, 3)
0.898
>>> round(inc.p.val, 1)
88.6
>>> os.remove('tmp.json')
calc_eta_s()[source]
calc_parameters()[source]

Postprocessing parameter calculation.

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_\mathrm{out} - h_\mathrm{in} \right) + \eta_\mathrm{s,design} \cdot f\left( expr \right) \cdot \left(h_\mathrm{out,s}-h_\mathrm{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}\]

exergy_balance(T0)[source]

Calculate exergy balance of a turbine.

Parameters:

T0 (float) – Ambient temperature T0 / K.

Note

\[ \begin{align}\begin{aligned}\begin{split} \dot{E}_\mathrm{P} = \begin{cases} -P & T_\mathrm{in}, T_\mathrm{out} \geq T_0\\ -P + \dot{E}_\mathrm{out}^\mathrm{T} & T_\mathrm{in} > T_0 \geq T_\mathrm{out}\\ -P +\dot{E}_\mathrm{out}^\mathrm{T}- \dot{E}_\mathrm{in}^\mathrm{T} & T_0 \geq T_\mathrm{in}, T_\mathrm{out}\\ \end{cases}\end{split}\\\begin{split}\dot{E}_\mathrm{F} = \begin{cases} \dot{E}_\mathrm{in}^\mathrm{PH} - \dot{E}_\mathrm{out}^\mathrm{PH} & T_\mathrm{in}, T_\mathrm{out} \geq T_0\\ \dot{E}_\mathrm{in}^\mathrm{T} + \dot{E}_\mathrm{in}^\mathrm{M} - \dot{E}_\mathrm{out}^\mathrm{M} & T_\mathrm{in} > T_0 \geq T_\mathrm{out}\\ \dot{E}_\mathrm{in}^\mathrm{M} - \dot{E}_\mathrm{out}^\mathrm{M} & T_0 \geq T_\mathrm{in}, T_\mathrm{out}\\ \end{cases}\end{split}\\\dot{E}_\mathrm{bus} = -P\end{aligned}\end{align} \]
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
>>> import os
>>> nw = Network(iterinfo=False)
>>> nw.units.set_defaults(**{
...     "pressure": "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')
>>> nw.save('tmp.json')
>>> 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='tmp.json')
>>> 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='tmp.json')
>>> nw.assert_convergence()
>>> round(inc.v.val, 2)
44.31
>>> os.remove('tmp.json')
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 [32].

\[\begin{split}X = \sqrt{\frac{T_\mathrm{in,design}}{T_\mathrm{in}}}\\ Y = \frac{\dot{m}_\mathrm{in} \cdot p_\mathrm{in,design}} {\dot{m}_\mathrm{in,design} \cdot p_\mathrm{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_\mathrm{s}}{\eta_\mathrm{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 [32].

\[\begin{split}X = \sqrt{\frac{T_\mathrm{in,design}}{T_\mathrm{in}}}\\ Y = \frac{\dot{m}_\mathrm{in} \cdot p_\mathrm{in,design}} {\dot{m}_\mathrm{in,design} \cdot p_\mathrm{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_\mathrm{in} \cdot p_\mathrm{out,design}}- f\left(Y,\vec{Y},\vec{Z}\right)\end{split}\]
check_parameter_bounds()[source]

Check parameter value limits.

get_parameters()[source]