Skip to content

Commit 5524e45

Browse files
committed
release
1 parent 1538229 commit 5524e45

File tree

9 files changed

+129
-112
lines changed

9 files changed

+129
-112
lines changed

Bioindustrial-Park

Submodule Bioindustrial-Park updated 28 files

biosteam/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
"""
1515
from __future__ import annotations
16-
__version__ = '2.51.13'
16+
__version__ = '2.51.14'
1717

1818
#: Chemical engineering plant cost index (defaults to 567.5 at 2017).
1919
CE: float = 567.5

biosteam/_system.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3370,7 +3370,8 @@ def _price2cost(self, stream):
33703370

33713371
def get_net_heat_utility_impact(self,
33723372
agent: bst.UtilityAgent, key: str,
3373-
heat_utilities: Optional[tuple[bst.HeatUtility]]=None
3373+
heat_utilities: Optional[tuple[bst.HeatUtility]]=None,
3374+
displace=True
33743375
):
33753376
if isinstance(agent, str):
33763377
ID = agent
@@ -3387,6 +3388,7 @@ def get_net_heat_utility_impact(self,
33873388
if heat_utilities is None: heat_utilities = self.heat_utilities
33883389
for hu in heat_utilities:
33893390
if hu.agent and hu.agent.ID == ID:
3391+
if not displace and hu.flow < 0: continue
33903392
if units == 'kg':
33913393
return hu.flow * CF * agent.MW * self.operating_hours
33923394
elif units == 'kmol':
@@ -3397,17 +3399,19 @@ def get_net_heat_utility_impact(self,
33973399
raise RuntimeError("unknown error")
33983400
return 0.
33993401

3400-
def get_net_electricity_impact(self, key):
3402+
def get_net_electricity_impact(self, key, displace=True):
3403+
power_utility = self.power_utility
3404+
if not displace and power_utility.power < 0: return 0.
34013405
try:
34023406
return self.power_utility.get_impact(key) * self.operating_hours
34033407
except KeyError:
34043408
return 0.
34053409

3406-
def get_net_utility_impact(self, key):
3410+
def get_net_utility_impact(self, key, displace=True):
34073411
agents = (*bst.HeatUtility.cooling_agents,
34083412
*bst.HeatUtility.heating_agents)
34093413
heat_utilities = self.heat_utilities
3410-
return sum([self.get_net_heat_utility_impact(i, key, heat_utilities) for i in agents]) + self.get_net_electricity_impact(key)
3414+
return sum([self.get_net_heat_utility_impact(i, key, heat_utilities, displace) for i in agents]) + self.get_net_electricity_impact(key, displace)
34113415

34123416
def get_total_feeds_impact(self, key):
34133417
"""
@@ -3449,7 +3453,7 @@ def get_total_input_impact(self, key):
34493453
impact += power_utility.get_impact(key)
34503454
return impact * self.operating_hours
34513455

3452-
def get_process_impact(self, key):
3456+
def get_process_impact(self, key, displace=True):
34533457
"""
34543458
Return the annual process impact given the impact indicator key.
34553459
@@ -3460,21 +3464,32 @@ def get_process_impact(self, key):
34603464
return 0.
34613465
else:
34623466
if key in process_impact_items:
3463-
return sum([item.impact() for item in process_impact_items[key]])
3467+
if displace:
3468+
return sum([item.impact() for item in process_impact_items[key]])
3469+
else:
3470+
return sum([flow * item.CF for item in process_impact_items[key] if (flow:=item.inventory()) > 0])
34643471
else:
34653472
return 0.
34663473

3467-
def get_net_impact(self, key):
3474+
def get_net_impact(self, key, displace=True):
34683475
"""
3469-
Return net annual impact, including displaced impacts, given the impact indicator key.
3476+
Return net annual impact, given the impact indicator key. If displace
3477+
is True, impacts from coproducts will substracted.
34703478
34713479
"""
3472-
return (
3473-
self.get_total_feeds_impact(key)
3474-
+ self.get_process_impact(key)
3475-
+ self.get_net_utility_impact(key)
3476-
- self.get_total_products_impact(key)
3477-
)
3480+
if displace:
3481+
return (
3482+
self.get_total_feeds_impact(key)
3483+
+ self.get_process_impact(key)
3484+
+ self.get_net_utility_impact(key)
3485+
- self.get_total_products_impact(key)
3486+
)
3487+
else:
3488+
return (
3489+
self.get_total_feeds_impact(key)
3490+
+ self.get_process_impact(key, displace=displace)
3491+
+ self.get_net_utility_impact(key, displace=displace)
3492+
)
34783493

34793494
def get_property_allocated_impact(self, key, name, basis, ignored=None, products=None):
34803495
if ignored is None: ignored = frozenset()

biosteam/evaluation/_parameter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, name, setter, element, system, distribution,
6464
distribution = shape.Uniform(*bounds)
6565
case _:
6666
raise ValueError(f"invalid distribution {distribution!r}; distribution must be either 'triangular' or 'uniform'")
67-
elif not bounds:
67+
elif bounds is None:
6868
if distribution: bounds = (distribution.lower[0], distribution.upper[0])
6969
elif not distribution:
7070
distribution = shape.Uniform(*bounds)

biosteam/plots/plots.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,8 @@ def plot_uncertainty_pairs_1d(
12231223
for values in ys:
12241224
if hasattr(values, 'ndim') and values.ndim == 1:
12251225
y.append(values)
1226+
fill.append(xbox.fill)
1227+
edge.append(xbox.edge)
12261228
else:
12271229
y.extend(values)
12281230
if ybox.fill is None and ybox.edge is None:

docs/tutorial/Comparative_techno-economic_analysis.ipynb

Lines changed: 7 additions & 7 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)