exerpy 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,117 +7,129 @@ from exerpy.components.component import component_registry
7
7
  @component_registry
8
8
  class SteamGenerator(Component):
9
9
  r"""
10
- Class for exergy analysis of steam generators.
10
+ Class for exergy and exergoeconomic analysis of heat exchangers.
11
11
 
12
- This class performs exergy analysis calculations for steam generators.
13
- The component has several input and output streams as follows:
14
-
15
- Inlet streams:
16
- - inl[0]: Feed water inlet (high pressure)
17
- - inl[1]: Steam inlet (intermediate pressure)
18
- - inl[2]: Heat inlet (providing the heat input Q)
19
- - inl[3]: Water injection (high pressure)
20
- - inl[4]: Water injection (intermediate pressure)
21
-
22
- Outlet streams:
23
- - outl[0]: Superheated steam outlet (high pressure)
24
- - outl[1]: Superheated steam outlet (intermediate pressure)
25
- - outl[2]: Drain / Blow down outlet
26
-
27
- The exergy product is defined as:
28
-
29
- .. math::
30
- \dot{E}_P = \Bigl[ \dot{m}_{\mathrm{out,HP}}\,e_{\mathrm{out,HP}}
31
- - \dot{m}_{\mathrm{in,HP}}\,e_{\mathrm{in,HP}} \Bigr]
32
- + \Bigl[ \dot{m}_{\mathrm{out,IP}}\,e_{\mathrm{out,IP}}
33
- - \dot{m}_{\mathrm{in,IP}}\,e_{\mathrm{in,IP}} \Bigr]
34
- - \dot{m}_{\mathrm{w,HP}}\,e_{\mathrm{w,HP}}
35
- - \dot{m}_{\mathrm{w,IP}}\,e_{\mathrm{w,IP}}
36
-
37
- where:
38
- - \(\dot{m}\) is the mass flow rate and \(e\) is the specific exergy of the stream.
39
- - The subscripts HP and IP denote high and intermediate pressure streams,
40
- respectively, and 'w' stands for water injection.
41
-
42
- The exergy fuel is computed from the heat input as:
43
-
44
- .. math::
45
- \dot{E}_F = E_q = Q \left( 1 - \frac{T_b}{T_0} \right)
46
-
47
- with the thermodynamic temperature difference defined by
48
-
49
- .. math::
50
- T_b = \frac{h_{\mathrm{out,HP}} - h_{\mathrm{in,HP}}}{s_{\mathrm{out,HP}} - s_{\mathrm{in,HP}}}
51
-
52
- where:
53
- - \(h\) and \(s\) are the specific enthalpy and entropy,
54
- - \(T_0\) is the ambient temperature.
55
-
56
- The exergy destruction and efficiency are then given by:
57
-
58
- .. math::
59
- \dot{E}_D = \dot{E}_F - \dot{E}_P \quad\mathrm{and}\quad \varepsilon = \frac{\dot{E}_P}{\dot{E}_F}
60
-
61
- Parameters
62
- ----------
63
- **kwargs : dict
64
- Arbitrary keyword arguments passed to the parent class.
12
+ This class performs exergy and exergoeconomic analysis calculations for heat exchanger components,
13
+ accounting for two inlet and two outlet streams across various temperature regimes, including
14
+ above and below ambient temperature, and optional dissipative behavior.
65
15
 
66
16
  Attributes
67
17
  ----------
68
18
  E_F : float
69
- Exergy fuel of the component :math:`\dot{E}_F` in :math:`\mathrm{W}`.
19
+ Exergy fuel of the component :math:`\dot{E}_\mathrm{F}` in :math:`\mathrm{W}`.
70
20
  E_P : float
71
- Exergy product of the component :math:`\dot{E}_P` in :math:`\mathrm{W}`.
21
+ Exergy product of the component :math:`\dot{E}_\mathrm{P}` in :math:`\mathrm{W}`.
72
22
  E_D : float
73
- Exergy destruction of the component :math:`\dot{E}_D` in :math:`\mathrm{W}`.
23
+ Exergy destruction of the component :math:`\dot{E}_\mathrm{D}` in :math:`\mathrm{W}`.
74
24
  epsilon : float
75
- Exergetic efficiency :math:`\varepsilon`.
25
+ Exergetic efficiency of the component :math:`\varepsilon` in :math:`-`.
76
26
  inl : dict
77
- Dictionary containing inlet streams.
27
+ Dictionary containing inlet stream data with mass flows and specific exergies.
78
28
  outl : dict
79
- Dictionary containing outlet streams.
29
+ Dictionary containing outlet stream data with mass flows and specific exergies.
30
+ Z_costs : float
31
+ Investment cost rate of the component in currency/h.
32
+ C_P : float
33
+ Cost of product stream :math:`\dot{C}_P` in currency/h.
34
+ C_F : float
35
+ Cost of fuel stream :math:`\dot{C}_F` in currency/h.
36
+ C_D : float
37
+ Cost of exergy destruction :math:`\dot{C}_D` in currency/h.
38
+ c_P : float
39
+ Specific cost of product stream (currency per unit exergy).
40
+ c_F : float
41
+ Specific cost of fuel stream (currency per unit exergy).
42
+ r : float
43
+ Relative cost difference, :math:`(c_P - c_F)/c_F`.
44
+ f : float
45
+ Exergoeconomic factor, :math:`\dot{Z}/(\dot{Z} + \dot{C}_D)`.
46
+ Ex_C_col : dict
47
+ Custom cost coefficients collection passed via `kwargs`.
48
+
49
+ Notes
50
+ -----
51
+ The component has several input and output streams as follows.
52
+
53
+ Inlet streams:
54
+
55
+ - inl[0]: Feed water inlet (high pressure)
56
+ - inl[1]: Steam inlet (intermediate pressure)
57
+ - inl[2]: Heat inlet (providing the heat input Q)
58
+ - inl[3]: Water injection (high pressure)
59
+ - inl[4]: Water injection (intermediate pressure)
60
+
61
+ Outlet streams:
62
+
63
+ - outl[0]: Superheated steam outlet (high pressure)
64
+ - outl[1]: Superheated steam outlet (intermediate pressure)
65
+ - outl[2]: Drain / Blow down outlet
66
+
80
67
  """
81
68
 
82
69
  def __init__(self, **kwargs):
83
- r"""Initialize steam generator component with given parameters."""
84
- self.dissipative = False
70
+ r"""
71
+ Initialize the steam generator component.
72
+
73
+ Parameters
74
+ ----------
75
+ **kwargs : dict
76
+ Arbitrary keyword arguments. Recognized keys:
77
+ - Ex_C_col (dict): custom cost coefficients, default {}
78
+ - Z_costs (float): investment cost rate in currency/h, default 0.0
79
+ """
85
80
  super().__init__(**kwargs)
86
81
 
87
82
  def calc_exergy_balance(self, T0: float, p0: float, split_physical_exergy) -> None:
88
83
  r"""
89
- Calculate the exergy balance of the steam generator.
84
+ Compute the exergy balance of the steam generator.
90
85
 
91
- This method computes the exergy fuel from the heat inlet using the relation
86
+ The exergy fuel is defined as follows.
87
+
88
+ If `split_physical_exergy` is `True`:
92
89
 
93
90
  .. math::
94
- E_F = Q \left(1 - \frac{T_b}{T_0}\right),
95
- \quad T_b = \frac{h_{\mathrm{out,HP}} - h_{\mathrm{in,HP}}}{s_{\mathrm{out,HP}} - s_{\mathrm{in,HP}}}
91
+ \dot{E}_{\mathrm{F}}
92
+ = \bigl[\dot{E}^{\mathrm{T}}_{\mathrm{out,HP}} - \dot{E}^{\mathrm{T}}_{\mathrm{in,HP}}\bigr]
93
+ + \bigl[\dot{E}^{\mathrm{T}}_{\mathrm{out,IP}} - \dot{E}^{\mathrm{T}}_{\mathrm{in,IP}}\bigr]
94
+ - \dot{E}^{\mathrm{T}}_{\mathrm{w,HP}}
95
+ - \dot{E}^{\mathrm{T}}_{\mathrm{w,IP}}
96
96
 
97
- and the exergy product as
97
+ If `split_physical_exergy` is `False`:
98
98
 
99
99
  .. math::
100
- E_P = \Bigl[ \dot{m}_{\mathrm{out,HP}}\,e_{\mathrm{out,HP}} -
101
- \dot{m}_{\mathrm{in,HP}}\,e_{\mathrm{in,HP}} \Bigr]
102
- + \Bigl[ \dot{m}_{\mathrm{out,IP}}\,e_{\mathrm{out,IP}} -
103
- \dot{m}_{\mathrm{in,IP}}\,e_{\mathrm{in,IP}} \Bigr]
104
- - \dot{m}_{\mathrm{w,HP}}\,e_{\mathrm{w,HP}}
105
- - \dot{m}_{\mathrm{w,IP}}\,e_{\mathrm{w,IP}}
100
+ \dot{E}_{\mathrm{F}}
101
+ = \bigl[\dot{E}^{\mathrm{PH}}_{\mathrm{out,HP}} - \dot{E}^{\mathrm{PH}}_{\mathrm{in,HP}}\bigr]
102
+ + \bigl[\dot{E}^{\mathrm{PH}}_{\mathrm{out,IP}} - \dot{E}^{\mathrm{PH}}_{\mathrm{in,IP}}\bigr]
103
+ - \dot{E}^{\mathrm{PH}}_{\mathrm{w,HP}}
104
+ - \dot{E}^{\mathrm{PH}}_{\mathrm{w,IP}}
106
105
 
107
- The exergy destruction is given by
106
+ The exergy product is defined as:
108
107
 
109
108
  .. math::
110
- E_D = E_F - E_P
111
109
 
112
- and the exergetic efficiency is
110
+ \dot{E}_\mathrm{P} = \Bigl[ \dot E^{\mathrm{PH}}_{\mathrm{out,HP}}
111
+ - \dot E^{\mathrm{PH}}_{\mathrm{in,HP}} \Bigr]
112
+ + \Bigl[ \dot E^{\mathrm{PH}}_{\mathrm{out,IP}}
113
+ - \dot E^{\mathrm{PH}}_{\mathrm{in,IP}} \Bigr]
114
+ - \dot E^{\mathrm{PH}}_{\mathrm{w,HP}}
115
+ - \dot E^{\mathrm{PH}}_{\mathrm{w,IP}}
113
116
 
114
- .. math::
115
- \varepsilon = \frac{E_P}{E_F}
117
+ where the subscripts HP and IP denote high and intermediate pressure streams,
118
+ respectively, and w stands for water injection.
116
119
 
117
120
  Parameters
118
121
  ----------
119
122
  T0 : float
120
- Ambient temperature in Kelvin.
123
+ Ambient temperature (K).
124
+ p0 : float
125
+ Ambient pressure (Pa).
126
+ split_physical_exergy : bool
127
+ Whether to split thermal and mechanical exergy.
128
+
129
+ Raises
130
+ ------
131
+ ValueError
132
+ If required inlets or outlets are missing.
121
133
  """
122
134
  # Ensure that all necessary streams exist
123
135
  required_inlets = [0]
@@ -129,12 +141,6 @@ class SteamGenerator(Component):
129
141
  if idx not in self.outl:
130
142
  raise ValueError(f"Missing outlet stream with index {idx}.")
131
143
 
132
- # Calculate T_b for high pressure streams: from superheated steam outlet (HP) and feed water inlet (HP)
133
- try:
134
- T_b = (self.outl[0]['h'] - self.inl[0]['h']) / (self.outl[0]['s'] - self.inl[0]['s'])
135
- except ZeroDivisionError:
136
- raise ZeroDivisionError("Division by zero encountered in calculating T_b. Check entropy differences.")
137
-
138
144
  if split_physical_exergy:
139
145
  exergy_type = 'e_T'
140
146
  else:
@@ -172,6 +178,15 @@ class SteamGenerator(Component):
172
178
 
173
179
 
174
180
  def aux_eqs(self, A, b, counter, T0, equations, chemical_exergy_enabled):
181
+ r"""
182
+ This function must be implemented in the future.
183
+
184
+ The exergoeconomic analysis of SteamGenerator is not implemented yet.
185
+ """
186
+ logging.error(
187
+ "The exergoeconomic analysis of SteamGenerator is not implemented yet. "
188
+ "This method will be implemented in a future release."
189
+ )
175
190
  """
176
191
  Auxiliary equations for the steam generator.
177
192
 
@@ -218,6 +233,16 @@ class SteamGenerator(Component):
218
233
  """
219
234
 
220
235
  def exergoeconomic_balance(self, T0):
236
+ r"""
237
+ This function must be implemented in the future.
238
+
239
+ The exergoeconomic analysis of SteamGenerator is not implemented yet.
240
+ """
241
+
242
+ logging.error(
243
+ "The exergoeconomic analysis of SteamGenerator is not implemented yet. "
244
+ "This method will be implemented in a future release."
245
+ )
221
246
  """
222
247
  Perform exergoeconomic balance calculations for the steam generator.
223
248
 
@@ -44,53 +44,52 @@ class Deaerator(Component):
44
44
  product and fuel are defined based on temperature relationships:
45
45
 
46
46
  .. math::
47
-
48
- \dot{E}_\mathrm{P} =
49
- \begin{cases}
50
- \begin{cases}
51
- \sum_i \dot{m}_i \cdot (e_\mathrm{out}^\mathrm{PH} -
52
- e_{\mathrm{in,}i}^\mathrm{PH})
53
- & T_{\mathrm{in,}i} < T_\mathrm{out} \mathrm{ & }
54
- T_{\mathrm{in,}i} \geq T_0 \\
55
- \sum_i \dot{m}_i \cdot e_\mathrm{out}^\mathrm{PH}
56
- & T_{\mathrm{in,}i} < T_\mathrm{out} \mathrm{ & }
57
- T_{\mathrm{in,}i} < T_0 \\
58
- \end{cases} & T_\mathrm{out} > T_0\\
59
- \mathrm{not defined (nan)} & T_\mathrm{out} = T_0\\
47
+ \displaystyle
48
+ \dot E_{P} =
60
49
  \begin{cases}
61
- \sum_i \dot{m}_i \cdot e_\mathrm{out}^\mathrm{PH}
62
- & T_{\mathrm{in,}i} > T_\mathrm{out} \mathrm{ & }
63
- T_{\mathrm{in,}i} \geq T_0 \\
64
- \sum_i \dot{m}_i \cdot (e_\mathrm{out}^\mathrm{PH} -
65
- e_{\mathrm{in,}i}^\mathrm{PH})
66
- & T_{\mathrm{in,}i} > T_\mathrm{out} \mathrm{ & }
67
- T_{\mathrm{in,}i} < T_0 \\
68
- \end{cases} & T_\mathrm{out} < T_0\\
50
+ \displaystyle
51
+ \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{out}}^{\mathrm{PH}}
52
+ -e_{\mathrm{in},i}^{\mathrm{PH}}\bigr),
53
+ \quad \text{if }T_{\mathrm{in},i}<T_{\mathrm{out}}\text{ and }T_{\mathrm{in},i}\ge T_{0},\\[8pt]
54
+ \displaystyle
55
+ \sum_{i}\dot m_{i}\,e_{\mathrm{out}}^{\mathrm{PH}},
56
+ \quad \text{if }T_{\mathrm{in},i}<T_{\mathrm{out}}\text{ and }T_{\mathrm{in},i}<T_{0},\\[8pt]
57
+ \displaystyle
58
+ \text{not defined (nan)},
59
+ \quad \text{if }T_{\mathrm{out}}=T_{0},\\[8pt]
60
+ \displaystyle
61
+ \sum_{i}\dot m_{i}\,e_{\mathrm{out}}^{\mathrm{PH}},
62
+ \quad \text{if }T_{\mathrm{in},i}>T_{\mathrm{out}}\text{ and }T_{\mathrm{in},i}\ge T_{0},\\[8pt]
63
+ \displaystyle
64
+ \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{out}}^{\mathrm{PH}}
65
+ -e_{\mathrm{in},i}^{\mathrm{PH}}\bigr),
66
+ \quad \text{if }T_{\mathrm{in},i}>T_{\mathrm{out}}\text{ and }T_{\mathrm{in},i}<T_{0}.
69
67
  \end{cases}
70
68
 
71
- \dot{E}_\mathrm{F} =
72
- \begin{cases}
73
- \begin{cases}
74
- \sum_i \dot{m}_i \cdot (e_{\mathrm{in,}i}^\mathrm{PH} -
75
- e_\mathrm{out}^\mathrm{PH})
76
- & T_{\mathrm{in,}i} > T_\mathrm{out} \\
77
- \sum_i \dot{m}_i \cdot e_{\mathrm{in,}i}^\mathrm{PH}
78
- & T_{\mathrm{in,}i} < T_\mathrm{out} \mathrm{ & }
79
- T_{\mathrm{in,}i} < T_0 \\
80
- \end{cases} & T_\mathrm{out} > T_0\\
81
- \sum_i \dot{m}_i \cdot e_{\mathrm{in,}i}^\mathrm{PH}
82
- & T_\mathrm{out} = T_0\\
69
+ .. math::
70
+ \displaystyle
71
+ \dot E_{F} =
83
72
  \begin{cases}
84
- \sum_i \dot{m}_i \cdot e_{\mathrm{in,}i}^\mathrm{PH}
85
- & T_{\mathrm{in,}i} > T_\mathrm{out} \mathrm{ & }
86
- T_{\mathrm{in,}i} \geq T_0 \\
87
- \sum_i \dot{m}_i \cdot (e_{\mathrm{in,}i}^\mathrm{PH} -
88
- e_\mathrm{out}^\mathrm{PH})
89
- & T_{\mathrm{in,}i} < T_\mathrm{out} \\
90
- \end{cases} & T_\mathrm{out} < T_0\\
73
+ \displaystyle
74
+ \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{in},i}^{\mathrm{PH}}
75
+ -e_{\mathrm{out}}^{\mathrm{PH}}\bigr),
76
+ \quad \text{if }T_{\mathrm{out}}>T_{0}\text{ and }T_{\mathrm{in},i}>T_{\mathrm{out}},\\[8pt]
77
+ \displaystyle
78
+ \sum_{i}\dot m_{i}\,e_{\mathrm{in},i}^{\mathrm{PH}},
79
+ \quad \text{if }T_{\mathrm{out}}>T_{0}\text{ and }T_{\mathrm{in},i}<T_{\mathrm{out}}
80
+ \text{ and }T_{\mathrm{in},i}<T_{0},\\[8pt]
81
+ \displaystyle
82
+ \sum_{i}\dot m_{i}\,e_{\mathrm{in},i}^{\mathrm{PH}},
83
+ \quad \text{if }T_{\mathrm{out}}=T_{0},\\[8pt]
84
+ \displaystyle
85
+ \sum_{i}\dot m_{i}\,e_{\mathrm{in},i}^{\mathrm{PH}},
86
+ \quad \text{if }T_{\mathrm{out}}<T_{0}\text{ and }T_{\mathrm{in},i}>T_{\mathrm{out}},\\[8pt]
87
+ \displaystyle
88
+ \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{in},i}^{\mathrm{PH}}
89
+ -e_{\mathrm{out}}^{\mathrm{PH}}\bigr),
90
+ \quad \text{if }T_{\mathrm{out}}<T_{0}\text{ and }T_{\mathrm{in},i}<T_{\mathrm{out}}.
91
91
  \end{cases}
92
92
 
93
- \forall i \in \mathrm{deaerator inlets}
94
93
  """
95
94
 
96
95
  def __init__(self, **kwargs):
@@ -177,14 +176,16 @@ class Deaerator(Component):
177
176
  the following auxiliary cost relations:
178
177
 
179
178
  (1) Mixing equation for chemical exergy costs (if enabled):
180
- - The outlet's specific chemical exergy cost is calculated as a mass-weighted
181
- average of the inlet streams' specific chemical exergy costs
182
- - This enforces proper chemical exergy cost distribution through the deaerator
179
+
180
+ - The outlet's specific chemical exergy cost is calculated as a mass-weighted average of the inlet streams' specific chemical exergy costs
181
+
182
+ - This enforces proper chemical exergy cost distribution through the deaerator
183
183
 
184
184
  (2) Mixing equation for mechanical exergy costs:
185
- - The outlet's specific mechanical exergy cost is calculated as a mass-weighted
186
- average of the inlet streams' specific mechanical exergy costs
187
- - This ensures mechanical exergy costs are properly conserved in the mixing process
185
+
186
+ - The outlet's specific mechanical exergy cost is calculated as a mass-weighted average of the inlet streams' specific mechanical exergy costs
187
+
188
+ - This ensures mechanical exergy costs are properly conserved in the mixing process
188
189
 
189
190
  Both equations implement the proportionality rule for mixing processes where
190
191
  the outlet's specific costs should reflect the contribution of each inlet stream.
@@ -44,53 +44,52 @@ class Mixer(Component):
44
44
  product and fuel are defined based on temperature relationships:
45
45
 
46
46
  .. math::
47
-
48
- \dot{E}_\mathrm{P} =
49
- \begin{cases}
50
- \begin{cases}
51
- \sum_i \dot{m}_i \cdot (e_\mathrm{out}^\mathrm{PH} -
52
- e_{\mathrm{in,}i}^\mathrm{PH})
53
- & T_{\mathrm{in,}i} < T_\mathrm{out} \mathrm{ & }
54
- T_{\mathrm{in,}i} \geq T_0 \\
55
- \sum_i \dot{m}_i \cdot e_\mathrm{out}^\mathrm{PH}
56
- & T_{\mathrm{in,}i} < T_\mathrm{out} \mathrm{ & }
57
- T_{\mathrm{in,}i} < T_0 \\
58
- \end{cases} & T_\mathrm{out} > T_0\\
59
- \mathrm{not defined (nan)} & T_\mathrm{out} = T_0\\
47
+ \displaystyle
48
+ \dot E_{P} =
60
49
  \begin{cases}
61
- \sum_i \dot{m}_i \cdot e_\mathrm{out}^\mathrm{PH}
62
- & T_{\mathrm{in,}i} > T_\mathrm{out} \mathrm{ & }
63
- T_{\mathrm{in,}i} \geq T_0 \\
64
- \sum_i \dot{m}_i \cdot (e_\mathrm{out}^\mathrm{PH} -
65
- e_{\mathrm{in,}i}^\mathrm{PH})
66
- & T_{\mathrm{in,}i} > T_\mathrm{out} \mathrm{ & }
67
- T_{\mathrm{in,}i} < T_0 \\
68
- \end{cases} & T_\mathrm{out} < T_0\\
50
+ \displaystyle
51
+ \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{out}}^{\mathrm{PH}}
52
+ -e_{\mathrm{in},i}^{\mathrm{PH}}\bigr),
53
+ \quad \text{if }T_{\mathrm{in},i}<T_{\mathrm{out}}\text{ and }T_{\mathrm{in},i}\ge T_{0},\\[8pt]
54
+ \displaystyle
55
+ \sum_{i}\dot m_{i}\,e_{\mathrm{out}}^{\mathrm{PH}},
56
+ \quad \text{if }T_{\mathrm{in},i}<T_{\mathrm{out}}\text{ and }T_{\mathrm{in},i}<T_{0},\\[8pt]
57
+ \displaystyle
58
+ \text{not defined (nan)},
59
+ \quad \text{if }T_{\mathrm{out}}=T_{0},\\[8pt]
60
+ \displaystyle
61
+ \sum_{i}\dot m_{i}\,e_{\mathrm{out}}^{\mathrm{PH}},
62
+ \quad \text{if }T_{\mathrm{in},i}>T_{\mathrm{out}}\text{ and }T_{\mathrm{in},i}\ge T_{0},\\[8pt]
63
+ \displaystyle
64
+ \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{out}}^{\mathrm{PH}}
65
+ -e_{\mathrm{in},i}^{\mathrm{PH}}\bigr),
66
+ \quad \text{if }T_{\mathrm{in},i}>T_{\mathrm{out}}\text{ and }T_{\mathrm{in},i}<T_{0}.
69
67
  \end{cases}
70
68
 
71
- \dot{E}_\mathrm{F} =
72
- \begin{cases}
73
- \begin{cases}
74
- \sum_i \dot{m}_i \cdot (e_{\mathrm{in,}i}^\mathrm{PH} -
75
- e_\mathrm{out}^\mathrm{PH})
76
- & T_{\mathrm{in,}i} > T_\mathrm{out} \\
77
- \sum_i \dot{m}_i \cdot e_{\mathrm{in,}i}^\mathrm{PH}
78
- & T_{\mathrm{in,}i} < T_\mathrm{out} \mathrm{ & }
79
- T_{\mathrm{in,}i} < T_0 \\
80
- \end{cases} & T_\mathrm{out} > T_0\\
81
- \sum_i \dot{m}_i \cdot e_{\mathrm{in,}i}^\mathrm{PH}
82
- & T_\mathrm{out} = T_0\\
69
+ .. math::
70
+ \displaystyle
71
+ \dot E_{F} =
83
72
  \begin{cases}
84
- \sum_i \dot{m}_i \cdot e_{\mathrm{in,}i}^\mathrm{PH}
85
- & T_{\mathrm{in,}i} > T_\mathrm{out} \mathrm{ & }
86
- T_{\mathrm{in,}i} \geq T_0 \\
87
- \sum_i \dot{m}_i \cdot (e_{\mathrm{in,}i}^\mathrm{PH} -
88
- e_\mathrm{out}^\mathrm{PH})
89
- & T_{\mathrm{in,}i} < T_\mathrm{out} \\
90
- \end{cases} & T_\mathrm{out} < T_0\\
73
+ \displaystyle
74
+ \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{in},i}^{\mathrm{PH}}
75
+ -e_{\mathrm{out}}^{\mathrm{PH}}\bigr),
76
+ \quad \text{if }T_{\mathrm{out}}>T_{0}\text{ and }T_{\mathrm{in},i}>T_{\mathrm{out}},\\[8pt]
77
+ \displaystyle
78
+ \sum_{i}\dot m_{i}\,e_{\mathrm{in},i}^{\mathrm{PH}},
79
+ \quad \text{if }T_{\mathrm{out}}>T_{0}\text{ and }T_{\mathrm{in},i}<T_{\mathrm{out}}
80
+ \text{ and }T_{\mathrm{in},i}<T_{0},\\[8pt]
81
+ \displaystyle
82
+ \sum_{i}\dot m_{i}\,e_{\mathrm{in},i}^{\mathrm{PH}},
83
+ \quad \text{if }T_{\mathrm{out}}=T_{0},\\[8pt]
84
+ \displaystyle
85
+ \sum_{i}\dot m_{i}\,e_{\mathrm{in},i}^{\mathrm{PH}},
86
+ \quad \text{if }T_{\mathrm{out}}<T_{0}\text{ and }T_{\mathrm{in},i}>T_{\mathrm{out}},\\[8pt]
87
+ \displaystyle
88
+ \sum_{i}\dot m_{i}\,\bigl(e_{\mathrm{in},i}^{\mathrm{PH}}
89
+ -e_{\mathrm{out}}^{\mathrm{PH}}\bigr),
90
+ \quad \text{if }T_{\mathrm{out}}<T_{0}\text{ and }T_{\mathrm{in},i}<T_{\mathrm{out}}.
91
91
  \end{cases}
92
92
 
93
- \forall i \in \mathrm{mixer inlets}
94
93
  """
95
94
 
96
95
  def __init__(self, **kwargs):
@@ -193,16 +192,18 @@ class Mixer(Component):
193
192
  This function adds rows to the cost matrix A and the right-hand-side vector b to enforce
194
193
  the following auxiliary cost relations:
195
194
 
196
- (1) Chemical exergy cost equation (if enabled):
197
- - F-principle: The specific chemical exergy cost of the outlet stream is calculated as
198
- the weighted average of the specific chemical exergy costs of the inlet streams.
199
- - For inlets with zero chemical exergy, their specific costs are directly transferred.
195
+ (1) Mixing equation for chemical exergy costs (if enabled):
196
+
197
+ - The outlet's specific chemical exergy cost is calculated as a mass-weighted average of the inlet streams' specific chemical exergy costs
198
+
199
+ - This enforces proper chemical exergy cost distribution through the deaerator
200
+
201
+ (2) Mixing equation for mechanical exergy costs:
200
202
 
201
- (2) Mechanical exergy cost equation:
202
- - F-principle: The specific mechanical exergy cost of the outlet stream is calculated as
203
- the weighted average of the specific mechanical exergy costs of the inlet streams.
204
- - For inlets with zero mechanical exergy, their specific costs are directly transferred.
203
+ - The outlet's specific mechanical exergy cost is calculated as a mass-weighted average of the inlet streams' specific mechanical exergy costs
205
204
 
205
+ - This ensures mechanical exergy costs are properly conserved in the mixing process
206
+
206
207
  Parameters
207
208
  ----------
208
209
  A : numpy.ndarray
@@ -9,17 +9,11 @@ from exerpy.components.component import component_registry
9
9
  @component_registry
10
10
  class Valve(Component):
11
11
  r"""
12
- Class for exergy analysis of valves.
12
+ Class for exergy and exergoeconomic analysis of valves.
13
13
 
14
- This class performs exergy analysis calculations for isenthalpic valves with
15
- one inlet and one outlet stream. The exergy product and fuel definitions
16
- vary based on the temperature relationships between inlet stream, outlet stream,
17
- and ambient conditions.
18
-
19
- Parameters
20
- ----------
21
- **kwargs : dict
22
- Arbitrary keyword arguments passed to parent class.
14
+ This class performs exergy and exergoeconomic analysis calculations for valve components,
15
+ accounting for one inlet and one outlet streams across various temperature regimes, including
16
+ above and below ambient temperature.
23
17
 
24
18
  Attributes
25
19
  ----------
@@ -32,11 +26,27 @@ class Valve(Component):
32
26
  epsilon : float
33
27
  Exergetic efficiency of the component :math:`\varepsilon` in :math:`-`.
34
28
  inl : dict
35
- Dictionary containing inlet stream data with temperature, mass flows,
36
- and specific exergies.
29
+ Dictionary containing inlet stream data with mass flows and specific exergies.
37
30
  outl : dict
38
- Dictionary containing outlet stream data with temperature, mass flows,
39
- and specific exergies.
31
+ Dictionary containing outlet stream data with mass flows and specific exergies.
32
+ Z_costs : float
33
+ Investment cost rate of the component in currency/h.
34
+ C_P : float
35
+ Cost of product stream :math:`\dot{C}_P` in currency/h.
36
+ C_F : float
37
+ Cost of fuel stream :math:`\dot{C}_F` in currency/h.
38
+ C_D : float
39
+ Cost of exergy destruction :math:`\dot{C}_D` in currency/h.
40
+ c_P : float
41
+ Specific cost of product stream (currency per unit exergy).
42
+ c_F : float
43
+ Specific cost of fuel stream (currency per unit exergy).
44
+ r : float
45
+ Relative cost difference, :math:`(c_P - c_F)/c_F`.
46
+ f : float
47
+ Exergoeconomic factor, :math:`\dot{Z}/(\dot{Z} + \dot{C}_D)`.
48
+ Ex_C_col : dict
49
+ Custom cost coefficients collection passed via `kwargs`.
40
50
 
41
51
  Notes
42
52
  -----
@@ -179,14 +189,17 @@ class Valve(Component):
179
189
  - Valve is treated as dissipative (warning issued)
180
190
 
181
191
  For T_out <= T0:
182
- (1) 1/E_M_in * C_M_in - 1/E_M_out * C_M_out = 0
183
- - F-principle: specific mechanical exergy costs equalized between inlet/outlet
184
- - If E_M is zero for either stream, appropriate fallback coefficients are used
192
+ (1) 1/E_M_in * C_M_in - 1/E_M_out * C_M_out = 0
193
+
194
+ - F-principle: specific mechanical exergy costs equalized between inlet/outlet
195
+
196
+ - If E_M is zero for either stream, appropriate fallback coefficients are used
185
197
 
186
198
  When chemical_exergy_enabled is True:
187
- (2) 1/E_CH_in * C_CH_in - 1/E_CH_out * C_CH_out = 0
188
- - F-principle: specific chemical exergy costs equalized between inlet/outlet
189
- - If E_CH is zero for either stream, appropriate fallback coefficients are used
199
+ (2) 1/E_CH_in * C_CH_in - 1/E_CH_out * C_CH_out = 0
200
+
201
+ - F-principle: specific chemical exergy costs equalized between inlet/outlet
202
+ - If E_CH is zero for either stream, appropriate fallback coefficients are used
190
203
 
191
204
  Parameters
192
205
  ----------
@@ -254,8 +267,12 @@ class Valve(Component):
254
267
  components (non-dissipative and non-CycleCloser) in proportion to their exergy destruction (E_D)
255
268
  and adding an extra overall cost balance row that enforces:
256
269
 
257
- (C_in,T - C_out,T) + (C_in,M - C_out,M) - C_diff = - Z_costs
258
-
270
+ .. math::
271
+ (\dot C_{\mathrm{in},T} - \dot C_{\mathrm{out},T})
272
+ + (\dot C_{\mathrm{in},M} - \dot C_{\mathrm{out},M})
273
+ - \dot C_{\mathrm{diff}}
274
+ = -\,\dot Z_{\mathrm{costs}}
275
+
259
276
  In this formulation, the unknown cost variable in the "dissipative" column (i.e. C_diff)
260
277
  is solved for, ensuring the valve’s cost balance.
261
278
 
@@ -283,8 +300,7 @@ class Valve(Component):
283
300
 
284
301
  Notes
285
302
  -----
286
- - It is assumed that each inlet/outlet streams CostVar_index dictionary has keys:
287
- "T" (thermal), "M" (mechanical), and "dissipative" (the extra unknown).
303
+ - It is assumed that each inlet/outlet stream's CostVar_index dictionary has keys: "T" (thermal), "M" (mechanical), and "dissipative" (the extra unknown).
288
304
  - self.Z_costs is the known cost rate (in currency/s) for the valve.
289
305
  """
290
306
  # --- Thermal difference row ---
@@ -832,7 +832,7 @@ composition_params = [
832
832
  # Define the component groups via unique labels
833
833
  grouped_components = {
834
834
  "Turbine": [6, 23, 56, 57, 58, 68, 122],
835
- "HeatExchanger": [10, 15, 16, 25, 26, 27, 43, 51, 55, 61, 62, 70, 71, 124, 126],
835
+ "HeatExchanger": [10, 25, 26, 27, 43, 51, 55, 61, 62, 70, 71, 124, 126],
836
836
  "CombustionChamber": [22, 90],
837
837
  "Valve": [2, 13, 14, 39, 42, 59, 68, 133],
838
838
  "Pump": [8, 44, 83, 159],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: exerpy
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Exergy analysis for tabular input data
5
5
  Author-email: Sergio Tomasinelli <s.tomasinelli@tu-berlin.de>, Robert Müller <robert.mueller.2@tu-berlin.de>, Francesco Witte <github@witte.sh>
6
6
  Requires-Python: >=3.10
@@ -33,10 +33,10 @@ Requires-Dist: sphinx>=7.2.2 ; extra == "dev"
33
33
  Requires-Dist: sphinx-copybutton ; extra == "dev"
34
34
  Requires-Dist: sphinx-design ; extra == "dev"
35
35
  Requires-Dist: sphinxcontrib.bibtex ; extra == "dev"
36
- Requires-Dist: tespy ; extra == "dev"
36
+ Requires-Dist: tespy>=0.9 ; extra == "dev"
37
37
  Requires-Dist: tox ; extra == "dev"
38
38
  Requires-Dist: pywin32 ; extra == "ebsilon"
39
- Requires-Dist: tespy ; extra == "tespy"
39
+ Requires-Dist: tespy>=0.9 ; extra == "tespy"
40
40
  Project-URL: Changelog, https://exerpy.readthedocs.io/en/latest/whats_new.html
41
41
  Project-URL: Documentation, https://exerpy.readthedocs.io/
42
42
  Project-URL: Homepage, https://github.com/oemof/exerpy
@@ -126,7 +126,7 @@ ongoing development. You can cite ExerPy using the following BibTeX entry:
126
126
  title = {{ExerPy}: Exergy Analysis in Python},
127
127
  note = {Supervision: Prof. Dr.-Ing. Fontina Petrakopoulou}
128
128
  url = {https://github.com/oemof/exerpy},
129
- version = {0.0.1},
129
+ version = {0.0.2},
130
130
  year = {2025}
131
131
  }
132
132