exerpy 0.0.2__py3-none-any.whl → 0.0.4__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.
- exerpy/__init__.py +2 -4
- exerpy/analyses.py +849 -304
- exerpy/components/__init__.py +3 -0
- exerpy/components/combustion/base.py +53 -35
- exerpy/components/component.py +8 -8
- exerpy/components/heat_exchanger/base.py +188 -121
- exerpy/components/heat_exchanger/condenser.py +98 -62
- exerpy/components/heat_exchanger/simple.py +237 -137
- exerpy/components/heat_exchanger/steam_generator.py +46 -41
- exerpy/components/helpers/cycle_closer.py +61 -34
- exerpy/components/helpers/power_bus.py +117 -0
- exerpy/components/nodes/deaerator.py +176 -58
- exerpy/components/nodes/drum.py +50 -39
- exerpy/components/nodes/flash_tank.py +218 -43
- exerpy/components/nodes/mixer.py +249 -69
- exerpy/components/nodes/splitter.py +173 -0
- exerpy/components/nodes/storage.py +130 -0
- exerpy/components/piping/valve.py +311 -115
- exerpy/components/power_machines/generator.py +105 -38
- exerpy/components/power_machines/motor.py +111 -39
- exerpy/components/turbomachinery/compressor.py +214 -68
- exerpy/components/turbomachinery/pump.py +215 -68
- exerpy/components/turbomachinery/turbine.py +182 -74
- exerpy/cost_estimation/__init__.py +65 -0
- exerpy/cost_estimation/turton.py +1260 -0
- exerpy/data/cost_correlations/cepci_index.json +135 -0
- exerpy/data/cost_correlations/component_mapping.json +450 -0
- exerpy/data/cost_correlations/material_factors.json +428 -0
- exerpy/data/cost_correlations/pressure_factors.json +206 -0
- exerpy/data/cost_correlations/turton2008.json +726 -0
- exerpy/data/cost_correlations/turton2008_design_analysis_synthesis_components_tables.pdf +0 -0
- exerpy/data/cost_correlations/turton2008_design_analysis_synthesis_components_theory.pdf +0 -0
- exerpy/functions.py +389 -264
- exerpy/parser/from_aspen/aspen_config.py +57 -48
- exerpy/parser/from_aspen/aspen_parser.py +373 -280
- exerpy/parser/from_ebsilon/__init__.py +2 -2
- exerpy/parser/from_ebsilon/check_ebs_path.py +15 -19
- exerpy/parser/from_ebsilon/ebsilon_config.py +328 -226
- exerpy/parser/from_ebsilon/ebsilon_functions.py +205 -38
- exerpy/parser/from_ebsilon/ebsilon_parser.py +392 -255
- exerpy/parser/from_ebsilon/utils.py +16 -11
- exerpy/parser/from_tespy/tespy_config.py +33 -1
- exerpy/parser/from_tespy/tespy_parser.py +151 -0
- {exerpy-0.0.2.dist-info → exerpy-0.0.4.dist-info}/METADATA +43 -2
- exerpy-0.0.4.dist-info/RECORD +57 -0
- exerpy-0.0.2.dist-info/RECORD +0 -44
- {exerpy-0.0.2.dist-info → exerpy-0.0.4.dist-info}/WHEEL +0 -0
- {exerpy-0.0.2.dist-info → exerpy-0.0.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
from exerpy.components.component import Component
|
|
4
|
-
from exerpy.components.component import component_registry
|
|
3
|
+
from exerpy.components.component import Component, component_registry
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
@component_registry
|
|
@@ -9,8 +8,8 @@ class Generator(Component):
|
|
|
9
8
|
r"""
|
|
10
9
|
Class for exergy analysis of generators.
|
|
11
10
|
|
|
12
|
-
This class performs exergy analysis calculations for generators, converting mechanical
|
|
13
|
-
or thermal energy flow into electrical energy. The exergy product is defined as
|
|
11
|
+
This class performs exergy analysis calculations for generators, converting mechanical
|
|
12
|
+
or thermal energy flow into electrical energy. The exergy product is defined as
|
|
14
13
|
the electrical power output, while the exergy fuel is the input energy flow.
|
|
15
14
|
|
|
16
15
|
Parameters
|
|
@@ -73,23 +72,22 @@ class Generator(Component):
|
|
|
73
72
|
split_physical_exergy : bool
|
|
74
73
|
Flag indicating whether physical exergy is split into thermal and mechanical components.
|
|
75
74
|
|
|
76
|
-
"""
|
|
75
|
+
"""
|
|
77
76
|
# Exergy product is the electrical power output
|
|
78
|
-
self.E_P = self.outl[0][
|
|
79
|
-
|
|
77
|
+
self.E_P = self.outl[0]["energy_flow"]
|
|
78
|
+
|
|
80
79
|
# Exergy fuel is the input power
|
|
81
|
-
self.E_F = self.inl[0][
|
|
82
|
-
|
|
80
|
+
self.E_F = self.inl[0]["energy_flow"]
|
|
81
|
+
|
|
83
82
|
# Calculate exergy destruction
|
|
84
83
|
self.E_D = self.E_F - self.E_P
|
|
85
|
-
|
|
84
|
+
|
|
86
85
|
# Calculate exergy efficiency
|
|
87
86
|
self.epsilon = self.calc_epsilon()
|
|
88
|
-
|
|
87
|
+
|
|
89
88
|
# Log the results
|
|
90
89
|
logging.info(
|
|
91
|
-
f"Generator
|
|
92
|
-
f"Generator exergy balance calculated: "
|
|
90
|
+
f"Exergy balance of Generator {self.name} calculated: "
|
|
93
91
|
f"E_P={self.E_P:.2f}, E_F={self.E_F:.2f}, E_D={self.E_D:.2f}, "
|
|
94
92
|
f"Efficiency={self.epsilon:.2%}"
|
|
95
93
|
)
|
|
@@ -97,14 +95,14 @@ class Generator(Component):
|
|
|
97
95
|
def aux_eqs(self, A, b, counter, T0, equations, chemical_exergy_enabled):
|
|
98
96
|
"""
|
|
99
97
|
Auxiliary equations for the generator.
|
|
100
|
-
|
|
98
|
+
|
|
101
99
|
This function adds rows to the cost matrix A and the right-hand-side vector b to enforce
|
|
102
100
|
the auxiliary cost relations for the generator. Since the generator converts mechanical
|
|
103
101
|
or thermal energy to electrical energy, the auxiliary equations typically enforce:
|
|
104
|
-
|
|
105
|
-
- No additional auxiliary equations are needed for generators as electrical energy
|
|
102
|
+
|
|
103
|
+
- No additional auxiliary equations are needed for generators as electrical energy
|
|
106
104
|
is pure exergy and the cost balance equations are sufficient.
|
|
107
|
-
|
|
105
|
+
|
|
108
106
|
Parameters
|
|
109
107
|
----------
|
|
110
108
|
A : numpy.ndarray
|
|
@@ -119,7 +117,7 @@ class Generator(Component):
|
|
|
119
117
|
Dictionary for storing equation labels.
|
|
120
118
|
chemical_exergy_enabled : bool
|
|
121
119
|
Flag indicating whether chemical exergy auxiliary equations should be added.
|
|
122
|
-
|
|
120
|
+
|
|
123
121
|
Returns
|
|
124
122
|
-------
|
|
125
123
|
A : numpy.ndarray
|
|
@@ -131,38 +129,107 @@ class Generator(Component):
|
|
|
131
129
|
equations : dict
|
|
132
130
|
Updated dictionary with equation labels.
|
|
133
131
|
"""
|
|
134
|
-
|
|
132
|
+
|
|
135
133
|
return [A, b, counter, equations]
|
|
136
|
-
|
|
137
|
-
def exergoeconomic_balance(self, T0):
|
|
138
|
-
"""
|
|
139
|
-
Perform exergoeconomic balance
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
134
|
+
|
|
135
|
+
def exergoeconomic_balance(self, T0, chemical_exergy_enabled=False):
|
|
136
|
+
r"""
|
|
137
|
+
Perform exergoeconomic cost balance for the generator (power-producing component).
|
|
138
|
+
|
|
139
|
+
The generator is a power-producing component (e.g., electrical generator, turbine)
|
|
140
|
+
where mechanical/electrical work is extracted from a flowing stream. The general
|
|
141
|
+
exergoeconomic balance equation is:
|
|
142
|
+
|
|
143
|
+
.. math::
|
|
144
|
+
\dot{C}_{\mathrm{in}}^{\mathrm{TOT}} - \dot{C}_{\mathrm{out}}^{\mathrm{TOT}}
|
|
145
|
+
- \dot{C}_{\mathrm{P}} + \dot{Z} = 0
|
|
146
|
+
|
|
147
|
+
For a generator, the product is the power output (electrical or mechanical),
|
|
148
|
+
and the fuel is the exergy decrease in the working fluid:
|
|
149
|
+
|
|
150
|
+
.. math::
|
|
151
|
+
\dot{C}_{\mathrm{P}} = \dot{C}_{\mathrm{out}}^{\mathrm{TOT}}
|
|
152
|
+
|
|
153
|
+
.. math::
|
|
154
|
+
\dot{C}_{\mathrm{F}} = \dot{C}_{\mathrm{in}}^{\mathrm{TOT}}
|
|
155
|
+
|
|
156
|
+
**Calculated exergoeconomic indicators:**
|
|
157
|
+
|
|
158
|
+
Specific cost of fuel:
|
|
159
|
+
|
|
160
|
+
.. math::
|
|
161
|
+
c_{\mathrm{F}} = \frac{\dot{C}_{\mathrm{F}}}{\dot{E}_{\mathrm{F}}}
|
|
162
|
+
|
|
163
|
+
Specific cost of product:
|
|
164
|
+
|
|
165
|
+
.. math::
|
|
166
|
+
c_{\mathrm{P}} = \frac{\dot{C}_{\mathrm{P}}}{\dot{E}_{\mathrm{P}}}
|
|
167
|
+
|
|
168
|
+
Cost rate of exergy destruction:
|
|
169
|
+
|
|
170
|
+
.. math::
|
|
171
|
+
\dot{C}_{\mathrm{D}} = c_{\mathrm{F}} \cdot \dot{E}_{\mathrm{D}}
|
|
172
|
+
|
|
173
|
+
Relative cost difference:
|
|
174
|
+
|
|
175
|
+
.. math::
|
|
176
|
+
r = \frac{\dot{C}_{\mathrm{P}} - \dot{C}_{\mathrm{F}}}{\dot{C}_{\mathrm{F}}}
|
|
177
|
+
|
|
178
|
+
Exergoeconomic factor:
|
|
179
|
+
|
|
180
|
+
.. math::
|
|
181
|
+
f = \frac{\dot{Z}}{\dot{Z} + \dot{C}_{\mathrm{D}}}
|
|
182
|
+
|
|
148
183
|
Parameters
|
|
149
184
|
----------
|
|
150
185
|
T0 : float
|
|
151
|
-
Ambient temperature
|
|
152
|
-
|
|
186
|
+
Ambient temperature (K).
|
|
187
|
+
chemical_exergy_enabled : bool, optional
|
|
188
|
+
If True, chemical exergy is considered in the calculations.
|
|
189
|
+
Default is False.
|
|
190
|
+
|
|
191
|
+
Attributes Set
|
|
192
|
+
--------------
|
|
193
|
+
C_P : float
|
|
194
|
+
Cost rate of product (currency/time).
|
|
195
|
+
C_F : float
|
|
196
|
+
Cost rate of fuel (currency/time).
|
|
197
|
+
c_P : float
|
|
198
|
+
Specific cost of product (currency/energy).
|
|
199
|
+
c_F : float
|
|
200
|
+
Specific cost of fuel (currency/energy).
|
|
201
|
+
C_D : float
|
|
202
|
+
Cost rate of exergy destruction (currency/time).
|
|
203
|
+
r : float
|
|
204
|
+
Relative cost difference (dimensionless).
|
|
205
|
+
f : float
|
|
206
|
+
Exergoeconomic factor (dimensionless).
|
|
207
|
+
|
|
208
|
+
Raises
|
|
209
|
+
------
|
|
210
|
+
ValueError
|
|
211
|
+
If E_P or E_F is zero, preventing computation of specific costs.
|
|
212
|
+
|
|
153
213
|
Notes
|
|
154
214
|
-----
|
|
155
|
-
|
|
156
|
-
|
|
215
|
+
Unlike other components, the generator does not add Z_costs to close the
|
|
216
|
+
cost balance in the C_P calculation. The cost balance is determined by
|
|
217
|
+
the total exergy costs of inlet and outlet streams.
|
|
218
|
+
|
|
219
|
+
The relative cost difference r is calculated using total cost rates
|
|
220
|
+
(C_P and C_F) rather than specific costs (c_P and c_F), which is
|
|
221
|
+
mathematically equivalent for this component type.
|
|
222
|
+
|
|
223
|
+
The exergy destruction E_D must be computed prior to calling this method.
|
|
157
224
|
"""
|
|
158
225
|
self.C_P = self.outl[0].get("C_TOT", 0)
|
|
159
226
|
self.C_F = self.inl[0].get("C_TOT", 0)
|
|
160
|
-
|
|
227
|
+
|
|
161
228
|
if self.E_P == 0 or self.E_F == 0:
|
|
162
229
|
raise ValueError(f"E_P or E_F is zero; cannot compute specific costs for component: {self.name}.")
|
|
163
|
-
|
|
230
|
+
|
|
164
231
|
self.c_P = self.C_P / self.E_P
|
|
165
232
|
self.c_F = self.C_F / self.E_F
|
|
166
|
-
self.C_D = self.c_F * self.E_D
|
|
233
|
+
self.C_D = self.c_F * self.E_D # Ensure that self.E_D is computed beforehand.
|
|
167
234
|
self.r = (self.C_P - self.C_F) / self.C_F
|
|
168
235
|
self.f = self.Z_costs / (self.Z_costs + self.C_D) if (self.Z_costs + self.C_D) != 0 else 0
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
from exerpy.components.component import Component
|
|
4
|
-
from exerpy.components.component import component_registry
|
|
3
|
+
from exerpy.components.component import Component, component_registry
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
@component_registry
|
|
@@ -10,7 +9,7 @@ class Motor(Component):
|
|
|
10
9
|
Class for exergy analysis of motors.
|
|
11
10
|
|
|
12
11
|
This class performs exergy analysis calculations for motors, converting electrical
|
|
13
|
-
energy into mechanical energy. The exergy product is defined as the mechanical
|
|
12
|
+
energy into mechanical energy. The exergy product is defined as the mechanical
|
|
14
13
|
power output, while the exergy fuel is the electrical power input.
|
|
15
14
|
|
|
16
15
|
Parameters
|
|
@@ -59,7 +58,7 @@ class Motor(Component):
|
|
|
59
58
|
r"""
|
|
60
59
|
Calculate the exergy balance of the motor.
|
|
61
60
|
|
|
62
|
-
Calculates the exergy product (mechanical power output), exergy fuel
|
|
61
|
+
Calculates the exergy product (mechanical power output), exergy fuel
|
|
63
62
|
(electrical power input), and the resulting exergy destruction and efficiency.
|
|
64
63
|
|
|
65
64
|
Parameters
|
|
@@ -71,46 +70,45 @@ class Motor(Component):
|
|
|
71
70
|
split_physical_exergy : bool
|
|
72
71
|
Flag indicating whether physical exergy is split into thermal and mechanical components.
|
|
73
72
|
|
|
74
|
-
"""
|
|
73
|
+
"""
|
|
75
74
|
|
|
76
|
-
if self.outl[0][
|
|
77
|
-
pruduct = self.inl[0][
|
|
78
|
-
fuel = self.outl[0][
|
|
75
|
+
if self.outl[0]["energy_flow"] > self.inl[0]["energy_flow"]:
|
|
76
|
+
pruduct = self.inl[0]["energy_flow"]
|
|
77
|
+
fuel = self.outl[0]["energy_flow"]
|
|
79
78
|
else:
|
|
80
|
-
pruduct = self.outl[0][
|
|
81
|
-
fuel = self.inl[0][
|
|
79
|
+
pruduct = self.outl[0]["energy_flow"]
|
|
80
|
+
fuel = self.inl[0]["energy_flow"]
|
|
82
81
|
|
|
83
82
|
# Exergy product is the mechanical power output
|
|
84
83
|
self.E_P = pruduct
|
|
85
|
-
|
|
84
|
+
|
|
86
85
|
# Exergy fuel is the electrical power input
|
|
87
86
|
self.E_F = fuel
|
|
88
|
-
|
|
87
|
+
|
|
89
88
|
# Calculate exergy destruction
|
|
90
89
|
self.E_D = self.E_F - self.E_P
|
|
91
|
-
|
|
90
|
+
|
|
92
91
|
# Calculate exergy efficiency
|
|
93
92
|
self.epsilon = self.calc_epsilon()
|
|
94
93
|
|
|
95
94
|
# Log the results
|
|
96
95
|
logging.info(
|
|
97
|
-
f"Motor
|
|
96
|
+
f"Exergy balance of Motor {self.name} calculated: "
|
|
98
97
|
f"E_P={self.E_P:.2f}, E_F={self.E_F:.2f}, E_D={self.E_D:.2f}, "
|
|
99
98
|
f"Efficiency={self.epsilon:.2%}"
|
|
100
99
|
)
|
|
101
100
|
|
|
102
|
-
|
|
103
101
|
def aux_eqs(self, A, b, counter, T0, equations, chemical_exergy_enabled):
|
|
104
102
|
"""
|
|
105
103
|
Auxiliary equations for the motor.
|
|
106
|
-
|
|
104
|
+
|
|
107
105
|
This function adds rows to the cost matrix A and the right-hand-side vector b to enforce
|
|
108
106
|
the auxiliary cost relations for the motor. Since the motor converts mechanical
|
|
109
107
|
or thermal energy to electrical energy, the auxiliary equations typically enforce:
|
|
110
|
-
|
|
111
|
-
- No additional auxiliary equations are needed for motors as electrical energy
|
|
108
|
+
|
|
109
|
+
- No additional auxiliary equations are needed for motors as electrical energy
|
|
112
110
|
is pure exergy and the cost balance equations are sufficient.
|
|
113
|
-
|
|
111
|
+
|
|
114
112
|
Parameters
|
|
115
113
|
----------
|
|
116
114
|
A : numpy.ndarray
|
|
@@ -125,7 +123,7 @@ class Motor(Component):
|
|
|
125
123
|
Dictionary for storing equation labels.
|
|
126
124
|
chemical_exergy_enabled : bool
|
|
127
125
|
Flag indicating whether chemical exergy auxiliary equations should be added.
|
|
128
|
-
|
|
126
|
+
|
|
129
127
|
Returns
|
|
130
128
|
-------
|
|
131
129
|
A : numpy.ndarray
|
|
@@ -138,36 +136,110 @@ class Motor(Component):
|
|
|
138
136
|
Updated dictionary with equation labels.
|
|
139
137
|
"""
|
|
140
138
|
return [A, b, counter, equations]
|
|
141
|
-
|
|
142
|
-
def exergoeconomic_balance(self, T0):
|
|
143
|
-
"""
|
|
144
|
-
Perform exergoeconomic balance
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
139
|
+
|
|
140
|
+
def exergoeconomic_balance(self, T0, chemical_exergy_enabled=False):
|
|
141
|
+
r"""
|
|
142
|
+
Perform exergoeconomic cost balance for the motor (power-consuming component).
|
|
143
|
+
|
|
144
|
+
The motor is a power-consuming component (e.g., electric motor, pump motor)
|
|
145
|
+
where mechanical/electrical work is consumed to drive a process. The general
|
|
146
|
+
exergoeconomic balance equation is:
|
|
147
|
+
|
|
148
|
+
.. math::
|
|
149
|
+
\dot{C}_{\mathrm{in}}^{\mathrm{TOT}} - \dot{C}_{\mathrm{out}}^{\mathrm{TOT}}
|
|
150
|
+
+ \dot{C}_{\mathrm{W}} + \dot{Z} = 0
|
|
151
|
+
|
|
152
|
+
For a motor, the fuel is the input stream (typically electrical power),
|
|
153
|
+
and the product is the output stream (mechanical work or driven fluid):
|
|
154
|
+
|
|
155
|
+
.. math::
|
|
156
|
+
\dot{C}_{\mathrm{F}} = \dot{C}_{\mathrm{in}}^{\mathrm{TOT}}
|
|
157
|
+
|
|
158
|
+
.. math::
|
|
159
|
+
\dot{C}_{\mathrm{P}} = \dot{C}_{\mathrm{out}}^{\mathrm{TOT}}
|
|
160
|
+
|
|
161
|
+
**Calculated exergoeconomic indicators:**
|
|
162
|
+
|
|
163
|
+
Specific cost of fuel:
|
|
164
|
+
|
|
165
|
+
.. math::
|
|
166
|
+
c_{\mathrm{F}} = \frac{\dot{C}_{\mathrm{F}}}{\dot{E}_{\mathrm{F}}}
|
|
167
|
+
|
|
168
|
+
Specific cost of product:
|
|
169
|
+
|
|
170
|
+
.. math::
|
|
171
|
+
c_{\mathrm{P}} = \frac{\dot{C}_{\mathrm{P}}}{\dot{E}_{\mathrm{P}}}
|
|
172
|
+
|
|
173
|
+
Cost rate of exergy destruction:
|
|
174
|
+
|
|
175
|
+
.. math::
|
|
176
|
+
\dot{C}_{\mathrm{D}} = c_{\mathrm{F}} \cdot \dot{E}_{\mathrm{D}}
|
|
177
|
+
|
|
178
|
+
Relative cost difference:
|
|
179
|
+
|
|
180
|
+
.. math::
|
|
181
|
+
r = \frac{\dot{C}_{\mathrm{P}} - \dot{C}_{\mathrm{F}}}{\dot{C}_{\mathrm{F}}}
|
|
182
|
+
|
|
183
|
+
Exergoeconomic factor:
|
|
184
|
+
|
|
185
|
+
.. math::
|
|
186
|
+
f = \frac{\dot{Z}}{\dot{Z} + \dot{C}_{\mathrm{D}}}
|
|
187
|
+
|
|
153
188
|
Parameters
|
|
154
189
|
----------
|
|
155
190
|
T0 : float
|
|
156
|
-
Ambient temperature
|
|
157
|
-
|
|
191
|
+
Ambient temperature (K).
|
|
192
|
+
chemical_exergy_enabled : bool, optional
|
|
193
|
+
If True, chemical exergy is considered in the calculations.
|
|
194
|
+
Default is False.
|
|
195
|
+
|
|
196
|
+
Attributes Set
|
|
197
|
+
--------------
|
|
198
|
+
C_P : float
|
|
199
|
+
Cost rate of product (currency/time).
|
|
200
|
+
C_F : float
|
|
201
|
+
Cost rate of fuel (currency/time).
|
|
202
|
+
c_P : float
|
|
203
|
+
Specific cost of product (currency/energy).
|
|
204
|
+
c_F : float
|
|
205
|
+
Specific cost of fuel (currency/energy).
|
|
206
|
+
C_D : float
|
|
207
|
+
Cost rate of exergy destruction (currency/time).
|
|
208
|
+
r : float
|
|
209
|
+
Relative cost difference (dimensionless).
|
|
210
|
+
f : float
|
|
211
|
+
Exergoeconomic factor (dimensionless).
|
|
212
|
+
|
|
213
|
+
Raises
|
|
214
|
+
------
|
|
215
|
+
ValueError
|
|
216
|
+
If E_P or E_F is zero, preventing computation of specific costs.
|
|
217
|
+
|
|
158
218
|
Notes
|
|
159
219
|
-----
|
|
160
|
-
The
|
|
161
|
-
|
|
220
|
+
The motor is a power-consuming component, opposite in function to a generator.
|
|
221
|
+
Unlike heat exchangers or pumps, the motor does not add Z_costs to close the
|
|
222
|
+
cost balance in the C_P calculation. The cost balance is determined by
|
|
223
|
+
the total exergy costs of inlet and outlet streams.
|
|
224
|
+
|
|
225
|
+
The relative cost difference r is calculated using total cost rates
|
|
226
|
+
(C_P and C_F) rather than specific costs (c_P and c_F), which is
|
|
227
|
+
mathematically equivalent for this component type.
|
|
228
|
+
|
|
229
|
+
The exergy destruction E_D must be computed prior to calling this method.
|
|
230
|
+
|
|
231
|
+
For motors coupled with pumps or compressors, the fuel is typically the
|
|
232
|
+
electrical energy consumed, and the product is the mechanical work delivered
|
|
233
|
+
to the driven equipment.
|
|
162
234
|
"""
|
|
163
235
|
self.C_P = self.outl[0].get("C_TOT", 0)
|
|
164
236
|
self.C_F = self.inl[0].get("C_TOT", 0)
|
|
165
|
-
|
|
237
|
+
|
|
166
238
|
if self.E_P == 0 or self.E_F == 0:
|
|
167
239
|
raise ValueError(f"E_P or E_F is zero; cannot compute specific costs for component: {self.name}.")
|
|
168
|
-
|
|
240
|
+
|
|
169
241
|
self.c_P = self.C_P / self.E_P
|
|
170
242
|
self.c_F = self.C_F / self.E_F
|
|
171
|
-
self.C_D = self.c_F * self.E_D
|
|
243
|
+
self.C_D = self.c_F * self.E_D # Ensure that self.E_D is computed beforehand.
|
|
172
244
|
self.r = (self.C_P - self.C_F) / self.C_F
|
|
173
245
|
self.f = self.Z_costs / (self.Z_costs + self.C_D) if (self.Z_costs + self.C_D) != 0 else 0
|