+1 vote
28 views

I am attempting to assign an economic allocation method for a calculation setup in using olca.ipc in Python with "setup.allocation_method=olca.AllocationType.ECONOMIC_ALLOCATION" in the below code:

This does seem to work and exports the result table below:

What am I doing wrong?

in openLCA by (150 points)
ago by (150 points)
the following code is what I used. I found the update in another question that fixed the problem of the USE_DEFAULT_ALLOCATION being undefined. restarted OLCA and IPC when I test the same product syteem with defaule and economic allocation, the result is the same through IPC, but different when using the calculation dialog box (the 'none' allocation gives the result found with IPC).

for sc in tst:
# create the calculation setup
    setup = olca.CalculationSetup()

# define the calculation type here
# see http://greendelta.github.io/olca-schema/html/CalculationType.html
    setup.calculation_type = olca.CalculationType.CONTRIBUTION_ANALYSIS
    setup.allocation_method = olca.AllocationType.ECONOMIC_ALLOCATION
# select the product system and LCIA method
    setup.impact_method = client.find(olca.ImpactMethod, 'ReCiPe 2016 Midpoint (H)')
    setup.product_system = client.find(olca.ProductSystem, sc)

# amount is the amount of the functional unit (fu) of the system that
# should be used in the calculation; unit, flow property, etc. of the fu
# can be also defined; by default openLCA will take the settings of the
# reference flow of the product system
    setup.amount = 1.0
# calculate the result and export it to an Excel file
    result = client.calculate(setup)
    client.excel_export(result, sc + 'ea.xlsx')

# the result remains accessible (for exports etc.) until
# you dispose it, which you should always do when you do
# not need it anymore
    client.dispose(result)

Please log in or register to answer this question.

...