Search in sources :

Example 1 with ProcessDocumentation

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

the class ProcessReferenceSearchTest method createModel.

@Override
protected Process createModel() {
    Process process = new Process();
    process.category = insertAndAddExpected("category", new Category());
    process.location = insertAndAddExpected("location", new Location());
    process.dqSystem = insertAndAddExpected("dqSystem", new DQSystem());
    process.exchangeDqSystem = insertAndAddExpected("exchangeDqSystem", new DQSystem());
    process.socialDqSystem = insertAndAddExpected("socialDqSystem", new DQSystem());
    String n1 = generateName();
    String n2 = generateName();
    String n3 = generateName();
    String n4 = generateName();
    String n5 = generateName();
    createExchange(process, 3d, true);
    createExchange(process, "2*" + n4, false);
    process.parameters.add(createParameter(n1, 3d, false));
    process.parameters.add(createParameter(n2, n1 + "*2*" + n3, false));
    process.socialAspects.add(createSocialAspect());
    process.socialAspects.add(createSocialAspect());
    process.documentation = createDocumentation();
    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);
    process = db.insert(process);
    for (Exchange e : process.exchanges) {
        addExpected("flow", e.flow, "exchanges", Exchange.class, e.id);
        addExpected("flowPropertyFactor", e.flowPropertyFactor, "exchanges", Exchange.class, e.id);
        addExpected("flowProperty", e.flowPropertyFactor.flowProperty, "flowPropertyFactor", FlowPropertyFactor.class, e.flowPropertyFactor.id);
        addExpected("unit", e.unit, "exchanges", Exchange.class, e.id);
        Process provider = processes.get(e.defaultProviderId);
        if (provider != null)
            addExpected("defaultProviderId", provider, "exchanges", Exchange.class, e.id);
    }
    for (SocialAspect a : process.socialAspects) {
        addExpected("indicator", a.indicator, "socialAspects", SocialAspect.class, a.id);
        addExpected("source", a.source, "socialAspects", SocialAspect.class, a.id);
    }
    ProcessDocumentation doc = process.documentation;
    addExpected("dataDocumentor", doc.dataDocumentor, "documentation", ProcessDocumentation.class, doc.id);
    addExpected("dataGenerator", doc.dataGenerator, "documentation", ProcessDocumentation.class, doc.id);
    addExpected("dataSetOwner", doc.dataSetOwner, "documentation", ProcessDocumentation.class, doc.id);
    addExpected("reviewer", doc.reviewer, "documentation", ProcessDocumentation.class, doc.id);
    addExpected("publication", doc.publication, "documentation", ProcessDocumentation.class, doc.id);
    for (Source s : process.documentation.sources) addExpected("sources", s, "documentation", ProcessDocumentation.class, doc.id);
    return process;
}
Also used : Exchange(org.openlca.core.model.Exchange) Category(org.openlca.core.model.Category) SocialAspect(org.openlca.core.model.SocialAspect) DQSystem(org.openlca.core.model.DQSystem) Parameter(org.openlca.core.model.Parameter) Process(org.openlca.core.model.Process) ProcessDocumentation(org.openlca.core.model.ProcessDocumentation) Source(org.openlca.core.model.Source) Location(org.openlca.core.model.Location)

Example 2 with ProcessDocumentation

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

the class ProcessWriter method writeProcessDoc.

private void writeProcessDoc(Process p) {
    if (p.documentation == null) {
        p.documentation = new ProcessDocumentation();
    }
    var doc = p.documentation;
    writeln("Process");
    writeln();
    writeln("Category type");
    writeln("material");
    writeln();
    writeln("Process identifier");
    writeln("Standard" + String.format("%015d", p.id));
    writeln();
    writeln("Type");
    writeln(p.processType == ProcessType.UNIT_PROCESS ? "Unit process" : "System");
    writeln();
    writeln("Process name");
    writeln(p.name);
    writeln();
    writeln("Status");
    writeln();
    writeln();
    // these sections all get an `Unspecified` value
    String[] uSections = { "Time period", "Geography", "Technology", "Representativeness", "Multiple output allocation", "Substitution allocation", "Cut off rules", "Capital goods", "Boundary with nature" };
    for (String uSection : uSections) {
        writeln(uSection);
        writeln("Unspecified");
        writeln();
    }
    writeln("Infrastructure");
    writeln("No");
    writeln();
    writeln("Date");
    writeln(new SimpleDateFormat("dd.MM.yyyy").format(new Date()));
    writeln();
    writeln("Record");
    writeln(doc.dataDocumentor != null ? doc.dataDocumentor.name : "");
    writeln();
    writeln("Generator");
    writeln(doc.dataGenerator != null ? doc.dataGenerator.name : "");
    writeln();
    // sources
    writeln("External documents");
    int sourceCount = 0;
    if (doc.publication != null) {
        writeln(doc.publication.name, doc.publication.description);
        sourceCount++;
    }
    for (var source : doc.sources) {
        writeln(source.name, source.description);
        sourceCount++;
    }
    if (sourceCount == 0) {
        writeln();
    }
    writeln();
    // we do not write sources as literature references as these are
    // are stored database wide in SimaPro. there are problems when
    // the same literature reference occurs in different SimaPro CSV
    // files. the import then just stops. instead we import them as
    // external docs (see above)
    writeln("Literature references");
    writeln();
    writeln();
    writeln("Collection method");
    writeln(doc.sampling);
    writeln();
    writeln("Data treatment");
    writeln(doc.dataTreatment);
    writeln();
    writeln("Verification");
    writeln(doc.reviewDetails);
    writeln();
    writeln("Comment");
    writeln(comment(p));
    writeln();
    writeln("Allocation rules");
    writeln(doc.inventoryMethod);
    writeln();
    writeln("System description");
    writeln("", "");
    writeln();
}
Also used : ProcessDocumentation(org.openlca.core.model.ProcessDocumentation) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 3 with ProcessDocumentation

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

the class EcoSpold2Export method exportProcesses.

private void exportProcesses() {
    for (ProcessDescriptor descriptor : descriptors) {
        ProcessDao dao = new ProcessDao(db);
        Process process = dao.getForId(descriptor.id);
        ProcessDocumentation doc = process.documentation;
        if (doc == null) {
            log.warn("no process entity or documentation for {} found", descriptor);
            continue;
        }
        exportProcess(process);
    }
}
Also used : ProcessDao(org.openlca.core.database.ProcessDao) ProcessDescriptor(org.openlca.core.model.descriptors.ProcessDescriptor) Process(org.openlca.core.model.Process) ProcessDocumentation(org.openlca.core.model.ProcessDocumentation)

Example 4 with ProcessDocumentation

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

the class DocImportMapper method map.

public void map(DataSet ds, Process process) {
    if (ds == null || process == null)
        return;
    this.process = process;
    this.doc = new ProcessDocumentation();
    process.documentation = doc;
    Activity a = Spold2.getActivity(ds);
    if (a != null) {
        doc.precedingDataSet = a.id;
    }
    mapTechnology(ds);
    mapGeography(Spold2.getGeography(ds));
    mapTime(Spold2.getTime(ds));
    mapAdminInfo(ds.adminInfo);
    mapRepresentativeness(Spold2.getRepresentativeness(ds));
}
Also used : Activity(spold2.Activity) ProcessDocumentation(org.openlca.core.model.ProcessDocumentation)

Example 5 with ProcessDocumentation

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

the class SourceUseSearchTest method setUp.

@Before
public void setUp() {
    source = db.insert(Source.of("test source"));
    process = new Process();
    process.name = "test process";
    process.documentation = new ProcessDocumentation();
    process = db.insert(process);
    method = db.insert(ImpactMethod.of("test method"));
    dqSystem = db.insert(new DQSystem());
}
Also used : DQSystem(org.openlca.core.model.DQSystem) Process(org.openlca.core.model.Process) ProcessDocumentation(org.openlca.core.model.ProcessDocumentation) Before(org.junit.Before)

Aggregations

ProcessDocumentation (org.openlca.core.model.ProcessDocumentation)18 Process (org.openlca.core.model.Process)9 Source (org.openlca.core.model.Source)5 ProcessDao (org.openlca.core.database.ProcessDao)4 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 DQSystem (org.openlca.core.model.DQSystem)2 ProcessDescriptor (org.openlca.core.model.descriptors.ProcessDescriptor)2 JsonElement (com.google.gson.JsonElement)1 TLongArrayList (gnu.trove.list.array.TLongArrayList)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Workbook (org.apache.poi.ss.usermodel.Workbook)1 SXSSFWorkbook (org.apache.poi.xssf.streaming.SXSSFWorkbook)1 Composite (org.eclipse.swt.widgets.Composite)1 Control (org.eclipse.swt.widgets.Control)1 ScrolledForm (org.eclipse.ui.forms.widgets.ScrolledForm)1 Before (org.junit.Before)1