diff --git a/VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldObstacleCompactSoftshell.java b/VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldObstacleCompactSoftshell.java index 3f1d6a88f9f78d1c9d4a3e66848322c00cb64472..750dcc88f4d00c3ac5b9b959a7e226f497d85257 100644 --- a/VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldObstacleCompactSoftshell.java +++ b/VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldObstacleCompactSoftshell.java @@ -61,10 +61,10 @@ public class PotentialFieldObstacleCompactSoftshell implements PotentialFieldObs double currentPotential = 0; if (distance < this.width) { - currentPotential = this.height * MathUtil.expAp(2 / (Math.pow(distance / (this.width), 2) - 1)); + currentPotential = this.height * Math.exp(2 / (Math.pow(distance / (this.width), 2) - 1)); } if (distance < radius) { - currentPotential += 100000 * MathUtil.expAp(1 / (Math.pow(distance / radius, 2) - 1)); + currentPotential += 100000 * Math.exp(1 / (Math.pow(distance / radius, 2) - 1)); } if (potential < currentPotential) diff --git a/VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldPedestrianCompactSoftshell.java b/VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldPedestrianCompactSoftshell.java index aa9fd25de19a98b44653cafe1dfc7233293c1d34..e7a91b0448a4ed6e757fa652849c3e73e1b35f6c 100644 --- a/VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldPedestrianCompactSoftshell.java +++ b/VadereSimulator/src/org/vadere/simulator/models/potential/PotentialFieldPedestrianCompactSoftshell.java @@ -62,14 +62,14 @@ public class PotentialFieldPedestrianCompactSoftshell implements PotentialFieldA double factor = this.attributes.getIntimateSpaceFactor(); if (distance < personalWidth + radii) { - potential += this.height * MathUtil.expAp(4 / (Math.pow(distance / (personalWidth + radii), (2 * perPower)) - 1)); + potential += this.height * Math.exp(4 / (Math.pow(distance / (personalWidth + radii), (2 * perPower)) - 1)); } if (distance < this.intimateWidth + radii) { potential += this.height / factor - * MathUtil.expAp(4 / (Math.pow(distance / (this.intimateWidth + radii), (2 * intPower)) - 1)); + * Math.exp(4 / (Math.pow(distance / (this.intimateWidth + radii), (2 * intPower)) - 1)); } if (distance < radii) { - potential += 1000 * MathUtil.expAp(1 / (Math.pow(distance / radii, 4) - 1)); + potential += 1000 * Math.exp(1 / (Math.pow(distance / radii, 4) - 1)); } } return potential; diff --git a/VadereSimulator/src/org/vadere/simulator/projects/ScenarioRun.java b/VadereSimulator/src/org/vadere/simulator/projects/ScenarioRun.java index 4b811609fe4ea54c2a31bf397af8f1c5a263ce86..d0b185de45636fca32b7707f258c9147a45181e5 100644 --- a/VadereSimulator/src/org/vadere/simulator/projects/ScenarioRun.java +++ b/VadereSimulator/src/org/vadere/simulator/projects/ScenarioRun.java @@ -68,30 +68,37 @@ public class ScenarioRun implements Runnable { @Override public void run() { try { - logger.info(String.format("Initializing scenario. Start of scenario '%s'...", scenario.getName())); - scenarioStore.getTopography().reset(); - - MainModelBuilder modelBuilder = new MainModelBuilder(scenarioStore); - modelBuilder.createModelAndRandom(); - - final MainModel mainModel = modelBuilder.getModel(); - final Random random = modelBuilder.getRandom(); - - // prepare processors and simulation data writer - if(scenarioStore.attributesSimulation.isWriteSimulationData()) { - processorManager = dataProcessingJsonManager.createProcessorManager(mainModel); + /** + * To make sure that no other Thread changes the scenarioStore object during the initialization of a scenario run + * this is an atomic operation with respect to the scenarioStore. We observed that with Linux 18.04 KUbunto + * the GUI-Thread changes the scenarioStore object during a simulation run. Which can lead to any unexpected behaviour. + */ + synchronized (scenarioStore) { + logger.info(String.format("Initializing scenario. Start of scenario '%s'...", scenario.getName())); + scenarioStore.getTopography().reset(); + + MainModelBuilder modelBuilder = new MainModelBuilder(scenarioStore); + modelBuilder.createModelAndRandom(); + + final MainModel mainModel = modelBuilder.getModel(); + final Random random = modelBuilder.getRandom(); + + // prepare processors and simulation data writer + if(scenarioStore.attributesSimulation.isWriteSimulationData()) { + processorManager = dataProcessingJsonManager.createProcessorManager(mainModel); + } + + // Only create output directory and write .scenario file if there is any output. + if(processorManager != null && !processorManager.isEmpty()) { + createAndSetOutputDirectory(); + scenario.saveToOutputPath(outputPath); + } + + sealAllAttributes(); + + // Run simulation main loop from start time = 0 seconds + simulation = new Simulation(mainModel, 0, scenarioStore.name, scenarioStore, passiveCallbacks, random, processorManager); } - - // Only create output directory and write .scenario file if there is any output. - if(processorManager != null && !processorManager.isEmpty()) { - createAndSetOutputDirectory(); - scenario.saveToOutputPath(outputPath); - } - - sealAllAttributes(); - - // Run simulation main loop from start time = 0 seconds - simulation = new Simulation(mainModel, 0, scenarioStore.name, scenarioStore, passiveCallbacks, random, processorManager); simulation.run(); } catch (Exception e) {