Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
57c76cb3
Commit
57c76cb3
authored
Jun 19, 2018
by
Jose Ignacio Monreal Bailey
Browse files
Creating dynamic filename outputs
Going to change it to seed plus timestamp
parent
c4a71167
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/traci/TraciSimulationController.java
View file @
57c76cb3
...
@@ -6,6 +6,8 @@ import java.io.FileOutputStream;
...
@@ -6,6 +6,8 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
java.io.ObjectInputStream
;
import
java.io.ObjectOutputStream
;
import
java.io.ObjectOutputStream
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.*
;
import
java.util.*
;
import
de.tud.kom.p2psim.api.simengine.SimulatorObserver
;
import
de.tud.kom.p2psim.api.simengine.SimulatorObserver
;
...
@@ -112,10 +114,10 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -112,10 +114,10 @@ public class TraciSimulationController implements VehicleController, SimulationS
/*
/*
* prevent vehicles form teleporting (http://sumo.dlr.de/wiki/Simulation/Why_Vehicles_are_teleporting)
* 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
(
1
00
));
_connection
.
addOption
(
"tripinfo-output.write-unfinished"
,
"t"
);
_connection
.
addOption
(
"tripinfo-output.write-unfinished"
,
"t"
);
_connection
.
addOption
(
"tripinfo-output"
,
"sumoCfg/Networks/Simple/simple4/simple4-outputTrip-"
+
Integer
.
toString
(
nextRandomInt
)
+
".xml"
)
;
String
outputTripFileName
=
getTripOutputFilename
(
nextRandomInt
);
//
_connection.addOption("tripinfo-output
.write-unfinished", _tripOutputFil
e);
_connection
.
addOption
(
"tripinfo-output
"
,
outputTripFileNam
e
);
_connection
.
printSumoError
(
true
);
_connection
.
printSumoError
(
true
);
try
{
try
{
...
@@ -132,6 +134,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -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
@Override
public
void
simulationFinished
()
{
public
void
simulationFinished
()
{
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment