Search in sources :

Example 6 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)

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