Search in sources :

Example 46 with ProcessModel

use of de.hpi.bpt.scylla.model.process.ProcessModel in project scylla by bptlab.

the class ProcessModelParserPluggable method runPluginsPerPM.

private static void runPluginsPerPM(SimulationManager simEnvironment, ProcessModel processModel, Element sim) throws ScyllaValidationException {
    run(simEnvironment, ProcessModelParserPluggable.class, processModel, sim);
    Map<Integer, ProcessModel> subProcesses = processModel.getSubProcesses();
    for (Element el : sim.getChildren()) {
        String elementName = el.getName();
        if (elementName.equals("subProcess")) {
            String identifier = el.getAttributeValue("id");
            if (identifier == null) {
                DebugLogger.log("Warning: Simulation configuration definition element '" + elementName + "' does not have an identifier, skip.");
                // no matching element in process, so skip definition
                continue;
            }
            Integer nodeId = processModel.getIdentifiersToNodeIds().get(identifier);
            if (nodeId == null) {
                DebugLogger.log("Simulation configuration definition for process element '" + identifier + "', but not available in process, skip.");
                // no matching element in process, so skip definition
                continue;
            }
            ProcessModel subProcess = subProcesses.get(nodeId);
            runPluginsPerPM(simEnvironment, subProcess, el);
        }
    }
}
Also used : ProcessModel(de.hpi.bpt.scylla.model.process.ProcessModel) Element(org.jdom2.Element)

Example 47 with ProcessModel

use of de.hpi.bpt.scylla.model.process.ProcessModel in project scylla by bptlab.

the class SimulationConfigurationParserPluggable method runPluginsPerSC.

private static void runPluginsPerSC(SimulationManager simEnvironment, SimulationConfiguration simulationConfiguration, ProcessModel processModel, Element sim) throws ScyllaValidationException {
    run(simEnvironment, SimulationConfigurationParserPluggable.class, simulationConfiguration, sim);
    Map<Integer, SimulationConfiguration> configurationsOfSubProcesses = simulationConfiguration.getConfigurationsOfSubProcesses();
    for (Element el : sim.getChildren()) {
        String elementName = el.getName();
        if (elementName.equals("subProcess")) {
            String identifier = el.getAttributeValue("id");
            if (identifier == null) {
                DebugLogger.log("Warning: Simulation configuration definition element '" + elementName + "' does not have an identifier, skip.");
                // no matching element in process, so skip definition
                continue;
            }
            Integer nodeId = processModel.getIdentifiersToNodeIds().get(identifier);
            if (nodeId == null) {
                DebugLogger.log("Simulation configuration definition for process element '" + identifier + "', but not available in process, skip.");
                // no matching element in process, so skip definition
                continue;
            }
            SimulationConfiguration childSimulationConfiguration = configurationsOfSubProcesses.get(nodeId);
            ProcessModel subProcess = processModel.getSubProcesses().get(nodeId);
            runPluginsPerSC(simEnvironment, childSimulationConfiguration, subProcess, el);
        }
    }
}
Also used : ProcessModel(de.hpi.bpt.scylla.model.process.ProcessModel) SimulationConfiguration(de.hpi.bpt.scylla.model.configuration.SimulationConfiguration) Element(org.jdom2.Element)

Example 48 with ProcessModel

use of de.hpi.bpt.scylla.model.process.ProcessModel in project scylla by bptlab.

the class SimulationConfigurationParserPluggable method runPlugins.

public static void runPlugins(SimulationManager simEnvironment, SimulationConfiguration simulationConfiguration, Document document) throws ScyllaValidationException {
    Namespace simNamespace = document.getRootElement().getNamespace();
    List<Element> simElements = document.getRootElement().getChildren("simulationConfiguration", simNamespace);
    Element sim = simElements.get(0);
    String processRef = sim.getAttributeValue("processRef");
    ProcessModel processModel = simEnvironment.getProcessModels().get(processRef);
    runPluginsPerSC(simEnvironment, simulationConfiguration, processModel, sim);
}
Also used : ProcessModel(de.hpi.bpt.scylla.model.process.ProcessModel) Element(org.jdom2.Element) Namespace(org.jdom2.Namespace)

Example 49 with ProcessModel

use of de.hpi.bpt.scylla.model.process.ProcessModel in project scylla by bptlab.

the class ProcessSimulationComponents method init.

public void init() {
    try {
        Map<Integer, TimeDistributionWrapper> arrivalRates = simulationConfiguration.getArrivalRates();
        Map<Integer, TimeDistributionWrapper> durations = simulationConfiguration.getDurations();
        Map<Integer, TimeDistributionWrapper> setUpDurations = simulationConfiguration.getSetUpDurations();
        Map<Integer, TimeDistributionWrapper> arrivalRatesAndDurations = new HashMap<Integer, TimeDistributionWrapper>();
        arrivalRatesAndDurations.putAll(arrivalRates);
        arrivalRatesAndDurations.putAll(durations);
        setSmallestTimeUnit(arrivalRatesAndDurations);
        setSmallestTimeUnit(setUpDurations);
        convertToDesmojDistributions(arrivalRatesAndDurations, false);
        convertToDesmojDistributions(setUpDurations, true);
        extensionDistributions = DistributionConversionPluggable.runPlugins(this);
        Map<Integer, SimulationConfiguration> configurationsOfSubProcesses = simulationConfiguration.getConfigurationsOfSubProcesses();
        for (Integer nodeId : configurationsOfSubProcesses.keySet()) {
            SimulationConfiguration scOfSubProcess = configurationsOfSubProcesses.get(nodeId);
            ProcessModel pmOfSubProcess = processModel.getSubProcesses().get(nodeId);
            ProcessSimulationComponents desmojObjects = new ProcessSimulationComponents(model, this, pmOfSubProcess, scOfSubProcess);
            desmojObjects.init();
            children.put(nodeId, desmojObjects);
        }
    } catch (InstantiationException e) {
        DebugLogger.error(e.getMessage());
        DebugLogger.error("Instantiation of simulation model failed.");
    }
}
Also used : ProcessModel(de.hpi.bpt.scylla.model.process.ProcessModel) SimulationConfiguration(de.hpi.bpt.scylla.model.configuration.SimulationConfiguration) HashMap(java.util.HashMap) TimeDistributionWrapper(de.hpi.bpt.scylla.model.configuration.distribution.TimeDistributionWrapper)

Example 50 with ProcessModel

use of de.hpi.bpt.scylla.model.process.ProcessModel in project scylla by bptlab.

the class SimulationModel method addNodeInfo.

public boolean addNodeInfo(ProcessModel processModel, ProcessInstance processInstance, ProcessNodeInfo nodeInfo) {
    String processId = processModel.getId();
    ProcessModel parent = processModel.getParent();
    while (parent != null) {
        processId = parent.getId();
        parent = parent.getParent();
    }
    int processInstanceId = processInstance.getId();
    if (!processNodeInfos.containsKey(processId)) {
        processNodeInfos.put(processId, new TreeMap<Integer, List<ProcessNodeInfo>>());
    }
    Map<Integer, List<ProcessNodeInfo>> nodeInfosOfProcess = processNodeInfos.get(processId);
    if (!nodeInfosOfProcess.containsKey(processInstanceId)) {
        nodeInfosOfProcess.put(processInstanceId, new ArrayList<ProcessNodeInfo>());
    }
    return nodeInfosOfProcess.get(processInstanceId).add(nodeInfo);
}
Also used : ProcessModel(de.hpi.bpt.scylla.model.process.ProcessModel) ArrayList(java.util.ArrayList) List(java.util.List) ProcessNodeInfo(de.hpi.bpt.scylla.logger.ProcessNodeInfo)

Aggregations

ProcessModel (de.hpi.bpt.scylla.model.process.ProcessModel)73 SimulationModel (de.hpi.bpt.scylla.simulation.SimulationModel)42 TimeSpan (desmoj.core.simulator.TimeSpan)26 ScyllaValidationException (de.hpi.bpt.scylla.exception.ScyllaValidationException)22 NodeNotFoundException (de.hpi.bpt.scylla.model.process.graph.exception.NodeNotFoundException)19 ScyllaRuntimeException (de.hpi.bpt.scylla.exception.ScyllaRuntimeException)18 ProcessInstance (de.hpi.bpt.scylla.simulation.ProcessInstance)18 ScyllaEvent (de.hpi.bpt.scylla.simulation.event.ScyllaEvent)16 Map (java.util.Map)16 HashMap (java.util.HashMap)14 ProcessNodeInfo (de.hpi.bpt.scylla.logger.ProcessNodeInfo)13 ProcessSimulationComponents (de.hpi.bpt.scylla.simulation.ProcessSimulationComponents)13 Element (org.jdom2.Element)13 TimeInstant (desmoj.core.simulator.TimeInstant)12 HashSet (java.util.HashSet)12 SimulationConfiguration (de.hpi.bpt.scylla.model.configuration.SimulationConfiguration)10 TimeUnit (java.util.concurrent.TimeUnit)10 EventDefinitionType (de.hpi.bpt.scylla.model.process.node.EventDefinitionType)8 ArrayList (java.util.ArrayList)8 Namespace (org.jdom2.Namespace)8