tespy.components.combustion package¶
tespy.components.combustion.base module¶
Module of class CombustionChamber.
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/combustion/base.py
SPDX-License-Identifier: MIT
- class tespy.components.combustion.base.CombustionChamber(label, **kwargs)[source]¶
Bases:
ComponentThe class CombustionChamber is parent class of all combustion components.
Ports¶
Fluid inlets: in1, in2
Fluid outlets: out1
Mandatory Equations¶
mass flow balance over all inflows and outflows:
mass_flow_funcpressure equality constraints:
combustion_pressure_structure_matrixconstraints for stoichiometry of the reaction:
stoichiometry_funcconstraint for energy balance:
energy_balance_func
- Parameters:
char_warnings (bool) – Ignore warnings on default characteristics usage for this component.
design (list) – List containing design parameters (stated as String).
design_path (str) – Path to the components design case.
f_nox (float, dict) – Mass-based nitric oxide (NO) generation rate in flue gas in mass of created NO per mass of fuel and air input. Only active if value is explicitly set. Quantity:
ratio.label (str) – The label of the component.
lamb (float, dict) – Available oxygen to stoichiometric oxygen ratio. Quantity:
ratio. Equation:lambda_func.local_design (bool) – Treat this component in design mode in an offdesign calculation.
local_offdesign (bool) – Treat this component in offdesign mode in a design calculation.
offdesign (list) – List containing offdesign parameters (stated as String).
printout (bool) – Include this component in the network’s results printout.
ti (float, dict) – Thermal input of fuel: lower heating value multiplied with mass flow. Quantity:
heat. Equation:ti_func.
Notes
Tip
You can add more fluids by importing
COMBUSTION_FLUIDSfrom thetespy.toolsmodule and passing the respective information. See in the example below, how to do that. To retrieve the fluids available by default run:from tespy.tools.global_vars import COMBUSTION_FLUIDS COMBUSTION_FLUIDS.fluids.keys()
Note
The fuel and the air components can be connected to either of the inlets.
Example
The combustion chamber calculates energy input due to combustion as well as the flue gas composition based on the type of fuel and the amount of oxygen supplied. In this example a mixture of methane, hydrogen and carbon dioxide is used as fuel.
>>> from tespy.components import Sink, Source, CombustionChamber >>> from tespy.connections import Connection >>> from tespy.networks import Network >>> from tespy.tools.fluid_properties import T_sat_p >>> nw = Network(iterinfo=False) >>> nw.units.set_defaults(**{ ... "pressure": "bar", "pressure_difference": "bar", ... "temperature": "degC" ... }) >>> amb = Source("ambient air") >>> sf = Source("fuel") >>> fg = Sink("flue gas outlet") >>> comb = CombustionChamber("combustion chamber") >>> amb_comb = Connection(amb, "out1", comb, "in1") >>> sf_comb = Connection(sf, "out1", comb, "in2") >>> comb_fg = Connection(comb, "out1", fg, "in1") >>> nw.add_conns(sf_comb, amb_comb, comb_fg)
Specify the thermal input of the combustion chamber. At the given fluid compositions this determines the mass flow of the fuel. The outlet temperature of the flue gas determines the ratio of oxygen to fuel mass flow.
>>> comb.set_attr(ti=500000) >>> amb_comb.set_attr( ... p=1, T=20, ... fluid={"Ar": 0.0129, "N2": 0.7553, "CO2": 0.0004, "O2": 0.2314} ... ) >>> sf_comb.set_attr(T=25, fluid={"CO2": 0.03, "H2": 0.01, "CH4": 0.96}) >>> comb_fg.set_attr(T=1200) >>> nw.solve("design") >>> round(comb.lamb.val, 3) 2.014 >>> comb.set_attr(lamb=2) >>> comb_fg.set_attr(T=None) >>> nw.solve("design") >>> round(comb_fg.T.val, 1) 1206.6
You can add a custom combustion fluid if you need. The combustion gas must be available in fluid property back-end and you need to provide the name of the fluid as well as its formation enthalpy
hfin kJ/mol or the lower heating valueLHVin J/kg. For example, let’s useethanolandacetoneas examples:>>> from tespy.tools import COMBUSTION_FLUIDS >>> COMBUSTION_FLUIDS.add_fluid("ethanol", hf=-234.95) >>> COMBUSTION_FLUIDS.add_fluid("acetone", LHV=28.603e6)
>>> sf_comb.set_attr(fluid={"acetone": 1}) >>> nw.solve("design") >>> round(comb_fg.T.val, 1) 1232.3 >>> sf_comb.set_attr(fluid={"ethanol": 1}) >>> nw.solve("design") >>> round(comb_fg.T.val, 1) 1241.7
- calc_lhv(f)[source]¶
Calculate the lower heating value of the combustion chamber’s fuel.
- Parameters:
f (str) – Alias of the fuel.
- Returns:
val (float) – Lower heating value of the combustion chambers fuel.
\[\begin{split}LHV = -\frac{\sum_i {\Delta H_f^0}_i - \sum_j {\Delta H_f^0}_j } {M_{fuel}}\\ \forall i \in \text{reation products},\\ \forall j \in \text{reation educts},\\ \Delta H_f^0: \text{molar formation enthalpy}\end{split}\]
- combustion_pressure_structure_matrix(k)[source]¶
Equations for reactor pressure balance.
- Returns:
residual (list) – Residual values of equations.
\[\begin{split}0 = p_\text{in,1} - p_\text{out,1}\\ 0 = p_\text{in,2} - p_\text{out,1}\end{split}\]
- 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, keep fluid composition within feasible range and then propagates it towards the outlet.
- energy_balance_func()[source]¶
Calculate the energy balance of the adiabatic combustion chamber.
- Returns:
residual (float) – Residual value of equation.
\[ \begin{align}\begin{aligned}\begin{split}\begin{split} 0 = & \sum_i \dot{m}_{in,i} \cdot \left( h_{in,i} - h_{in,i,ref} \right)\\ & -\dot{m}_{out,2}\cdot\left( h_{out,1}-h_{out,1,ref} \right)\\ & + LHV_{fuel} \cdot\left(\sum_i\dot{m}_{in,i}\cdot x_{fuel,in,i}- \dot{m}_{out,1} \cdot x_{fuel} \right) \end{split}\\\end{split}\\\forall i \in \text{inlets}\end{aligned}\end{align} \]
Note
The temperature for the reference state is set to 25 °C, thus the water may be liquid. In order to make sure, the state is referring to the lower heating value, the state of the water in the flue gas is forced to gaseous.
Reference temperature: 298.15 K.
Reference pressure: 1 bar.
- entropy_balance()[source]¶
Calculate entropy balance of combustion chamber.
Note
The entropy balance makes the following parameter available:
T_mcomb: Thermodynamic temperature of heat of combustionS_comb: Entropy production due to combustionS_irr: Entropy production due to irreversibilty
The methodology for entropy analysis of combustion processes is derived from [31]. Similar to the energy balance of a combustion reaction, we need to define the same reference state for the entropy balance of the combustion. The temperature for the reference state is set to 25 °C and reference pressure is 1 bar. As the water in the flue gas may be liquid but the thermodynamic temperature of heat of combustion refers to the lower heating value, the water is forced to gas at the reference point by considering evaporation.
Reference temperature: 298.15 K.
Reference pressure: 1 bar.
\[\begin{split}T_\text{m,comb}= \frac{\dot{m}_\text{fuel} \cdot LHV} {\dot{S}_\text{comb}}\\ \dot{S}_\text{comb}= \dot{m}_\text{fluegas} \cdot \left(s_\text{fluegas}-s_\text{fluegas,ref}\right) - \sum_{i=1}^2 \dot{m}_{\text{in,}i} \cdot \left( s_{\text{in,}i} - s_{\text{in,ref,}i} \right)\\ \dot{S}_\text{irr}= 0\\\end{split}\]
- 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.
\[\begin{split}val = \begin{cases} 5 \cdot 10^5 & \text{key = 'p'}\\ 10^6 & \text{key = 'h'} \end{cases}\end{split}\]
- 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.
\[\begin{split}val = \begin{cases} 5 \cdot 10^5 & \text{key = 'p'}\\ 5 \cdot 10^5 & \text{key = 'h'} \end{cases}\end{split}\]
- lambda_func()[source]¶
Calculate the residual for specified lambda.
- Returns:
residual (float) – Residual value of equation.
\[ \begin{align}\begin{aligned}0 = \frac{\dot{m}_{f,m}}{\dot{m}_{O_2,m} \cdot \left(n_{C,fuel} + 0.25 \cdot n_{H,fuel}\right)} - \lambda\\\begin{split}\dot{m}_{fluid,m} = \sum_i \frac{x_{fluid,i} \cdot \dot{m}_{i}} {M_{fluid}}\\ \forall i \in inlets\end{split}\end{aligned}\end{align} \]
- mass_flow_func()[source]¶
Calculate the residual value for component’s mass flow balance.
- Returns:
residual (list) – Vector with residual value for component’s mass flow balance.
\[0 = \dot{m}_{in,1} + \dot{m}_{in,2} - \dot{m}_{out,1}\]
- stoichiometry_func()[source]¶
Calculate residual values for all fluids in stoichiometry.
Shared intermediate quantities (molar flows of fuel atoms, oxygen, lambda, excess fuel) are computed once and reused for every fluid equation, instead of being recomputed per fluid.
- Returns:
residual (list) – Vector with residual values of equations.
General equation for each fluid:
\[\begin{split}res = \sum_i \left(x_{fluid,i} \cdot \dot{m}_{i}\right) - \sum_j \left(x_{fluid,j} \cdot \dot{m}_{j}\right) + dm\\ \forall i \in \text{combustion inlets},\; \forall j \in \text{flue gas outlet}\end{split}\]where \(dm\) accounts for the production or consumption of reactive species (see
stoichiometryfor the per-species expressions).
tespy.components.combustion.diabatic module¶
Module of class DiabaticCombustionChamber.
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/combustion/diabatic.py
SPDX-License-Identifier: MIT
- class tespy.components.combustion.diabatic.DiabaticCombustionChamber(label, **kwargs)[source]¶
Bases:
CombustionChamberAn extension of the adiabatic combustion chamber with pressure drop and heat loss.
Ports¶
Fluid inlets: in1, in2
Fluid outlets: out1
Mandatory Equations¶
mass flow balance over all inflows and outflows:
mass_flow_funcconstraints for stoichiometry of the reaction:
stoichiometry_func
- Parameters:
char_warnings (bool) – Ignore warnings on default characteristics usage for this component.
design (list) – List containing design parameters (stated as String).
design_path (str) – Path to the components design case.
dp (float, dict) – Inlet 0 to outlet 0 absolute pressure change. Quantity:
pressure_difference. Equation:dp_structure_matrix.eta (float, dict) – Heat dissipation ratio relative to thermal input. Quantity:
efficiency. Equation:energy_balance_func.f_nox (float, dict) – Mass-based nitric oxide (NO) generation rate in flue gas in mass of created NO per mass of fuel and air input. Only active if value is explicitly set. Quantity:
ratio.label (str) – The label of the component.
lamb (float, dict) – Available oxygen to stoichiometric oxygen ratio. Quantity:
ratio. Equation:lambda_func.local_design (bool) – Treat this component in design mode in an offdesign calculation.
local_offdesign (bool) – Treat this component in offdesign mode in a design calculation.
offdesign (list) – List containing offdesign parameters (stated as String).
pr (float, dict) – Outlet 0 to inlet 0 pressure ratio. Quantity:
ratio. Equation:pr_structure_matrix.printout (bool) – Include this component in the network’s results printout.
Qloss (float, dict) – Heat dissipation. Quantity:
heat.ti (float, dict) – Thermal input of fuel: lower heating value multiplied with mass flow. Quantity:
heat. Equation:ti_func.
Notes
Tip
You can add more fluids by importing
COMBUSTION_FLUIDSfrom thetespy.toolsmodule and passing the respective information. See in the example oftespy.components.combustion.base.CombustionChamber, how to do that. To retrieve the fluids available by default run:from tespy.tools.global_vars import COMBUSTION_FLUIDS COMBUSTION_FLUIDS.fluids.keys()
Note
The fuel and the air components can be connected to either of the inlets. The pressure of inlet 2 is disconnected from the pressure of inlet 1. A warning is prompted, if the pressure at inlet 2 is lower than the pressure at inlet 1.
Example
The combustion chamber calculates energy input due to combustion as well as the flue gas composition based on the type of fuel and the amount of oxygen supplied. In this example a mixture of methane, hydrogen and carbon dioxide is used as fuel.
>>> from tespy.components import Sink, Source, DiabaticCombustionChamber >>> from tespy.connections import Connection >>> from tespy.networks import Network >>> from tespy.tools.fluid_properties import T_sat_p >>> nw = Network(iterinfo=False) >>> nw.units.set_defaults(**{ ... "pressure": "bar", "pressure_difference": "bar", ... "temperature": "degC" ... }) >>> amb = Source('ambient air') >>> sf = Source('fuel') >>> fg = Sink('flue gas outlet') >>> comb = DiabaticCombustionChamber('combustion chamber') >>> amb_comb = Connection(amb, 'out1', comb, 'in1') >>> sf_comb = Connection(sf, 'out1', comb, 'in2') >>> comb_fg = Connection(comb, 'out1', fg, 'in1') >>> nw.add_conns(sf_comb, amb_comb, comb_fg)
Specify the thermal input of the combustion chamber. At the given fluid compositions this determines the mass flow of the fuel. The outlet temperature of the flue gas determines the ratio of oxygen to fuel mass flow. In contrast to the simple combustion chamber, this component does allow for a pressure drop. Therefore the outlet pressure or the pressure ratio of the combustion chamber must be specified. Since the component is not adiabatic, an efficiency value
etacan be supplied to account for heat loss to the ambient. First, we specifyeta=1and expect identical lambda or outlet temperature as in an adiabatic combustion chamber.>>> comb.set_attr(ti=500000, pr=0.95, eta=1) >>> amb_comb.set_attr( ... p=1.2, T=20, ... fluid={'Ar': 0.0129, 'N2': 0.7553, 'CO2': 0.0004, 'O2': 0.2314} ... ) >>> sf_comb.set_attr( ... p=1.3, T=25, fluid={'CO2': 0.03, 'H2': 0.01, 'CH4': 0.96} ... ) >>> comb_fg.set_attr(T=1200) >>> nw.solve('design') >>> round(comb.lamb.val, 3) 2.014 >>> round(comb_fg.p.val, 2) 1.14
Instead of the pressure ratio, we can also specify the outlet pressure. The pressure ratio is the ratio of pressure at the outlet to the pressure at the inlet 1 (ambient air inlet in this example).
>>> comb.set_attr(pr=None) >>> comb_fg.set_attr(p=1) >>> nw.solve('design') >>> round(comb.pr.val, 3) 0.833
We can change lambda to a specific value and unset the flue gas temperature:
>>> comb.set_attr(lamb=2) >>> comb_fg.set_attr(T=None) >>> nw.solve('design') >>> round(comb_fg.T.val, 1) 1206.5
Now, if we change the efficiency value, e.g. to 0.9, a total of 10 % of heat respective to the thermal input will be transferred to the ambient. Note, that the heat loss
Qlosshas a negative value as it is extracted from the system.>>> eta = 0.9 >>> comb.set_attr(eta=eta) >>> nw.solve('design') >>> round(comb.Qloss.val, 0) -50000.0 >>> round(comb.ti.val * comb.eta.val, 0) 450000.0
- energy_balance_func()[source]¶
Calculate the energy balance of the diabatic combustion chamber.
- Returns:
residual (float) – Residual value of equation.
\[ \begin{align}\begin{aligned}\begin{split}\begin{split} 0 = & \sum_i \dot{m}_{in,i} \cdot \left( h_{in,i} - h_{in,i,ref} \right)\\ & -\dot{m}_{out,2}\cdot\left( h_{out,1}-h_{out,1,ref} \right)\\ & + LHV_{fuel} \cdot\left(\sum_i\dot{m}_{in,i}\cdot x_{fuel,in,i}- \dot{m}_{out,1} \cdot x_{fuel} \right) \cdot \eta \end{split}\\\end{split}\\\forall i \in \text{inlets}\end{aligned}\end{align} \]
Note
The temperature for the reference state is set to 25 °C, thus the water may be liquid. In order to make sure, the state is referring to the lower heating value, the state of the water in the flue gas is forced to gaseous.
Reference temperature: 298.15 K.
Reference pressure: 1 bar.
tespy.components.combustion.engine module¶
Module of class CombustionEngine.
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/combustion/engine.py
SPDX-License-Identifier: MIT
- class tespy.components.combustion.engine.CombustionEngine(label, **kwargs)[source]¶
Bases:
CombustionChamberAn internal combustion engine supplies power and heat cogeneration.
The combustion engine produces power and heat in cogeneration from fuel combustion. The combustion properties are identical to the combustion chamber. Thermal input and power output, heat output and heat losses are linked with an individual characteristic line for each property.
Ports¶
Fluid inlets: in1, in2, in3, in4
Fluid outlets: out1, out2, out3
Power outlets: power
Mandatory Equations¶
mass flow balance over all inflows and outflows:
mass_flow_funcpressure equality constraints:
combustion_pressure_structure_matrixconstraints for stoichiometry of the reaction:
stoichiometry_funcconstraint for energy balance:
energy_balance_funcequation for thermal input to power generation relation:
tiP_char_funcequation for thermal input to heating port 1 heat generation relation:
Q1_char_funcequation for thermal input to heating port 2 heat generation relation:
Q2_char_funcequation for thermal input to heat dissipation relation:
Qloss_char_funcequation for mass flow equality at heating ports:
variable_equality_structure_matrixequation for fluid composition equality at heating ports:
variable_equality_structure_matrix
When a power or heat connector is attached:
energy_connector_balance:
energy_connector_balance_func
- Parameters:
char_warnings (bool) – Ignore warnings on default characteristics usage for this component.
design (list) – List containing design parameters (stated as String).
design_path (str) – Path to the components design case.
dp1 (float, dict) – Heating port 1 inlet to outlet absolute pressure change. Quantity:
pressure_difference. Equation:dp_structure_matrix.dp2 (float, dict) – Heating port 2 inlet to outlet absolute pressure change. Quantity:
pressure_difference. Equation:dp_structure_matrix.eta_mech (float) – Description missing.
f_nox (float, dict) – Mass-based nitric oxide (NO) generation rate in flue gas in mass of created NO per mass of fuel and air input. Only active if value is explicitly set. Quantity:
ratio.label (str) – The label of the component.
lamb (float, dict) – Available oxygen to stoichiometric oxygen ratio. Quantity:
ratio. Equation:lambda_func.local_design (bool) – Treat this component in design mode in an offdesign calculation.
local_offdesign (bool) – Treat this component in offdesign mode in a design calculation.
offdesign (list) – List containing offdesign parameters (stated as String).
P (float, dict,
"var") – Mechanical power generated by the engine. Quantity:power. Can be set as a system variable by passing"var"as its value.pr1 (float, dict) – Heating port 1 outlet to inlet pressure ratio. Quantity:
ratio. Equation:pr_structure_matrix.pr2 (float, dict) – Heating port 2 outlet to inlet pressure ratio. Quantity:
ratio. Equation:pr_structure_matrix.printout (bool) – Include this component in the network’s results printout.
Q1 (float, dict) – Heating port 1 heat production. Quantity:
heat. Equation:Q1_func.Q1_char (tespy.tools.characteristics.CharLine, dict) – Thermal input to heat production of port 1 lookup table.
Q2 (float, dict) – Heating port 2 heat production. Quantity:
heat. Equation:Q2_func.Q2_char (tespy.tools.characteristics.CharLine, dict) – Thermal input to heat production of port 2 lookup table.
Qloss (float, dict,
"var") – Heat dissipation. Quantity:heat. Can be set as a system variable by passing"var"as its value.Qloss_char (tespy.tools.characteristics.CharLine, dict) – Thermal input to heat dissipation lookup table.
T_v_inner (float) – Description missing.
ti (float, dict) – Thermal input of fuel: lower heating value multiplied with mass flow. Quantity:
heat. Equation:ti_func.tiP_char (tespy.tools.characteristics.CharLine, dict) – Thermal input to power lookup table.
zeta1 (float, dict) – Deprecated, use
zeta1_d4instead.zeta1_d4 (float, dict) – Heating port 1 geometry-independent friction coefficient zeta/D^4 for pressure loss calculation. Equation:
zeta_d4_func.zeta2 (float, dict) – Deprecated, use
zeta2_d4instead.zeta2_d4 (float, dict) – Heating port 2 geometry-independent friction coefficient zeta/D^4 for pressure loss calculation. Equation:
zeta_d4_func.
Notes
Tip
You can add more fluids by importing
COMBUSTION_FLUIDSfrom thetespy.toolsmodule and passing the respective information. See in the example oftespy.components.combustion.base.CombustionChamber, how to do that. To retrieve the fluids available by default run:from tespy.tools.global_vars import COMBUSTION_FLUIDS COMBUSTION_FLUIDS.fluids.keys()
Note
The fuel and the air components can be connected to either of the inlets.
Example
The combustion chamber calculates energy input due to combustion as well as the flue gas composition based on the type of fuel and the amount of oxygen supplied. In this example a mixture of methane, hydrogen and carbon dioxide is used as fuel. There are two cooling ports, the cooling water will flow through them in parallel.
>>> from tespy.components import (Sink, Source, CombustionEngine, Merge, ... Splitter) >>> from tespy.connections import Connection, Ref >>> from tespy.networks import Network >>> nw = Network(iterinfo=False) >>> nw.units.set_defaults(**{ ... "pressure": "bar", "pressure_difference": "bar", ... "temperature": "degC" ... }) >>> amb = Source('ambient') >>> sf = Source('fuel') >>> fg = Sink('flue gas outlet') >>> cw_in = Source('cooling water inlet') >>> sp = Splitter('cooling water splitter', num_out=2) >>> me = Merge('cooling water merge', num_in=2) >>> cw_out = Sink('cooling water outlet') >>> chp = CombustionEngine(label='internal combustion engine') >>> amb_comb = Connection(amb, 'out1', chp, 'in3') >>> sf_comb = Connection(sf, 'out1', chp, 'in4') >>> comb_fg = Connection(chp, 'out3', fg, 'in1') >>> nw.add_conns(sf_comb, amb_comb, comb_fg) >>> cw_sp = Connection(cw_in, 'out1', sp, 'in1') >>> sp_chp1 = Connection(sp, 'out1', chp, 'in1') >>> sp_chp2 = Connection(sp, 'out2', chp, 'in2') >>> chp1_me = Connection(chp, 'out1', me, 'in1') >>> chp2_me = Connection(chp, 'out2', me, 'in2') >>> me_cw = Connection(me, 'out1', cw_out, 'in1') >>> nw.add_conns(cw_sp, sp_chp1, sp_chp2, chp1_me, chp2_me, me_cw)
The combustion engine produces a power output of 10 MW the oxygen to stoichiometric oxygen ratio is set to 1. Only pressure ratio 1 is set as we reconnect both cooling water streams. At the merge all pressure values will be identical automatically. Reference the mass flow at the splitter to be split in half.
>>> chp.set_attr(pr1=0.99, P=-10e6, lamb=1.0, ... design=['pr1'], offdesign=['zeta1_d4']) >>> amb_comb.set_attr(p=5, T=30, fluid={'Ar': 0.0129, 'N2': 0.7553, ... 'CO2': 0.0004, 'O2': 0.2314}) >>> sf_comb.set_attr(T=30, fluid={'CH4': 1}) >>> cw_sp.set_attr(p=3, T=60, m=50, fluid={'H2O': 1}) >>> sp_chp2.set_attr(m=Ref(sp_chp1, 1, 0)) >>> mode = 'design' >>> nw.solve(mode=mode) >>> design_state = nw.save(as_dict=True) >>> round(chp.ti.val, 0) 25300000.0 >>> round(chp.Q1.val, 0) -4980000.0 >>> chp.set_attr(Q1=-4e6, P=None) >>> mode = 'offdesign' >>> nw.solve(mode=mode, init_path=design_state, design_path=design_state) >>> round(chp.ti.val, 0) 17794554.0 >>> round(chp.P.val / chp.P.design, 3) 0.617 >>> chp.set_attr(P=chp.P.design * 0.75, Q1=None) >>> mode = 'offdesign' >>> nw.solve(mode=mode, init_path=design_state, design_path=design_state) >>> round(chp.ti.val, 0) 20550000.0 >>> round(chp.P.val / chp.P.design, 3) 0.75
- Q1_char_func()[source]¶
Calculate the relation of heat output 1 and thermal input.
- Returns:
residual (float) – Residual value of equation.
\[\begin{split}\begin{split} 0 = & \dot{m}_1 \cdot \left(h_{out,1} - h_{in,1} \right) \cdot f_{TI}\left(\frac{P}{P_{design}}\right) \\ & - LHV \cdot \left[\sum_i \left(\dot{m}_{in,i} \cdot x_{f,i}\right) - \dot{m}_{out,3} \cdot x_{f,3} \right] \cdot f_{Q1}\left(\frac{P}{P_{ref}}\right)\\ \end{split}\\ \forall i \in [3,4]\end{split}\]
- Q1_func()[source]¶
Calculate residual value of primary heat loop function.
- Returns:
residual (float) – Residual value of equation.
\[0 = \dot{m}_1 \cdot \left(h_{out,1} + h_{in,1} \right) - \dot{Q}_1\]
- Q2_char_func()[source]¶
Calculate the relation of heat output 2 and thermal input.
- Returns:
residual (float) – Residual value of equation.
\[\begin{split}\begin{split} 0 = & \dot{m}_2 \cdot \left(h_{out,2} - h_{in,2} \right) \cdot f_{TI}\left(\frac{P}{P_{design}}\right) \\ & - LHV \cdot \left[\sum_i \left(\dot{m}_{in,i} \cdot x_{f,i}\right) - \dot{m}_{out,3} \cdot x_{f,3} \right] \cdot f_{Q2}\left(\frac{P}{P_{ref}}\right)\\ \end{split}\\ \forall i \in [3,4]\end{split}\]
- Q2_func()[source]¶
Calculate residual value of secondary heat loop function.
- Returns:
residual (float) – Residual value of equation.
\[0 = \dot{m}_2 \cdot \left(h_{out,2} - h_{in,2} \right) - \dot{Q}_2\]
- Qloss_char_func()[source]¶
Calculate the relation of heat loss and thermal input.
- Returns:
residual (float) – Residual value of equation.
\[\begin{split}\begin{split} 0 = & \dot{Q}_{loss} \cdot f_{TI}\left(\frac{P}{P_{design}}\right) \\ & + LHV \cdot \left[\sum_i \left(\dot{m}_{in,i} \cdot x_{f,i}\right) - \dot{m}_{out,3} \cdot x_{f,3} \right] \cdot f_{QLOSS}\left(\frac{P}{P_{ref}}\right)\\ \end{split}\\ \forall i \in [3,4]\end{split}\]
- energy_balance_deriv(increment_filter, k, dependents=None)[source]¶
Calculate partial derivatives of energy balance function.
- Parameters:
increment_filter (ndarray) – Matrix for filtering non-changing variables.
k (int) – Position of equation in Jacobian matrix.
- energy_balance_func()[source]¶
Calculate the energy balance of the combustion engine.
- Returns:
residual (float) – Residual value of equation.
\[\begin{split}\begin{split} 0 = & \sum_i \dot{m}_{in,i} \cdot \left( h_{in,i} - h_{in,i,ref} \right)\\ & - \dot{m}_{out,3} \cdot \left( h_{out,3} - h_{out,3,ref} \right)\\ & + LHV_{fuel} \cdot \left(\sum_j \left(\dot{m}_{in,j} \cdot x_{fuel,j} \right)- \dot{m}_{out,3} \cdot x_{fuel,3} \right)\\ & - \dot{Q}_1 - \dot{Q}_2 - P - \dot{Q}_{loss}\\ \end{split}\\ \forall i \in [1,2] j \in [3,4]\end{split}\]
Note
The temperature for the reference state is set to 25 °C, thus the water may be liquid. In order to make sure, the state is referring to the lower heating value, the necessary enthalpy difference for evaporation is added.
Reference temperature: 298.15 K.
Reference pressure: 1 bar.
- entropy_balance()[source]¶
Calculate entropy balance of combustion engine.
For the entropy balance of a combustion engine two additional parameters need to be specified:
virtual inner temperature
T_v_innerthat is used to determine the entropy of heat transferred from the hot side.mechanical efficiency
eta_mechdescribing the ratio of power outputPto reversible power of the motor [32]. It is used to determine the irreversibilty inside the motor.\[P_\text{irr,inner}=\left(1 - \frac{1}{\eta_\text{mech}} \right) \cdot P\]
The default values are:
T_v_inner: flue gas temperature (result of calculation)eta_mech: 0.85
Note
The entropy balance makes the following parameter available:
T_mcomb: Thermodynamic temperature of heat of combustionS_comb: Entropy production due to combustionT_mQ1: Thermodynamic temperature of heat at cold side of heater 1S_Q11: Entropy transport at hot side of heater 1S_Q12: Entropy transport at cold side of heater 1S_Q1irr: Entropy production due to heat transfer at heater 1S_irr1: Entropy production due to pressure losses at heater 1T_mQ2: Thermodynamic temperature of heat at cold side of heater 2S_Q21: Entropy transport at hot side of heater 2S_Q22: Entropy transport at cold side of heater 2S_Q2irr: Entropy production due to heat transfer at heater 2S_irr2: Entropy production due to pressure losses at heater 2S_irr_i: Entropy production due to internal irreversibiltyS_Qloss: Entropy transport with heat loss to ambientS_Qcomb: Virtual entropy transport of heat to revert combustion gases to reference stateS_irr: Total entropy production due to irreversibilty
The methodology for entropy analysis of combustion processes is derived from [31]. Similar to the energy balance of a combustion reaction, we need to define the same reference state for the entropy balance of the combustion. The temperature for the reference state is set to 25 °C and reference pressure is 1 bar. As the water in the flue gas may be liquid but the thermodynamic temperature of heat of combustion refers to the lower heating value, the water is forced to gas at the reference point by considering evaporation.
Reference temperature: 298.15 K.
Reference pressure: 1 bar.
\[\begin{split}\begin{split} T_\text{m,comb}= & \frac{\dot{m}_\text{fuel} \cdot LHV} {\dot{S}_\text{comb}}\\ \dot{S}_\text{comb} =&\dot{S}_\text{Q,comb}-\left( \dot{S}_\text{Q,11} + \dot{S}_\text{Q,21} + \dot{S}_\text{Q,loss} +\dot{S}_\text{irr,i}\right)\\ \dot{S}_\text{Q,comb}= & \dot{m}_\text{fluegas} \cdot \left(s_\text{fluegas}-s_\text{fluegas,ref}\right)\\ & - \sum_{i=3}^4 \dot{m}_{\text{in,}i} \cdot \left( s_{\text{in,}i} - s_{\text{in,ref,}i} \right)\\ \dot{S}_\text{Q,11}= & \frac{\dot{Q}_1}{T_\text{v,inner}}\\ \dot{S}_\text{Q,21}= & \frac{\dot{Q}_2}{T_\text{v,inner}}\\ \dot{S}_\text{Q,loss}= & \frac{\dot{Q}_\text{loss}} {T_\text{v,inner}}\\ \dot{S}_\text{irr,i}= & \frac{\left(1 - \frac{1}{\eta_\text{mech}}\right) \cdot P}{T_\text{v,inner}}\\ T_\text{Q,12} = &\frac{-\dot{Q}_1}{\dot{m}_1 \cdot \left( s_\text{out,1} - s_\text{in,1}\right)}\\ T_\text{Q,22} = &\frac{-\dot{Q}_2}{\dot{m}_2 \cdot \left( s_\text{out,2} - s_\text{in,2}\right)}\\ \dot{S}_\text{irr} = &\sum \dot{S}_\text{irr}\\ \end{split}\\\end{split}\]
- 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.
\[\begin{split}val = \begin{cases} 5 \cdot 10^5 & \text{key = 'p'}\\ 10^6 & \text{key = 'h'} \end{cases}\end{split}\]
- 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.
\[\begin{split}val = \begin{cases} 5 \cdot 10^5 & \text{key = 'p'}\\ 5 \cdot 10^5 & \text{key = 'h'} \end{cases}\end{split}\]
- tiP_char_func()[source]¶
Calculate the relation of output power and thermal input.
- Returns:
residual (float) – Residual value of equation.
\[0 = P \cdot f_{TI}\left(\frac{P}{P_{design}}\right)+ LHV \cdot \left[\sum_i \left(\dot{m}_{in,i} \cdot x_{f,i}\right) - \dot{m}_{out,3} \cdot x_{f,3} \right] \; \forall i \in [3,4]\]
- variable_equality_structure_matrix(k, **kwargs)[source]¶
Create pairwise linear relationship between two variables
varfor all inlets and the respective outlets. This usually is applied to mass flow, pressure, enthalpy and fluid composition.\[var_\text{in,i} = var_\text{out,i}\]- Parameters:
k (int) – equation number in systems of equations
variable (str) – Connection variable name, e.g.
h.