Search code examples
brightway

How to add the exchanges with parameters to a group?


I have created a database in Brightway2 and almost all the activities in this database using the parameters. In order to update these parameters, I am using the parameters.add_exchanges_to_group(group, activity) and ActivityParameter.recalculate_exchanges(group)

This code is very slow when there a lot of activities! Are there any other ways to add exchanges to the group in the parameters class?!

Can we define the group in dictionary or list and import it in one step instead of adding the activities one by one to the group?


Solution

  • You can see the parameter code here. There isn't another way to add exchanges.

    What is your use case? If there are lots of parameterized exchanges, maybe storing parameters as text strings is not the best way. I would recommend either writing a library to generate inventory data, or use presamples.