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:
[x] The popup window should create the properties dictionary if it is not present
[x] The popup window should allow existing properties to be edited or deleted, and new properties to be created. The activity node should be saved whenever such an action is taken.
Defining default allocation
Database objects can have a default_allocation metadata key. In code, this looks like:
The values for default_allocation must be in multifunctional.allocation_strategies (see default values).
[x] Users should be able to see, and add or edit, the default_allocation metadata key for each Database in the project
[x] Users should be able to create, update, or delete the default_allocation on processes as well - see the docs. These values override the Database default if given.
[x] Displaying and having the option to change the default allocation only makes sense for multifunctional process nodes, i.e. nodes which have the type multifunctional. These display and selection components should not be displayed for any other node types.
[ ] The text for database "Def. Allocation" for non-multifunctional databases (i.e. bw2data.databases['<name>'].get("backend") != "multifunctional") should be "Not applicable"
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).
[x] Users can add new allocation functions by specifying their label (corresponds to default_allocation) and property label (corresponds to labels used in process properties).
Redoing allocation on changes
This is done automatically whenever a calculation is made. However, it isn't done when changes are made.
[ ] Changing the default allocation method for a database should redo allocation (i.e. call bw2data.Database('<name>').process().
[ ] Changing the default allocation for a multifunctional activity should redo allocation (i.e. call bw2data.Database('<name>').process().
[ ] Each Database object which is a subclass ofmultifunctional.MultifunctionalDatabase (can also test bw2data.databases['<name>'].get("backend") == "multifunctional", this is the same underlying code path) should have the option to redo allocation via an action in the database panel right click contextual menu. To redo allocation, call bw2data.Database('<name>').process().
[ ] Re-allocating a database should force a data table refresh for all right side activity details "Products" panels whose activities reference that database to get new allocation factors.
LCA for multifunctional activities
Multifunctional activities cannot be used in LCA calculations.
[ ] Database processes which have the type multifunctional cannot be dragged into calculation setups
Feedback on allocation
[ ] Uses should be able to see if the given allocation property key is present and non-zero for each functional exchange of each multifunctional process in a database.
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
properties
of a process in the inventory tab. Properties are a dictionary ofstr: float
values. See themultifunctional
test fixtures for examples.properties
dictionary if it is not presentDefining default allocation
Database
objects can have adefault_allocation
metadata key. In code, this looks like:The values for
default_allocation
must be inmultifunctional.allocation_strategies
(see default values).default_allocation
metadata key for eachDatabase
in the projectdefault_allocation
on processes as well - see the docs. These values override theDatabase
default if given.multifunctional
. These display and selection components should not be displayed for any other node types.bw2data.databases['<name>'].get("backend") != "multifunctional"
) should be "Not applicable"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 themultifunctional.allocation_strategies
can be appended to on demand (either AB startup or some other convenient time).default_allocation
) and property label (corresponds to labels used in processproperties
).Redoing allocation on changes
This is done automatically whenever a calculation is made. However, it isn't done when changes are made.
bw2data.Database('<name>').process()
.bw2data.Database('<name>').process()
.Database
object which is a subclass ofmultifunctional.MultifunctionalDatabase
(can also testbw2data.databases['<name>'].get("backend") == "multifunctional"
, this is the same underlying code path) should have the option to redo allocation via an action in the database panel right click contextual menu. To redo allocation, callbw2data.Database('<name>').process()
.LCA for
multifunctional
activitiesMultifunctional activities cannot be used in LCA calculations.
multifunctional
cannot be dragged into calculation setupsFeedback on allocation
functional
exchange of eachmultifunctional
process in a database.