BioSTEAMDevelopmentGroup / BLocS

BioSTEAM Location-Specific Evaluation
Other
4 stars 1 forks source link

Corn stover reactions / TEA problem #2

Closed daltonwstewart closed 2 years ago

daltonwstewart commented 2 years ago

Hi again @yoelcortes,

I'm having a separate problem with eval_by_state.py when I try to run it for the corn stover biorefinery. I added the uncertain parameters from biorefineries/cornstover/webapp_model.py like we discussed, and now I get this error: InfeasibleRegion: <System: SYS7> <SaccharificationAndCoFermentation: R303> not enough reactants; reaction conversion is infeasible.

Do I need to modify how I set up the parameters? I'm not sure where this error comes into play, so I would greatly appreciate it if you could take a look. Thank you!

daltonwstewart commented 2 years ago

@yoelcortes, here is the entire traceback for this issue, which happens when I run evaluate_SS('cornstover') in eval_by_state.py

Traceback (most recent call last):

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/flexsolve/iterative_solvers.py", line 139, in conditional_aitken g, condition = f(x)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1266, in _iter_run self._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1357, in _run if isa(i, Unit): run(i, i.run)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 78, in try_method_with_object_stamp raise_error_with_object_stamp(object, error)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 70, in raise_error_with_object_stamp raise error

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 74, in try_method_with_object_stamp return method(*args)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_unit.py", line 780, in run for i in specification: i()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biorefineries/cornstover/_system.py", line 534, in adjust_CSL_and_DAP_feed_to_fermentation R303._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biorefineries/cornstover/units.py", line 538, in _run self.cofermentation(effluent)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/reaction/_reaction.py", line 393, in call raise InfeasibleRegion('not enough reactants; reaction conversion')

InfeasibleRegion: not enough reactants; reaction conversion is infeasible

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/evaluation/_model.py", line 326, in _evaluate_sample self._update_state(sample, thorough, **dyn_sim_kwargs)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/evaluation/_state.py", line 376, in _update_state raise Error

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/evaluation/_state.py", line 362, in _update_state self._specification() if self._specification else self._system.simulate(**dyn_sim_kwargs)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1663, in simulate else: self._converge()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1403, in _converge self._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1358, in _run elif isa(i, System): converge(i)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 98, in converge_system_in_path try_method_with_object_stamp(system, method)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 78, in try_method_with_object_stamp raise_error_with_object_stamp(object, error)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 70, in raise_error_with_object_stamp raise error

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 74, in try_method_with_object_stamp return method(*args)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1401, in _converge self._converge_method()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1372, in _aitken self._solve(flx.conditional_aitken)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1390, in _solve solver(f, self._get_recycle_data())

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/flexsolve/iterative_solvers.py", line 142, in conditional_aitken g, condition = f(x)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1266, in _iter_run self._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1357, in _run if isa(i, Unit): run(i, i.run)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 78, in try_method_with_object_stamp raise_error_with_object_stamp(object, error)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 70, in raise_error_with_object_stamp raise error

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 74, in try_method_with_object_stamp return method(*args)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_unit.py", line 780, in run for i in specification: i()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biorefineries/cornstover/_system.py", line 534, in adjust_CSL_and_DAP_feed_to_fermentation R303._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biorefineries/cornstover/units.py", line 538, in _run self.cofermentation(effluent)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/reaction/_reaction.py", line 393, in call raise InfeasibleRegion('not enough reactants; reaction conversion')

InfeasibleRegion: not enough reactants; reaction conversion is infeasible

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/flexsolve/iterative_solvers.py", line 139, in conditional_aitken g, condition = f(x)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1266, in _iter_run self._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1357, in _run if isa(i, Unit): run(i, i.run)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 78, in try_method_with_object_stamp raise_error_with_object_stamp(object, error)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 70, in raise_error_with_object_stamp raise error

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 74, in try_method_with_object_stamp return method(*args)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_unit.py", line 780, in run for i in specification: i()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biorefineries/cornstover/_system.py", line 534, in adjust_CSL_and_DAP_feed_to_fermentation R303._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biorefineries/cornstover/units.py", line 538, in _run self.cofermentation(effluent)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/reaction/_reaction.py", line 393, in call raise InfeasibleRegion('not enough reactants; reaction conversion')

InfeasibleRegion: not enough reactants; reaction conversion is infeasible

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "", line 1, in evaluate_SS('cornstover')

File "/Users/daltonstewart/Dropbox/Stewart-Guest_Shared/Code/BLocS/blocs/incentives/eval_by_state.py", line 505, in evaluate_SS model.evaluate()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/evaluation/_model.py", line 321, in evaluate values[i] = evaluate(samples[i], thorough, **dyn_sim_kwargs)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/evaluation/_model.py", line 336, in _evaluate_sample values = self._exception_hook(new_exception, sample)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/evaluation/_model.py", line 103, in raise_exception def raise_exception(exception, sample): raise exception

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/evaluation/_model.py", line 332, in _evaluate_sample self._specification() if self._specification else self._system.simulate(**dyn_sim_kwargs)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1663, in simulate else: self._converge()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1403, in _converge self._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1358, in _run elif isa(i, System): converge(i)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 98, in converge_system_in_path try_method_with_object_stamp(system, method)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 78, in try_method_with_object_stamp raise_error_with_object_stamp(object, error)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 70, in raise_error_with_object_stamp raise error

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 74, in try_method_with_object_stamp return method(*args)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1401, in _converge self._converge_method()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1372, in _aitken self._solve(flx.conditional_aitken)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1390, in _solve solver(f, self._get_recycle_data())

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/flexsolve/iterative_solvers.py", line 142, in conditional_aitken g, condition = f(x)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1266, in _iter_run self._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_system.py", line 1357, in _run if isa(i, Unit): run(i, i.run)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 78, in try_method_with_object_stamp raise_error_with_object_stamp(object, error)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 70, in raise_error_with_object_stamp raise error

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/exceptions.py", line 74, in try_method_with_object_stamp return method(*args)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biosteam/_unit.py", line 780, in run for i in specification: i()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biorefineries/cornstover/_system.py", line 534, in adjust_CSL_and_DAP_feed_to_fermentation R303._run()

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/biorefineries/cornstover/units.py", line 538, in _run self.cofermentation(effluent)

File "/Users/daltonstewart/anaconda3/lib/python3.7/site-packages/thermosteam/reaction/_reaction.py", line 393, in call raise InfeasibleRegion('not enough reactants; reaction conversion')

InfeasibleRegion: not enough reactants; reaction conversion is infeasible

yoelcortes commented 2 years ago

Hi @dstew16, when you copied the code from the webapp_model, you added a tab in https://github.com/BioSTEAMDevelopmentGroup/BLocS/blob/aeded4104291cc2aa37b208e092ea013b3fb4f9f/blocs/incentives/eval_by_state.py#L311. If you move the nested if statement outside it'll be fixed.

I also just fixed a bug with the new biosteam version (if you updated, please updated again jaja; otherwise, it should be fine).

Thanks!

daltonwstewart commented 2 years ago

Everything seems to be working now! Thanks so much for all your help!