Search in sources :

Example 1 with Parameter

use of org.openlca.ilcd.models.Parameter in project olca-modules by GreenDelta.

the class Node method init.

static Node init(ProcessInstance pi, Process process) {
    Node n = new Node();
    n.modelID = pi.id;
    n.process = process;
    n.scalingFactor = pi.scalingFactor;
    for (Parameter param : pi.parameters) {
        n.params.put(param.name, param.value);
    }
    return n;
}
Also used : Parameter(org.openlca.ilcd.models.Parameter)

Example 2 with Parameter

use of org.openlca.ilcd.models.Parameter in project olca-modules by GreenDelta.

the class ModelIOTest method testSimpleModel.

@Test
public void testSimpleModel() throws Exception {
    Model model = new Model();
    Models.forceDataSetInfo(model).uuid = UUID.randomUUID().toString();
    Models.forceModelName(model).name.add(LangString.of("Example model", "en"));
    Models.forcePublication(model).version = "01.00.000";
    Classification classification = new Classification();
    Category category = new Category();
    category.level = 0;
    category.value = "Life cycle models";
    classification.categories.add(category);
    Models.forceClassifications(model).add(classification);
    Models.forceQuantitativeReference(model).refProcess = 42;
    Technology tech = Models.forceTechnology(model);
    Group group = new Group();
    group.id = 42;
    group.name.add(LangString.of("Use phase", "en"));
    tech.groups.add(group);
    ProcessInstance pi = new ProcessInstance();
    tech.processes.add(pi);
    GroupRef groupRef = new GroupRef();
    groupRef.groupID = 42;
    pi.groupRefs.add(groupRef);
    Parameter param = new Parameter();
    param.name = "distance";
    param.value = 42.42;
    pi.parameters.add(param);
    Connection con = new Connection();
    con.outputFlow = UUID.randomUUID().toString();
    DownstreamLink link = new DownstreamLink();
    link.inputFlow = UUID.randomUUID().toString();
    link.process = 42;
    con.downstreamLinks.add(link);
    pi.connections.add(con);
    StringWriter writer = new StringWriter();
    XmlBinder binder = new XmlBinder();
    binder.toWriter(model, writer);
    StringReader reader = new StringReader(writer.toString());
    model = JAXB.unmarshal(reader, Model.class);
    assertEquals(1, model.info.technology.processes.size());
}
Also used : Group(org.openlca.ilcd.models.Group) Category(org.openlca.ilcd.commons.Category) Connection(org.openlca.ilcd.models.Connection) DownstreamLink(org.openlca.ilcd.models.DownstreamLink) StringWriter(java.io.StringWriter) Technology(org.openlca.ilcd.models.Technology) Classification(org.openlca.ilcd.commons.Classification) Model(org.openlca.ilcd.models.Model) StringReader(java.io.StringReader) Parameter(org.openlca.ilcd.models.Parameter) ProcessInstance(org.openlca.ilcd.models.ProcessInstance) GroupRef(org.openlca.ilcd.models.GroupRef) Test(org.junit.Test)

Aggregations

Parameter (org.openlca.ilcd.models.Parameter)2 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 Test (org.junit.Test)1 Category (org.openlca.ilcd.commons.Category)1 Classification (org.openlca.ilcd.commons.Classification)1 Connection (org.openlca.ilcd.models.Connection)1 DownstreamLink (org.openlca.ilcd.models.DownstreamLink)1 Group (org.openlca.ilcd.models.Group)1 GroupRef (org.openlca.ilcd.models.GroupRef)1 Model (org.openlca.ilcd.models.Model)1 ProcessInstance (org.openlca.ilcd.models.ProcessInstance)1 Technology (org.openlca.ilcd.models.Technology)1