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);
}
}
}
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);
}
}
}
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);
}
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.");
}
}
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);
}
Aggregations