brightway-lca / brightway2

Metapackage for brightway2 imports and documentation
https://brightway.dev/
BSD 3-Clause "New" or "Revised" License
100 stars 37 forks source link

Trying to create activity parameters through imports of databases #65

Closed MaximeAgez closed 1 year ago

MaximeAgez commented 1 year ago

Hi, I have a small project to make an exporter taking a SimaPro CSV and dumping it into activity-browser. There are some hurdles to account for (multi-output processes for example), but right now I am struggling to have the parameters exported AND working. If anyone has some idea where I am missing something that would help me greatly.

Of course when the module will ultimately work, I am willing to share it with anyone interested.

After using write_database() and after creating database parameters through write_database_parameters() (both functions from the SimaProCSVImporter class of brightway2), I then define activity parameters using the new_activity_parameters() function of bw2data.parameters. I make sure to have only one group of activity parameters per activity parameters. The import happens properly as can be shown in the parameters.db screenshot below:

image

I also made sure to add the _1 unit activity parameters which (to my knowledge) are required for the formulas to work as intended.

The problem that I have is that the values that are shown in AB are not the values calculated from formulas. I suspect the problem to be that none of the exchanges that are created through the write_database() function are defined as parametrized exchanges within the parameters.db. The problem is that I have no idea how to force brightway to create those parametrized exchanges in the parameters.db.

Anyone knows?

Thanks!