Search in sources :

Example 31 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project olca-modules by GreenDelta.

the class ProcessImport method valid.

private boolean valid(DataSet ds) {
    Activity activity = Spold2.getActivity(ds);
    if (activity.id == null || activity.name == null)
        return false;
    IntermediateExchange refFlow = null;
    for (IntermediateExchange techFlow : Spold2.getProducts(ds)) {
        if (techFlow.outputGroup == null)
            continue;
        if (techFlow.outputGroup != 0)
            continue;
        if (techFlow.amount == null || techFlow.amount == 0)
            continue;
        refFlow = techFlow;
        break;
    }
    return refFlow != null;
}
Also used : IntermediateExchange(spold2.IntermediateExchange) Activity(spold2.Activity)

Example 32 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project olca-modules by GreenDelta.

the class ProcessImport method getProcessName.

/**
 * The name of the process has the following pattern:
 * <p>
 * <process name> | <product name> | <system model>, <process type>
 * <p>
 * Where <system model> is a mnemonic like "APOS" or "Cutoff" and the process
 * type is "U" when it is a unit process or "S" when it is a LCI result
 */
private String getProcessName(DataSet ds) {
    // the process and ref. product name
    Activity a = Spold2.getActivity(ds);
    String name = a != null ? a.name : "?";
    IntermediateExchange qRef = Spold2.getReferenceProduct(ds);
    if (qRef != null && qRef.name != null) {
        name += " | " + qRef.name;
    }
    // we try to infer a short name for the system model here
    // because the short name is part of the master data which
    // is not always available (or can be found) when importing
    // a data set
    String model = null;
    Representativeness repri = Spold2.getRepresentativeness(ds);
    if (repri.systemModelName != null) {
        String sys = repri.systemModelName.toLowerCase();
        if (sys.contains("consequential")) {
            model = "Consequential";
        } else if (sys.contains("apos") || sys.contains("allocation at the point of substitution")) {
            model = "APOS";
        } else if (sys.contains("cut-off") || sys.contains("cutoff")) {
            model = "Cutoff";
        } else if (sys.contains("legacy")) {
            model = "Legacy";
        } else {
            model = repri.systemModelName;
        }
    }
    if (model != null) {
        name += " | " + model;
    }
    // the process type
    String type = a != null && a.type == 2 ? "S" : "U";
    name += ", " + type;
    return name;
}
Also used : Representativeness(spold2.Representativeness) IntermediateExchange(spold2.IntermediateExchange) Activity(spold2.Activity)

Example 33 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project olca-modules by GreenDelta.

the class RefId method forProcess.

/**
 * We generate a UUID for the resulting process in openLCA from the activity
 * ID and the ID of the reference flow (the product output with an amount >
 * 0).
 */
public static String forProcess(DataSet ds) {
    Activity activity = Spold2.getActivity(ds);
    if (activity == null)
        return KeyGen.NULL_UUID;
    // product ID
    IntermediateExchange qRef = Spold2.getReferenceProduct(ds);
    String productID = qRef != null && qRef.flowId != null ? qRef.flowId : KeyGen.NULL_UUID;
    return KeyGen.get(activity.id, productID);
}
Also used : IntermediateExchange(spold2.IntermediateExchange) Activity(spold2.Activity)

Example 34 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity in project olca-modules by GreenDelta.

the class MasterData method writeIndexEntry.

public static void writeIndexEntry(DataSet ds) {
    if (ds == null || ds.masterData == null)
        return;
    ActivityIndexEntry indexEntry = new ActivityIndexEntry();
    ds.masterData.activityIndexEntries.add(indexEntry);
    indexEntry.systemModelId = "8b738ea0-f89e-4627-8679-433616064e82";
    ActivityDescription d = ds.description;
    if (d == null)
        return;
    Activity activity = d.activity;
    if (activity != null) {
        indexEntry.activityNameId = activity.activityNameId;
        indexEntry.id = activity.id;
    }
    Time timePeriod = d.timePeriod;
    if (timePeriod != null) {
        indexEntry.endDate = timePeriod.end;
        indexEntry.startDate = timePeriod.start;
    }
    Geography geography = d.geography;
    if (geography != null)
        indexEntry.geographyId = geography.id;
}
Also used : Geography(spold2.Geography) ActivityIndexEntry(spold2.ActivityIndexEntry) ActivityDescription(spold2.ActivityDescription) Activity(spold2.Activity) Time(spold2.Time)

Example 35 with Activity

use of com.google.api.ads.admanager.axis.v202205.Activity 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)

Aggregations

Activity (org.eclipse.bpmn2.Activity)21 FlowElement (org.eclipse.bpmn2.FlowElement)12 ArrayList (java.util.ArrayList)9 CallActivity (org.eclipse.bpmn2.CallActivity)9 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)9 SubProcess (org.eclipse.bpmn2.SubProcess)9 ErrorEventDefinition (org.eclipse.bpmn2.ErrorEventDefinition)8 EventDefinition (org.eclipse.bpmn2.EventDefinition)8 MessageEventDefinition (org.eclipse.bpmn2.MessageEventDefinition)8 RootElement (org.eclipse.bpmn2.RootElement)8 SignalEventDefinition (org.eclipse.bpmn2.SignalEventDefinition)8 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)8 Entry (java.util.Map.Entry)7 ConditionalEventDefinition (org.eclipse.bpmn2.ConditionalEventDefinition)7 EscalationEventDefinition (org.eclipse.bpmn2.EscalationEventDefinition)7 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)7 TimerEventDefinition (org.eclipse.bpmn2.TimerEventDefinition)7 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)7 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)6 Escalation (org.eclipse.bpmn2.Escalation)6