Summary:
Context
I am replicating published Agribalyse 3.2 consumer product results (e.g. AGRIBALYSE 3.2 – Tableur produits alimentaires) by running the same LCI in OpenLCA via the internal script editor (Jython). Test process: Milk, whole, pasteurised, processed in FR | Ambient (long) | Pack | No preparation | at consumer {FR} [Ciqual code: 19024] U. Functional unit: 1 kg. Impact method: EF 3.1 Method (adapted).
Expected vs actual
- OpenLCA UI with allocation “As defined in process” / “Process defaults”: Climate change = 1.46 kg CO2e/kg (matches published value).
- Same calculation in UI with allocation “None”: Climate change = 1.489… kg CO2e/kg.
- Internal Jython script (building product system with ProductSystemBuilder, then CalculationSetup.of(system).withImpactMethod(...).withAmount(1.0).withUnit(...), and calling SystemCalculator.calculate(setup)): Climate change = 1.489… kg CO2e/kg — i.e. the same as the UI with “None” allocation.
Finding
The script result matches the UI only when the UI allocation is set to “None”. After building the setup, reading back the allocation (e.g. via setup.getAllocation() or setup.allocation) always returns NONE, regardless of trying to set it via withAllocation(allocEnum), setAllocation(allocEnum), or setup.allocation = allocEnum. So the calculator appears to run with no allocation.
In addition, in this Jython context we could not load the AllocationType enum (tried org.openlca.core.model.AllocationType, org.openlca.schema.AllocationType, Class.forName(...), and AllocationMethod) to pass e.g. USE_DEFAULT_ALLOCATION into the setup.
Question
How can we set the calculation allocation to “process defaults” (or “as defined in process”) from the internal Jython script so that results match the UI and the published Agribalyse values (1.46 kg CO2e/kg for this process)? Is there a supported way to apply allocation in the script/API, or is this a known limitation?
Environment
OpenLCA 2.x, Agribalyse 3.2 database, script run from the built-in script editor (Jython) with database open.