BioSTEAMDevelopmentGroup / biosteam

The Biorefinery Simulation and Techno-Economic Analysis Modules; Life Cycle Assessment; Chemical Process Simulation Under Uncertainty
Other
176 stars 35 forks source link

AttributeError: 'Stream' object has no attribute 'indices' #160

Closed adilsal33m closed 1 year ago

adilsal33m commented 1 year ago

Describe the bug Setting the 'iskinetic' attribute of Fermentation class to true gives an AttributeError.

To Reproduce I have only set the iskinetic parameter to True wihich is False by default: from biorefineries.cane import create_sugarcane_chemicals from biosteam.units import Fermentation from biosteam import Stream, settings

settings.set_thermo(create_sugarcane_chemicals()) feed = Stream('feed', Water=1.20e+05, Glucose=1.89e+03, Sucrose=2.14e+04, DryYeast=1.03e+04, units='kg/hr', T=32+273.15) F1 = Fermentation('F1', ins=feed, outs=('CO2', 'product'), tau=8, efficiency=0.90, N=8,iskinetic=True) F1.simulate() F1.show()

Actual behavior

AttributeError Traceback (most recent call last) e:\OneDrive - Institute of Business Administration\PhD\Summer 2023\Research\xai-implementations\fermentation.ipynb Cell 18 in () 7 feed = Stream('feed', 8 Water=1.20e+05, 9 Glucose=1.89e+03, (...) 12 units='kg/hr', 13 T=32+273.15) 14 F1 = Fermentation('F1', 15 ins=feed, outs=('CO2', 'product'), 16 tau=8, efficiency=0.90, N=8,iskinetic=True) ---> 17 F1.simulate() 18 F1.show()

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\biosteam_unit.py:1639, in Unit.simulate(self, run, design_kwargs, cost_kwargs) 1637 for ps in self._specifications: ps.compile_path(self) 1638 self._load_stream_links() -> 1639 self.run() 1640 self._summary(design_kwargs, cost_kwargs)

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\biosteam_unit.py:1367, in Unit.run(self) 1365 if self.run_after_specifications: self._run() 1366 else: -> 1367 self._run()

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\biosteam\units_fermentation.py:298, in Fermentation._run(self) 296 self.hydrolysis_reaction.force_reaction(effluent) 297 if self.iskinetic: --> 298 self.fermentation_reaction.X = self._calc_efficiency(effluent, self._tau) 299 self.fermentation_reaction.force_reaction(effluent) 300 self.cell_growth_reaction.force_reaction(effluent)

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\biosteam\units_fermentation.py:218, in Fermentation._calc_efficiency(self, feed, tau) 216 def _calc_efficiency(self, feed, tau): # pragma: no cover 217 # Get initial concentrations --> 218 y, e, s, w = feed.indices(['Yeast', 219 '64-17-5', 220 '492-61-5', 221 '7732-18-5']) 222 mass = feed.mass 223 F_vol = feed.F_vol

AttributeError: 'Stream' object has no attribute 'indices'

Version Name: biosteam Version: 2.37.3

yoelcortes commented 1 year ago

Thanks for the detailed bug report. It should be fixed with the latest commit to BioSTEAM. I also upload a new version to PyPI (pip install biosteam==2.37.4).

Thanks,