Search in sources :

Example 1 with IAllocation

use of org.openlca.ecospold.IAllocation in project olca-modules by GreenDelta.

the class EcoSpold01Import method mapAllocations.

private void mapAllocations(Process process, List<IAllocation> allocations) {
    for (IAllocation allocation : allocations) {
        double factor = Math.round(allocation.getFraction() * 10000d) / 1000000d;
        Exchange product = localExchangeCache.get(allocation.getReferenceToCoProduct());
        for (Integer i : allocation.getReferenceToInputOutput()) {
            Exchange e = localExchangeCache.get(i);
            if (e == null) {
                log.warn("allocation factor points to an exchange that " + "does not exist: " + i);
                continue;
            }
            AllocationFactor af = new AllocationFactor();
            af.productId = product.flow.id;
            af.value = factor;
            af.method = AllocationMethod.CAUSAL;
            af.exchange = e;
            process.allocationFactors.add(af);
        }
    }
}
Also used : IExchange(org.openlca.ecospold.IExchange) Exchange(org.openlca.core.model.Exchange) IAllocation(org.openlca.ecospold.IAllocation) AllocationFactor(org.openlca.core.model.AllocationFactor)

Aggregations

AllocationFactor (org.openlca.core.model.AllocationFactor)1 Exchange (org.openlca.core.model.Exchange)1 IAllocation (org.openlca.ecospold.IAllocation)1 IExchange (org.openlca.ecospold.IExchange)1