cauldron / activity-browser

GUI for Brightway
GNU Lesser General Public License v3.0
0 stars 3 forks source link

Graphical elements for handling multifunctionality #33

Closed cmutel closed 1 month ago

cmutel commented 4 months ago

Feature request

We have a backend library for allocating multifunctional processes: https://github.com/brightway-lca/multifunctional. A multifunctional process is one which produces more than one useful function, such as a gas turbine that can product heat and electricity. Note that inputs can also be functional, e.g. a recycling center can take in waste aluminium (waste treatment function) and create useful raw materials.

We would like to extend the Activity Browser to exposes some of this multifunctional functionality to AB users. Namely, we need to support the following:

Defining and editing properties

Defining default allocation

Database objects can have a default_allocation metadata key. In code, this looks like:

import bw2data
bw2data.Database("some label").metadata['default_allocation'] = 'something'

The values for default_allocation must be in multifunctional.allocation_strategies (see default values).

Adding allocation methods

multifunctional can support arbitrary allocation functions, but we don't need that for the AB. Instead, we only need to support new property-based allocations. These have a simple code form, and the multifunctional.allocation_strategies can be appended to on demand (either AB startup or some other convenient time).

Redoing allocation on changes

This is done automatically whenever a calculation is made. However, it isn't done when changes are made.

LCA for multifunctional activities

Multifunctional activities cannot be used in LCA calculations.

Feedback on allocation