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);
}
}
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));
}
}
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;
}
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);
}
}
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;
}
Aggregations