Search in sources :

Example 1 with IExchange

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

the class MethodConverter method mapLCIAFactor.

private IExchange mapLCIAFactor(ImpactFactor factor) {
    IExchange exchange = factory.createExchange();
    Flow flow = factor.flow;
    exchange.setNumber((int) flow.id);
    Categories.map(factor.flow.category, exchange, config);
    Util.mapFlowInformation(exchange, factor.flow);
    exchange.setUnit(factor.unit.name);
    exchange.setName(factor.flow.name);
    exchange.setMeanValue(factor.value);
    return exchange;
}
Also used : IExchange(org.openlca.ecospold.IExchange) Flow(org.openlca.core.model.Flow)

Example 2 with IExchange

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

the class ProcessConverter method mapExchange.

private IExchange mapExchange(Exchange inExchange) {
    IExchange exchange = factory.createExchange();
    Flow flow = inExchange.flow;
    exchange.setNumber((int) flow.id);
    exchange.setName(inExchange.flow.name);
    if (inExchange.isInput) {
        exchange.setInputGroup(mapFlowType(flow.flowType, true));
    } else {
        exchange.setOutputGroup(mapFlowType(flow.flowType, false));
    }
    Categories.map(flow.category, exchange, config);
    Util.mapFlowInformation(exchange, inExchange.flow);
    if (inExchange.unit != null) {
        exchange.setUnit(inExchange.unit.name);
    }
    if (inExchange.uncertainty == null) {
        exchange.setMeanValue(inExchange.amount);
    } else {
        mapUncertainty(inExchange, exchange);
    }
    mapComment(inExchange, exchange);
    return exchange;
}
Also used : IExchange(org.openlca.ecospold.IExchange) Flow(org.openlca.core.model.Flow)

Example 3 with IExchange

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

the class ProcessConverter method mapExchanges.

private void mapExchanges(DataSet dataSet) {
    Exchange qRef = process.quantitativeReference;
    for (Exchange exchange : process.exchanges) {
        IExchange iExchange = mapExchange(exchange);
        dataSet.getExchanges().add(iExchange);
        if (Objects.equals(exchange, qRef)) {
            mapRefFlow(dataSet, exchange, iExchange);
        }
    }
}
Also used : IExchange(org.openlca.ecospold.IExchange) Exchange(org.openlca.core.model.Exchange) IExchange(org.openlca.ecospold.IExchange)

Example 4 with IExchange

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

the class EcoSpold01Import method mapExchanges.

private void mapExchanges(List<IExchange> inExchanges, Process ioProcess) {
    for (IExchange inExchange : inExchanges) {
        FlowBucket flow = flowImport.handleProcessExchange(inExchange);
        if (flow == null || !flow.isValid()) {
            log.error("Could not import flow: " + inExchange);
            continue;
        }
        Exchange outExchange = ioProcess.add(Exchange.of(flow.flow, flow.flowProperty, flow.unit));
        outExchange.isInput = inExchange.getInputGroup() != null;
        ExchangeAmount exchangeAmount = new ExchangeAmount(outExchange, inExchange);
        outExchange.description = inExchange.getGeneralComment();
        exchangeAmount.map(flow.conversionFactor);
        localExchangeCache.put(inExchange.getNumber(), outExchange);
        if (ioProcess.quantitativeReference == null && inExchange.getOutputGroup() != null && (inExchange.getOutputGroup() == 0 || inExchange.getOutputGroup() == 2)) {
            ioProcess.quantitativeReference = outExchange;
        }
    }
}
Also used : IExchange(org.openlca.ecospold.IExchange) Exchange(org.openlca.core.model.Exchange) IExchange(org.openlca.ecospold.IExchange)

Example 5 with IExchange

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

the class EcoSpold01Import method mapFactors.

private void mapFactors(List<IExchange> inFactors, ImpactCategory ioCategory) {
    for (IExchange inFactor : inFactors) {
        FlowBucket flow = flowImport.handleImpactFactor(inFactor);
        if (flow == null || !flow.isValid()) {
            log.error("Could not import flow: " + inFactor);
            continue;
        }
        ImpactFactor factor = new ImpactFactor();
        factor.flow = flow.flow;
        factor.flowPropertyFactor = flow.flow.getFactor(flow.flowProperty);
        factor.unit = flow.unit;
        factor.value = flow.conversionFactor * inFactor.getMeanValue();
        ioCategory.impactFactors.add(factor);
    }
}
Also used : ImpactFactor(org.openlca.core.model.ImpactFactor) IExchange(org.openlca.ecospold.IExchange)

Aggregations

IExchange (org.openlca.ecospold.IExchange)6 Exchange (org.openlca.core.model.Exchange)2 Flow (org.openlca.core.model.Flow)2 HashSet (java.util.HashSet)1 ImpactFactor (org.openlca.core.model.ImpactFactor)1 Location (org.openlca.core.model.Location)1 IGeography (org.openlca.ecospold.IGeography)1