Search in sources :

Example 11 with ImpactFactor

use of org.openlca.core.model.ImpactFactor 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)

Example 12 with ImpactFactor

use of org.openlca.core.model.ImpactFactor in project olca-modules by GreenDelta.

the class MethodConverter method mapLCIACategory.

private void mapLCIACategory(ImpactCategory category, DataSet dataSet) {
    IReferenceFunction refFun = factory.createReferenceFunction();
    dataSet.setReferenceFunction(refFun);
    String subCategory = category.name;
    String name = null;
    if (subCategory.contains("-")) {
        String[] parts = subCategory.split("-", 2);
        subCategory = parts[0].trim();
        name = parts[1].trim();
    }
    refFun.setSubCategory(subCategory);
    refFun.setName(name);
    refFun.setUnit(category.referenceUnit);
    for (ImpactFactor factor : category.impactFactors) {
        dataSet.getExchanges().add(mapLCIAFactor(factor));
    }
}
Also used : ImpactFactor(org.openlca.core.model.ImpactFactor) IReferenceFunction(org.openlca.ecospold.IReferenceFunction)

Example 13 with ImpactFactor

use of org.openlca.core.model.ImpactFactor in project olca-modules by GreenDelta.

the class ImpactMethodReferenceSearchTest method createImpactFactor.

private ImpactFactor createImpactFactor(Object value) {
    ImpactFactor iFactor = new ImpactFactor();
    Flow flow = createFlow();
    FlowPropertyFactor factor = flow.flowPropertyFactors.get(0);
    Unit unit = factor.flowProperty.unitGroup.units.get(0);
    iFactor.flow = flow;
    iFactor.flowPropertyFactor = factor;
    iFactor.unit = unit;
    boolean formula = value instanceof String;
    if (formula)
        iFactor.formula = value.toString();
    else
        iFactor.value = (double) value;
    return iFactor;
}
Also used : ImpactFactor(org.openlca.core.model.ImpactFactor) FlowPropertyFactor(org.openlca.core.model.FlowPropertyFactor) Unit(org.openlca.core.model.Unit) Flow(org.openlca.core.model.Flow)

Example 14 with ImpactFactor

use of org.openlca.core.model.ImpactFactor in project olca-modules by GreenDelta.

the class ImpactCategoryImport method switchFactorRefs.

private void switchFactorRefs(ImpactCategory impact) {
    for (ImpactFactor f : impact.impactFactors) {
        f.flow = refs.switchRef(f.flow);
        f.unit = refs.switchRef(f.unit);
        f.flowPropertyFactor = refs.switchRef(f.flowPropertyFactor, f.flow);
    }
}
Also used : ImpactFactor(org.openlca.core.model.ImpactFactor)

Example 15 with ImpactFactor

use of org.openlca.core.model.ImpactFactor in project olca-modules by GreenDelta.

the class ParameterReferencesTest method createImpactFactor.

private ImpactFactor createImpactFactor(String formula, Uncertainty u) {
    ImpactFactor f = new ImpactFactor();
    f.formula = formula;
    f.uncertainty = u;
    return f;
}
Also used : ImpactFactor(org.openlca.core.model.ImpactFactor)

Aggregations

ImpactFactor (org.openlca.core.model.ImpactFactor)19 ImpactCategory (org.openlca.core.model.ImpactCategory)6 Parameter (org.openlca.core.model.Parameter)5 Test (org.junit.Test)4 Flow (org.openlca.core.model.Flow)4 FlowPropertyFactor (org.openlca.core.model.FlowPropertyFactor)4 ArrayList (java.util.ArrayList)3 Uncertainty (org.openlca.core.model.Uncertainty)3 FlowDao (org.openlca.core.database.FlowDao)2 ImpactCategoryDao (org.openlca.core.database.ImpactCategoryDao)2 Exchange (org.openlca.core.model.Exchange)2 Unit (org.openlca.core.model.Unit)2 AbstractZipTest (org.openlca.jsonld.AbstractZipTest)2 JsonElement (com.google.gson.JsonElement)1 TLongByteHashMap (gnu.trove.map.hash.TLongByteHashMap)1 TLongHashSet (gnu.trove.set.hash.TLongHashSet)1 Collections (java.util.Collections)1 Date (java.util.Date)1 List (java.util.List)1 Objects (java.util.Objects)1