exerpy.components¶
Component¶
- class exerpy.components.component.Component(**kwargs)[source]¶
Bases:
objectBase class for all ExerPy components.
This class serves as the parent class for all exergy analysis components. It provides the basic structure and methods for exergy analysis calculations including the calculation of exergetic efficiency and exergy balance.
- Parameters:
**kwargs (dict) – Arbitrary keyword arguments that will be assigned as attributes to the component.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
Notes
The exergetic efficiency is calculated as the ratio of exergy product to exergy fuel:
\[\varepsilon = \frac{\dot{E}_\mathrm{P}}{\dot{E}_\mathrm{F}}\]The exergy balance for any component follows the principle:
\[\dot{E}_\mathrm{F} = \dot{E}_\mathrm{P} + \dot{E}_\mathrm{D}\]See also
exerpy.componentsModule containing all available components for exergy analysis
- class Input(*, name: Annotated[str, msgspec.Meta(min_length=1)])[source]¶
Bases:
StructKeys of the component’s entry in the input that ExerPy reads.
A subclass that reads further keys extends its parent’s
Input. The keys not declared here are still passed on, but not validated.- name: Annotated[str, msgspec.Meta(min_length=1)]¶
- calc_epsilon()[source]¶
Calculate the exergetic efficiency of the component.
The exergetic efficiency is defined as the ratio of exergy product to exergy fuel. If the exergy fuel is zero, the function returns NaN to avoid division by zero.
- Returns:
float or nan – Exergetic efficiency \(\varepsilon = \frac{\dot{E}_\mathrm{P}}{\dot{E}_\mathrm{F}}\) or NaN if \(\dot{E}_\mathrm{F} = 0\).
Notes
\[\begin{split}\varepsilon = \begin{cases} \frac{\dot{E}_\mathrm{P}}{\dot{E}_\mathrm{F}} & \mathrm{if } \dot{E}_\mathrm{F} \neq 0\\ \mathrm{NaN} & \mathrm{if } \dot{E}_\mathrm{F} = 0 \end{cases}\end{split}\]
- calc_exergy_balance(T0: float, p0: float) None[source]¶
Calculate the exergy balance of the component.
This method should be implemented by child classes to perform specific exergy balance calculations.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Cost balance of a component.
This method is intentionally empty in the base class. Every component overrides it and defines its own cost of fuel \(\dot{C}_\mathrm{F}\) and cost of product \(\dot{C}_\mathrm{P}\), following the fuel and the product of its exergy balance. What is derived from the two is the same for every component:
\[c_\mathrm{F} = \frac{\dot{C}_\mathrm{F}}{\dot{E}_\mathrm{F}} \qquad c_\mathrm{P} = \frac{\dot{C}_\mathrm{P}}{\dot{E}_\mathrm{P}}\]The cost of the exergy destroyed is what the destroyed exergy would have cost as fuel. It is not part of the cost balance, which is why it shows up nowhere in the cost matrix:
\[\dot{C}_\mathrm{D} = c_\mathrm{F} \cdot \dot{E}_\mathrm{D}\]The relative cost difference says by how much a unit of exergy becomes more expensive passing through the component, and the exergoeconomic factor says how much of the cost the component causes is investment rather than inefficiency:
\[r = \frac{c_\mathrm{P} - c_\mathrm{F}}{c_\mathrm{F}} \qquad f = \frac{\dot{Z}}{\dot{Z} + \dot{C}_\mathrm{D}}\]with \(\dot{Z}\) the investment and operating cost of the component [2]. The share of the cost of the dissipative components charged to the component, \(\dot{Z}_\mathrm{diss}\), is part of its cost balance and thus of \(c_\mathrm{P}\) and \(r\) [33], but not of \(f\): it is neither the investment of the component nor the cost of its exergy destruction.
The docstring of each component states only its own \(\dot{C}_\mathrm{F}\) and \(\dot{C}_\mathrm{P}\); the five definitions above are not repeated there.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- exerpy.components.component.component_registry(cls)[source]¶
A decorator function to register components in the component registry. Registers the class using the class’s name as the key.
- exerpy.components.component.set_equal_specific_cost(A, row, ref, out, label, ref_is_outlet=False)[source]¶
Write the row that gives two streams the same specific cost of one exergy share \(x\).
\[\frac{\dot{C}^{x}_\mathrm{ref}}{\dot{E}^{x}_\mathrm{ref}} = \frac{\dot{C}^{x}_\mathrm{out}}{\dot{E}^{x}_\mathrm{out}}\]A stream without exergy of the share carries no cost of it, \(\dot{C}^{x} = c^{x} \dot{E}^{x} = 0\) [33]. If either stream has none, the row becomes \(\dot{C}^{x}_\mathrm{out} = 0\), or \(\dot{C}^{x}_\mathrm{ref} = 0\) if
refis an outlet as well and the one without exergy. An inlet is never fixed, its cost is set upstream.- Parameters:
A (numpy.ndarray) – Cost matrix, changed in place.
row (int) – Index of the row to write.
ref (dict) – Reference stream, an inlet or an outlet of the component.
out (dict) – Outlet priced against
ref.label (str) – Cost variable:
"T","M","PH","CH", or"exergy"for power and heat.ref_is_outlet (bool, optional) – True if
refis an outlet of the component too (P-principle). Default is False.
- exerpy.components.component.set_mixing_cost(A, row, inlets, out, label, weights=None)[source]¶
Write the row that gives the outlet of a mixing node the mass-weighted specific cost of its inlets.
\[\frac{\dot{C}^{x}_\mathrm{out}}{\dot{E}^{x}_\mathrm{out}} = \sum_{i} \frac{n_{i} \, \dot{m}_{i}}{\sum_{k} n_{k} \, \dot{m}_{k}} \cdot \frac{\dot{C}^{x}_{i}}{\dot{E}^{x}_{i}}\]\(n_{i}\) is how often inlet \(i\) exists, e.g. the number of parallel branches it stands for. An inlet without exergy of the share \(x\) adds nothing. An outlet without it carries no cost of it, and the row becomes \(\dot{C}^{x}_\mathrm{out} = 0\).
- Parameters:
A (numpy.ndarray) – Cost matrix, changed in place.
row (int) – Index of the row to write.
inlets (iterable of dict) – Inlet streams of the node.
out (dict) – Outlet stream of the node.
label (str) – Cost variable, e.g.
"M"or"CH".weights (iterable of float, optional) – How often each inlet exists, \(n_{i}\), in the order of
inlets. Default is 1 each.
CombustionChamber¶
- class exerpy.components.combustion.base.CombustionChamber(**kwargs)[source]¶
Bases:
ComponentClass for exergy and exergoeconomic analysis of combustion chambers.
This class performs exergy and exergoeconomic analysis calculations for combustion chambers, considering both thermal and mechanical exergy flows, as well as chemical exergy flows. The combustion gas leaves at outlet 0, every further material outlet is ash or slag. With split physical exergy, the exergy product is the increase of the thermal exergy from all inlets to all outlets and the exergy fuel the decrease of the chemical and the mechanical exergy. Without the split, the product is the increase of the physical exergy and the fuel the decrease of the chemical exergy. The ash is heated with the gas, so the increase of its physical exergy is product, while its chemical exergy is subtracted from the fuel.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with mass flows and specific exergies.
outl (dict) – Dictionary containing outlet stream data with mass flows and specific exergies.
Z_costs (float) – Investment cost rate of the component in currency/h.
C_P (float) – Cost of product stream \(\dot{C}_P\) in currency/h.
C_F (float) – Cost of fuel stream \(\dot{C}_F\) in currency/h.
C_D (float) – Cost of exergy destruction \(\dot{C}_D\) in currency/h.
c_P (float) – Specific cost of product stream (currency per unit exergy).
c_F (float) – Specific cost of fuel stream (currency per unit exergy).
r (float) – Relative cost difference, \((c_P - c_F)/c_F\).
f (float) – Exergoeconomic factor, \(\dot{Z}/(\dot{Z} + \dot{C}_D)\).
Ex_C_col (dict) – Custom cost coefficients collection passed via kwargs.
Notes
This component requires the calculation of both physical and chemical exergy.
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Add auxiliary cost equations for the combustion chamber.
The hot gas leaving the chamber at outlet 0 is the product, so the cost of its thermal exergy is left to the cost balance. What the chamber does not raise is blended: the gas takes the mass-weighted mean of the specific costs of all inlets (F-principle).
With split physical exergy the rule is written for the mechanical exergy; without the split the stream carries a single cost variable for its physical exergy, that variable is the product, and no mechanical rule exists. The cost balance determines it:
\[\dot{C}^\mathrm{PH}_\mathrm{gas} + \dot{C}^\mathrm{CH}_\mathrm{gas} + \sum_\mathrm{A} \bigl(\dot{C}^\mathrm{PH}_\mathrm{A} + \dot{C}^\mathrm{CH}_\mathrm{A}\bigr) = \sum_{i} \bigl(\dot{C}^\mathrm{PH}_{\mathrm{in},i} + \dot{C}^\mathrm{CH}_{\mathrm{in},i}\bigr) + \dot{Z}\]The chemical rule is written in either mode, and a combustion chamber needs the chemical exergy to be enabled at all, since the fuel enters as chemical exergy.
For \(x = \mathrm{M}\) (only with split physical exergy) and \(x = \mathrm{CH}\), the rule \(\dot m_\mathrm{gas}\,c^{x}_\mathrm{gas} = \sum_{i} \dot m_{i}\,c^{x}_{\mathrm{in},i}\) over all inlets \(i\) is written into the matrix as
\[-\frac{1}{\dot{E}^{x}_{\mathrm{gas}}}\,\dot{C}^{x}_{\mathrm{gas}} + \sum_{i} \frac{\dot m_{i}}{\sum_{j} \dot m_{j}} \frac{1}{\dot{E}^{x}_{\mathrm{in},i}}\,\dot{C}^{x}_{\mathrm{in},i} = 0\]An inlet without exergy of the form \(x\) brings no cost of it and is left out of the sum. If the gas has no exergy of the form \(x\), the row sets its cost to zero, \(\dot{C}^{x}_{\mathrm{gas}} = 0\).
Every further outlet \(\mathrm{A}\), such as ash or slag, stems from the fuel stream \(\mathrm{f}\), the inlet with the largest chemical exergy flow, in the share \(k = \dot m_\mathrm{A} / \dot m_\mathrm{f}\) [33]. Its chemical exergy keeps the specific cost of the fuel (F-principle), and with split physical exergy its mechanical exergy mixes like that of the gas:
\[\frac{\dot{C}^{\mathrm{CH}}_{\mathrm{A}}}{\dot{E}^{\mathrm{CH}}_{\mathrm{A}}} = \frac{\dot{C}^{\mathrm{CH}}_{\mathrm{f}}}{\dot{E}^{\mathrm{CH}}_{\mathrm{f}}}\]The increase of its physical exergy \(x\) (T with split physical exergy, PH without) is product and costs as much per unit as the increase of the gas (P-principle):
\[\frac{\dot{C}^{x}_{\mathrm{A}} - k\,\dot{C}^{x}_{\mathrm{f}}} {\dot{E}^{x}_{\mathrm{A}} - k\,\dot{E}^{x}_{\mathrm{f}}} = \frac{\dot{C}^{x}_{\mathrm{gas}} - \sum_{i} \dot{C}^{x}_{\mathrm{in},i} + \sum_\mathrm{A} k\,\dot{C}^{x}_{\mathrm{f}}} {\dot{E}^{x}_{\mathrm{gas}} - \sum_{i} \dot{E}^{x}_{\mathrm{in},i} + \sum_\mathrm{A} k\,\dot{E}^{x}_{\mathrm{f}}}\]If the ash gains no physical exergy, it keeps the cost of its share of the fuel, \(\dot{C}^{x}_{\mathrm{A}} = k\,\dot{C}^{x}_{\mathrm{f}}\).
- Parameters:
A (numpy.ndarray) – Current cost matrix.
b (numpy.ndarray) – Current RHS vector.
counter (int) – Starting row index.
T0 (float) – Ambient temperature.
equations (dict or list) – Structure for equation labels.
chemical_exergy_enabled (bool) – Must be True to include chemical exergy mixing.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – Updated cost matrix.
b (numpy.ndarray) – Updated RHS vector.
counter (int) – Updated row index.
equations (dict or list) – Updated labels.
- Raises:
ValueError – If chemical_exergy_enabled is False.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Compute the exergy balance of the combustion chamber.
The sums run over all inlets and over all outlets, the combustion gas at outlet 0 and any ash or slag at further outlets. With split physical exergy, the thermal exergy of the streams is raised (product) at the expense of their chemical and mechanical exergy (fuel):
\[\dot{E}_\mathrm{P} = \sum \dot{E}^{\mathrm{T}}_{\mathrm{out}} - \sum \dot{E}^{\mathrm{T}}_{\mathrm{in}}\]\[\dot{E}_\mathrm{F} = \Bigl(\sum \dot{E}^{\mathrm{CH}}_{\mathrm{in}} - \sum \dot{E}^{\mathrm{CH}}_{\mathrm{out}}\Bigr) + \Bigl(\sum \dot{E}^{\mathrm{M}}_{\mathrm{in}} - \sum \dot{E}^{\mathrm{M}}_{\mathrm{out}}\Bigr)\]Without the split:
\[\dot{E}_\mathrm{P} = \sum \dot{E}^{\mathrm{PH}}_{\mathrm{out}} - \sum \dot{E}^{\mathrm{PH}}_{\mathrm{in}}\]\[\dot{E}_\mathrm{F} = \sum \dot{E}^{\mathrm{CH}}_{\mathrm{in}} - \sum \dot{E}^{\mathrm{CH}}_{\mathrm{out}}\]An inlet below the ambient temperature brings thermal exergy that the chamber has to make up first, so it reduces the product.
The exergy destruction \(\dot{E}_\mathrm{D} = \dot{E}_\mathrm{F} - \dot{E}_\mathrm{P}\) is the same in both cases: the total exergy of all inlets less that of all outlets.
- Parameters:
T0 (float) – Ambient temperature (K).
p0 (float) – Ambient pressure (Pa).
split_physical_exergy (bool) – Whether to split thermal and mechanical exergy.
- Raises:
ValueError – If fewer than two inlets or no outlets are defined, if a stream is no material stream, if outlet 0 is missing or if a stream has no chemical exergy.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the combustion chamber.
\[\sum_{i} \bigl(\dot{C}^{\mathrm{PH}}_{\mathrm{in},i} + \dot{C}^{\mathrm{CH}}_{\mathrm{in},i}\bigr) - \dot{C}^{\mathrm{PH}}_{\mathrm{gas}} - \dot{C}^{\mathrm{CH}}_{\mathrm{gas}} - \sum_\mathrm{A} \bigl(\dot{C}^{\mathrm{PH}}_{\mathrm{A}} + \dot{C}^{\mathrm{CH}}_{\mathrm{A}}\bigr) + \dot{Z} = 0\]This method computes cost coefficients and ratios. Fuel and product take the same exergy forms as in
calc_exergy_balance(), all outlets (gas and ash) against all inlets, so that \(\dot{C}_\mathrm{P} = \dot{C}_\mathrm{F} + \dot{Z}\). With split physical exergy:\[\dot{C}_\mathrm{P} = \sum \dot{C}^{\mathrm{T}}_{\mathrm{out}} - \sum \dot{C}^{\mathrm{T}}_{\mathrm{in}}\]\[\dot{C}_\mathrm{F} = \Bigl(\sum \dot{C}^{\mathrm{CH}}_{\mathrm{in}} - \sum \dot{C}^{\mathrm{CH}}_{\mathrm{out}}\Bigr) + \Bigl(\sum \dot{C}^{\mathrm{M}}_{\mathrm{in}} - \sum \dot{C}^{\mathrm{M}}_{\mathrm{out}}\Bigr)\]Without the split:
\[\dot{C}_\mathrm{P} = \sum \dot{C}^{\mathrm{PH}}_{\mathrm{out}} - \sum \dot{C}^{\mathrm{PH}}_{\mathrm{in}}\]\[\dot{C}_\mathrm{F} = \sum \dot{C}^{\mathrm{CH}}_{\mathrm{in}} - \sum \dot{C}^{\mathrm{CH}}_{\mathrm{out}}\]- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
HeatExchanger¶
- class exerpy.components.heat_exchanger.base.HeatExchanger(**kwargs)[source]¶
Bases:
ComponentClass for exergy and exergoeconomic analysis of heat exchangers.
This class performs exergy and exergoeconomic analysis calculations for heat exchanger components, accounting for two inlet and two outlet streams across various temperature regimes, including above and below ambient temperature, and optional dissipative behavior.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with mass flows and specific exergies.
outl (dict) – Dictionary containing outlet stream data with mass flows and specific exergies.
Z_costs (float) – Investment cost rate of the component in currency/h.
C_P (float) – Cost of product stream \(\dot{C}_P\) in currency/h.
C_F (float) – Cost of fuel stream \(\dot{C}_F\) in currency/h.
C_D (float) – Cost of exergy destruction \(\dot{C}_D\) in currency/h.
c_P (float) – Specific cost of product stream (currency per unit exergy).
c_F (float) – Specific cost of fuel stream (currency per unit exergy).
r (float) – Relative cost difference, \((c_P - c_F)/c_F\).
f (float) – Exergoeconomic factor, \(\dot{Z}/(\dot{Z} + \dot{C}_D)\).
Ex_C_col (dict) – Custom cost coefficients collection passed via kwargs.
- class Input(*, name: Annotated[str, msgspec.Meta(min_length=1)], dissipative: bool | None | UnsetType = UNSET, kA: float | None | UnsetType = UNSET, parameters: dict[str, Any] | None | UnsetType = UNSET)[source]¶
Bases:
Input- dissipative: bool | None | UnsetType¶
- kA: float | None | UnsetType¶
- parameters: dict[str, Any] | None | UnsetType¶
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Add auxiliary cost equations for the heat exchanger.
The hot stream gives up exergy and the cold stream takes it up, so which stream carries the product depends on where the two sit relative to the ambient temperature. The stream that is fuel follows the F-principle; the product is left to the cost balance.
Writing \(x\) for the cost variable of the physical exergy, the rules below hold in both split modes: \(x = \mathrm{T}\) with split physical exergy and \(x = \mathrm{PH}\) without it. What changes is only that the mechanical rule at the end exists only with the split.
Case 1, all streams above \(T_0\): the hot stream is the fuel.
\[\frac{\dot{C}^{x}_{\mathrm{in},1}}{\dot{E}^{x}_{\mathrm{in},1}} = \frac{\dot{C}^{x}_{\mathrm{out},1}}{\dot{E}^{x}_{\mathrm{out},1}}\]Case 2, all streams at or below \(T_0\): the cold stream carries the cold exergy that is consumed, so it is the fuel.
\[\frac{\dot{C}^{x}_{\mathrm{in},2}}{\dot{E}^{x}_{\mathrm{in},2}} = \frac{\dot{C}^{x}_{\mathrm{out},2}}{\dot{E}^{x}_{\mathrm{out},2}}\]Case 3, both streams crossing \(T_0\): both outlets are product, priced alike (P-principle).
\[\frac{\dot{C}^{x}_{\mathrm{out},1}}{\dot{E}^{x}_{\mathrm{out},1}} = \frac{\dot{C}^{x}_{\mathrm{out},2}}{\dot{E}^{x}_{\mathrm{out},2}}\]Case 4, only the hot inlet above \(T_0\): the cold stream is the fuel.
\[\frac{\dot{C}^{x}_{\mathrm{in},2}}{\dot{E}^{x}_{\mathrm{in},2}} = \frac{\dot{C}^{x}_{\mathrm{out},2}}{\dot{E}^{x}_{\mathrm{out},2}}\]Case 5, only the cold inlet below \(T_0\): the hot stream is the fuel.
\[\frac{\dot{C}^{x}_{\mathrm{in},1}}{\dot{E}^{x}_{\mathrm{in},1}} = \frac{\dot{C}^{x}_{\mathrm{out},1}}{\dot{E}^{x}_{\mathrm{out},1}}\]Case 6, the hot stream always above and the cold stream always below \(T_0\): the unit has no product and is dissipative. It is handled by
dis_eqs(), and nothing is written here.On top of the rule for the case, the pressure and the composition pass through on both branches \(i\) at their own specific cost. The mechanical rule exists only with split physical exergy, since without it the stream has no mechanical cost variable; the chemical rule exists whenever chemical exergy is enabled:
\[\frac{\dot{C}^\mathrm{M}_{\mathrm{in},i}}{\dot{E}^\mathrm{M}_{\mathrm{in},i}} = \frac{\dot{C}^\mathrm{M}_{\mathrm{out},i}}{\dot{E}^\mathrm{M}_{\mathrm{out},i}} \qquad \frac{\dot{C}^\mathrm{CH}_{\mathrm{in},i}}{\dot{E}^\mathrm{CH}_{\mathrm{in},i}} = \frac{\dot{C}^\mathrm{CH}_{\mathrm{out},i}}{\dot{E}^\mathrm{CH}_{\mathrm{out},i}}\]- Parameters:
A (numpy.ndarray) – Current cost matrix.
b (numpy.ndarray) – Current RHS vector.
counter (int) – Starting row index for auxiliary equations.
T0 (float) – Ambient temperature (K).
equations (dict or list) – Structure for equation labels.
chemical_exergy_enabled (bool) – Must be True to include chemical exergy mixing.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – Updated cost matrix.
b (numpy.ndarray) – Updated RHS vector.
counter (int) – Updated row index after adding equations.
equations (dict or list) – Updated labels.
- Raises:
ValueError – If required cost variable indices are missing.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Compute the exergy balance of the heat exchanger.
Case 1: All streams above ambient temperature
If split_physical_exergy=True:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{out},2} - \dot{E}^{\mathrm{T}}_{\mathrm{in},2}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in},1} - \dot{E}^{\mathrm{PH}}_{\mathrm{out},1} + \bigl(\dot{E}^{\mathrm{M}}_{\mathrm{in},2} - \dot{E}^{\mathrm{M}}_{\mathrm{out},2}\bigr)\]Else:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{PH}}_{\mathrm{out},2} - \dot{E}^{\mathrm{PH}}_{\mathrm{in},2}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in},1} - \dot{E}^{\mathrm{PH}}_{\mathrm{out},1}\]Case 2: All streams below or equal to ambient temperature
If split_physical_exergy=True:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{out},1} - \dot{E}^{\mathrm{T}}_{\mathrm{in},1}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in},2} - \dot{E}^{\mathrm{PH}}_{\mathrm{out},2} + \bigl(\dot{E}^{\mathrm{M}}_{\mathrm{in},1} - \dot{E}^{\mathrm{M}}_{\mathrm{out},1}\bigr)\]Else
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{PH}}_{\mathrm{out},1} - \dot{E}^{\mathrm{PH}}_{\mathrm{in},1}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in},2} - \dot{E}^{\mathrm{PH}}_{\mathrm{out},2}\]Case 3: Both stream crossing ambient temperature
If split_physical_exergy=True:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{out},1} + \dot{E}^{\mathrm{T}}_{\mathrm{out},2}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in},1} + \dot{E}^{\mathrm{PH}}_{\mathrm{in},2} - \bigl(\dot{E}^{\mathrm{M}}_{\mathrm{out},1} + \dot{E}^{\mathrm{M}}_{\mathrm{out},2}\bigr)\]Else:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{PH}}_{\mathrm{out},1} + \dot{E}^{\mathrm{PH}}_{\mathrm{out},2}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in},1} + \dot{E}^{\mathrm{PH}}_{\mathrm{in},2}\]Case 4: Only the hot inlet above ambient temperature
If split_physical_exergy=True:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{out},1}\]\[\dot{E}_{\mathrm{F}} = \bigl(\dot{E}^{\mathrm{PH}}_{\mathrm{in},1} + \dot{E}^{\mathrm{PH}}_{\mathrm{in},2}\bigr) - \bigl(\dot{E}^{\mathrm{PH}}_{\mathrm{out},2} + \dot{E}^{\mathrm{M}}_{\mathrm{out},1}\bigr)\]Else:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{PH}}_{\mathrm{out},1}\]\[\dot{E}_{\mathrm{F}} = \bigl(\dot{E}^{\mathrm{PH}}_{\mathrm{in},1} + \dot{E}^{\mathrm{PH}}_{\mathrm{in},2}\bigr) - \dot{E}^{\mathrm{PH}}_{\mathrm{out},2}\]Case 5: Only the cold inlet below ambient temperature
If split_physical_exergy=True:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{out},2}\]\[\dot{E}_{\mathrm{F}} = \bigl(\dot{E}^{\mathrm{PH}}_{\mathrm{in},1} - \dot{E}^{\mathrm{PH}}_{\mathrm{out},1}\bigr) + \bigl(\dot{E}^{\mathrm{PH}}_{\mathrm{in},2} - \dot{E}^{\mathrm{M}}_{\mathrm{out},2}\bigr)\]Else:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{PH}}_{\mathrm{out},2}\]\[\dot{E}_{\mathrm{F}} = \bigl(\dot{E}^{\mathrm{PH}}_{\mathrm{in},1} - \dot{E}^{\mathrm{PH}}_{\mathrm{out},1}\bigr) + \dot{E}^{\mathrm{PH}}_{\mathrm{in},2}\]Case 6: Hot stream always above and cold stream always below ambient temperature (dissipative case):
\[\dot{E}_{\mathrm{P}} = \mathrm{NaN}\]\[\dot{E}_{\mathrm{F}} = \bigl(\dot{E}^{\mathrm{PH}}_{\mathrm{in},1} - \dot{E}^{\mathrm{PH}}_{\mathrm{out},1}\bigr) - \dot{E}^{\mathrm{PH}}_{\mathrm{out},2} + \dot{E}^{\mathrm{PH}}_{\mathrm{in},2}\]If dissipative is True, the component is treated as dissipative:
\[\dot{E}_{\mathrm{P}} = \mathrm{NaN}\]\[\dot{E}_{\mathrm{F}} = \bigl(\dot{E}^{\mathrm{PH}}_{\mathrm{in},1} - \dot{E}^{\mathrm{PH}}_{\mathrm{out},1}\bigr) - \dot{E}^{\mathrm{PH}}_{\mathrm{out},2} + \dot{E}^{\mathrm{PH}}_{\mathrm{in},2}\]- Parameters:
T0 (float) – Ambient temperature (K).
p0 (float) – Ambient pressure (Pa).
split_physical_exergy (bool) – Whether to split thermal and mechanical exergy.
- Raises:
ValueError – If required inlets or outlets are missing.
- dis_eqs(A, b, counter, T0, equations, chemical_exergy_enabled=False, all_components=None, split_physical_exergy=True)[source]¶
Construct cost equations for a dissipative HeatExchanger.
Distributes the heat exchanger’s extra cost difference (C_diff) to all other productive components (non-dissipative and non-CycleCloser) in proportion to their exergy destruction (E_D) and adds an overall cost balance row that enforces:
\[(\dot C_{\mathrm{in},1} - \dot C_{\mathrm{out},1}) + (\dot C_{\mathrm{in},2} - \dot C_{\mathrm{out},2}) - \dot C_{\mathrm{diff}} = -\,\dot Z_{\mathrm{costs}}\]A main working fluid keeps its specific cost between inlet and outlet for each exergy share \(x\) (thermal, mechanical, chemical). Where its inlet or outlet carries no exergy of a share, the outlet carries no cost of it, and the cost of the inlet stays in \(\dot C_\mathrm{diff}\):
\[\frac{\dot{C}^{x}_{\mathrm{in}}}{\dot{E}^{x}_{\mathrm{in}}} = \frac{\dot{C}^{x}_{\mathrm{out}}}{\dot{E}^{x}_{\mathrm{out}}} \qquad \text{or} \qquad \dot{C}^{x}_{\mathrm{out}} = 0 \quad \text{for} \quad \dot{E}^{x}_{\mathrm{in}} = 0 \ \text{or} \ \dot{E}^{x}_{\mathrm{out}} = 0\]The auxiliary fluid, e.g. the cooling water of a condenser, brings its cost into the component and leaves without cost, \(\dot{C}^{x}_{\mathrm{aux,out}} = 0\), so its cost is part of \(\dot C_\mathrm{diff}\) [33]. It is the side that is discharged: the exergy analysis follows each outlet through splitters, mixers and dissipative components, and the side whose paths all end in a loss stream of
E_Lis the auxiliary fluid (attributeauxiliary_side). If neither side or both are discharged, a stream that gains exergy is taken as the auxiliary fluid, and if both lose exergy, both are main working fluids.- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the cost matrix.
T0 (float) – Ambient temperature (K).
equations (dict) – Dictionary mapping row indices to equation labels.
chemical_exergy_enabled (bool, optional) – Flag indicating whether chemical exergy is considered.
all_components (list, optional) – Global list of all component objects; if not provided, defaults to [].
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
tuple – Updated (A, b, counter, equations).
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the heat exchanger.
\[\dot{C}^{\mathrm{T}}_{\mathrm{in},1} + \dot{C}^{\mathrm{M}}_{\mathrm{in},1} + \dot{C}^{\mathrm{T}}_{\mathrm{in},2} + \dot{C}^{\mathrm{M}}_{\mathrm{in},2} - \dot{C}^{\mathrm{T}}_{\mathrm{out},1} - \dot{C}^{\mathrm{M}}_{\mathrm{out},1} - \dot{C}^{\mathrm{T}}_{\mathrm{out},2} - \dot{C}^{\mathrm{M}}_{\mathrm{out},2} + \dot{Z} = 0\]In case the chemical exergy of the streams is know:
\[\dot{C}^{\mathrm{CH}}_{\mathrm{in},1} = \dot{C}^{\mathrm{CH}}_{\mathrm{out},1}\]\[\dot{C}^{\mathrm{CH}}_{\mathrm{in},2} = \dot{C}^{\mathrm{CH}}_{\mathrm{out},2}\]This method computes cost coefficients and ratios:
Case 1: All streams above ambient temperature
\[\dot{C}_P = \dot{C}^{\mathrm{T}}_{\mathrm{out},2} - \dot{C}^{\mathrm{T}}_{\mathrm{in},2}\]\[\dot{C}_F = \dot{C}^{\mathrm{PH}}_{\mathrm{in},1} - \dot{C}^{\mathrm{PH}}_{\mathrm{out},1} + \bigl(\dot{C}^{\mathrm{M}}_{\mathrm{in},2} - \dot{C}^{\mathrm{M}}_{\mathrm{out},2}\bigr)\]Case 2: All streams below or equal to ambient temperature
\[\dot{C}_P = \dot{C}^{\mathrm{T}}_{\mathrm{out},1} - \dot{C}^{\mathrm{T}}_{\mathrm{in},1}\]\[\dot{C}_F = \dot{C}^{\mathrm{PH}}_{\mathrm{in},2} - \dot{C}^{\mathrm{PH}}_{\mathrm{out},2} + \bigl(\dot{C}^{\mathrm{M}}_{\mathrm{in},1} - \dot{C}^{\mathrm{M}}_{\mathrm{out},1}\bigr)\]Case 3: Both stream crossing ambient temperature
\[\dot{C}_P = \dot{C}^{\mathrm{T}}_{\mathrm{out},1} + \dot{C}^{\mathrm{T}}_{\mathrm{out},2}\]\[\dot{C}_F = \dot{C}^{\mathrm{PH}}_{\mathrm{in},1} + \dot{C}^{\mathrm{PH}}_{\mathrm{in},2} - \bigl(\dot{C}^{\mathrm{M}}_{\mathrm{out},1} + \dot{C}^{\mathrm{M}}_{\mathrm{out},2}\bigr)\]Case 4: Only the hot inlet above ambient temperature
\[\dot{C}_P = \dot{C}^{\mathrm{T}}_{\mathrm{out},1}\]\[\dot{C}_F = \bigl(\dot{C}^{\mathrm{PH}}_{\mathrm{in},1} + \dot{C}^{\mathrm{PH}}_{\mathrm{in},2}\bigr) - \bigl(\dot{C}^{\mathrm{PH}}_{\mathrm{out},2} + \dot{C}^{\mathrm{M}}_{\mathrm{out},1}\bigr)\]Case 5: Only the cold inlet below ambient temperature
\[\dot{C}_P = \dot{C}^{\mathrm{T}}_{\mathrm{out},2}\]\[\dot{C}_F = \dot{C}^{\mathrm{PH}}_{\mathrm{in},1} - \dot{C}^{\mathrm{PH}}_{\mathrm{out},1} + \bigl(\dot{C}^{\mathrm{PH}}_{\mathrm{in},2} - \dot{C}^{\mathrm{M}}_{\mathrm{out},2}\bigr)\]Case 6: Hot stream always above and cold stream always below ambient temperature (dissipative case):
\[\dot{C}_P = \mathrm{NaN}\]\[\dot{C}_F = \bigl(\dot{C}^{\mathrm{PH}}_{\mathrm{in},1} - \dot{C}^{\mathrm{PH}}_{\mathrm{out},1}\bigr) - \dot{C}^{\mathrm{PH}}_{\mathrm{out},2} + \dot{C}^{\mathrm{PH}}_{\mathrm{in},2}\]- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
SimpleHeatExchanger¶
- class exerpy.components.heat_exchanger.simple.SimpleHeatExchanger(**kwargs)[source]¶
Bases:
ComponentClass for exergy and exergoeconomic analysis of simple heat exchangers.
This class performs exergy and exergoeconomic analysis calculations for heat exchanger components, accounting for one inlet and one outlet stream across various temperature regimes, including above and below ambient temperature, and optional dissipative behavior.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with mass flows and specific exergies.
outl (dict) – Dictionary containing outlet stream data with mass flows and specific exergies.
Z_costs (float) – Investment cost rate of the component in currency/h.
C_P (float) – Cost of product stream \(\dot{C}_P\) in currency/h.
C_F (float) – Cost of fuel stream \(\dot{C}_F\) in currency/h.
C_D (float) – Cost of exergy destruction \(\dot{C}_D\) in currency/h.
c_P (float) – Specific cost of product stream (currency per unit exergy).
c_F (float) – Specific cost of fuel stream (currency per unit exergy).
r (float) – Relative cost difference, \((c_P - c_F)/c_F\).
f (float) – Exergoeconomic factor, \(\dot{Z}/(\dot{Z} + \dot{C}_D)\).
Ex_C_col (dict) – Custom cost coefficients collection passed via kwargs.
T_hot (float, optional) – Temperature of the heat source in K, for a stream that takes in heat above the ambient temperature. Given, the fuel is the exergy of the heat at that temperature, \(\dot{E}_\mathrm{F} = \dot{Q}\,(1 - T_0/T_\mathrm{hot})\), so the loss of the heat transfer from the source counts as exergy destruction of the component.
T_cold (float, optional) – Temperature of the heat consumer in K, for a stream that releases heat above the ambient temperature. Given, the product is the exergy of the heat at that temperature, \(\dot{E}_\mathrm{P} = |\dot{Q}|\,(1 - T_0/T_\mathrm{cold})\).
the (Without them, the heat is valued at the exergy change of the stream itself, and the loss of)
component. (heat transfer to or from the outside lies outside the)
- class Input(*, name: Annotated[str, msgspec.Meta(min_length=1)], dissipative: bool | None | UnsetType = UNSET, T_hot: Annotated[float, msgspec.Meta(description='Absolute temperature, in K unless a unit is given'), Limit(gt=0, ge=None, le=None)] | None | UnsetType = UNSET, T_cold: Annotated[float, msgspec.Meta(description='Absolute temperature, in K unless a unit is given'), Limit(gt=0, ge=None, le=None)] | None | UnsetType = UNSET)[source]¶
Bases:
Input- T_cold: Annotated[float, msgspec.Meta(description='Absolute temperature, in K unless a unit is given'), Limit(gt=0, ge=None, le=None)] | None | UnsetType¶
- T_hot: Annotated[float, msgspec.Meta(description='Absolute temperature, in K unless a unit is given'), Limit(gt=0, ge=None, le=None)] | None | UnsetType¶
- dissipative: bool | None | UnsetType¶
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the simple heat exchanger.
Writing \(x\) for the cost variable of the physical exergy, the rules hold in both split modes with \(x = \mathrm{T}\) for split physical exergy and \(x = \mathrm{PH}\) without it.
The cost of the heat follows the direction of its exergy, which below the ambient temperature is against the heat (see
heat_exergy_reversed()).Heat as product, when its exergy leaves: heat released above or taken in below the ambient temperature. The stream gives up the fuel, so it follows the F-principle:
\[\frac{\dot{C}^{x}_\mathrm{in}}{\dot{E}^{x}_\mathrm{in}} = \frac{\dot{C}^{x}_\mathrm{out}}{\dot{E}^{x}_\mathrm{out}}\]Heat as fuel, when its exergy enters: the cost balance alone prices the outlet, so no rule is written:
\[\dot{C}^{x}_\mathrm{out} = \dot{C}^{x}_\mathrm{in} + \dot{C}^\mathrm{TOT}_\mathrm{heat} + \dot{Z}\]The pressure and the composition pass through at their own specific cost in either case. The mechanical rule exists only with split physical exergy, since without it the stream has no mechanical cost variable; the chemical rule exists whenever chemical exergy is enabled:
\[\frac{\dot{C}^\mathrm{M}_\mathrm{in}}{\dot{E}^\mathrm{M}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out}}{\dot{E}^\mathrm{M}_\mathrm{out}} \qquad \frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_\mathrm{out}}{\dot{E}^\mathrm{CH}_\mathrm{out}}\]Without a heat connection there is no cost variable for the heat, so no rule is written for the physical exergy and the cost balance alone prices the outlet. The heat then has no cost, and the component warns.
- Parameters:
A (numpy.ndarray) – Coefficient matrix of the cost equation system.
b (numpy.ndarray) – Right-hand side vector of the cost equation system.
counter (int) – Index of the next free row.
T0 (float) – Ambient temperature in \(\mathrm{K}\).
equations (dict) – Dictionary documenting the equations.
chemical_exergy_enabled (bool) – Whether chemical exergy is part of the analysis.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
tuple – The updated matrix, vector, row index and equation dictionary.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Compute the exergy balance of the simple heat exchanger.
Heat release :math:dot{Q}<0
Case 1: Both streams above ambient temperature. With split physical exergy the heat is valued at the change of thermal exergy, so the friction of the stream is exergy destruction. Without the split \(\mathrm{PH}\) takes the place of \(\mathrm{T}\): the pressure drop is then part of the exergy of the heat, and the component warns.
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{in}} - \dot{E}^{\mathrm{T}}_{\mathrm{out}}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in}} - \dot{E}^{\mathrm{PH}}_{\mathrm{out}}\]Case 2: Inlet above and outlet below ambient temperature. The product is the thermal exergy the stream gains below the ambient temperature. The heat released above it serves no purpose, since heat transfer across the ambient temperature has no meaningful product [2], so the thermal exergy of the inlet is destroyed. Without the split the warm and the cold exergy cannot be told apart: the heat carries the net change of physical exergy, \(\dot{E}_{\mathrm{P}} = \dot{E}_{\mathrm{F}} = |\dot{E}^{\mathrm{PH}}_{\mathrm{out}} - \dot{E}^{\mathrm{PH}}_{\mathrm{in}}|\), nothing is destroyed, and the component warns.
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{out}}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{T}}_{\mathrm{in}} + \dot{E}^{\mathrm{T}}_{\mathrm{out}} + \bigl(\dot{E}^{\mathrm{M}}_{\mathrm{in}} - \dot{E}^{\mathrm{M}}_{\mathrm{out}}\bigr)\]Case 3: Both streams below ambient temperature
If split_physical_exergy=True:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{out}} - \dot{E}^{\mathrm{T}}_{\mathrm{in}}\]\[\dot{E}_{\mathrm{F}} = \bigl(\dot{E}^{\mathrm{T}}_{\mathrm{out}} - \dot{E}^{\mathrm{T}}_{\mathrm{in}}\bigr) + \bigl(\dot{E}^{\mathrm{M}}_{\mathrm{in}} - \dot{E}^{\mathrm{M}}_{\mathrm{out}}\bigr)\]Else:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{PH}}_{\mathrm{out}} - \dot{E}^{\mathrm{PH}}_{\mathrm{in}}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{out}} - \dot{E}^{\mathrm{PH}}_{\mathrm{in}}\]Heat injection :math:dot{Q}>0
Case 1: Both streams above ambient temperature. As for the heat release, the heat is the change of thermal exergy with split physical exergy and of physical exergy without.
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{PH}}_{\mathrm{out}} - \dot{E}^{\mathrm{PH}}_{\mathrm{in}}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{T}}_{\mathrm{out}} - \dot{E}^{\mathrm{T}}_{\mathrm{in}}\]Case 2: Inlet below and outlet above ambient temperature. The product is the thermal exergy of the outlet. The cold exergy of the inlet is used up while the heat warms the stream to the ambient temperature, which has no meaningful product [2], so it is destroyed, as when a stream is cooled across the ambient temperature. Without the split, as there, \(\dot{E}_{\mathrm{P}} = \dot{E}_{\mathrm{F}} = |\dot{E}^{\mathrm{PH}}_{\mathrm{out}} - \dot{E}^{\mathrm{PH}}_{\mathrm{in}}|\) and the component warns.
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{out}}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{T}}_{\mathrm{in}} + \dot{E}^{\mathrm{T}}_{\mathrm{out}} + \bigl(\dot{E}^{\mathrm{M}}_{\mathrm{in}} - \dot{E}^{\mathrm{M}}_{\mathrm{out}}\bigr)\]Case 3: Both streams below ambient temperature. The cold exergy the stream gives up leaves with the heat and is the product; the pressure drop is fuel and destroyed [2].
If split_physical_exergy=True:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{T}}_{\mathrm{in}} - \dot{E}^{\mathrm{T}}_{\mathrm{out}}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{T}}_{\mathrm{in}} - \dot{E}^{\mathrm{T}}_{\mathrm{out}} + \bigl(\dot{E}^{\mathrm{M}}_{\mathrm{in}} - \dot{E}^{\mathrm{M}}_{\mathrm{out}}\bigr)\]Else:
\[\dot{E}_{\mathrm{P}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in}} - \dot{E}^{\mathrm{PH}}_{\mathrm{out}}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in}} - \dot{E}^{\mathrm{PH}}_{\mathrm{out}}\]Fully dissipative or :math:dot{Q}=0
\[\dot{E}_{\mathrm{P}} = \mathrm{NaN}\]\[\dot{E}_{\mathrm{F}} = \dot{E}^{\mathrm{PH}}_{\mathrm{in}} - \dot{E}^{\mathrm{PH}}_{\mathrm{out}}\]- Parameters:
T0 (float) – Ambient temperature (K).
p0 (float) – Ambient pressure (Pa).
split_physical_exergy (bool) – Whether to split thermal and mechanical exergy.
- Raises:
ValueError – If required inlet or outlet are missing.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the simple heat exchanger.
Fuel and product costs follow the exergy definitions of
calc_exergy_balance(). The heat is the product or a fuel by the direction of its exergy (seeheat_exergy_reversed()), with \(\dot{C}_\mathrm{Q}\) the cost of the heat connection, zero without one, and \(\dot{Z}\) including the share of dissipative costs.Heat as product (heat released above or taken in below the ambient temperature). The stream gives up the fuel at the specific costs it enters with, \(x \in \{\mathrm{T}, \mathrm{M}\}\) with split physical exergy and \(x = \mathrm{PH}\) without:
\[\dot{C}_\mathrm{F} = \sum_x c^{x}_\mathrm{in} \bigl(\dot{E}^{x}_\mathrm{in} - \dot{E}^{x}_\mathrm{out}\bigr), \qquad \dot{C}_\mathrm{P} = \dot{C}_\mathrm{Q}\]Without a heat connection \(\dot{C}_\mathrm{P} = \dot{C}_\mathrm{F} + \dot{Z}\).
Heat as fuel, both streams above the ambient temperature, or without split:
\[\dot{C}_\mathrm{F} = \dot{C}_\mathrm{Q}, \qquad \dot{C}_\mathrm{P} = \dot{C}^{x}_\mathrm{out} - \dot{C}^{x}_\mathrm{in} \quad (x = \mathrm{PH})\]Both streams below the ambient temperature, with split:
\[\dot{C}_\mathrm{F} = \dot{C}_\mathrm{Q} + \dot{C}^{\mathrm{M}}_\mathrm{in} - \dot{C}^{\mathrm{M}}_\mathrm{out}, \qquad \dot{C}_\mathrm{P} = \dot{C}^{\mathrm{T}}_\mathrm{out} - \dot{C}^{\mathrm{T}}_\mathrm{in}\]The stream crossing the ambient temperature, with split:
\[\dot{C}_\mathrm{F} = \dot{C}^{\mathrm{T}}_\mathrm{in} + \dot{C}_\mathrm{Q} + \dot{C}^{\mathrm{M}}_\mathrm{in} - \dot{C}^{\mathrm{M}}_\mathrm{out}, \qquad \dot{C}_\mathrm{P} = \dot{C}^{\mathrm{T}}_\mathrm{out}\]Without a product (dissipative), \(\dot{C}_\mathrm{P}\) is NaN; for \(\dot{Q} = 0\), \(\dot{C}_\mathrm{F} = \dot{C}^{\mathrm{PH}}_\mathrm{in} - \dot{C}^{\mathrm{PH}}_\mathrm{out}\).
- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations. Default is False.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Attributes Set
————–
C_P (float) – Cost rate of product (currency/time).
C_F (float) – Cost rate of fuel (currency/time).
c_P (float) – Specific cost of product (currency/energy).
c_F (float) – Specific cost of fuel (currency/energy).
C_D (float) – Cost rate of exergy destruction (currency/time).
r (float) – Relative cost difference (dimensionless).
f (float) – Exergoeconomic factor (dimensionless).
SteamGenerator¶
- class exerpy.components.heat_exchanger.steam_generator.SteamGenerator(**kwargs)[source]¶
Bases:
ComponentClass for exergy and exergoeconomic analysis of heat exchangers.
This class performs exergy and exergoeconomic analysis calculations for heat exchanger components, accounting for two inlet and two outlet streams across various temperature regimes, including above and below ambient temperature, and optional dissipative behavior.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with mass flows and specific exergies.
outl (dict) – Dictionary containing outlet stream data with mass flows and specific exergies.
Z_costs (float) – Investment cost rate of the component in currency/h.
C_P (float) – Cost of product stream \(\dot{C}_P\) in currency/h.
C_F (float) – Cost of fuel stream \(\dot{C}_F\) in currency/h.
C_D (float) – Cost of exergy destruction \(\dot{C}_D\) in currency/h.
c_P (float) – Specific cost of product stream (currency per unit exergy).
c_F (float) – Specific cost of fuel stream (currency per unit exergy).
r (float) – Relative cost difference, \((c_P - c_F)/c_F\).
f (float) – Exergoeconomic factor, \(\dot{Z}/(\dot{Z} + \dot{C}_D)\).
Ex_C_col (dict) – Custom cost coefficients collection passed via kwargs.
T_hot (float) – Temperature of the heat source \(T_\mathrm{hot}\) in \(\mathrm{K}\).
Notes
The component has several input and output streams as follows.
Inlet streams:
inl[0]: Feed water inlet (high pressure)
inl[1]: Steam inlet (intermediate pressure)
inl[2]: Heat inlet (providing the heat input Q)
inl[3]: Water injection (high pressure)
inl[4]: Water injection (intermediate pressure)
Outlet streams:
outl[0]: Superheated steam outlet (high pressure)
outl[1]: Superheated steam outlet (intermediate pressure)
outl[2]: Drain / Blow down outlet
The heat is picked by its kind rather than by its index, among inlets and outlets, so it may sit on any connector (the EBSILON parser maps it to an outlet). Every material inlet that is neither the feed water nor the steam inlet is a water injection, and the drain is the material outlet that is neither of the two steam outlets, on whatever connector, and may be missing. The heat source of a steam generator is usually outside of the model, so its temperature is not known from the streams and has to be given as
T_hot.- class Input(*, name: Annotated[str, msgspec.Meta(min_length=1)], T_hot: Annotated[float, msgspec.Meta(description='Absolute temperature, in K unless a unit is given'), Limit(gt=0, ge=None, le=None)] | None | UnsetType = UNSET)[source]¶
Bases:
Input- T_hot: Annotated[float, msgspec.Meta(description='Absolute temperature, in K unless a unit is given'), Limit(gt=0, ge=None, le=None)] | None | UnsetType¶
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the steam generator.
The heat carries the cost into the component and the steam carries it out. Writing \(x\) for a cost variable of a stream, the rules are the same in every split mode and only the set of \(x\) changes: \(\{\mathrm{T}, \mathrm{M}\}\) with split physical exergy, \(\{\mathrm{PH}\}\) without, and \(\mathrm{CH}\) in addition when chemical exergy is enabled.
The drain leaves at the state of the boiler water, so it is priced like the high pressure steam, for every cost variable it carries (P-principle):
\[\frac{\dot{C}^{x}_\mathrm{steam,HP}}{\dot{E}^{x}_\mathrm{steam,HP}} = \frac{\dot{C}^{x}_\mathrm{drain}}{\dot{E}^{x}_\mathrm{drain}}\]What the component does not raise passes through at its own specific cost (F-principle). That is the mechanical exergy with the split, and the chemical exergy when it is enabled; the product variable, \(\mathrm{T}\) with the split and \(\mathrm{PH}\) without, is left to the cost balance:
\[\frac{\dot{C}^{x}_\mathrm{feed}}{\dot{E}^{x}_\mathrm{feed}} = \frac{\dot{C}^{x}_\mathrm{steam,HP}}{\dot{E}^{x}_\mathrm{steam,HP}} \qquad \frac{\dot{C}^{x}_\mathrm{in,IP}}{\dot{E}^{x}_\mathrm{in,IP}} = \frac{\dot{C}^{x}_\mathrm{steam,IP}}{\dot{E}^{x}_\mathrm{steam,IP}}\]Both steam outlets come from the same heat, so they are produced at the same specific cost (P-principle):
\[\frac{\dot{C}^\mathrm{T}_\mathrm{steam,HP}}{\dot{E}^\mathrm{T}_\mathrm{steam,HP}} = \frac{\dot{C}^\mathrm{T}_\mathrm{steam,IP}}{\dot{E}^\mathrm{T}_\mathrm{steam,IP}} \qquad \text{or, without the split,} \qquad \frac{\dot{C}^\mathrm{PH}_\mathrm{steam,HP}}{\dot{E}^\mathrm{PH}_\mathrm{steam,HP}} = \frac{\dot{C}^\mathrm{PH}_\mathrm{steam,IP}}{\dot{E}^\mathrm{PH}_\mathrm{steam,IP}}\]- Parameters:
A (numpy.ndarray) – Coefficient matrix of the cost equation system.
b (numpy.ndarray) – Right-hand side vector of the cost equation system.
counter (int) – Index of the next free row.
T0 (float) – Ambient temperature in \(\mathrm{K}\).
equations (dict) – Dictionary documenting the equations.
chemical_exergy_enabled (bool) – Whether chemical exergy is part of the analysis.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
tuple – The updated matrix, vector, row index and equation dictionary.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Compute the exergy balance of the steam generator.
The fuel is the exergy of the heat entering the component,
\[\dot{E}_{\mathrm{F}} = \dot{Q} \cdot \left(1 - \frac{T_0}{T_\mathrm{hot}}\right)\]with \(T_\mathrm{hot}\) the temperature of the heat source, which the component takes from its
T_hotattribute. The heat source of a steam generator is usually outside of the model, so that temperature is not known from the streams and has to be given.The product is the physical exergy the water and steam streams gain,
\[\dot{E}_\mathrm{P} = \Bigl[ \dot E^{\mathrm{PH}}_{\mathrm{out,HP}} - \dot E^{\mathrm{PH}}_{\mathrm{in,HP}} \Bigr] + \Bigl[ \dot E^{\mathrm{PH}}_{\mathrm{out,IP}} - \dot E^{\mathrm{PH}}_{\mathrm{in,IP}} \Bigr] - \sum \dot E^{\mathrm{PH}}_{\mathrm{w}}\]where the subscripts HP and IP denote the high and the intermediate pressure streams and w the water injections. The drain is not part of the product, so its exergy is counted as destruction, together with the losses of the component.
- Parameters:
T0 (float) – Ambient temperature (K).
p0 (float) – Ambient pressure (Pa).
split_physical_exergy (bool) – Whether to split thermal and mechanical exergy. The fuel and the product of this component are the same either way.
- Raises:
ValueError – If required inlets or outlets are missing.
Notes
Without
T_hotthe fuel cannot be evaluated from the heat, and the thermal exergy the water and steam streams gain is used instead. That makes the fuel of the component an approximation of itself: with split physical exergy it exceeds the product by the mechanical exergy alone, and without the split the two are equal and the exergy destruction is zero. The component warns in that case.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform the exergoeconomic cost balance of the steam generator.
Fuel and product follow
calc_exergy_balance(): the fuel is the heat entering the component and the product is the cost the water and steam streams gain. The drain is not part of the product, so the cost leaving with it raises the cost of the exergy destruction.- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Turbine¶
- class exerpy.components.turbomachinery.turbine.Turbine(**kwargs)[source]¶
Bases:
ComponentClass for exergy analysis of turbines.
This class performs exergy analysis calculations for turbines, with definitions of exergy product and fuel varying based on the temperature relationships between inlet stream, outlet stream, and ambient conditions.
- Parameters:
**kwargs (dict) – Arbitrary keyword arguments passed to parent class.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
P (float) – Power output of the turbine in \(\mathrm{W}\).
inl (dict) – Dictionary containing inlet stream data with temperature, mass flows, enthalpies, and specific exergies. Must have at least one inlet.
outl (dict) – Dictionary containing outlet streams data with temperature, mass flows, enthalpies, and specific exergies. Can have multiple outlets, their properties will be summed up in the calculations.
Notes
The exergy analysis considers three cases based on temperature relationships:
\[ \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}\end{aligned}\end{align} \]- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the turbine.
The power is the product of the turbine and the expanding stream is its fuel, so every cost variable the stream carries follows the F-principle: it leaves the component at the specific cost at which it entered.
With split physical exergy, for every material outlet:
\[\frac{\dot{C}^\mathrm{T}_\mathrm{in}}{\dot{E}^\mathrm{T}_\mathrm{in}} = \frac{\dot{C}^\mathrm{T}_\mathrm{out}}{\dot{E}^\mathrm{T}_\mathrm{out}} \qquad \frac{\dot{C}^\mathrm{M}_\mathrm{in}}{\dot{E}^\mathrm{M}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out}}{\dot{E}^\mathrm{M}_\mathrm{out}}\]Without the split the stream carries a single cost variable for its physical exergy, and the two rules above collapse into one:
\[\frac{\dot{C}^\mathrm{PH}_\mathrm{in}}{\dot{E}^\mathrm{PH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{PH}_\mathrm{out}}{\dot{E}^\mathrm{PH}_\mathrm{out}}\]With chemical exergy enabled, either way:
\[\frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_\mathrm{out}}{\dot{E}^\mathrm{CH}_\mathrm{out}}\]The power leaving the turbine is one single product, so all of its outlets are priced alike (P-principle), against the first of them that carries power:
\[\frac{\dot{C}^\mathrm{TOT}_\mathrm{ref}}{\dot{E}^\mathrm{TOT}_\mathrm{ref}} = \frac{\dot{C}^\mathrm{TOT}_\mathrm{out}}{\dot{E}^\mathrm{TOT}_\mathrm{out}}\]Expanding below the ambient temperature is only resolved with the split. Without it the component warns and charges the outlet with the specific cost of the physical exergy of the inlet; with it, the case is not implemented and no equation is written.
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature.
equations (list or dict) – Data structure for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index after adding all auxiliary equations.
equations (list or dict) – Updated structure with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the turbine.
Performs exergy balance calculations considering the temperature relationships between inlet stream, outlet stream, and ambient conditions.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
Notes
Below the ambient temperature the expansion produces cold exergy along with the power. Crediting it to the product requires the thermal part of the physical exergy, so with
split_physical_exergy=Falsethe balance falls back to\[\dot{E}_\mathrm{P} = |P| \qquad \dot{E}_\mathrm{F} = \dot{E}^\mathrm{PH}_\mathrm{in} - \sum \dot{E}^\mathrm{PH}_\mathrm{out}\]which leaves the cold exergy in the outlet stream instead of counting it as product. The exergy destruction is the same either way, the exergetic efficiency is not.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the turbine.
The general exergoeconomic balance equation is:
\[\dot{C}^{\mathrm{T}}_{\mathrm{in}} + \dot{C}^{\mathrm{M}}_{\mathrm{in}} - \dot{C}^{\mathrm{T}}_{\mathrm{out}} - \dot{C}^{\mathrm{M}}_{\mathrm{out}} + \dot{Z} = 0\]In case the chemical exergy of the streams is known:
\[\dot{C}^{\mathrm{CH}}_{\mathrm{in}} = \dot{C}^{\mathrm{CH}}_{\mathrm{out}}\]This method computes cost rates for product and fuel, and derives exergoeconomic indicators. The turbine may have multiple power outputs and multiple material outlets. The product cost includes the total cost of all power streams, while material outlet costs are summed accordingly.
Case 1: Inlet and outlet above ambient temperature
Both inlet and first material outlet satisfy \(T \geq T_0\):
\[\dot{C}_{\mathrm{P}} = \sum \dot{C}^{\mathrm{TOT}}_{\mathrm{power,out}}\]\[\dot{C}_{\mathrm{F}} = \dot{C}^{\mathrm{PH}}_{\mathrm{in}} - \sum \dot{C}^{\mathrm{PH}}_{\mathrm{material,out}}\]Case 2: Inlet above and outlet at or below ambient temperature
Inlet satisfies \(T > T_0\) and first material outlet \(T \leq T_0\):
\[\dot{C}_{\mathrm{P}} = \sum \dot{C}^{\mathrm{TOT}}_{\mathrm{power,out}} + \sum \dot{C}^{\mathrm{T}}_{\mathrm{material,out}}\]\[\dot{C}_{\mathrm{F}} = \dot{C}^{\mathrm{T}}_{\mathrm{in}} + \bigl(\dot{C}^{\mathrm{M}}_{\mathrm{in}} - \sum \dot{C}^{\mathrm{M}}_{\mathrm{material,out}}\bigr)\]Case 3: Both inlet and outlet at or below ambient temperature
Both inlet and first material outlet satisfy \(T \leq T_0\):
\[\dot{C}_{\mathrm{P}} = \sum \dot{C}^{\mathrm{TOT}}_{\mathrm{power,out}} + \bigl(\sum \dot{C}^{\mathrm{T}}_{\mathrm{material,out}} - \dot{C}^{\mathrm{T}}_{\mathrm{in}}\bigr)\]\[\dot{C}_{\mathrm{F}} = \dot{C}^{\mathrm{M}}_{\mathrm{in}} - \sum \dot{C}^{\mathrm{M}}_{\mathrm{material,out}}\]- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations. Default is False.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Attributes Set
————–
C_P (float) – Cost rate of product (currency/time).
C_F (float) – Cost rate of fuel (currency/time).
c_P (float) – Specific cost of product (currency/energy).
c_F (float) – Specific cost of fuel (currency/energy).
C_D (float) – Cost rate of exergy destruction (currency/time).
r (float) – Relative cost difference (dimensionless).
f (float) – Exergoeconomic factor (dimensionless).
Compressor¶
- class exerpy.components.turbomachinery.compressor.Compressor(**kwargs)[source]¶
Bases:
ComponentClass for exergy and exergoeconomic analysis of compressors.
This class performs exergy and exergoeconomic analysis calculations for compressors, considering thermal, mechanical, and physical exergy flows. The exergy product and fuel are calculated based on temperature relationships between inlet, outlet, and ambient conditions.
- Parameters:
**kwargs (dict) – Arbitrary keyword arguments passed to parent class. Optional parameter ‘Z_costs’ (float): Investment cost rate of the component in currency/h.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
P (float) – Power input to the compressor in \(\mathrm{W}\).
inl (dict) – Dictionary containing inlet stream data with temperature, mass flows, enthalpies, and specific exergies.
outl (dict) – Dictionary containing outlet stream data with temperature, mass flows, enthalpies, and specific exergies.
Z_costs (float) – Investment cost rate of the component in currency/h.
Notes
The exergy analysis considers three cases based on temperature relationships:
Case 1 - Both temperatures at or above ambient (\(T_\mathrm{in}, T_\mathrm{out} \geq T_0\)):
\[\begin{split}\dot{E}_\mathrm{P} &= \dot{m} \cdot (e_\mathrm{out}^\mathrm{PH} - e_\mathrm{in}^\mathrm{PH})\\ \dot{E}_\mathrm{F} &= |\dot{W}|\end{split}\]Case 2 - Inlet below, outlet above ambient (\(T_\mathrm{in} < T_0 < T_\mathrm{out}\)):
\[\begin{split}\dot{E}_\mathrm{P} &= \dot{m} \cdot e_\mathrm{out}^\mathrm{T} + \dot{m} \cdot (e_\mathrm{out}^\mathrm{M} - e_\mathrm{in}^\mathrm{M})\\ \dot{E}_\mathrm{F} &= |\dot{W}| + \dot{m} \cdot e_\mathrm{in}^\mathrm{T}\end{split}\]Case 3 - Both temperatures below ambient (\(T_\mathrm{in}, T_\mathrm{out} \leq T_0\)):
\[\begin{split}\dot{E}_\mathrm{P} &= \dot{m} \cdot (e_\mathrm{out}^\mathrm{M} - e_\mathrm{in}^\mathrm{M})\\ \dot{E}_\mathrm{F} &= |\dot{W}| + \dot{m} \cdot (e_\mathrm{in}^\mathrm{T} - e_\mathrm{out}^\mathrm{T})\end{split}\]For all valid cases, the exergy destruction is:
\[\dot{E}_\mathrm{D} = \dot{E}_\mathrm{F} - \dot{E}_\mathrm{P}\]- where:
\(\dot{W}\): Power input
\(e^\mathrm{T}\): Thermal exergy
\(e^\mathrm{M}\): Mechanical exergy
\(e^\mathrm{PH}\): Physical exergy
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the compressor.
The power driving the compressor is its fuel and what the stream gains is its product. With chemical exergy enabled the composition does not change, so its specific cost passes through unchanged (F-principle), whether or not the physical exergy is split:
\[\frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_\mathrm{out}}{\dot{E}^\mathrm{CH}_\mathrm{out}}\]Without split physical exergy no further equation is written. The stream carries a single cost variable for its physical exergy, that variable is the only one the component produces, and the cost balance alone determines it:
\[\dot{C}^\mathrm{PH}_\mathrm{out} = \dot{C}^\mathrm{PH}_\mathrm{in} + \dot{C}^\mathrm{TOT}_\mathrm{power} + \dot{Z}\]With split physical exergy the outlet carries two cost variables, so one equation is needed, and which one depends on where the stream sits relative to the ambient temperature.
Both streams above \(T_0\): the thermal and the mechanical exergy are both gained, so both are part of the product and are priced alike (P-principle):
\[\frac{\dot{C}^\mathrm{T}_\mathrm{out} - \dot{C}^\mathrm{T}_\mathrm{in}} {\dot{E}^\mathrm{T}_\mathrm{out} - \dot{E}^\mathrm{T}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out} - \dot{C}^\mathrm{M}_\mathrm{in}} {\dot{E}^\mathrm{M}_\mathrm{out} - \dot{E}^\mathrm{M}_\mathrm{in}}\]Inlet at or below and outlet above \(T_0\): the outlet carries thermal exergy that the inlet did not have, so the whole of it is product:
\[\frac{\dot{C}^\mathrm{T}_\mathrm{out}}{\dot{E}^\mathrm{T}_\mathrm{out}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out} - \dot{C}^\mathrm{M}_\mathrm{in}} {\dot{E}^\mathrm{M}_\mathrm{out} - \dot{E}^\mathrm{M}_\mathrm{in}}\]Both streams at or below \(T_0\): the cold exergy of the stream is consumed, so it is fuel and follows the F-principle:
\[\frac{\dot{C}^\mathrm{T}_\mathrm{in}}{\dot{E}^\mathrm{T}_\mathrm{in}} = \frac{\dot{C}^\mathrm{T}_\mathrm{out}}{\dot{E}^\mathrm{T}_\mathrm{out}}\]A share the stream does not gain passes through at its own specific cost instead, and a share the outlet does not carry has no cost, \(\dot{C}^{x}_\mathrm{out} = 0\).
Below the ambient temperature the split is what separates the cold exergy from the pressure rise, so running without it there makes the component warn.
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature.
equations (list or dict) – Data structure for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index (increased by 2 if chemical exergy is enabled, or by 1 otherwise).
equations (list or dict) – Updated structure with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the compressor.
Performs exergy balance calculations considering the temperature relationships between inlet stream, outlet stream, and ambient conditions.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the compressor.
The general exergoeconomic balance equation is:
\[\dot{C}^{\mathrm{T}}_{\mathrm{in}} + \dot{C}^{\mathrm{M}}_{\mathrm{in}} - \dot{C}^{\mathrm{T}}_{\mathrm{out}} - \dot{C}^{\mathrm{M}}_{\mathrm{out}} + \dot{Z} = 0\]In case the chemical exergy of the streams is known:
\[\dot{C}^{\mathrm{CH}}_{\mathrm{in}} = \dot{C}^{\mathrm{CH}}_{\mathrm{out}}\]This method computes cost rates for product and fuel, and derives exergoeconomic indicators. The compressor consumes power (fuel) to increase the exergy of the working fluid (product).
Case 1: Both inlet and outlet above ambient temperature
Both inlet and outlet satisfy \(T \geq T_0\):
\[\dot{C}_{\mathrm{P}} = \dot{C}^{\mathrm{PH}}_{\mathrm{out}} - \dot{C}^{\mathrm{PH}}_{\mathrm{in}}\]\[\dot{C}_{\mathrm{F}} = \dot{C}^{\mathrm{TOT}}_{\mathrm{power,in}}\]Case 2: Inlet at or below and outlet above ambient temperature
Inlet satisfies \(T \leq T_0\) and outlet \(T > T_0\):
\[\dot{C}_{\mathrm{P}} = \dot{C}^{\mathrm{T}}_{\mathrm{out}} + \bigl(\dot{C}^{\mathrm{M}}_{\mathrm{out}} - \dot{C}^{\mathrm{M}}_{\mathrm{in}}\bigr)\]\[\dot{C}_{\mathrm{F}} = \dot{C}^{\mathrm{TOT}}_{\mathrm{power,in}} + \dot{C}^{\mathrm{T}}_{\mathrm{in}}\]Case 3: Both inlet and outlet at or below ambient temperature
Both inlet and outlet satisfy \(T \leq T_0\):
\[\dot{C}_{\mathrm{P}} = \dot{C}^{\mathrm{M}}_{\mathrm{out}} - \dot{C}^{\mathrm{M}}_{\mathrm{in}}\]\[\dot{C}_{\mathrm{F}} = \dot{C}^{\mathrm{TOT}}_{\mathrm{power,in}} + \bigl(\dot{C}^{\mathrm{T}}_{\mathrm{in}} - \dot{C}^{\mathrm{T}}_{\mathrm{out}}\bigr)\]- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations. Default is False.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Attributes Set
————–
C_P (float) – Cost rate of product (currency/time).
C_F (float) – Cost rate of fuel (currency/time).
c_P (float) – Specific cost of product (currency/energy).
c_F (float) – Specific cost of fuel (currency/energy).
C_D (float) – Cost rate of exergy destruction (currency/time).
r (float) – Relative cost difference (dimensionless).
f (float) – Exergoeconomic factor (dimensionless).
- Raises:
ValueError – If no inlet power stream is found.
Pump¶
- class exerpy.components.turbomachinery.pump.Pump(**kwargs)[source]¶
Bases:
ComponentClass for exergy analysis of pumps.
This class performs exergy analysis calculations for pumps, with definitions of exergy product and fuel varying based on the temperature relationships between inlet stream, outlet stream, and ambient conditions.
- Parameters:
**kwargs (dict) – Arbitrary keyword arguments passed to parent class.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
P (float) – Power input to the pump in \(\mathrm{W}\).
inl (dict) – Dictionary containing inlet stream data with temperature, mass flows, enthalpies, and specific exergies.
outl (dict) – Dictionary containing outlet stream data with temperature, mass flows, enthalpies, and specific exergies.
Notes
The exergy analysis considers three cases based on temperature relationships:
Case 1 - Both temperatures at or above ambient (\(T_\mathrm{in}, T_\mathrm{out} \geq T_0\)):
\[\begin{split}\dot{E}_\mathrm{P} &= \dot{m} \cdot (e_\mathrm{out}^\mathrm{PH} - e_\mathrm{in}^\mathrm{PH})\\ \dot{E}_\mathrm{F} &= |\dot{W}|\end{split}\]Case 2 - Inlet below, outlet above ambient (\(T_\mathrm{in} < T_0 < T_\mathrm{out}\)), with split physical exergy:
\[\begin{split}\dot{E}_\mathrm{P} &= \dot{m} \cdot \bigl(e_\mathrm{out}^\mathrm{T} + e_\mathrm{out}^\mathrm{M} - e_\mathrm{in}^\mathrm{M}\bigr)\\ \dot{E}_\mathrm{F} &= |\dot{W}| + \dot{m} \cdot e_\mathrm{in}^\mathrm{T}\end{split}\]Case 3 - Both temperatures below ambient (\(T_\mathrm{in}, T_\mathrm{out} \leq T_0\)), with split physical exergy:
\[\begin{split}\dot{E}_\mathrm{P} &= \dot{m} \cdot (e_\mathrm{out}^\mathrm{M} - e_\mathrm{in}^\mathrm{M})\\ \dot{E}_\mathrm{F} &= |\dot{W}| + \dot{m} \cdot (e_\mathrm{in}^\mathrm{T} - e_\mathrm{out}^\mathrm{T})\end{split}\]Without the split, cases 2 and 3 fall back to case 1 and the pump warns.
For all valid cases, the exergy destruction is:
\[\dot{E}_\mathrm{D} = \dot{E}_\mathrm{F} - \dot{E}_\mathrm{P}\]If the outlet is colder than the inlet, fuel and product are not defined and the exergy destruction is the exergy balance, \(|\dot{W}| + \dot{m}\,(e_\mathrm{in}^\mathrm{PH} - e_\mathrm{out}^\mathrm{PH})\).
- where:
\(\dot{W}\): Power input
\(e^\mathrm{PH}\): Physical exergy
\(e^\mathrm{M}\): Mechanical exergy
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the pump.
The power driving the pump is its fuel and what the stream gains is its product. With chemical exergy enabled the composition does not change, so its specific cost passes through unchanged (F-principle), whether or not the physical exergy is split:
\[\frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_\mathrm{out}}{\dot{E}^\mathrm{CH}_\mathrm{out}}\]Without split physical exergy no further equation is written. The stream carries a single cost variable for its physical exergy, that variable is the only one the component produces, and the cost balance alone determines it:
\[\dot{C}^\mathrm{PH}_\mathrm{out} = \dot{C}^\mathrm{PH}_\mathrm{in} + \dot{C}^\mathrm{TOT}_\mathrm{power} + \dot{Z}\]With split physical exergy the outlet carries two cost variables, so one equation is needed, and which one depends on where the stream sits relative to the ambient temperature.
Both streams above \(T_0\): the thermal and the mechanical exergy are both gained, so both are part of the product and are priced alike (P-principle):
\[\frac{\dot{C}^\mathrm{T}_\mathrm{out} - \dot{C}^\mathrm{T}_\mathrm{in}} {\dot{E}^\mathrm{T}_\mathrm{out} - \dot{E}^\mathrm{T}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out} - \dot{C}^\mathrm{M}_\mathrm{in}} {\dot{E}^\mathrm{M}_\mathrm{out} - \dot{E}^\mathrm{M}_\mathrm{in}}\]Inlet at or below and outlet above \(T_0\): the outlet carries thermal exergy that the inlet did not have, so the whole of it is product:
\[\frac{\dot{C}^\mathrm{T}_\mathrm{out}}{\dot{E}^\mathrm{T}_\mathrm{out}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out} - \dot{C}^\mathrm{M}_\mathrm{in}} {\dot{E}^\mathrm{M}_\mathrm{out} - \dot{E}^\mathrm{M}_\mathrm{in}}\]Both streams at or below \(T_0\): the cold exergy of the stream is consumed, so it is fuel and follows the F-principle:
\[\frac{\dot{C}^\mathrm{T}_\mathrm{in}}{\dot{E}^\mathrm{T}_\mathrm{in}} = \frac{\dot{C}^\mathrm{T}_\mathrm{out}}{\dot{E}^\mathrm{T}_\mathrm{out}}\]A share the stream does not gain passes through at its own specific cost instead, and a share the outlet does not carry has no cost, \(\dot{C}^{x}_\mathrm{out} = 0\).
Below the ambient temperature the split is what separates the cold exergy from the pressure rise, so running without it there makes the component warn.
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature.
equations (list or dict) – Data structure for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index (increased by 2 if chemical exergy is enabled, or by 1 otherwise).
equations (list or dict) – Updated structure with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the pump.
Performs exergy balance calculations considering the temperature relationships between inlet stream, outlet stream, and ambient conditions.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the pump.
The general exergoeconomic balance equation is:
\[\dot{C}^{\mathrm{T}}_{\mathrm{in}} + \dot{C}^{\mathrm{M}}_{\mathrm{in}} - \dot{C}^{\mathrm{T}}_{\mathrm{out}} - \dot{C}^{\mathrm{M}}_{\mathrm{out}} + \dot{Z} = 0\]In case the chemical exergy of the streams is known:
\[\dot{C}^{\mathrm{CH}}_{\mathrm{in}} = \dot{C}^{\mathrm{CH}}_{\mathrm{out}}\]This method computes cost rates for product and fuel, and derives exergoeconomic indicators. The pump consumes power (fuel) to increase the exergy of the working fluid (product).
Case 1: Both inlet and outlet above ambient temperature
Both inlet and outlet satisfy \(T \geq T_0\):
\[\dot{C}_{\mathrm{P}} = \dot{C}^{\mathrm{PH}}_{\mathrm{out}} - \dot{C}^{\mathrm{PH}}_{\mathrm{in}}\]\[\dot{C}_{\mathrm{F}} = \dot{C}^{\mathrm{TOT}}_{\mathrm{power,in}}\]Case 2: Inlet at or below and outlet above ambient temperature
Inlet satisfies \(T \leq T_0\) and outlet \(T > T_0\):
\[\dot{C}_{\mathrm{P}} = \dot{C}^{\mathrm{T}}_{\mathrm{out}} + \bigl(\dot{C}^{\mathrm{M}}_{\mathrm{out}} - \dot{C}^{\mathrm{M}}_{\mathrm{in}}\bigr)\]\[\dot{C}_{\mathrm{F}} = \dot{C}^{\mathrm{TOT}}_{\mathrm{power,in}} + \dot{C}^{\mathrm{T}}_{\mathrm{in}}\]Case 3: Both inlet and outlet at or below ambient temperature
Both inlet and outlet satisfy \(T \leq T_0\):
\[\dot{C}_{\mathrm{P}} = \dot{C}^{\mathrm{M}}_{\mathrm{out}} - \dot{C}^{\mathrm{M}}_{\mathrm{in}}\]\[\dot{C}_{\mathrm{F}} = \dot{C}^{\mathrm{TOT}}_{\mathrm{power,in}} + \bigl(\dot{C}^{\mathrm{T}}_{\mathrm{in}} - \dot{C}^{\mathrm{T}}_{\mathrm{out}}\bigr)\]- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations. Default is False.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Attributes Set
————–
C_P (float) – Cost rate of product (currency/time).
C_F (float) – Cost rate of fuel (currency/time).
c_P (float) – Specific cost of product (currency/energy).
c_F (float) – Specific cost of fuel (currency/energy).
C_D (float) – Cost rate of exergy destruction (currency/time).
r (float) – Relative cost difference (dimensionless).
f (float) – Exergoeconomic factor (dimensionless).
- Raises:
ValueError – If no inlet power stream is found.
Drum¶
- class exerpy.components.nodes.drum.Drum(**kwargs)[source]¶
Bases:
ComponentClass for exergy and exergoeconomic analysis of steam drums.
A drum separates the water/steam mixture of an evaporator circuit. It takes the feed water and the heating steam coming back from the evaporator, and returns saturated steam, the circulating water that goes back to the evaporator and, optionally, a blow down. At least two inlets and two outlets are required; further outlets are supported.
All streams leaving a drum are at the same saturation state, so all of them are treated as products of the separation: the exergy product is the sum of all outlets and the exergy fuel the sum of all inlets,
\[\dot{E}_\mathrm{P} = \sum_j \dot{E}^\mathrm{PH}_{\mathrm{out,}j} \qquad \dot{E}_\mathrm{F} = \sum_i \dot{E}^\mathrm{PH}_{\mathrm{in,}i}\]and in the exergoeconomic analysis every outlet carries the same specific costs (see
aux_eqs()). A blow down is therefore charged at the same rate as the steam and takes its share of the costs out of the plant; declare it inE_Lto report it as a loss of the system.- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with mass flows and specific exergies.
outl (dict) – Dictionary containing outlet stream data with mass flows and specific exergies.
Z_costs (float) – Investment cost rate of the component in currency/h.
Note
The Ebsilon steam drum (component 20) is mapped to this component: the feed water (pin 1) and the heating steam (pin 4) become the inlets, the circulating water (pin 3), the saturated steam (pin 2) and the blow down (pin 5) the outlets.
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the drum.
Everything leaving a drum leaves at the same saturation state, so all outlets are co-products carrying the same specific costs (P-principle), while the composition passes through at its own specific cost (F-principle).
With split physical exergy, for every further outlet \(j\):
\[\frac{\dot{C}^\mathrm{T}_{\mathrm{out,}1}}{\dot{E}^\mathrm{T}_{\mathrm{out,}1}} = \frac{\dot{C}^\mathrm{T}_{\mathrm{out,}j}}{\dot{E}^\mathrm{T}_{\mathrm{out,}j}} \qquad \frac{\dot{C}^\mathrm{M}_{\mathrm{out,}1}}{\dot{E}^\mathrm{M}_{\mathrm{out,}1}} = \frac{\dot{C}^\mathrm{M}_{\mathrm{out,}j}}{\dot{E}^\mathrm{M}_{\mathrm{out,}j}}\]and, since the thermal and the mechanical exergy of a saturated stream are produced together, one further rule couples the two at the first outlet:
\[\frac{\dot{C}^\mathrm{T}_{\mathrm{out,}1}}{\dot{E}^\mathrm{T}_{\mathrm{out,}1}} = \frac{\dot{C}^\mathrm{M}_{\mathrm{out,}1}}{\dot{E}^\mathrm{M}_{\mathrm{out,}1}}\]Without the split each stream carries a single cost variable for its physical exergy. The two rules per outlet collapse into one, and the coupling rule disappears with the variable it coupled:
\[\frac{\dot{C}^\mathrm{PH}_{\mathrm{out,}1}}{\dot{E}^\mathrm{PH}_{\mathrm{out,}1}} = \frac{\dot{C}^\mathrm{PH}_{\mathrm{out,}j}}{\dot{E}^\mathrm{PH}_{\mathrm{out,}j}}\]With chemical exergy enabled, either way, for every outlet \(j\):
\[\frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_{\mathrm{out,}j}}{\dot{E}^\mathrm{CH}_{\mathrm{out,}j}}\]A blowdown carries the same specific cost as the saturated steam and takes its share of the costs out of the plant; it is not charged back to the other outlets.
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature.
equations (dict) – Dictionary for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index.
equations (dict) – Updated dictionary with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the drum.
- Parameters:
T0 (float) – Ambient temperature T0 / K.
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
- Raises:
ValueError – If fewer than two inlets or fewer than two outlets are connected.
Note
Please note, that the exergy balance accounts for physical exergy only. The sums run over all connected streams, so a third outlet such as a blow down is part of the exergy product instead of being ignored.
\[\begin{split}\dot{E}_\mathrm{P} = \sum \dot{E}_{\mathrm{out,}j}^\mathrm{PH}\\ \dot{E}_\mathrm{F} = \sum \dot{E}_{\mathrm{in,}i}^\mathrm{PH}\end{split}\]
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the drum.
Fuel and product are summed over all connected streams, in line with
calc_exergy_balance():\[\dot{C}_\mathrm{F} = \sum_i \dot{C}^\mathrm{PH}_{\mathrm{in},i} \qquad \dot{C}_\mathrm{P} = \sum_i \dot{C}^\mathrm{PH}_{\mathrm{out},i}\]- Parameters:
T0 (float) – Ambient temperature.
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Deaerator¶
- class exerpy.components.nodes.deaerator.Deaerator(**kwargs)[source]¶
Bases:
ComponentClass for exergy analysis of deaerators.
This class performs exergy analysis calculations for deaerators with multiple inlet streams and one outlet stream. The exergy product and fuel definitions vary based on the temperature relationships between inlet streams, outlet stream, and ambient conditions.
- Parameters:
**kwargs (dict) – Arbitrary keyword arguments passed to parent class.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet streams data with temperature, mass flows, and specific exergies.
outl (dict) – Dictionary containing outlet stream data with temperature, mass flows, and specific exergies.
Notes
The exergy product and fuel follow the change of the specific exergy of each inlet \(i\) on its way to the outlet [33]. A decrease is fuel, an increase product. An inlet on the other side of the ambient temperature than the outlet crosses it, so its exergy at the inlet is fuel and the exergy it carries at the outlet product:
\[\dot E_{P} = \sum_{i \in P} \dot m_{i}\,\bigl(e_{\mathrm{out}} - e_{\mathrm{in},i}\bigr) + \sum_{i \in X} \dot m_{i}\,e_{\mathrm{out}} \qquad \dot E_{F} = \sum_{i \in F} \dot m_{i}\,\bigl(e_{\mathrm{in},i} - e_{\mathrm{out}}\bigr) + \sum_{i \in X} \dot m_{i}\,e_{\mathrm{in},i}\]with \(P\) the inlets whose specific exergy rises, \(F\) those whose specific exergy falls and \(X\) those that cross the ambient temperature; \(e\) is the physical exergy \(e^\mathrm{PH}\). With the outlet exactly at the ambient temperature there is no product, \(\dot E_{P}\) is NaN and \(\dot E_{F} = \dot E_{D} = \sum_{i} \dot m_{i}\, (e_{\mathrm{in},i} - e_{\mathrm{out}})\).
With split physical exergy, the thermal exergy \(e^\mathrm{T}\) takes the place of \(e^\mathrm{PH}\) in these sums, and the decrease of mechanical exergy of every inlet is part of the fuel [33]:
\[\dot E_{F} \mathrel{+}= \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{in},i}^{\mathrm{M}} -e_{\mathrm{out}}^{\mathrm{M}}\bigr)\]With chemical exergy, the decrease of the sum of the chemical exergies is part of the fuel as well [33]:
\[\dot E_{F} \mathrel{+}= \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{in},i}^{\mathrm{CH}} -e_{\mathrm{out}}^{\mathrm{CH}}\bigr)\]A further material outlet, such as the vent, leaves with its own exergy: the sums above take all inlets to the state of the main outlet 0, so for each vent \(v\) the fuel is corrected by \(\dot m_v (e_{\mathrm{out}} - e_v)\) in every exergy form, and the exergy destruction is the full balance. The vent leaves at the specific costs of the main outlet.
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the deaerator.
A deaerator mixes several streams into one. The stream leaving it is warmer than the colder inlets, so its thermal exergy is the product of the mixing, while what the component does not raise is simply blended.
Writing \(x\) for a cost variable that merely passes through, the outlet takes the mass-weighted mean of the specific costs of the inlets:
\[\frac{\dot{C}^{x}_\mathrm{out}}{\dot{E}^{x}_\mathrm{out}} = \sum_{i} \frac{\dot{m}_{\mathrm{in},i}}{\sum_{k} \dot{m}_{\mathrm{in},k}} \cdot \frac{\dot{C}^{x}_{\mathrm{in},i}}{\dot{E}^{x}_{\mathrm{in},i}}\]With split physical exergy this rule is written for the mechanical exergy, \(x = \mathrm{M}\), while the thermal exergy of the outlet is the product of the mixing and is left to the cost balance.
Without the split there is no mechanical cost variable, and the single cost variable of the physical exergy of the outlet is the product, so no mixing rule is written at all; the cost balance alone determines it:
\[\dot{C}^\mathrm{PH}_\mathrm{out} = \sum_{i} \dot{C}^\mathrm{PH}_{\mathrm{in},i} + \dot{Z}\]With chemical exergy enabled the rule is written for \(x = \mathrm{CH}\) in either mode, since the composition of the outlet is the mixture of the inlets.
An inlet without exergy of the share adds nothing to the sum, and an outlet without it carries no cost of it, \(\dot{C}^{x}_\mathrm{out} = 0\).
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature (provided for consistency; not used in this function).
equations (dict) – Dictionary for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index (increased by 2 if chemical exergy is enabled, or by 1 otherwise).
equations (dict) – Updated dictionary with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the deaerator.
Performs exergy balance calculations considering the temperature relationships between inlet streams, outlet stream, and ambient conditions.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
- Raises:
ValueError – If the required inlet and outlet streams are not properly defined.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the deaerator (mixing component).
The deaerator is a mixing component where multiple streams combine. The general exergoeconomic balance equation is:
\[\sum_{\mathrm{in}} \left(\dot{C}^{\mathrm{T}}_{\mathrm{in}} + \dot{C}^{\mathrm{M}}_{\mathrm{in}} + \dot{C}^{\mathrm{CH}}_{\mathrm{in}}\right) - \sum_{\mathrm{out}} \left(\dot{C}^{\mathrm{T}}_{\mathrm{out}} + \dot{C}^{\mathrm{M}}_{\mathrm{out}} + \dot{C}^{\mathrm{CH}}_{\mathrm{out}}\right) + \dot{Z} = 0\]The cost of the fuel takes the same exergy forms and streams as the fuel of
calc_exergy_balance()[33]. An inlet whose specific exergy \(e^{x}\) falls (\(x = \mathrm{T}\) with split physical exergy, \(\mathrm{PH}\) without) gives up that decrease at its own specific cost, an inlet crossing the ambient temperature brings its whole cost of that form, and the decrease of mechanical (with split) and chemical exergy (if known) of all inlets is fuel:\[\dot{C}_\mathrm{F} = \sum_{i \in F} \dot m_{i}\, c^{x}_{\mathrm{in},i} \bigl(e^{x}_{\mathrm{in},i} - e^{x}_\mathrm{out}\bigr) + \sum_{i \in X} \dot C^{x}_{\mathrm{in},i} + \sum_{y \in \{\mathrm{M}, \mathrm{CH}\}} \Bigl(\sum_{i} \dot C^{y}_{\mathrm{in},i} - \dot C^{y}_\mathrm{out}\Bigr)\]With the outlet at the ambient temperature every inlet only gives up exergy, so all inlets count as \(F\). The product cost closes the balance, \(\dot{C}_\mathrm{P} = \dot{C}_\mathrm{F} + \dot{Z} + \dot{Z}_\mathrm{diss}\).
- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations. Default is False.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Attributes Set
————–
C_P (float) – Cost rate of product (currency/time).
C_F (float) – Cost rate of fuel (currency/time).
c_P (float) – Specific cost of product (currency/energy).
c_F (float) – Specific cost of fuel (currency/energy).
C_D (float) – Cost rate of exergy destruction (currency/time).
r (float) – Relative cost difference (dimensionless).
f (float) – Exergoeconomic factor (dimensionless).
Notes
The deaerator treats thermal, mechanical, and chemical exergy components differently depending on whether inlets are “hot” or “cold” relative to the outlet temperature. The distinction ensures proper cost allocation for streams that provide heating versus those being heated.
Future development may include merging profits from dissipative components.
Mixer¶
- class exerpy.components.nodes.mixer.Mixer(**kwargs)[source]¶
Bases:
ComponentClass for exergy analysis of mixers.
This class performs exergy analysis calculations for mixers with multiple inlet streams and generally one outlet stream (multiple outlets are possible). The exergy product and fuel definitions vary based on the temperature relationships between inlet streams, outlet streams, and ambient conditions.
- Parameters:
**kwargs (dict) – Arbitrary keyword arguments passed to parent class.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet streams data with temperature, mass flows, and specific exergies.
outl (dict) – Dictionary containing outlet stream data with temperature, mass flows, and specific exergies.
Notes
The exergy product and fuel follow the change of the specific exergy of each inlet \(i\) on its way to the outlet [33]. A decrease is fuel, an increase product. An inlet on the other side of the ambient temperature than the outlet crosses it, so its exergy at the inlet is fuel and the exergy it carries at the outlet product:
\[\dot E_{P} = \sum_{i \in P} \dot m_{i}\,\bigl(e_{\mathrm{out}} - e_{\mathrm{in},i}\bigr) + \sum_{i \in X} \dot m_{i}\,e_{\mathrm{out}} \qquad \dot E_{F} = \sum_{i \in F} \dot m_{i}\,\bigl(e_{\mathrm{in},i} - e_{\mathrm{out}}\bigr) + \sum_{i \in X} \dot m_{i}\,e_{\mathrm{in},i}\]with \(P\) the inlets whose specific exergy rises, \(F\) those whose specific exergy falls and \(X\) those that cross the ambient temperature; \(e\) is the physical exergy \(e^\mathrm{PH}\). With the outlet exactly at the ambient temperature there is no product, \(\dot E_{P}\) is NaN and \(\dot E_{F} = \dot E_{D} = \sum_{i} \dot m_{i}\, (e_{\mathrm{in},i} - e_{\mathrm{out}})\).
With split physical exergy, the thermal exergy \(e^\mathrm{T}\) takes the place of \(e^\mathrm{PH}\) in these sums, and the decrease of mechanical exergy of every inlet is part of the fuel [33]:
\[\dot E_{F} \mathrel{+}= \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{in},i}^{\mathrm{M}} -e_{\mathrm{out}}^{\mathrm{M}}\bigr)\]With chemical exergy, the decrease of the sum of the chemical exergies is part of the fuel as well, so that inlets of different composition are covered [33]:
\[\dot E_{F} \mathrel{+}= \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{in},i}^{\mathrm{CH}} -e_{\mathrm{out}}^{\mathrm{CH}}\bigr)\]An inlet that stands for several identical parallel branches, such as the outlet of a
ParabolicTroughwithnum_branches\(n\), counts \(n\) times, here and in the cost equations, every other inlet once.- class Input(*, name: Annotated[str, msgspec.Meta(min_length=1)], num_branches: Annotated[float, msgspec.Meta(description='Number of identical parallel branches'), Limit(gt=0, ge=None, le=None)] | None | UnsetType = UNSET)[source]¶
Bases:
Input- num_branches: Annotated[float, msgspec.Meta(description='Number of identical parallel branches'), Limit(gt=0, ge=None, le=None)] | None | UnsetType¶
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the mixer.
A mixer brings several streams together into one. The thermal exergy of the outlet is the product of the mixing, while what the component does not raise is simply blended.
Writing \(x\) for a cost variable that merely passes through, the outlet takes the mass-weighted mean of the specific costs of the inlets:
\[\frac{\dot{C}^{x}_\mathrm{out}}{\dot{E}^{x}_\mathrm{out}} = \sum_{i} \frac{n_{i} \, \dot{m}_{\mathrm{in},i}}{\sum_{k} n_{k} \, \dot{m}_{\mathrm{in},k}} \cdot \frac{\dot{C}^{x}_{\mathrm{in},i}}{\dot{E}^{x}_{\mathrm{in},i}}\]where \(n_{i}\) is the number of parallel branches inlet \(i\) stands for (1 for a single stream).
With split physical exergy this rule is written for the mechanical exergy, \(x = \mathrm{M}\), while the thermal exergy of the outlet is the product of the mixing and is left to the cost balance.
Without the split there is no mechanical cost variable, and the single cost variable of the physical exergy of the outlet is the product, so no mixing rule is written at all; the cost balance alone determines it:
\[\dot{C}^\mathrm{PH}_\mathrm{out} = \sum_{i} \dot{C}^\mathrm{PH}_{\mathrm{in},i} + \dot{Z}\]With chemical exergy enabled the rule is written for \(x = \mathrm{CH}\) in either mode, since the composition of the outlet is the mixture of the inlets.
An inlet without exergy of the share adds nothing to the sum, and an outlet without it carries no cost of it, \(\dot{C}^{x}_\mathrm{out} = 0\).
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature (provided for consistency; not used in this function).
equations (list or dict) – Data structure for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index (increased by 2 if chemical exergy is enabled, or by 1 otherwise).
equations (list or dict) – Updated structure with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the mixer.
Performs exergy balance calculations considering the temperature relationships between inlet streams, outlet stream(s), and ambient conditions.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
- Raises:
ValueError – If the required inlet and outlet streams are not properly defined.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the mixer.
The mixer is a component where multiple streams combine. The general exergoeconomic balance equation is:
\[\sum_{\mathrm{in}} \left(\dot{C}^{\mathrm{T}}_{\mathrm{in}} + \dot{C}^{\mathrm{M}}_{\mathrm{in}} + \dot{C}^{\mathrm{CH}}_{\mathrm{in}}\right) - \sum_{\mathrm{out}} \left(\dot{C}^{\mathrm{T}}_{\mathrm{out}} + \dot{C}^{\mathrm{M}}_{\mathrm{out}} + \dot{C}^{\mathrm{CH}}_{\mathrm{out}}\right) + \dot{Z} = 0\]The cost of the fuel takes the same exergy forms and streams as the fuel of
calc_exergy_balance()[33]. An inlet whose specific exergy \(e^{x}\) falls (\(x = \mathrm{T}\) with split physical exergy, \(\mathrm{PH}\) without) gives up that decrease at its own specific cost, an inlet crossing the ambient temperature brings its whole cost of that form, and the decrease of mechanical (with split) and chemical exergy (if known) of all inlets is fuel:\[\dot{C}_\mathrm{F} = \sum_{i \in F} \dot m_{i}\, c^{x}_{\mathrm{in},i} \bigl(e^{x}_{\mathrm{in},i} - e^{x}_\mathrm{out}\bigr) + \sum_{i \in X} \dot C^{x}_{\mathrm{in},i} + \sum_{y \in \{\mathrm{M}, \mathrm{CH}\}} \Bigl(\sum_{i} \dot C^{y}_{\mathrm{in},i} - \dot C^{y}_\mathrm{out}\Bigr)\]With the outlet at the ambient temperature every inlet only gives up exergy, so all inlets count as \(F\). The product cost closes the balance, \(\dot{C}_\mathrm{P} = \dot{C}_\mathrm{F} + \dot{Z} + \dot{Z}_\mathrm{diss}\).
- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations. Default is False.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Attributes Set
————–
C_P (float) – Cost rate of product (currency/time).
C_F (float) – Cost rate of fuel (currency/time).
c_P (float) – Specific cost of product (currency/energy).
c_F (float) – Specific cost of fuel (currency/energy).
C_D (float) – Cost rate of exergy destruction (currency/time).
r (float) – Relative cost difference (dimensionless).
f (float) – Exergoeconomic factor (dimensionless).
Notes
The mixer treats thermal, mechanical, and chemical exergy components differently depending on whether inlets are “hot” or “cold” relative to the outlet temperature. The distinction ensures proper cost allocation for streams that provide heating versus those being heated.
Future development may include merging profits from dissipative components.
Generator¶
- class exerpy.components.power_machines.generator.Generator(**kwargs)[source]¶
Bases:
ComponentClass for exergy analysis of generators.
This class performs exergy analysis calculations for generators, converting mechanical or thermal energy flow into electrical energy. The exergy product is defined as the electrical power output, while the exergy fuel is the input energy flow.
- Parameters:
**kwargs (dict) – Arbitrary keyword arguments passed to parent class.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with energy flow.
outl (dict) – Dictionary containing outlet stream data with energy flow.
Notes
The exergy analysis for a generator is straightforward as electrical energy is pure exergy. The equations are:
\[ \begin{align}\begin{aligned}\dot{E}_\mathrm{P} & = \dot{W}_\mathrm{el}\\\dot{E}_\mathrm{F} & = \dot{W}_\mathrm{in}\\\dot{E}_\mathrm{D} & = \dot{E}_\mathrm{F} - \dot{E}_\mathrm{P}\end{aligned}\end{align} \]- where:
\(\dot{W}_\mathrm{el}\): Electrical power output
\(\dot{W}_\mathrm{in}\): Input power
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the generator.
The generator converts shaft power into electrical power. Both streams are power, each carrying one cost variable, and the outlet is the only one the component produces, so the cost balance alone determines it:
\[\dot{C}^\mathrm{TOT}_\mathrm{out} = \dot{C}^\mathrm{TOT}_\mathrm{in} + \dot{Z}\]No auxiliary equation is therefore written, and the split of the physical exergy does not apply: it concerns material streams only, and this component has none.
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature.
equations (dict) – Dictionary for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index.
equations (dict) – Updated dictionary with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the generator.
Calculates the exergy product (electrical power output), exergy fuel (input power), and the resulting exergy destruction and efficiency.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the generator (power-producing component).
The generator is a power-producing component (e.g., electrical generator, turbine) where mechanical/electrical work is extracted from a flowing stream. The general exergoeconomic balance equation is:
\[\dot{C}_{\mathrm{in}}^{\mathrm{TOT}} - \dot{C}_{\mathrm{out}}^{\mathrm{TOT}} - \dot{C}_{\mathrm{P}} + \dot{Z} = 0\]For a generator, the product is the power output (electrical or mechanical), and the fuel is the exergy decrease in the working fluid:
\[\dot{C}_{\mathrm{P}} = \dot{C}_{\mathrm{out}}^{\mathrm{TOT}}\]\[\dot{C}_{\mathrm{F}} = \dot{C}_{\mathrm{in}}^{\mathrm{TOT}}\]- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations. Default is False.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Attributes Set
————–
C_P (float) – Cost rate of product (currency/time).
C_F (float) – Cost rate of fuel (currency/time).
c_P (float) – Specific cost of product (currency/energy).
c_F (float) – Specific cost of fuel (currency/energy).
C_D (float) – Cost rate of exergy destruction (currency/time).
r (float) – Relative cost difference (dimensionless).
f (float) – Exergoeconomic factor (dimensionless).
- Raises:
ValueError – If E_P or E_F is zero, preventing computation of specific costs.
Notes
Unlike other components, the generator does not add Z_costs to close the cost balance in the C_P calculation. The cost balance is determined by the total exergy costs of inlet and outlet streams.
The relative cost difference r is calculated using total cost rates (C_P and C_F) rather than specific costs (c_P and c_F), which is mathematically equivalent for this component type.
The exergy destruction E_D must be computed prior to calling this method.
Motor¶
- class exerpy.components.power_machines.motor.Motor(**kwargs)[source]¶
Bases:
ComponentClass for exergy analysis of motors.
This class performs exergy analysis calculations for motors, converting electrical energy into mechanical energy. The exergy product is defined as the mechanical power output, while the exergy fuel is the electrical power input.
- Parameters:
**kwargs (dict) – Arbitrary keyword arguments passed to parent class.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with energy flow.
outl (dict) – Dictionary containing outlet stream data with energy flow.
Notes
The exergy analysis for a motor is straightforward as both electrical and mechanical energy are pure exergy. The equations are:
\[ \begin{align}\begin{aligned}\dot{E}_\mathrm{P} & = \dot{W}_\mathrm{mech}\\\dot{E}_\mathrm{F} & = \dot{W}_\mathrm{el}\\\dot{E}_\mathrm{D} & = \dot{E}_\mathrm{F} - \dot{E}_\mathrm{P}\end{aligned}\end{align} \]- where:
\(\dot{W}_\mathrm{mech}\): Mechanical power output
\(\dot{W}_\mathrm{el}\): Electrical power input
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the motor.
The motor converts electrical power into shaft power. Both streams are power, each carrying one cost variable, and the outlet is the only one the component produces, so the cost balance alone determines it:
\[\dot{C}^\mathrm{TOT}_\mathrm{out} = \dot{C}^\mathrm{TOT}_\mathrm{in} + \dot{Z}\]No auxiliary equation is therefore written, and the split of the physical exergy does not apply: it concerns material streams only, and this component has none.
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature.
equations (dict) – Dictionary for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index.
equations (dict) – Updated dictionary with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the motor.
Calculates the exergy product (mechanical power output), exergy fuel (electrical power input), and the resulting exergy destruction and efficiency.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the motor (power-consuming component).
The motor is a power-consuming component (e.g., electric motor, pump motor) where mechanical/electrical work is consumed to drive a process. The general exergoeconomic balance equation is:
\[\dot{C}_{\mathrm{in}}^{\mathrm{TOT}} - \dot{C}_{\mathrm{out}}^{\mathrm{TOT}} + \dot{C}_{\mathrm{W}} + \dot{Z} = 0\]For a motor, the fuel is the input stream (typically electrical power), and the product is the output stream (mechanical work or driven fluid):
\[\dot{C}_{\mathrm{F}} = \dot{C}_{\mathrm{in}}^{\mathrm{TOT}}\]\[\dot{C}_{\mathrm{P}} = \dot{C}_{\mathrm{out}}^{\mathrm{TOT}}\]- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations. Default is False.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Attributes Set
————–
C_P (float) – Cost rate of product (currency/time).
C_F (float) – Cost rate of fuel (currency/time).
c_P (float) – Specific cost of product (currency/energy).
c_F (float) – Specific cost of fuel (currency/energy).
C_D (float) – Cost rate of exergy destruction (currency/time).
r (float) – Relative cost difference (dimensionless).
f (float) – Exergoeconomic factor (dimensionless).
- Raises:
ValueError – If E_P or E_F is zero, preventing computation of specific costs.
Notes
The motor is a power-consuming component, opposite in function to a generator. Unlike heat exchangers or pumps, the motor does not add Z_costs to close the cost balance in the C_P calculation. The cost balance is determined by the total exergy costs of inlet and outlet streams.
The relative cost difference r is calculated using total cost rates (C_P and C_F) rather than specific costs (c_P and c_F), which is mathematically equivalent for this component type.
The exergy destruction E_D must be computed prior to calling this method.
For motors coupled with pumps or compressors, the fuel is typically the electrical energy consumed, and the product is the mechanical work delivered to the driven equipment.
Valve¶
- class exerpy.components.piping.valve.Valve(**kwargs)[source]¶
Bases:
ComponentClass for exergy and exergoeconomic analysis of valves.
This class performs exergy and exergoeconomic analysis calculations for valve components, accounting for one inlet and one outlet streams across various temperature regimes, including above and below ambient temperature.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with mass flows and specific exergies.
outl (dict) – Dictionary containing outlet stream data with mass flows and specific exergies.
Z_costs (float) – Investment cost rate of the component in currency/h.
C_P (float) – Cost of product stream \(\dot{C}_P\) in currency/h.
C_F (float) – Cost of fuel stream \(\dot{C}_F\) in currency/h.
C_D (float) – Cost of exergy destruction \(\dot{C}_D\) in currency/h.
c_P (float) – Specific cost of product stream (currency per unit exergy).
c_F (float) – Specific cost of fuel stream (currency per unit exergy).
r (float) – Relative cost difference, \((c_P - c_F)/c_F\).
f (float) – Exergoeconomic factor, \(\dot{Z}/(\dot{Z} + \dot{C}_D)\).
Ex_C_col (dict) – Custom cost coefficients collection passed via kwargs.
Notes
The exergy analysis accounts for physical, thermal, and mechanical exergy based on temperature relationships:
\[ \begin{align}\begin{aligned}\begin{split}\dot{E}_\mathrm{P} = \begin{cases} \text{not defined (nan)} & T_\mathrm{in}, T_\mathrm{out} > T_0\\ \dot{m} \cdot e_\mathrm{out}^\mathrm{T} & T_\mathrm{in} > T_0 \geq T_\mathrm{out}\\ \dot{m} \cdot (e_\mathrm{out}^\mathrm{T} - 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{m} \cdot (e_\mathrm{in}^\mathrm{PH} - e_\mathrm{out}^\mathrm{PH}) & T_\mathrm{in}, T_\mathrm{out} > T_0\\ \dot{m} \cdot (e_\mathrm{in}^\mathrm{T} + e_\mathrm{in}^\mathrm{M} - e_\mathrm{out}^\mathrm{M}) & T_\mathrm{in} > T_0 \geq T_\mathrm{out}\\ \dot{m} \cdot (e_\mathrm{in}^\mathrm{M} - e_\mathrm{out}^\mathrm{M}) & T_0 \geq T_\mathrm{in}, T_\mathrm{out} \end{cases}\end{split}\end{aligned}\end{align} \]For all cases, except when \(T_\mathrm{out} > T_\mathrm{in}\), the exergy destruction is calculated as:
\[\begin{split}\dot{E}_\mathrm{D} = \begin{cases} \dot{E}_\mathrm{F} & \text{if } \dot{E}_\mathrm{P} = \text{nan}\\ \dot{E}_\mathrm{F} - \dot{E}_\mathrm{P} & \mathrm{otherwise} \end{cases}\end{split}\]- Where:
\(e^\mathrm{T}\): Thermal exergy
\(e^\mathrm{PH}\): Physical exergy
\(e^\mathrm{M}\): Mechanical exergy
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the valve.
A valve destroys exergy and produces nothing, unless it expands into the range below the ambient temperature: there the cold exergy the stream gains is a product. A valve that stays above \(T_0\) is dissipative, handled by
dis_eqs()instead, and this method writes nothing for it.For a productive valve, expanding to \(T_\mathrm{out} \leq T_0\), the pressure the stream gives up is the fuel and follows the F-principle.
With split physical exergy the cold exergy the stream gains is the product, determined by the cost balance, and the mechanical exergy needs the rule:
\[\frac{\dot{C}^\mathrm{M}_\mathrm{in}}{\dot{E}^\mathrm{M}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out}}{\dot{E}^\mathrm{M}_\mathrm{out}}\]Without the split there is no mechanical cost variable to rule on: the stream carries one variable for its physical exergy, and the cost balance alone determines it:
\[\dot{C}^\mathrm{PH}_\mathrm{out} = \dot{C}^\mathrm{PH}_\mathrm{in} + \dot{Z}\]With chemical exergy enabled, either way, the composition does not change:
\[\frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_\mathrm{out}}{\dot{E}^\mathrm{CH}_\mathrm{out}}\]Where the inlet or the outlet carries no exergy of a share \(x\), the outlet carries no cost of it, \(\dot{C}^{x}_\mathrm{out} = 0\).
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature.
equations (dict) – Dictionary for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index.
equations (dict) – Updated dictionary with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the valve.
Performs exergy balance calculations considering the temperature relationships between inlet stream, outlet stream, and ambient conditions.
Below the ambient temperature the product is the gain of thermal exergy. A liquid that warms on throttling loses thermal exergy instead, so the valve has no product and is treated as dissipative [33].
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
- Raises:
ValueError – If the required inlet and outlet streams are not properly defined.
- dis_eqs(A, b, counter, T0, equations, chemical_exergy_enabled=False, all_components=None, split_physical_exergy=True)[source]¶
Constructs the cost equations for a dissipative Valve in ExerPy, distributing the valve’s extra cost difference (C_diff) to all other productive components (non-dissipative and non-CycleCloser) in proportion to their exergy destruction (E_D) and adding an extra overall cost balance row that enforces:
\[(\dot C_{\mathrm{in},T} - \dot C_{\mathrm{out},T}) + (\dot C_{\mathrm{in},M} - \dot C_{\mathrm{out},M}) - \dot C_{\mathrm{diff}} = -\,\dot Z_{\mathrm{costs}}\]In this formulation, the unknown cost variable in the “dissipative” column (i.e. C_diff) is solved for, ensuring the valve’s cost balance.
For each exergy share \(x\) the outlet keeps the specific cost of the inlet. Where the inlet or the outlet carries no exergy of a share, the outlet carries no cost of it, and the cost of the inlet stays in \(\dot C_\mathrm{diff}\):
\[\frac{\dot{C}^{x}_\mathrm{in}}{\dot{E}^{x}_\mathrm{in}} = \frac{\dot{C}^{x}_\mathrm{out}}{\dot{E}^{x}_\mathrm{out}} \qquad \text{or} \qquad \dot{C}^{x}_\mathrm{out} = 0 \quad \text{for} \quad \dot{E}^{x}_\mathrm{in} = 0 \ \text{or} \ \dot{E}^{x}_\mathrm{out} = 0\]- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the cost matrix.
T0 (float) – Ambient temperature (not explicitly used here).
equations (dict) – Dictionary mapping row indices to equation labels.
chemical_exergy_enabled (bool, optional) – Flag indicating whether chemical exergy is considered.
all_components (list, optional) – Global list of all component objects; if not provided, defaults to [].
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
tuple – Updated (A, b, counter, equations).
Notes
It is assumed that each inlet/outlet stream’s CostVar_index dictionary has keys: “T” (thermal), “M” (mechanical), and “dissipative” (the extra unknown).
self.Z_costs is the known cost rate (in currency/s) for the valve.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the valve (throttling component).
The valve is a throttling device that reduces pressure without doing work. Unlike other components, a valve can be either dissipative (purely destructive) or productive depending on temperature conditions and whether physical exergy is split into thermal and mechanical components.
Dissipative Valve (E_P is NaN):
When the valve has no identifiable product (Cases 1, 4, or Cases 2-3 without split), the entire decrease of exergy is destruction. The cost of fuel is the decrease in physical exergy cost:
\[\dot{C}_{\mathrm{F}} = \dot{C}_{\mathrm{in}}^{\mathrm{PH}} - \dot{C}_{\mathrm{out}}^{\mathrm{PH}}\]\[\dot{C}_{\mathrm{P}} = \text{NaN (no product)}\]Productive Valve (E_P has a value):
When physical exergy is split (split_physical_exergy=True) and specific temperature conditions are met, the valve can have a product:
Case 2 (Inlet above T0, outlet below T0):
The product is the thermal exergy at the outlet (cooling capacity), and the fuel is the thermal exergy decrease plus the mechanical exergy decrease:
\[\dot{C}_{\mathrm{P}} = \dot{C}_{\mathrm{out}}^{\mathrm{T}}\]\[\dot{C}_{\mathrm{F}} = \dot{C}_{\mathrm{in}}^{\mathrm{T}} + (\dot{C}_{\mathrm{in}}^{\mathrm{M}} - \dot{C}_{\mathrm{out}}^{\mathrm{M}})\]Case 3 (Both inlet and outlet below T0):
The product is the increase in thermal exergy (cooling capacity increase), and the fuel is the mechanical exergy decrease:
\[\dot{C}_{\mathrm{P}} = \dot{C}_{\mathrm{out}}^{\mathrm{T}} - \dot{C}_{\mathrm{in}}^{\mathrm{T}}\]\[\dot{C}_{\mathrm{F}} = \dot{C}_{\mathrm{in}}^{\mathrm{M}} - \dot{C}_{\mathrm{out}}^{\mathrm{M}}\]- Parameters:
T0 (float) – Ambient temperature (K).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations. Default is False.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Attributes Set
————–
C_P (float or NaN) – Cost rate of product (currency/time). NaN for dissipative valves.
C_F (float or NaN) – Cost rate of fuel (currency/time).
c_P (float or NaN) – Specific cost of product (currency/energy). NaN for dissipative valves.
c_F (float or NaN) – Specific cost of fuel (currency/energy).
C_D (float or NaN) – Cost rate of exergy destruction (currency/time).
r (float or NaN) – Relative cost difference (dimensionless). NaN for dissipative valves.
f (float or NaN) – Exergoeconomic factor (dimensionless).
Notes
The valve is unique among components because:
1. It typically has no capital cost (Z_costs ≈ 0), making the exergoeconomic factor f close to zero.
2. It can be dissipative (no product) or productive (identifiable product) depending on the analysis approach and temperature conditions.
3. For dissipative valves, many exergoeconomic parameters are NaN since there is no identifiable product.
4. The relative cost difference r is calculated using specific costs (c_P and c_F) rather than total cost rates, unlike generator and motor components.
5. The method handles NaN values throughout to accommodate both dissipative and productive valve configurations.
The exergy destruction E_D and product/fuel definitions E_P and E_F must be computed prior to calling this method (via exergy_balance).
For refrigeration cycles (Case 2) or cryogenic applications (Case 3), the productive valve approach may be more appropriate. For typical throttling applications, the dissipative approach is standard.
Storage¶
- class exerpy.components.nodes.storage.Storage(**kwargs)[source]¶
Bases:
ComponentClass for exergy and exergoeconomic analysis of a storage.
This class performs exergy and exergoeconomic analysis calculations for storage components, accounting for one inlet and one outlet stream.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with mass flows and specific exergies.
outl (dict) – Dictionary containing outlet stream data with mass flows and specific exergies.
Z_costs (float) – Investment cost rate of the component in currency/h.
C_P (float) – Cost of product stream \(\dot{C}_P\) in currency/h.
C_F (float) – Cost of fuel stream \(\dot{C}_F\) in currency/h.
C_D (float) – Cost of exergy destruction \(\dot{C}_D\) in currency/h.
c_P (float) – Specific cost of product stream (currency per unit exergy).
c_F (float) – Specific cost of fuel stream (currency per unit exergy).
r (float) – Relative cost difference, \((c_P - c_F)/c_F\).
f (float) – Exergoeconomic factor, \(\dot{Z}/(\dot{Z} + \dot{C}_D)\).
Ex_C_col (dict) – Custom cost coefficients collection passed via kwargs.
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Cost balance and auxiliary equations for the storage.
A storage that charges or discharges does not balance over its streams alone: part of the exergy stays behind in the store or comes out of it. That share carries a cost variable of its own, \(\dot{C}_\mathrm{stored}\), which the analysis allocates for the component, so the cost balance is written here and not by the generic one:
\[\sum \dot{C}_\mathrm{in} + \dot{Z} = \sum \dot{C}_\mathrm{out} \pm \dot{C}_\mathrm{stored}\]with the stored cost on the side it flows to.
The store is filled at the state of the outlet, so what goes into it or comes out of it is priced like the outlet. With split physical exergy that is its thermal exergy, without the split its physical exergy:
\[\frac{\dot{C}_\mathrm{stored}}{\dot{E}_\mathrm{stored}} = \frac{\dot{C}^\mathrm{T}_\mathrm{out}}{\dot{E}^\mathrm{T}_\mathrm{out}} \qquad \text{or} \qquad \frac{\dot{C}_\mathrm{stored}}{\dot{E}_\mathrm{stored}} = \frac{\dot{C}^\mathrm{PH}_\mathrm{out}}{\dot{E}^\mathrm{PH}_\mathrm{out}}\]A storage holding its level stores nothing, and the variable is fixed at zero instead, since the specific cost of nothing is undefined:
\[\dot{C}_\mathrm{stored} = 0 \qquad \text{for} \qquad \dot{E}_\mathrm{stored} = 0\]An outlet without exergy of that share carries no cost of it, and the stored cost follows from the cost balance:
\[\dot{C}^{x}_\mathrm{out} = 0 \qquad \text{for} \qquad \dot{E}^{x}_\mathrm{out} = 0, \quad x \in \{\mathrm{T}, \mathrm{PH}\}\]What the storage does not raise passes through at its own specific cost (F-principle). That is the mechanical exergy with the split, and the chemical exergy when it is enabled; without the split there is no mechanical cost variable and this rule is not written:
\[\frac{\dot{C}^\mathrm{M}_\mathrm{in}}{\dot{E}^\mathrm{M}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out}}{\dot{E}^\mathrm{M}_\mathrm{out}} \qquad \frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_\mathrm{out}}{\dot{E}^\mathrm{CH}_\mathrm{out}}\]- Parameters:
A (numpy.ndarray) – Coefficient matrix of the cost equation system.
b (numpy.ndarray) – Right-hand side vector of the cost equation system.
counter (int) – Index of the next free row.
T0 (float) – Ambient temperature in \(\mathrm{K}\).
equations (dict) – Dictionary documenting the equations.
chemical_exergy_enabled (bool) – Whether chemical exergy is part of the analysis.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
tuple – The updated matrix, vector, row index and equation dictionary.
- Raises:
ValueError – If the analysis did not allocate a cost variable for the stored exergy.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Compute the exergy balance of the storage.
- Parameters:
T0 (float) – Ambient temperature in Kelvin.
p0 (float) – Ambient pressure in Pascal.
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
Notes
The exergy analysis considers the cases where the storage is either charged or discharged.
Case 1 (Charging):
\[\dot{E}_\mathrm{F} = \dot{E}_\mathrm{in}^\mathrm{PH} - \dot{E}_\mathrm{out}^\mathrm{PH}\]\[\dot{E}_\mathrm{P} = (\dot{m}_\mathrm{in} - \dot{m}_\mathrm{out}) \cdot e_\mathrm{out}^\mathrm{PH}\]Case 2 (Discharging):
\[\dot{E}_\mathrm{F} = (\dot{m}_\mathrm{out} - \dot{m}_\mathrm{in}) \cdot e_\mathrm{out}^\mathrm{PH}\]\[\dot{E}_\mathrm{P} = \dot{E}_\mathrm{out}^\mathrm{PH} - \dot{E}_\mathrm{in}^\mathrm{PH}\]Where the chemical exergy of the streams is known, \(e^\mathrm{PH} + e^\mathrm{CH}\) takes the place of \(e^\mathrm{PH}\), as in the cost balance.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform the exergoeconomic cost balance of the storage.
Fuel and product follow
calc_exergy_balance(): while the storage charges, the fuel is what the stream gives up and the product is what goes into the store; while it discharges, the store is the fuel and the gain of the stream is the product. A storage holding its level is treated like a pipe in the cost balance.- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Flash Tank¶
- class exerpy.components.nodes.flash_tank.FlashTank(**kwargs)[source]¶
Bases:
ComponentClass for exergy and exergoeconomic analysis of flash tank.
This class performs exergy and exergoeconomic analysis calculations for flash tank components, accounting for two inlet and two outlet streams.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Dictionary containing inlet stream data with mass flows and specific exergies.
outl (dict) – Dictionary containing outlet stream data with mass flows and specific exergies.
Z_costs (float) – Investment cost rate of the component in currency/h.
C_P (float) – Cost of product stream \(\dot{C}_P\) in currency/h.
C_F (float) – Cost of fuel stream \(\dot{C}_F\) in currency/h.
C_D (float) – Cost of exergy destruction \(\dot{C}_D\) in currency/h.
c_P (float) – Specific cost of product stream (currency per unit exergy).
c_F (float) – Specific cost of fuel stream (currency per unit exergy).
r (float) – Relative cost difference, \((c_P - c_F)/c_F\).
f (float) – Exergoeconomic factor, \(\dot{Z}/(\dot{Z} + \dot{C}_D)\).
Ex_C_col (dict) – Custom cost coefficients collection passed via kwargs.
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the flash tank.
The tank separates one stream into a vapour and a liquid outlet. Both come out of the same vessel, so both are product and both are priced alike (P-principle), while the pressure and the composition merely pass through (F-principle).
With split physical exergy, the two outlets carry the same specific cost of their thermal exergy, and each keeps the specific cost of the mechanical exergy of the inlet:
\[\frac{\dot{C}^\mathrm{T}_{\mathrm{out},1}}{\dot{E}^\mathrm{T}_{\mathrm{out},1}} = \frac{\dot{C}^\mathrm{T}_{\mathrm{out},2}}{\dot{E}^\mathrm{T}_{\mathrm{out},2}} \qquad \frac{\dot{C}^\mathrm{M}_\mathrm{in}}{\dot{E}^\mathrm{M}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_{\mathrm{out},j}}{\dot{E}^\mathrm{M}_{\mathrm{out},j}}\]Without the split the mechanical rules fall away and the P-rule acts on the physical exergy of the two outlets instead:
\[\frac{\dot{C}^\mathrm{PH}_{\mathrm{out},1}}{\dot{E}^\mathrm{PH}_{\mathrm{out},1}} = \frac{\dot{C}^\mathrm{PH}_{\mathrm{out},2}}{\dot{E}^\mathrm{PH}_{\mathrm{out},2}}\]With chemical exergy enabled, either way:
\[\frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_{\mathrm{out},j}}{\dot{E}^\mathrm{CH}_{\mathrm{out},j}}\]Note that these are equalities of specific cost, cost divided by the exergy flow of the stream, so two outlets carrying different mass flows are priced the same per unit of exergy.
- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature (not used).
equations (list or dict) – Data structure for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index after adding equations.
equations (list or dict) – Updated structure with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Compute the exergy balance of the flash tank.
- Parameters:
T0 (float) – Ambient temperature in Kelvin.
p0 (float) – Ambient pressure in Pascal.
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical components.
- Raises:
ValueError – If the number of inlet or outlet streams is less than two.
Notes
The thermal exergy of the inlet is fuel and that of the outlets is product. The decrease of mechanical exergy (with split physical exergy) and of chemical exergy (if known) is fuel as well, so the exergy destruction is the full exergy balance:
\[\dot{E}_\mathrm{F} = \dot{E}_\mathrm{in}^\mathrm{T} + \Bigl(\dot{E}_\mathrm{in}^\mathrm{M} - \sum_{i} \dot{E}_{\mathrm{out},i}^\mathrm{M}\Bigr) + \Bigl(\dot{E}_\mathrm{in}^\mathrm{CH} - \sum_{i} \dot{E}_{\mathrm{out},i}^\mathrm{CH}\Bigr)\]\[\dot{E}_\mathrm{P} = \sum_{i} \dot{E}_{\mathrm{out},i}^\mathrm{T}\]Without the split, \(\mathrm{PH}\) takes the place of \(\mathrm{T}\) and the mechanical term falls away. The cost of fuel and product follows the same forms.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform exergoeconomic cost balance for the flash tank.
The cost of fuel and product follows the exergy forms of
calc_exergy_balance():\[\dot{C}_\mathrm{F} = \dot{C}_\mathrm{in}^\mathrm{T} + \Bigl(\dot{C}_\mathrm{in}^\mathrm{M} - \sum_{i} \dot{C}_{\mathrm{out},i}^\mathrm{M}\Bigr) + \Bigl(\dot{C}_\mathrm{in}^\mathrm{CH} - \sum_{i} \dot{C}_{\mathrm{out},i}^\mathrm{CH}\Bigr) \qquad \dot{C}_\mathrm{P} = \sum_{i} \dot{C}_{\mathrm{out},i}^\mathrm{T}\]- Parameters:
T0 (float) – Ambient temperature
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Cycle Closer¶
- class exerpy.components.helpers.cycle_closer.CycleCloser(**kwargs)[source]¶
Bases:
ComponentComponent for closing cycles. This component is not considered in exergy analysis, but it is used in exergoeconomic analysis.
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the cycle closer.
The cycle closer is an artefact of the model, not a piece of equipment: it passes the stream on untouched. Every cost variable therefore leaves it at the specific cost at which it entered, and the component gets no cost balance of its own.
With split physical exergy:
\[\frac{\dot{C}^\mathrm{T}_\mathrm{in}}{\dot{E}^\mathrm{T}_\mathrm{in}} = \frac{\dot{C}^\mathrm{T}_\mathrm{out}}{\dot{E}^\mathrm{T}_\mathrm{out}} \qquad \frac{\dot{C}^\mathrm{M}_\mathrm{in}}{\dot{E}^\mathrm{M}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out}}{\dot{E}^\mathrm{M}_\mathrm{out}}\]Without the split the stream carries one cost variable for its physical exergy, and the two rules collapse into one:
\[\frac{\dot{C}^\mathrm{PH}_\mathrm{in}}{\dot{E}^\mathrm{PH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{PH}_\mathrm{out}}{\dot{E}^\mathrm{PH}_\mathrm{out}}\]The composition of a closed cycle does not change, so its chemical exergy is neither fuel nor product of any component, and the rules around the cycle leave the level of its cost open. The cycle closer sets it to zero:
\[\dot{C}^\mathrm{CH}_\mathrm{out} = 0\]When a stream enters the cycle from outside (see
is_closed_cycle()), such as make-up water, that stream sets the chemical cost, and it passes the closer unchanged:\[\frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_\mathrm{out}}{\dot{E}^\mathrm{CH}_\mathrm{out}}\]- Parameters:
A (numpy.ndarray) – The current cost matrix.
b (numpy.ndarray) – The current right-hand-side vector.
counter (int) – The current row index in the matrix.
T0 (float) – Ambient temperature (not used in this component).
equations (list or dict) – Data structure for storing equation labels.
chemical_exergy_enabled (bool) – Flag indicating whether chemical exergy auxiliary equations should be added.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
A (numpy.ndarray) – The updated cost matrix.
b (numpy.ndarray) – The updated right-hand-side vector.
counter (int) – The updated row index (increased by 2).
equations (list or dict) – Updated structure with equation labels.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Skip the exergy balance of the cycle closer.
The cycle closer is part of how the plant is wired, not a piece of equipment: it closes a loop so that the model has a defined starting point. It neither converts nor destroys exergy, so its fuel, product, destruction and efficiency are all undefined and are set to NaN.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\) (unused).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\) (unused).
split_physical_exergy (bool) – Kept for a uniform component interface; the cycle closer carries no material stream to split.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True) None[source]¶
Exergoeconomic balance for the CycleCloser is not defined.
This component does not generate or consume exergy, so all cost terms are undefined.
- Parameters:
T0 (float) – Ambient temperature (unused).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- is_closed_cycle(components)[source]¶
Check that no stream enters the cycle of the closer from outside.
The fluid is followed downstream from the outlet of the closer. A heat exchanger passes each inlet on to the outlet on the same connector, every other component to all of its outlets. The cycle is open if a component on it takes in a stream that is not part of the cycle but passes on into it. A walk that does not come back to the closer counts as closed.
- Parameters:
components (dict) – All components of the plant, by name.
- Returns:
bool – False if a stream from outside the cycle enters it.
Heliostat Field¶
- class exerpy.components.solar_thermal.heliostatfield.Heliostatfield(**kwargs)[source]¶
Bases:
ComponentClass for exergy analysis of a heliostat field.
The heliostat field concentrates incoming solar radiation and delivers heat to the central receiver. The fuel is the exergy of the incoming solar heat and the product is the exergy of the heat effectively delivered to the receiver; their difference is the optical loss of the field. Radiation is converted to exergy with the Petela/Spanner factor \(\alpha = 1 - \frac{4}{3}\,T_0 / T_\mathrm{sun}\).
All thermal and optical losses are accounted as exergy destruction (\(\dot{E}_\mathrm{D}\)), not as a separate exergy loss.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
Q_Solar (float) – Incoming solar heat input \(\dot{Q}_\mathrm{solar}\) in \(\mathrm{W}\).
P (float) – Effective heat delivered to the receiver \(\dot{Q}_\mathrm{eff}\) in \(\mathrm{W}\).
inl (dict) – Inlet connections (a heliostat field has no material inlet).
outl (dict) – Heat outlet connections: the heat delivered to the receiver and the incoming solar heat (both carry heat, no mass flow).
- class Input(*, name: Annotated[str, msgspec.Meta(min_length=1)], Q_Solar: float | None | UnsetType = UNSET)[source]¶
Bases:
Input- Q_Solar: float | None | UnsetType¶
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the heliostat field.
The field takes in the solar radiation and delivers heat to the receiver. Both are heat streams carrying one cost variable each, and the outlet is the only one the field produces, so the cost balance alone determines it and no auxiliary equation is written:
\[\dot{C}^\mathrm{TOT}_\mathrm{out} = \dot{C}^\mathrm{TOT}_\mathrm{in} + \dot{Z}\]The split of the physical exergy does not apply here: it concerns material streams, and the field has none.
- Parameters:
A (numpy.ndarray) – Coefficient matrix of the cost equation system.
b (numpy.ndarray) – Right-hand side vector of the cost equation system.
counter (int) – Index of the next free row.
T0 (float) – Ambient temperature in \(\mathrm{K}\).
equations (dict) – Dictionary documenting the equations.
chemical_exergy_enabled (bool) – Whether chemical exergy is part of the analysis.
split_physical_exergy (bool, optional) – Kept for a uniform component interface; the heat streams of the field carry a single cost variable either way. Default is True.
- Returns:
tuple – The unchanged matrix, vector, row index and equation dictionary.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the heliostat field.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical parts.
- Returns:
None – The method updates the attributes E_F, E_P, E_D, and epsilon of the component instance.
- Raises:
ValueError – If the component has no outlet connections attribute, or no valid heat output to the receiver.
Notes
Solar radiation is converted to exergy with the Petela/Spanner factor \(\alpha = 1 - \frac{4}{3}\,T_0 / T_\mathrm{sun}\), with \(T_\mathrm{sun} = 5778\ \mathrm{K}\).
Exergy fuel: the incoming solar heat exergy, \(\dot{E}_\mathrm{F} = \dot{Q}_\mathrm{solar}\,\alpha\).
Exergy product: the exergy of the heat delivered to the receiver, \(\dot{E}_\mathrm{P} = \dot{Q}_\mathrm{eff}\,\alpha\).
Exergy destruction: \(\dot{E}_\mathrm{D} = \dot{E}_\mathrm{F} - \dot{E}_\mathrm{P}\).
Exergetic efficiency: \(\varepsilon = \dot{E}_\mathrm{P} / \dot{E}_\mathrm{F}\).
If the field has no outlet connections, all exergy values are set to zero and epsilon to NaN.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform the exergoeconomic cost balance of the heliostat field.
Fuel and product follow
calc_exergy_balance(): the fuel is the incoming solar radiation and the product is the heat delivered to the receiver. The specific cost of the solar radiation is a boundary condition of the system and is usually set to zero.- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – Kept for a uniform component interface. Default is True.
Parabolic Trough¶
- class exerpy.components.solar_thermal.parabolictrough.ParabolicTrough(**kwargs)[source]¶
Bases:
ComponentClass for exergy analysis of a parabolic trough collector.
A parabolic trough concentrates incoming solar radiation onto an absorber tube and raises the physical exergy of the heat-transfer fluid flowing through it. The fuel is the exergy of the incoming solar heat and the product is the physical-exergy increase of the fluid; the difference is the exergy destruction. A single modelled branch may stand in for
num_branchesidentical parallel branches, applied as the scaling factor \(\beta\).All thermal and optical losses of the collector are accounted as exergy destruction (\(\dot{E}_\mathrm{D}\)), not as a separate exergy loss.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
Q_Solar (float) – Incoming solar heat input per branch \(\dot{Q}_\mathrm{solar}\) in \(\mathrm{W}\).
beta (float) – Number of identical parallel branches the modelled branch represents.
inl (dict) – Inlet connections, including the heat-transfer-fluid stream.
outl (dict) – Outlet connections, including the heat-transfer-fluid stream.
- class Input(*, name: Annotated[str, msgspec.Meta(min_length=1)], Q_Solar: float | None | UnsetType = UNSET, num_branches: Annotated[float, msgspec.Meta(description='Number of identical parallel branches'), Limit(gt=0, ge=None, le=None)] | None | UnsetType = UNSET)[source]¶
Bases:
Input- Q_Solar: float | None | UnsetType¶
- num_branches: Annotated[float, msgspec.Meta(description='Number of identical parallel branches'), Limit(gt=0, ge=None, le=None)] | None | UnsetType¶
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the parabolic trough.
The component absorbs solar heat, so the thermal exergy the working fluid gains is its product and the cost balance alone determines it. What the fluid does not gain passes through at its own specific cost (F-principle).
With split physical exergy the fluid loses pressure, so its mechanical exergy is part of the fuel and needs the rule:
\[\frac{\dot{C}^\mathrm{M}_\mathrm{in}}{\dot{E}^\mathrm{M}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out}}{\dot{E}^\mathrm{M}_\mathrm{out}}\]Without the split the fluid carries a single cost variable for its physical exergy, that variable is the product, and no auxiliary equation is written; the cost balance fixes it:
\[\dot{C}^\mathrm{PH}_\mathrm{out} = \dot{C}^\mathrm{PH}_\mathrm{in} + \dot{C}^\mathrm{TOT}_\mathrm{solar} + \dot{Z}\]With chemical exergy enabled, either way, the composition does not change:
\[\frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_\mathrm{out}}{\dot{E}^\mathrm{CH}_\mathrm{out}}\]- Parameters:
A (numpy.ndarray) – Coefficient matrix of the cost equation system.
b (numpy.ndarray) – Right-hand side vector of the cost equation system.
counter (int) – Index of the next free row.
T0 (float) – Ambient temperature in \(\mathrm{K}\).
equations (dict) – Dictionary documenting the equations.
chemical_exergy_enabled (bool) – Whether chemical exergy is part of the analysis.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
tuple – The updated matrix, vector, row index and equation dictionary.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Calculate the exergy balance of the parabolic trough.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag indicating whether physical exergy is split into thermal and mechanical parts.
- Returns:
None – The method updates the attributes E_F, E_P, E_D, and epsilon of the component.
- Raises:
ValueError – If the component lacks a material inlet/outlet, or no solar heat input is given.
Notes
Solar radiation is converted to exergy with the Petela/Spanner factor \(\alpha = 1 - \frac{4}{3}\,T_0 / T_\mathrm{sun}\), with \(T_\mathrm{sun} = 5778\ \mathrm{K}\).
Without splitting physical exergy:
Exergy fuel: the incoming solar heat exergy, scaled by the number of branches, \(\dot{E}_\mathrm{F} = \beta\,\dot{Q}_\mathrm{solar}\,\alpha\).
Exergy product: the physical-exergy increase of the heat-transfer fluid, \(\dot{E}_\mathrm{P} = \beta\,\dot{m}\,(e^\mathrm{PH}_\mathrm{out} - e^\mathrm{PH}_\mathrm{in})\).
With split physical exergy (useful output is thermal exergy, as in the SimpleHeatExchanger heat-release product):
Exergy product: the thermal-exergy gain, \(\dot{E}_\mathrm{P} = \beta\,\dot{m}\,(e^\mathrm{T}_\mathrm{out} - e^\mathrm{T}_\mathrm{in})\).
Exergy fuel: solar heat plus the fluid’s mechanical-exergy decrease, \(\dot{E}_\mathrm{F} = \beta\,\dot{Q}_\mathrm{solar}\,\alpha + \beta\,\dot{m}\,(e^\mathrm{M}_\mathrm{in} - e^\mathrm{M}_\mathrm{out})\).
In both cases \(\dot{E}_\mathrm{D} = \dot{E}_\mathrm{F} - \dot{E}_\mathrm{P}\) equals the true destruction. All thermal and optical losses are accounted as exergy destruction. If the fluid is not above ambient temperature (off-design), the fuel and product are NaN.
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform the exergoeconomic cost balance of the parabolic trough.
Fuel and product follow
calc_exergy_balance(): the product is the thermal (with split physical exergy) or physical exergy gain of the working fluid, the fuel is the solar heat plus, with the split, the mechanical exergy the fluid loses over the pressure drop.- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
Solar Tower¶
- class exerpy.components.solar_thermal.solartower.SolarTower(**kwargs)[source]¶
Bases:
ComponentClass for exergy analysis of Solar Tower.
The component has a working-fluid inlet and outlet plus a heat connection that carries the solar heat input. The fuel is the supplied solar heat exergy and the product is the physical exergy gained by the working fluid.
All thermal losses are accounted as exergy destruction (\(\dot{E}_\mathrm{D}\)), not as a separate exergy loss.
- Variables:
E_F (float) – Exergy fuel of the component \(\dot{E}_\mathrm{F}\) in \(\mathrm{W}\).
E_P (float) – Exergy product of the component \(\dot{E}_\mathrm{P}\) in \(\mathrm{W}\).
E_D (float) – Exergy destruction of the component \(\dot{E}_\mathrm{D}\) in \(\mathrm{W}\).
epsilon (float) – Exergetic efficiency of the component \(\varepsilon\) in \(-\).
inl (dict) – Inlet connections: the working-fluid stream and the heat connection that carries the solar heat input (the latter has no mass flow).
outl (dict) – Outlet connection: the working-fluid stream.
- aux_eqs(A, b, counter, T0, equations, chemical_exergy_enabled, split_physical_exergy=True)[source]¶
Auxiliary equations for the solar tower.
The component absorbs solar heat, so the thermal exergy the working fluid gains is its product and the cost balance alone determines it. What the fluid does not gain passes through at its own specific cost (F-principle).
With split physical exergy the fluid loses pressure, so its mechanical exergy is part of the fuel and needs the rule:
\[\frac{\dot{C}^\mathrm{M}_\mathrm{in}}{\dot{E}^\mathrm{M}_\mathrm{in}} = \frac{\dot{C}^\mathrm{M}_\mathrm{out}}{\dot{E}^\mathrm{M}_\mathrm{out}}\]Without the split the fluid carries a single cost variable for its physical exergy, that variable is the product, and no auxiliary equation is written; the cost balance fixes it:
\[\dot{C}^\mathrm{PH}_\mathrm{out} = \dot{C}^\mathrm{PH}_\mathrm{in} + \dot{C}^\mathrm{TOT}_\mathrm{solar} + \dot{Z}\]With chemical exergy enabled, either way, the composition does not change:
\[\frac{\dot{C}^\mathrm{CH}_\mathrm{in}}{\dot{E}^\mathrm{CH}_\mathrm{in}} = \frac{\dot{C}^\mathrm{CH}_\mathrm{out}}{\dot{E}^\mathrm{CH}_\mathrm{out}}\]- Parameters:
A (numpy.ndarray) – Coefficient matrix of the cost equation system.
b (numpy.ndarray) – Right-hand side vector of the cost equation system.
counter (int) – Index of the next free row.
T0 (float) – Ambient temperature in \(\mathrm{K}\).
equations (dict) – Dictionary documenting the equations.
chemical_exergy_enabled (bool) – Whether chemical exergy is part of the analysis.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.
- Returns:
tuple – The updated matrix, vector, row index and equation dictionary.
- calc_exergy_balance(T0: float, p0: float, split_physical_exergy) None[source]¶
Method to calculate the exergy balance of the Solar Tower component.
- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
p0 (float) – Ambient pressure in \(\mathrm{Pa}\).
split_physical_exergy (bool) – Flag to indicate whether to split physical exergy into thermal and mechanical parts.
- Returns:
None – The method updates the attributes E_F, E_P, E_D, and epsilon of the component instance.
- Raises:
ValueError – If there is no outlet, more than one outlet, or no valid solar heat input.
Notes
Without splitting physical exergy:
Exergy fuel: the supplied solar heat exergy, \(\dot{E}_\mathrm{F} = |\dot{E}_\mathrm{heat}|\).
Exergy product: the physical-exergy gain of the working fluid, \(\dot{E}_\mathrm{P} = \dot{m}\,(e^\mathrm{PH}_\mathrm{out} - e^\mathrm{PH}_\mathrm{in})\).
With split physical exergy (the receiver’s useful output is thermal exergy, as in the SimpleHeatExchanger heat-release product):
Exergy product: the thermal-exergy gain, \(\dot{E}_\mathrm{P} = \dot{m}\,(e^\mathrm{T}_\mathrm{out} - e^\mathrm{T}_\mathrm{in})\).
Exergy fuel: solar heat plus the fluid’s mechanical-exergy decrease, \(\dot{E}_\mathrm{F} = |\dot{E}_\mathrm{heat}| + \dot{m}\,(e^\mathrm{M}_\mathrm{in} - e^\mathrm{M}_\mathrm{out})\).
In both cases \(\dot{E}_\mathrm{D} = \dot{E}_\mathrm{F} - \dot{E}_\mathrm{P}\) equals the true destruction and \(\varepsilon = \dot{E}_\mathrm{P} / \dot{E}_\mathrm{F}\).
- exergoeconomic_balance(T0, chemical_exergy_enabled=False, split_physical_exergy=True)[source]¶
Perform the exergoeconomic cost balance of the solar tower.
Fuel and product follow
calc_exergy_balance(): the product is the thermal (with split physical exergy) or physical exergy gain of the working fluid, the fuel is the solar heat plus, with the split, the mechanical exergy the fluid loses over the pressure drop.- Parameters:
T0 (float) – Ambient temperature in \(\mathrm{K}\).
chemical_exergy_enabled (bool, optional) – If True, chemical exergy is considered in the calculations.
split_physical_exergy (bool, optional) – If True, the physical exergy of a material stream is split into a thermal and a mechanical share, each with its own cost variable. If False, the stream carries a single cost variable for its physical exergy. Default is True.