Skip to content

Commit

Permalink
better feed priority; 0.49.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
yoelcortes committed Dec 16, 2024
1 parent 9a6bd00 commit bea8c7d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
name='thermosteam',
packages=['thermosteam'],
license='MIT',
version='0.49.0',
version='0.49.1',
description="BioSTEAM's Premier Thermodynamic Engine",
long_description=open('README.rst', encoding='utf-8').read(),
author='Yoel Cortes-Pena',
Expand Down
2 changes: 1 addition & 1 deletion thermosteam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# update_module(chemicals, numba)
# use_numba_chemicals()
# del use_numba_chemicals
__version__ = "0.49.0"
__version__ = "0.49.1"

from . import thermo
del thermo
Expand Down
8 changes: 6 additions & 2 deletions thermosteam/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2079,20 +2079,24 @@ def unmark_disjunction(stream):
if port in disjunctions:
disjunctions.remove(port)

def feed_complexity(stream):
return stream.F_mass * (stream.mol != 0).sum()** 2

def sort_feeds_big_to_small(feeds):
if feeds:
feed_priorities = tmo.AbstractStream.feed_priorities
feed_complexities = {i: feed_complexity(i) for i in feeds}
def feed_priority(feed):
if feed in feed_priorities:
return feed_priorities[feed]
elif feed:
try:
return 1. - feed.F_mass / F_mass_max if F_mass_max else 1.
return 1. - feed_complexities[feed] / max_complexity if max_complexity else 1.
except:
return 2
else:
return 2.
F_mass_max = max([i.F_mass for i in feeds])
max_complexity = max(feed_complexities.values())
feeds.sort(key=feed_priority)

# %% Path tools
Expand Down

0 comments on commit bea8c7d

Please sign in to comment.