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
2d56973c
Commit
2d56973c
authored
Oct 05, 2017
by
Tobias Meuser
Browse files
Extended vehicle route randomly after exit
parent
30a32f4c
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 @
2d56973c
...
...
@@ -50,7 +50,7 @@ import it.polito.appeal.traci.SumoTraciConnection;
public
class
TraciSimulationController
implements
VehicleController
,
SimulationSetupExtractor
,
EdgeController
,
SimulatorObserver
{
private
static
final
File
TEMP_FILE
=
new
File
(
new
File
(
System
.
getProperty
(
"java.io.tmpdir"
)),
"road_network.tmp"
);
private
List
<
RoadNetworkEdge
>
modifiedEdges
=
new
ArrayList
<>(
);
private
Random
_random
=
Randoms
.
getRandom
(
getClass
()
);
private
static
final
Map
<
String
,
TraciSimulationController
>
CONTROLLER
=
new
HashMap
<>();
...
...
@@ -200,6 +200,9 @@ public class TraciSimulationController implements VehicleController, SimulationS
@Override
public
boolean
nextStep
()
{
if
(
Simulator
.
getEndTime
()
==
Simulator
.
getCurrentTime
())
{
return
false
;
}
try
{
// for (RoadNetworkEdge roadNetworkEdge : modifiedEdges) {
// SumoCommand setMaxSpeedCommand = Edge.setMaxSpeed(roadNetworkEdge.getEdgeID(), roadNetworkEdge.getOriginalMaxSpeed());
...
...
@@ -534,6 +537,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
}
edges
.
add
(
accessibleEdges
.
get
(
j
));
List
<
RoadNetworkEdge
>
newPaths
;
while
((
newPaths
=
edges
.
get
(
edges
.
size
()
-
1
).
getAccessibleEdges
()).
size
()
>
0
)
{
edges
.
add
(
newPaths
.
get
(
_random
.
nextInt
(
newPaths
.
size
())));
}
for
(
RoadNetworkEdge
roadNetworkEdge
:
edges
)
{
if
(
pEdgesToAvoid
.
contains
(
roadNetworkEdge
))
{
continue
outer
;
...
...
@@ -708,14 +716,6 @@ public class TraciSimulationController implements VehicleController, SimulationS
RoadNetworkEdge
edge
=
_roadNetwork
.
getEdge
(
pEdgeID
);
edge
.
setMaxSpeed
(
pMaxSpeed
);
if
(
edge
.
getOriginalMaxSpeed
()
!=
pMaxSpeed
)
{
if
(!
modifiedEdges
.
contains
(
edge
))
{
modifiedEdges
.
add
(
edge
);
}
}
else
{
modifiedEdges
.
remove
(
edge
);
}
}
}
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