Commit 8bd9a92d authored by Daniel Lehmberg's avatar Daniel Lehmberg
Browse files

Code cleaning and order of time and state update in Simulation.run()

parent 277e4b8f
......@@ -272,7 +272,9 @@ public class Simulation {
assert assertAllPedestrianInBounds(): "Pedestrians are outside of topography bound.";
updateCallbacks(simTimeInSec);
updateWriters(simTimeInSec); // set SimulationState with Time!!!
step++;
this.simulationState = new SimulationState(name, topography, scenarioStore, simTimeInSec, step, mainModel);
if (attributesSimulation.isWriteSimulationData()) {
processorManager.update(this.simulationState);
......@@ -346,19 +348,11 @@ public class Simulation {
}
private SimulationState initialSimulationState() {
SimulationState state =
new SimulationState(name, topography.clone(), scenarioStore, simTimeInSec, step, mainModel);
SimulationState state = new SimulationState(name, topography.clone(), scenarioStore, simTimeInSec, step, mainModel);
return state;
}
private void updateWriters(double simTimeInSec) {
SimulationState simulationState =
new SimulationState(name, topography, scenarioStore, simTimeInSec, step, mainModel);
this.simulationState = simulationState;
}
private void updateCallbacks(double simTimeInSec) {
List<Stimulus> stimuli = stimulusController.getStimuliForTime(simTimeInSec);
......@@ -388,7 +382,6 @@ public class Simulation {
}
topographyController.update(simTimeInSec); //rebuild CellGrid
step++;
Collection<Pedestrian> pedestrians = topography.getElements(Pedestrian.class);
perceptionModel.update(pedestrians, stimuli);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment