Commit 4846b945 by Benedikt Zoennchen

### synchronize scenarioStore access. Use exact exponential function for...

`synchronize scenarioStore access. Use exact exponential function for pedestrian and obstacle potential calculation`
parent 9f043451
 ... ... @@ -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) ... ...
 ... ... @@ -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; ... ...
 ... ... @@ -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) { ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!