Commit 57c76cb3 authored by Jose Ignacio Monreal Bailey's avatar Jose Ignacio Monreal Bailey
Browse files

Creating dynamic filename outputs

Going to change it to seed plus timestamp
parent c4a71167
......@@ -6,6 +6,8 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import de.tud.kom.p2psim.api.simengine.SimulatorObserver;
......@@ -112,10 +114,10 @@ public class TraciSimulationController implements VehicleController, SimulationS
/*
* prevent vehicles form teleporting (http://sumo.dlr.de/wiki/Simulation/Why_Vehicles_are_teleporting)
*/
_connection.addOption("time-to-teleport", Integer.toString(-1));
_connection.addOption("time-to-teleport", Integer.toString(100));
_connection.addOption("tripinfo-output.write-unfinished", "t");
_connection.addOption("tripinfo-output", "sumoCfg/Networks/Simple/simple4/simple4-outputTrip-" + Integer.toString(nextRandomInt) + ".xml");
//_connection.addOption("tripinfo-output.write-unfinished", _tripOutputFile);
String outputTripFileName = getTripOutputFilename(nextRandomInt);
_connection.addOption("tripinfo-output", outputTripFileName);
_connection.printSumoError(true);
try {
......@@ -132,6 +134,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
}
}
private String getTripOutputFilename(int nextRandomInt) {
Path path = Paths.get(_configFile);
return path.getParent().toString() + "/results/" + path.getParent().getFileName().toString() + "-" + Integer.toString(nextRandomInt) + ".xml";
}
@Override
public void simulationFinished() {
/*
......
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