Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add exergoeconomic analysis #474

Open
wants to merge 43 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
82a5db9
add tests
FriederikeTUB Jan 12, 2024
f52d59d
add splitting for exergy cost stream of source
FriederikeTUB Jan 15, 2024
fd3a59d
add exergoeconomic analysis
FriederikeTUB Jan 15, 2024
78ea466
add exergoeconomic cost balances and auxiliary equations for some com…
FriederikeTUB Jan 15, 2024
b274b71
add cost attributes to connection
FriederikeTUB Jan 15, 2024
4449475
Add draft for refactoring of cost balacing
fwitte Jan 16, 2024
61aa2c1
refactor code for exergoeconomic analysis
FriederikeTUB Jan 23, 2024
f90c60c
add auxiliary equations and exergoeconomic balances for nodes
FriederikeTUB Jan 26, 2024
2251c5a
add auxiliary equations for heat exchanger
FriederikeTUB Jan 26, 2024
9cd1c45
edit auxiliary equations and exergoeconomic balances for combustion
FriederikeTUB Jan 26, 2024
68fb4a4
add auxiliary equations and exergoeconomic balances for valve
FriederikeTUB Jan 26, 2024
92523d6
edit auxiliary equations and exergoeconomic balances for compressor &…
FriederikeTUB Jan 26, 2024
4775c2c
add calc_zeta function
FriederikeTUB Jan 26, 2024
05dcd67
add c and C subdivision in printed table
FriederikeTUB Jan 26, 2024
ee82cdd
add some tests
FriederikeTUB Jan 26, 2024
b537836
add structure for dissipative components
FriederikeTUB Jan 26, 2024
fc7fd9f
edit auxiliary equations
FriederikeTUB Jan 26, 2024
4972a93
add structure for internal power supply
FriederikeTUB Jan 27, 2024
ca5c55f
edit code for dissipative components and tests
FriederikeTUB Jan 28, 2024
8455bea
auxiliary equations cycle closer
FriederikeTUB Feb 14, 2024
ba8192b
aktueller Stand
FriederikeTUB Feb 14, 2024
ff675fc
Merge branch 'dev' into HEAD
fwitte Feb 14, 2024
6a3b12c
Tidy up and draft concept for using bus exergy flows as variables
fwitte Feb 14, 2024
7681639
Remove some outdated stuff
fwitte Feb 14, 2024
58737c0
add division of massless streams in bus based and component based for…
FriederikeTUB Feb 14, 2024
6edc600
some more component tests
FriederikeTUB Feb 22, 2024
0a81455
change efficency calculation since E_bus["massless"] is not component…
FriederikeTUB Feb 22, 2024
b62527c
fix a problem with busses
FriederikeTUB Feb 22, 2024
a26788a
fix some more problems
FriederikeTUB Feb 22, 2024
9c671f8
some more tests
FriederikeTUB Mar 5, 2024
dc50f58
add conversion molar and mass flow
FriederikeTUB Mar 5, 2024
3847a69
try to build Jubrans gas turbine system
FriederikeTUB Mar 5, 2024
997cca4
add starting value for circular processes and tests
FriederikeTUB Mar 6, 2024
39de500
edit auxiliary equations, add case that only one exergy is 0 but the …
FriederikeTUB Mar 9, 2024
f80e138
edit unit handling
FriederikeTUB Apr 23, 2024
68f27ff
edit aux eq for compressor
FriederikeTUB Apr 23, 2024
0b32aaf
evaluate refrigerator results
FriederikeTUB Apr 23, 2024
87c16d1
change Ex_C_col for dissipative components
FriederikeTUB May 7, 2024
207e256
remove C_L for components
FriederikeTUB May 7, 2024
37c72a8
add air to fuel bus
FriederikeTUB May 7, 2024
d75c858
try cgam analysis
FriederikeTUB May 7, 2024
8a27d9b
revising auxiliary equations
FriederikeTUB May 8, 2024
95c41de
edit bus equations
FriederikeTUB Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

185 changes: 185 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions bash.exe.stackdump
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Stack trace:
Frame Function Args
000FFFFCD30 00210062B0E (0021028A770, 00210275E51, 00000000059, 000FFFFB710)
000FFFFCD30 0021004846A (000FFFFCD30, 00200000000, 00000000000, 00000000001)
000FFFFCD30 002100484A2 (00000000000, 00000000000, 00000000059, 99B853482A57)
000FFFFCD30 0021006E496 (00210045323, 00210358A70, 00000000000, 0000000000D)
000FFFFCD30 0021006E4A9 (00210045170, 0021023D7E0, 002100448F2, 000FFFFC910)
000FFFFCD30 00210070DE4 (00000000013, 00000000001, 000FFFFC910, 00210278640)
000FFFFCD30 0021005AB65 (000FFFFCA60, 00000000000, 00000000000, 008FFFFFFFF)
000FFFFCD30 0021005B335 (00000000002, 00000000000, 000FFFFCD30, 00000030201)
000FFFFCD30 0021005B847 (002100DF73E, 00000000000, 00000000000, 00000000000)
000FFFFCD30 0021005BB86 (00000000000, 000FFFFCD30, FFFFFFFFFFFFFFC6, 00000000000)
000FFFFCD30 00210048C0C (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFFFF0 00210047716 (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFFFF0 002100477C4 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
6 changes: 6 additions & 0 deletions src/tespy/components/basics/cycle_closer.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,9 @@ def calc_parameters(self):
d2 = self.outl[0].fluid.val
diff = [d1[key] - d2[key] for key in d1.keys()]
self.fluid_deviation.val = np.linalg.norm(diff)


"""+F+F+F+F++++START++++F+F+F+F+"""

def exergoeconomic_balance(self, T0):
return
40 changes: 40 additions & 0 deletions src/tespy/components/basics/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,43 @@ def exergy_balance(self, T0):
}
self.E_D = np.nan
self.epsilon = self._calc_epsilon()


"""+F+F+F+F++++START++++F+F+F+F+ von Jubran"""
def set_source_costs(self, c_tot=None):
# c_tot must be in SI unit ($/J)

if c_tot is not None:
self.outl[0].c_tot = c_tot
# calculate outlet
self.outl[0].Ex_tot = self.outl[0].Ex_physical + self.outl[0].Ex_chemical
self.outl[0].C_tot = self.outl[0].c_tot * self.outl[0].Ex_tot

# approx costs per exergy unit fot T, M, PH and CH
# c_tot = c_therm = c_mech = c_physical = c_chemical
self.outl[0].c_therm = c_tot
self.outl[0].c_mech = c_tot
self.outl[0].c_physical = c_tot
self.outl[0].c_chemical = c_tot

self.outl[0].C_therm = self.outl[0].c_therm * self.outl[0].Ex_therm
self.outl[0].C_mech = self.outl[0].c_mech * self.outl[0].Ex_mech
self.outl[0].C_physical = self.outl[0].c_physical * self.outl[0].Ex_physical
self.outl[0].C_chemical = self.outl[0].c_chemical * self.outl[0].Ex_chemical


"""
self.outl[0].C_therm = self.outl[0].C_tot * (self.outl[0].Ex_therm / self.outl[0].Ex_tot)
self.outl[0].C_mech = self.outl[0].C_tot * (self.outl[0].Ex_mech / self.outl[0].Ex_tot)
self.outl[0].C_physical = self.outl[0].C_tot * (self.outl[0].Ex_physical / self.outl[0].Ex_tot)
self.outl[0].C_chemical = self.outl[0].C_tot * (self.outl[0].Ex_chemical / self.outl[0].Ex_tot)

self.outl[0].c_therm = self.outl[0].C_therm / self.outl[0].Ex_therm * unit_c if self.outl[0].Ex_therm != 0 else 0
self.outl[0].c_mech = self.outl[0].C_mech / self.outl[0].Ex_mech * unit_c if self.outl[0].Ex_mech != 0 else 0
self.outl[0].c_physical = self.outl[0].C_physical / self.outl[0].Ex_physical * unit_c if self.outl[0].Ex_physical != 0 else 0
self.outl[0].c_chemical = self.outl[0].C_chemical / self.outl[0].Ex_chemical * unit_c if self.outl[0].Ex_chemical != 0 else 0
"""
def set_source_costs_standard(self):
# determine source costs depending on material, temperature, ...
return
"""+F+F+F+F++++END++++F+F+F+F+ von Jubran"""
44 changes: 43 additions & 1 deletion src/tespy/components/combustion/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,4 +1399,46 @@ def exergy_balance(self, T0):

self.E_D = self.E_F - self.E_P
self.epsilon = self._calc_epsilon()
self.E_bus = np.nan
self.E_bus = {"chemical": np.nan, "physical": np.nan, "massless": np.nan}


"""+F+F+F+F++++START++++F+F+F+F+"""

def exergoeconomic_balance(self, T0):
self.C_P = self.outl[0].C_therm - (
self.inl[0].C_therm + self.inl[1].C_therm
)
self.C_F = (
self.inl[0].C_chemical + self.inl[1].C_chemical -
self.outl[0].C_chemical + self.inl[0].C_mech +
self.inl[1].C_mech - self.outl[0].C_mech
)
self.c_F = self.C_F / self.E_F
self.c_P = self.C_P / self.E_P
self.C_D = self.c_F * self.E_D
self.r = (self.C_P - self.C_F) / self.C_F
self.f = self.Z_costs / (self.Z_costs + self.C_D)

def aux_eqs(self, exergy_cost_matrix, exergy_cost_vector, counter, T0):
if self.outl[0].Ex_mech != 0 and self.inl[0].Ex_mech != 0 and self.inl[1].Ex_mech != 0:
exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = -1 / self.outl[0].Ex_mech
exergy_cost_matrix[counter+0, self.inl[0].Ex_C_col["mech"]] = 1 / self.inl[0].Ex_mech * self.inl[0].m.val / (self.inl[0].m.val + self.inl[1].m.val)
exergy_cost_matrix[counter+0, self.inl[1].Ex_C_col["mech"]] = 1 / self.inl[1].Ex_mech * self.inl[1].m.val / (self.inl[0].m.val + self.inl[1].m.val)
else:
exergy_cost_matrix[counter+0, self.outl[0].Ex_C_col["mech"]] = 1

if self.outl[0].Ex_chemical != 0 and self.inl[0].Ex_chemical != 0 and self.inl[1].Ex_chemical != 0:
exergy_cost_matrix[counter+1, self.outl[0].Ex_C_col["chemical"]] = -1 / self.outl[0].Ex_chemical
exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["chemical"]] = 1 / self.inl[0].Ex_chemical * self.inl[0].m.val / (self.inl[0].m.val + self.inl[1].m.val)
exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["chemical"]] = 1 / self.inl[1].Ex_chemical * self.inl[1].m.val / (self.inl[0].m.val + self.inl[1].m.val)
elif self.in1[0].Ex_chemical == 0:
exergy_cost_matrix[counter+1, self.inl[0].Ex_C_col["chemical"]] = 1
elif self.inl[1].Ex_chemical == 0:
exergy_cost_matrix[counter+1, self.inl[1].Ex_C_col["chemical"]] = 1

for i in range(2):
exergy_cost_vector[counter+i]=0

return [exergy_cost_matrix, exergy_cost_vector, counter+2]

"""+F+F+F+F++++END++++F+F+F+F+"""