BioSTEAMDevelopmentGroup / Bioindustrial-Park

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

Error about HP model running #128

Closed zasddsgg closed 3 days ago

zasddsgg commented 1 month ago

Hello, I use git clone to download the Bioindustrial-Park, biosteam, thermosteam folder, and install with pip install. But when I run the HP model, I will encounter the following problems. Could I consult you how to run the HP model. Thanks for your help. Wish you a good day.

a) When I run the code in https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/HP/analyses/1_full_evaluation.py, the error will still report. I have downloaded the newest the Bioindustrial-Park, biosteam, thermosteam folder.

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 44
     42 from biosteam.utils import TicToc
     43 from biosteam.plots import plot_montecarlo_across_coordinate
---> 44 from biorefineries.HP.system_light_lle_vacuum_distillation import spec, HP_sys, get_AA_MPSP, get_GWP, get_FEC, R301, simulate_and_print
     46 # from biorefineries.HP.analyses import models # for the baseline biorefinery
     47 # from biorefineries.HP.analyses import models_targeted_improvements as models # for a biorefinery with targeted improvements over the baseline biorefinery
     48 from biorefineries.HP.analyses import models_2015 as models # for the biorefinery with achieved fermentation performance improvements

ModuleNotFoundError: No module named 'biorefineries.HP'

b) When I run the code in https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/HP/TRY_analysis_new.py, the following error will report. It seems that because of code in https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/HP/TRY_analysis_new.py#L755.

  Cell In[8], line 755
    add_shapes = {
                 ^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
yoelcortes commented 1 month ago

@sarangbhagwat, could you help @zasddsgg navigate issues with the HP module? Thanks!

zasddsgg commented 1 month ago

Thank you very much. @yoelcortes Could you take some time to help look at this issue. Thanks a lot @sarangbhagwat.

zasddsgg commented 1 month ago

Hello, could you take some time to help look at this issue. I can't get past the HP code right now. Thanks a lot @sarangbhagwat.

sarangbhagwat commented 1 month ago

@zasddsgg Absolutely, I'm planning to look into it over this weekend/Monday. It's been a hectic Friday and Saturday here at UIUC with the end of the semester, and I haven't been able to get around to it yet since you posted Thursday night.

For a potential quick fix now, I'd suggest adding the "biorefineries" folder that's inside your Bioindustrial-Park clone to your Python paths. Also make sure you don't have the pip-installed "biorefineries" package in your working environment.

zasddsgg commented 1 month ago

Thank you for your advice. I tried to copy the "biorefineries" folder that's inside my Bioindustrial-Park clone into my Python paths (D:\anaconda\envs\zddd\Lib\site-packages). I do not use pip install biorefineries to install, I use cd Bioindustrial-Park, pip install ., cd biosteam, pip install ., cd thermosteam, pip install . to install.

a) But when I run the the code in https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/HP/analyses/1_full_evaluation.py, the following error will still report.

Error in model spec: <multieffectevaporator: f401> failed to extrapolate enthalpy of vaporization method 'dippr_perry_8e' at t=2295.5906179769677 k for component with casrn '64-19-7'
Resetting cache and emptying recycles ...
Loading and simulating with baseline specifications ...
Loading and simulating with required specifications ...
Error in model spec: maximum number of iterations exceeded; root could not be solved
Resetting cache and emptying recycles ...
Loading and simulating with baseline specifications ...
Loading and simulating with required specifications ...
maximum number of iterations exceeded; root could not be solved
Trying fixedpoint ...
maximum number of iterations exceeded; root could not be solved
Trying aitken ...
maximum number of iterations exceeded; root could not be solved
Bugfix barrage failed.

Error in model spec: maximum number of iterations exceeded; root could not be solved
Resetting cache and emptying recycles ...
Loading and simulating with baseline specifications ...
Loading and simulating with required specifications ...
maximum number of iterations exceeded; root could not be solved
Trying fixedpoint ...
maximum number of iterations exceeded; root could not be solved
Trying aitken ...
maximum number of iterations exceeded; root could not be solved
Bugfix barrage failed.

[50] Elapsed time: 747 sec
Error in model spec: <multieffectevaporator: f401> failed to extrapolate enthalpy of vaporization method 'dippr_perry_8e' at t=1145.0040335419658 k for component with casrn '64-19-7'
Resetting cache and emptying recycles ...
Loading and simulating with baseline specifications ...
Loading and simulating with required specifications ...
<MultiEffectEvaporator: F401> Failed to extrapolate enthalpy of vaporization method 'DIPPR_PERRY_8E' at T=1259.8066388378586 K for component with CASRN '64-19-7'
Trying fixedpoint ...
<MultiEffectEvaporator: F401> Failed to extrapolate enthalpy of vaporization method 'DIPPR_PERRY_8E' at T=1150.272144169193 K for component with CASRN '64-19-7'
Trying aitken ...
<MultiEffectEvaporator: F401> Failed to extrapolate enthalpy of vaporization method 'DIPPR_PERRY_8E' at T=1150.2834401096054 K for component with CASRN '64-19-7'
Bugfix barrage failed.

Error in model spec: <multieffectevaporator: f401> failed to extrapolate enthalpy of vaporization method 'dippr_perry_8e' at t=1150.281754703237 k for component with casrn '64-19-7'
Resetting cache and emptying recycles ...
Loading and simulating with baseline specifications ...
Loading and simulating with required specifications ...
Error in model spec: <multieffectevaporator: f401> failed to extrapolate enthalpy of vaporization method 'dippr_perry_8e' at t=2057.5042781514935 k for component with casrn '64-19-7'
Resetting cache and emptying recycles ...
Loading and simulating with baseline specifications ...
Loading and simulating with required specifications ...
<MultiEffectEvaporator: F401> Failed to extrapolate enthalpy of vaporization method 'DIPPR_PERRY_8E' at T=2039.7278118915249 K for component with CASRN '64-19-7'
Trying fixedpoint ...
<MultiEffectEvaporator: F401> Failed to extrapolate enthalpy of vaporization method 'DIPPR_PERRY_8E' at T=2061.7437397735066 K for component with CASRN '64-19-7'
Trying aitken ...
<MultiEffectEvaporator: F401> Failed to extrapolate enthalpy of vaporization method 'DIPPR_PERRY_8E' at T=2061.5826295653646 K for component with CASRN '64-19-7'
Bugfix barrage failed.

Error in model spec: <multieffectevaporator: f401> failed to extrapolate enthalpy of vaporization method 'dippr_perry_8e' at t=2061.607113956943 k for component with casrn '64-19-7'
Resetting cache and emptying recycles ...
Loading and simulating with baseline specifications ...
Loading and simulating with required specifications ...
<MultiEffectEvaporator: F401> Failed to extrapolate enthalpy of vaporization method 'DIPPR_PERRY_8E' at T=2051.597033918451 K for component with CASRN '64-19-7'
Trying fixedpoint ...
<MultiEffectEvaporator: F401> Failed to extrapolate enthalpy of vaporization method 'DIPPR_PERRY_8E' at T=2061.8379537173214 K for component with CASRN '64-19-7'
Trying aitken ...
<MultiEffectEvaporator: F401> Failed to extrapolate enthalpy of vaporization method 'DIPPR_PERRY_8E' at T=2061.846273745416 K for component with CASRN '64-19-7'
Bugfix barrage failed.

b) When I run the code in https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/HP/TRY_analysis_new.py, the following error will still report.

  Cell In[1], line 755
    add_shapes = {
                 ^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
yoelcortes commented 1 month ago

@sarangbhagwat, thanks for looking into this! I will have time to look at it towards the end of the week, so please feel free to let me know of any issues you are running into or things that need to be updated (any where).

@zasddsgg, thanks for sharing the full traceback with the code you are running. Hopefully we can get the HP biorefinery working soon.

sarangbhagwat commented 1 month ago

Hi @zasddsgg,

The TRY_analysis_new issue is fixed in the latest commit; there was a missing comma in the commit before that, thanks for spotting it.

For the messages you are getting when running the uncertainty analysis (1_full_evaluation): those are messages showing errors with specific points during the Monte Carlo analysis. This is because the version of the HP biorefinery on the master branch is currently undergoing updates. However, you will notice there are not many such messages relative to the total number of simulations being run in that analysis (2000 by default), and there should be no fatal errors. Try running the module until 2000 simulations are completed and results are saved.

If, instead of using the most up-to-date HP biorefinery, you would like to reproduce the HP results as they were published in Bhagwat et al. 2021, simply switch to the commit that's linked in the HP biorefinery's README (commit 427ec9a) as well as the biosteam and thermosteam commits linked in the README. This will run without issue.

Feel free to reach out again with issues, and we'll try our best to respond soon.

Best, Sarang

zasddsgg commented 1 month ago

Thank you for your answers and revisions.

a) For import contourplots in https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/master/biorefineries/HP/TRY_analysis_new.py#L12, ModuleNotFoundError: No module named 'contourplots' happens, I don't seem to have found this module in python. Did you write it yourself?

b) If some of the simulations when running 2000 times still return the above error, will the final analysis of the results (such as global sensitivity analysis, 50% quantile, 5% quantile, 95% quantile of MPSP and GWP) use the results of those simulations without error? So it took less than 2,000 simulations to analyze the results, right? In excel for exported uncertainty analysis results, will BioSTEAM automatically delete the results of those simulations that report the above errors, and then automatically analyze the results of the remaining simulations without errors to obtain the results of 5%, 50% and 95% quantiles of GWP and MPSP, and Spearman result in excel?

c) Running 2000 times seems to take a few hours, which seems a bit long, could I ask you why don't run 100 times or 1000 times, but 2000 times?

d) In commit 427ec9a, the version and associated code used for the article were not found. May I ask where I can find the version of used biorefineries, BioSTEAM, thermosteam and the related code (e.g. System, Uncertainty analysis, TRY)?

zasddsgg commented 3 days ago

Hello, could I trouble you help with this issue @sarangbhagwat, thanks for your help again.

zasddsgg commented 3 days ago

I solved the problem a).

But for problem b-d, could I trouble you help with them. Thanks for your help again.

b) If some of the simulations when running 2000 times still return the above error, will the final analysis of the results (such as global sensitivity analysis, 50% quantile, 5% quantile, 95% quantile of MPSP and GWP) use the results of those simulations without error? So it took less than 2,000 simulations to analyze the results, right? In excel for exported uncertainty analysis results, will BioSTEAM automatically delete the results of those simulations that report the above errors, and then automatically analyze the results of the remaining simulations without errors to obtain the results of 5%, 50% and 95% quantiles of GWP and MPSP, and Spearman result in excel?

c) Running 2000 times seems to take a few hours, which seems a bit long, could I ask you why don't run 100 times or 1000 times, but 2000 times?

d) In commit 427ec9a, the version and associated code used for the article were not found. May I ask where I can find the version of used biorefineries, BioSTEAM, thermosteam and the related code (e.g. System, Uncertainty analysis, TRY)?

sarangbhagwat commented 3 days ago

Hi, @zasddsgg.

(a) If you are choosing to run the work-in-progress version of HP, you need contourplots. This is a module we have been developing recently to plot certain figures. Simply execute pip install contourplots.

(b) Again, for the work-in-progress version of HP, the final results will exclude points with errors. Yes, that means it will use fewer than 2000 simulations. That is why I strongly suggest using the publication version of HP.

(c) We chose 2000 simulations to ensure stable results. 500 is too few; 1000 and 2000 give roughly the same results to the 3rd significant digit. Again, this is for the publication version of HP.

(d) All analyses and files are in fact present in commit 427ec9a. You will need to click 'Browse files' and navigate to the HP module to see them. To make it easier for you, here is the link: https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/tree/427ec9ad260de62d97f1591cb46891207af8951a/BioSTEAM%202.x.x/biorefineries/HP . The README on that page also provides full guidance on installation and usage, but feel free to let us know if you need any further help with that.

We're very happy you are using these modules! Just a note, for questions like (d), we'd encourage you to explore at least a little further before posting, especially as using the publication version of HP would also have resolved questions (a) - (c) for you. We appreciate your questions a lot, but as we are a growing community, it would be very helpful to have less overlap between some of the questions you have, and to see them consolidated instead. Thanks again.

zasddsgg commented 3 days ago

Thank you very much for your answer and recommendation. I got it. Thanks for your help again. Wish you a good day.

sarangbhagwat commented 3 days ago

No problem! Thank you too for your understanding. Hope you have a great day!