enableMonitoring();
// check whether we have a processor for executing the model
if (processorInfo == null) {
throw new InvalidProcessorException(getIdentification()
+ "Ooops ... no processor to start with ...");
}
if (processorInfo.getLocal() == null) {
throw new InvalidProcessorException(getIdentification()
+ "No local processor available!!!");
}
SimSystem.report(Level.CONFIG,
"[Classname of the main/top most processor: "
+ processorInfo.getLocal().getClassName() + "]");
if (processorInfo.getLocal() instanceof IRunnable) {
if (startHook != null) {
startHook.execute(processorInfo);
}
if (!config.isSilent()) {
SimSystem.report(Level.FINER, getIdentification() + "Simulating ...");
}
stopWatch.start();
initializeWallClockTime();
((IRunnable) processorInfo.getLocal()).run(getStopPolicy(), getDelay(),
isStartPaused());
stopWatch.stop();
if (endHook != null) {
endHook.execute(processorInfo);
}
printMonitoringResults();
// write time needed for running the model into a file (if enabled)
if (config.isLogTime()) {
try {
FileOutputStream fs = new FileOutputStream("./simprot.txt", true);
try (PrintStream p = new PrintStream(fs)) {
p.println(model.getLocal().getName() + ";"
+ stopWatch.elapsedSeconds());
}
// fs.close();
} catch (Exception e) {
SimSystem.report(e);
}
}
} else {
throw new InvalidProcessorException(getIdentification()
+ "Oooops ... the top most processor is not runnable!!!");
}
}