use of org.openlca.core.model.FlowPropertyFactor in project olca-modules by GreenDelta.
the class FlowReferenceSearchTest method createFlowPropertyFactor.
private FlowPropertyFactor createFlowPropertyFactor() {
FlowPropertyFactor factor = new FlowPropertyFactor();
factor.flowProperty = db.insert(new FlowProperty());
return factor;
}
use of org.openlca.core.model.FlowPropertyFactor in project olca-modules by GreenDelta.
the class ImpactMethodReferenceSearchTest method createFlow.
private Flow createFlow() {
Flow flow = new Flow();
UnitGroup group = new UnitGroup();
Unit unit = new Unit();
unit.name = "unit";
group.units.add(unit);
group = db.insert(group);
FlowProperty property = new FlowProperty();
property.unitGroup = group;
property = db.insert(property);
FlowPropertyFactor factor = new FlowPropertyFactor();
factor.flowProperty = property;
flow.flowPropertyFactors.add(factor);
return db.insert(flow);
}
use of org.openlca.core.model.FlowPropertyFactor in project olca-modules by GreenDelta.
the class ImpactMethodReferenceSearchTest method createModel.
@Override
protected ImpactMethod createModel() {
ImpactMethod method = new ImpactMethod();
method.category = insertAndAddExpected("category", new Category());
String n1 = generateName();
// String n2 = generateName();
String n3 = generateName();
String n4 = generateName();
String n5 = generateName();
// method.parameters.add(createParameter(n1, 3d, false));
// method.parameters.add(createParameter(n2, n1 + "*2*" + n3, false));
insertAndAddExpected(n3, createParameter(n3, "5*5", true));
// formula with parameter to see if added as reference (unexpected)
insertAndAddExpected(n4, createParameter(n4, "3*" + n5, true));
Parameter globalUnreferenced = createParameter(n1, "3*3", true);
Parameter globalUnreferenced2 = createParameter(n5, "3*3", true);
// must be inserted manually
globalUnreferenced = db.insert(globalUnreferenced);
globalUnreferenced2 = db.insert(globalUnreferenced2);
method.impactCategories.add(createImpactCategory(n4));
method.impactCategories.add(createImpactCategory(n4));
method = db.insert(method);
for (ImpactCategory category : method.impactCategories) for (ImpactFactor f : category.impactFactors) {
addExpected("flow", f.flow, "impactFactors", ImpactFactor.class, f.id);
addExpected("flowPropertyFactor", f.flowPropertyFactor, "impactFactors", ImpactFactor.class, f.id);
addExpected("flowProperty", f.flowPropertyFactor.flowProperty, "flowPropertyFactor", FlowPropertyFactor.class, f.flowPropertyFactor.id);
addExpected("unit", f.unit, "impactFactors", ImpactFactor.class, f.id);
}
return method;
}
use of org.openlca.core.model.FlowPropertyFactor in project olca-modules by GreenDelta.
the class TestData method flow.
public static Flow flow(String name, String unit, FlowType type) {
String flowId = KeyGen.get("flow", name, unit);
FlowDao dao = new FlowDao(Tests.getDb());
Flow flow = dao.getForRefId(flowId);
if (flow != null)
return flow;
flow = new Flow();
flow.name = name;
flow.refId = flowId;
flow.flowType = type;
FlowProperty property = property(unit);
FlowPropertyFactor factor = new FlowPropertyFactor();
factor.flowProperty = property;
factor.conversionFactor = 1;
flow.flowPropertyFactors.add(factor);
flow.referenceFlowProperty = property;
return dao.insert(flow);
}
use of org.openlca.core.model.FlowPropertyFactor in project olca-modules by GreenDelta.
the class FlowPropertyFactorUseSearchTest method setup.
@Before
public void setup() {
flow = new Flow();
flow.name = "flow";
property = new FlowProperty();
property.name = "property";
factor = new FlowPropertyFactor();
factor.flowProperty = property;
flow.flowPropertyFactors.add(factor);
property = new FlowPropertyDao(database).insert(property);
flow = new FlowDao(database).insert(flow);
factor = flow.getFactor(property);
search = new FlowPropertyFactorUseSearch(flow, database);
}
Aggregations