Search in sources :

Example 11 with AllocationFactor

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;
}
Also used : Exchange(org.openlca.core.model.Exchange) AllocationFactor(org.openlca.core.model.AllocationFactor)

Example 12 with AllocationFactor

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);
    }
}
Also used : Exchange(org.openlca.core.model.Exchange) AllocationFactor(org.openlca.core.model.AllocationFactor)

Aggregations

AllocationFactor (org.openlca.core.model.AllocationFactor)12 Exchange (org.openlca.core.model.Exchange)6 JsonObject (com.google.gson.JsonObject)3 JsonArray (com.google.gson.JsonArray)2 JsonElement (com.google.gson.JsonElement)1 AllocationMethod (org.openlca.core.model.AllocationMethod)1 Flow (org.openlca.core.model.Flow)1 IAllocation (org.openlca.ecospold.IAllocation)1 IExchange (org.openlca.ecospold.IExchange)1