use of org.openlca.core.model.AllocationFactor in project olca-modules by GreenDelta.
the class TestProcess method alloc.
/**
* Adds an economic or physical allocation factor for the given flow and
* method to the process. Use this method *after* the exchanges are added.
*/
public TestProcess alloc(String flow, AllocationMethod method, double factor) {
AllocationFactor f = new AllocationFactor();
f.method = method;
Exchange e = findExchange(process, flow);
f.productId = e.flow.id;
f.value = factor;
process.allocationFactors.add(f);
return this;
}
use of org.openlca.core.model.AllocationFactor in project olca-modules by GreenDelta.
the class ProcessImport method switchAllocationProducts.
private void switchAllocationProducts(Process srcProcess, Process destProcess) {
for (AllocationFactor factor : destProcess.allocationFactors) {
long srcProductId = factor.productId;
String srcRefId = null;
for (Exchange srcExchange : srcProcess.exchanges) {
if (srcExchange.flow == null)
continue;
if (srcExchange.flow.id == srcProductId) {
srcRefId = srcExchange.flow.refId;
}
}
factor.productId = seq.get(seq.FLOW, srcRefId);
}
}
Aggregations