Commit e1e66f27 authored by Benedikt Zoennchen's avatar Benedikt Zoennchen

Issue Fix: #88

parent eee5b7a3
Pipeline #59264 passed with stage
in 48 seconds
......@@ -76,7 +76,7 @@
"finishTime" : 200.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -78,7 +78,7 @@
"finishTime" : 30.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -78,7 +78,7 @@
"finishTime" : 30.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -78,7 +78,7 @@
"finishTime" : 30.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -78,7 +78,7 @@
"finishTime" : 30.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -78,7 +78,7 @@
"finishTime" : 30.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -78,7 +78,7 @@
"finishTime" : 30.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -78,7 +78,7 @@
"finishTime" : 30.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -75,7 +75,7 @@
"finishTime" : 1300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -75,7 +75,7 @@
"finishTime" : 1300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -61,7 +61,7 @@
"finishTime" : 500.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -61,7 +61,7 @@
"finishTime" : 500.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -61,7 +61,7 @@
"finishTime" : 300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -61,7 +61,7 @@
"finishTime" : 300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -61,7 +61,7 @@
"finishTime" : 300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -61,7 +61,7 @@
"finishTime" : 300.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -92,7 +92,7 @@
"finishTime" : 100.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -95,7 +95,7 @@
"finishTime" : 100.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -75,7 +75,7 @@
"finishTime" : 500.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.0,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -91,7 +91,7 @@
"finishTime" : 50.0,
"simTimeStepLength" : 0.4,
"realTimeSimTimeRatio" : 0.1,
"writeSimulationData" : true,
"writeSimulationData" : false,
"visualizationEnabled" : true,
"printFPS" : false,
"needsBoundary" : false,
......
......@@ -140,7 +140,9 @@ public class Simulation {
c.preLoop(simTimeInSec);
}
processorManager.preLoop(this.simulationState);
if(attributesSimulation.isWriteSimulationData()) {
processorManager.preLoop(this.simulationState);
}
}
private void postLoop() {
......@@ -154,7 +156,9 @@ public class Simulation {
c.postLoop(simTimeInSec);
}
processorManager.postLoop(this.simulationState);
if(attributesSimulation.isWriteSimulationData()) {
processorManager.postLoop(this.simulationState);
}
topographyController.postLoop(this.simTimeInSec);
}
......@@ -163,8 +167,10 @@ public class Simulation {
*/
public void run() {
try {
processorManager.setMainModel(mainModel);
processorManager.initOutputFiles();
if(attributesSimulation.isWriteSimulationData()) {
processorManager.setMainModel(mainModel);
processorManager.initOutputFiles();
}
preLoop();
......@@ -192,7 +198,11 @@ public class Simulation {
assert assertAllPedestrianInBounds();
updateCallbacks(simTimeInSec);
updateWriters(simTimeInSec);
processorManager.update(this.simulationState);
if(attributesSimulation.isWriteSimulationData()) {
processorManager.update(this.simulationState);
}
for (PassiveCallback c : passiveCallbacks) {
c.postUpdate(simTimeInSec);
......@@ -219,7 +229,9 @@ public class Simulation {
// this is necessary to free the resources (files), the SimulationWriter and processor are writing in!
postLoop();
processorManager.writeOutput();
if(attributesSimulation.isWriteSimulationData()) {
processorManager.writeOutput();
}
logger.info("Finished writing all output files");
}
}
......
......@@ -13,6 +13,7 @@ import java.util.Random;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.Nullable;
import org.vadere.simulator.control.PassiveCallback;
import org.vadere.simulator.control.Simulation;
import org.vadere.simulator.models.MainModel;
......@@ -38,7 +39,9 @@ public class ScenarioRun implements Runnable {
private final DataProcessingJsonManager dataProcessingJsonManager;
private Simulation simulation;
private ProcessorManager processorManager;
// the processor is null if no output is written i.e. if scenarioStore.attributesSimulation.isWriteSimulationData() is false.
private @Nullable ProcessorManager processorManager;
private final Scenario scenario;
private final ScenarioStore scenarioStore; // contained in scenario, but here for convenience
......@@ -76,10 +79,12 @@ public class ScenarioRun implements Runnable {
final Random random = modelBuilder.getRandom();
// prepare processors and simulation data writer
processorManager = dataProcessingJsonManager.createProcessorManager(mainModel);
if(scenarioStore.attributesSimulation.isWriteSimulationData()) {
processorManager = dataProcessingJsonManager.createProcessorManager(mainModel);
}
// Only create output directory and write .scenario file if there is any output.
if(!processorManager.isEmpty()) {
if(processorManager != null && !processorManager.isEmpty()) {
createAndSetOutputDirectory();
scenario.saveToOutputPath(outputPath);
}
......@@ -166,7 +171,10 @@ public class ScenarioRun implements Runnable {
private void sealAllAttributes() {
scenarioStore.sealAllAttributes();
processorManager.sealAllAttributes();
if(processorManager != null) {
processorManager.sealAllAttributes();
}
}
}
Markdown is supported
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