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);
}
}
}
Aggregations