Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with system.get_net_impact() for LCA #13

Open
daltonwstewart opened this issue Feb 15, 2024 · 1 comment
Open

Issue with system.get_net_impact() for LCA #13

daltonwstewart opened this issue Feb 15, 2024 · 1 comment

Comments

@daltonwstewart
Copy link
Collaborator

Hi @yoelcortes

I hope you're doing well! I'm working on performing LCA with BLocS for one of my dissertation projects, but I've run into a slight problem with the built in system.get_net_impact() function.

When trying to run corn_LCFP_eval.py I get this error message (there is more to it but these are the last and most relevant lines):

File "/Users/daltonwstewart/Documents/Code/BLocS/blocs/corn_LCFP_eval.py", line 172, in get_total_CI_SD
LCA_3(system, NG_SD, cons_SD) +

File "/Users/daltonwstewart/Documents/Code/BLocS/blocs/corn_LCFP_eval.py", line 119, in LCA_3
total_emissions = system.get_net_impact(key=key) / system.get_mass_flow(cn.ethanol) # [kg CO2e/kg ethanol]

File "/opt/anaconda3/lib/python3.9/site-packages/biosteam/_system.py", line 2983, in get_net_impact
self.get_total_feeds_impact(key)

File "/opt/anaconda3/lib/python3.9/site-packages/biosteam/_system.py", line 2931, in get_total_feeds_impact
return sum([s.F_mass * s.characterization_factors[key] for s in self.feeds

File "/opt/anaconda3/lib/python3.9/site-packages/biosteam/_system.py", line 2932, in
if key in s.characterization_factors]) * self.operating_hours

TypeError: argument of type 'numpy.float64' is not iterable

It seems that the characterization factors for the feeds don't format in a way that the function can use. Can you take a look and see if it's the function or the way I've defined things in my file?

Thank you!
Dalton

@yoelcortes
Copy link
Member

@daltonwstewart.

Sure, I believe is related to line 230 tea.feedstock.characterization_factors = CI. The characterization_factors attribute is a dictionary. Use set_CF, as shown in https://biosteam.readthedocs.io/en/latest/tutorial/Life_cycle_assessment.html. For details on set_CF, check out https://biosteam.readthedocs.io/en/latest/API/thermosteam/Stream.html#thermosteam.Stream.set_CF.

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants