exerpy 0.0.2__py3-none-any.whl → 0.0.3__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.
Files changed (39) hide show
  1. exerpy/__init__.py +2 -4
  2. exerpy/analyses.py +597 -297
  3. exerpy/components/__init__.py +3 -0
  4. exerpy/components/combustion/base.py +53 -35
  5. exerpy/components/component.py +8 -8
  6. exerpy/components/heat_exchanger/base.py +186 -119
  7. exerpy/components/heat_exchanger/condenser.py +96 -60
  8. exerpy/components/heat_exchanger/simple.py +237 -137
  9. exerpy/components/heat_exchanger/steam_generator.py +46 -41
  10. exerpy/components/helpers/cycle_closer.py +61 -34
  11. exerpy/components/helpers/power_bus.py +117 -0
  12. exerpy/components/nodes/deaerator.py +176 -58
  13. exerpy/components/nodes/drum.py +50 -39
  14. exerpy/components/nodes/flash_tank.py +218 -43
  15. exerpy/components/nodes/mixer.py +249 -69
  16. exerpy/components/nodes/splitter.py +173 -0
  17. exerpy/components/nodes/storage.py +130 -0
  18. exerpy/components/piping/valve.py +311 -115
  19. exerpy/components/power_machines/generator.py +105 -38
  20. exerpy/components/power_machines/motor.py +111 -39
  21. exerpy/components/turbomachinery/compressor.py +181 -63
  22. exerpy/components/turbomachinery/pump.py +182 -63
  23. exerpy/components/turbomachinery/turbine.py +182 -74
  24. exerpy/functions.py +388 -263
  25. exerpy/parser/from_aspen/aspen_config.py +57 -48
  26. exerpy/parser/from_aspen/aspen_parser.py +373 -280
  27. exerpy/parser/from_ebsilon/__init__.py +2 -2
  28. exerpy/parser/from_ebsilon/check_ebs_path.py +15 -19
  29. exerpy/parser/from_ebsilon/ebsilon_config.py +328 -226
  30. exerpy/parser/from_ebsilon/ebsilon_functions.py +205 -38
  31. exerpy/parser/from_ebsilon/ebsilon_parser.py +392 -255
  32. exerpy/parser/from_ebsilon/utils.py +16 -11
  33. exerpy/parser/from_tespy/tespy_config.py +32 -1
  34. exerpy/parser/from_tespy/tespy_parser.py +151 -0
  35. {exerpy-0.0.2.dist-info → exerpy-0.0.3.dist-info}/METADATA +43 -2
  36. exerpy-0.0.3.dist-info/RECORD +48 -0
  37. exerpy-0.0.2.dist-info/RECORD +0 -44
  38. {exerpy-0.0.2.dist-info → exerpy-0.0.3.dist-info}/WHEEL +0 -0
  39. {exerpy-0.0.2.dist-info → exerpy-0.0.3.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,130 @@
1
+ import logging
2
+
3
+ import numpy as np
4
+
5
+ from exerpy.components.component import Component, component_registry
6
+
7
+
8
+ @component_registry
9
+ class Storage(Component):
10
+ r"""
11
+ Class for exergy and exergoeconomic analysis of a storage.
12
+
13
+ This class performs exergy and exergoeconomic analysis calculations for storage components,
14
+ accounting for one inlet and one outlet stream.
15
+
16
+ Attributes
17
+ ----------
18
+ E_F : float
19
+ Exergy fuel of the component :math:`\dot{E}_\mathrm{F}` in :math:`\mathrm{W}`.
20
+ E_P : float
21
+ Exergy product of the component :math:`\dot{E}_\mathrm{P}` in :math:`\mathrm{W}`.
22
+ E_D : float
23
+ Exergy destruction of the component :math:`\dot{E}_\mathrm{D}` in :math:`\mathrm{W}`.
24
+ epsilon : float
25
+ Exergetic efficiency of the component :math:`\varepsilon` in :math:`-`.
26
+ inl : dict
27
+ Dictionary containing inlet stream data with mass flows and specific exergies.
28
+ outl : dict
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
+
50
+ def __init__(self, **kwargs):
51
+ r"""
52
+ Initialize the storage component.
53
+
54
+ Parameters
55
+ ----------
56
+ **kwargs : dict
57
+ Arbitrary keyword arguments. Recognized keys:
58
+ - Ex_C_col (dict): custom cost coefficients, default {}
59
+ - Z_costs (float): investment cost rate in currency/h, default 0.0
60
+ """
61
+ self.dissipative = False
62
+ super().__init__(**kwargs)
63
+
64
+ def calc_exergy_balance(self, T0: float, p0: float, split_physical_exergy) -> None:
65
+ r"""
66
+ Compute the exergy balance of the storage.
67
+
68
+ Parameters
69
+ ----------
70
+ T0 : float
71
+ Ambient temperature in Kelvin.
72
+ p0 : float
73
+ Ambient pressure in Pascal.
74
+ split_physical_exergy : bool
75
+ Flag indicating whether physical exergy is split into thermal and mechanical components.
76
+
77
+ Notes
78
+ -----
79
+ The exergy analysis considers the cases where the storage is either charged or discharged.
80
+
81
+ Case 1 (Charging):
82
+
83
+ .. math::
84
+
85
+ \dot{E}_\mathrm{F} = \dot{E}_\mathrm{in}^\mathrm{PH} - \dot{E}_\mathrm{out}^\mathrm{PH}
86
+
87
+ .. math::
88
+ \dot{E}_\mathrm{P} = (\dot{m}_\mathrm{in} - \dot{m}_\mathrm{out}) \cdot e_\mathrm{out}^\mathrm{PH}
89
+
90
+
91
+ Case 2 (Discharging):
92
+
93
+ .. math::
94
+
95
+ \dot{E}_\mathrm{F} = (\dot{m}_\mathrm{out} - \dot{m}_\mathrm{in}) \cdot e_\mathrm{out}^\mathrm{PH}
96
+
97
+ .. math::
98
+
99
+ \dot{E}_\mathrm{P} = \dot{E}_\mathrm{out}^\mathrm{PH} - \dot{E}_\mathrm{in}^\mathrm{PH}
100
+
101
+ """
102
+
103
+ if self.outl[0]["m"] < self.inl[0]["m"]:
104
+ logging.info(f"Storage '{self.name}' is charged.")
105
+ self.E_F = self.inl[0]["m"] * self.inl[0]["e_PH"] - self.outl[0]["m"] * self.outl[0]["e_PH"]
106
+ self.E_P = (self.inl[0]["m"] - self.outl[0]["m"]) * self.outl[0][
107
+ "e_PH"
108
+ ] # assuming that exergy is stored at the same temperature as the outlet
109
+ self.E_D = self.E_F - self.E_P
110
+ elif self.outl[0]["m"] > self.inl[0]["m"]:
111
+ logging.info(f"Storage '{self.name}' is discharged.")
112
+ self.E_F = (self.outl[0]["m"] - self.inl[0]["m"]) * self.outl[0][
113
+ "e_PH"
114
+ ] # assuming that exergy is stored at the same temperature as the outlet
115
+ self.E_P = self.outl[0]["m"] * self.outl[0]["e_PH"] - self.inl[0]["m"] * self.inl[0]["e_PH"]
116
+ self.E_D = self.E_F - self.E_P
117
+
118
+ self.epsilon = self.E_P / self.E_F if self.E_F != 0 else np.nan
119
+
120
+ # Log the results.
121
+ logging.info(
122
+ f"Exergy balance of Storage {self.name} calculated: "
123
+ f"E_F = {self.E_F:.2f} W, E_P = {self.E_P:.2f} W, E_D = {self.E_D:.2f} W, "
124
+ )
125
+
126
+ def exergoeconomic_balance(self, T0, chemical_exergy_enabled=False):
127
+ r"""
128
+ This class has not been implemented yet!
129
+ """
130
+ pass