BioSTEAMDevelopmentGroup / Bioindustrial-Park

BioSTEAM's Premier Repository for Biorefinery Models and Results
MIT License
36 stars 17 forks source link

Consultation about TCI_ratio in uncertainty analysis #127

Open zasddsgg opened 1 month ago

zasddsgg commented 1 month ago

a) Hello, as for the setting of TCI_ratio, it seems that it only applies to the unit created using the cost decorator (https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/lactic/models.py#L251-L258). Why does the cost of other units (such as bst.units.Pump, bst.units.HXutility, bst.units.Flash) remain unchanged in uncertainty analysis?

b) For BatchCrystallizer, the code I use is BC101 = bst.units.BatchCrystallizer('BC101', inlet, outlet, tau=24, V=3000, T=30 + 273.15), but why does the following code return None, which causes an error (TypeError: unsupported operand type(s) for /=: 'NoneType' and 'int') when running the code unit.cost_items[item].cost /= old_ratio (https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/lactic/models.py#L251-L258)? The code is as follows:

import biosteam as bst
from biorefineries import cellulosic
cs = cellulosic.Biorefinery('corn stover ethanol')
inlet = cs.cornstover
BC101 = bst.units.BatchCrystallizer('BC101', inlet, 'outlet', tau=24, V=3000, T=30 + 273.15)
for item in BC101.cost_items:
    print(BC101.cost_items[item].cost)
yalinli2 commented 1 month ago

TCI_ratio is just a factor we added considering we are not sure of the actual cost of the equipment. It can be applied to any unit, just a matter of how you add it. You need to understand how biosteam calculate the cost for a unit (which is described in detail in the tutorials) to write the code for your specific case. We unfortunately don't have the manpower/resources to help other people write their codes, we make biosteam open-source so other people can look at the codes and figure it out themselves, there is no mystery on how biosteam works.

zasddsgg commented 1 month ago

But code if hasattr(unit, 'cost_items') seems to decide that only units with cost_items will execute the following unit.cost_items[item].cost /= old_ratio. For units created via bst.units.Pump, bst.units.HXutility, bst.units.Flash, it will report AttributeError: 'HXutility' object has no attribute 'cost_items', so the cost of it will not change.