Skip to content

Commit

Permalink
add convinient set_design_result method
Browse files Browse the repository at this point in the history
  • Loading branch information
yoelcortes committed Jul 23, 2024
1 parent c9b57ad commit 7151c2f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Bioindustrial-Park
28 changes: 28 additions & 0 deletions biosteam/_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,34 @@ def get_design_result(self, key: str, units: str):
"""
return convert(self.design_results[key], self._units[key], units)


def set_design_result(self, key: str, units: str, value: float):
"""
Set design result in given the units of measure.
Parameters
----------
key :
Name of design result.
units :
Units of measure.
value:
Value of the design result.
Examples
--------
>>> import biosteam as bst
>>> bst.settings.set_thermo(['Water'], cache=True)
>>> feed = bst.Stream(None, Water=100)
>>> tank = bst.StorageTank(None, feed)
>>> tank.simulate()
>>> tank.set_design_result('Total volume', 'm3', 1000)
>>> tank.get_design_result('Total volume', 'm3')
1000.0
"""
self.design_results[key] = convert(value, units, self._units[key])

def reset_cache(self, isdynamic=None):
pass

Expand Down
2 changes: 1 addition & 1 deletion biosteam/facilities/_boiler_turbogenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def __init__(self, ID='', ins=None,
if satisfy_system_electricity_demand is None: satisfy_system_electricity_demand = True
if fuel_source is None: fuel_source = 'CH4'
if oxygen_rich_gas_composition is None: oxygen_rich_gas_composition = dict(O2=21, N2=79, phase='g', units='kg/hr')
if CO2_emissions_concentration is None: CO2_emissions_concentration = 0.055 # Usually between 4 - 7 for biomass and natural gas
if CO2_emissions_concentration is None: CO2_emissions_concentration = 0.055 # Usually between 4 - 7 for biomass and natural gas (https://www.sciencedirect.com/science/article/pii/S0957582021005127)
bst.Facility.__init__(self, ID, ins, outs, thermo)
settings = bst.settings
self.boiler_efficiency_basis = boiler_efficiency_basis
Expand Down
2 changes: 1 addition & 1 deletion thermosteam

0 comments on commit 7151c2f

Please sign in to comment.