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
70547348
Commit
70547348
authored
Oct 05, 2017
by
Tobias Meuser
Committed by
Jose Ignacio Monreal Bailey
Aug 20, 2019
Browse files
Extended vehicle route randomly after exit
parent
dbef7b09
Changes
1
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/traci/TraciSimulationController.java
View file @
70547348
...
@@ -50,7 +50,7 @@ import it.polito.appeal.traci.SumoTraciConnection;
...
@@ -50,7 +50,7 @@ import it.polito.appeal.traci.SumoTraciConnection;
public
class
TraciSimulationController
implements
VehicleController
,
SimulationSetupExtractor
,
EdgeController
,
SimulatorObserver
{
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
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
<>();
private
static
final
Map
<
String
,
TraciSimulationController
>
CONTROLLER
=
new
HashMap
<>();
...
@@ -200,6 +200,9 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -200,6 +200,9 @@ public class TraciSimulationController implements VehicleController, SimulationS
@Override
@Override
public
boolean
nextStep
()
{
public
boolean
nextStep
()
{
if
(
Simulator
.
getEndTime
()
==
Simulator
.
getCurrentTime
())
{
return
false
;
}
try
{
try
{
// for (RoadNetworkEdge roadNetworkEdge : modifiedEdges) {
// for (RoadNetworkEdge roadNetworkEdge : modifiedEdges) {
// SumoCommand setMaxSpeedCommand = Edge.setMaxSpeed(roadNetworkEdge.getEdgeID(), roadNetworkEdge.getOriginalMaxSpeed());
// SumoCommand setMaxSpeedCommand = Edge.setMaxSpeed(roadNetworkEdge.getEdgeID(), roadNetworkEdge.getOriginalMaxSpeed());
...
@@ -534,6 +537,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -534,6 +537,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
}
}
edges
.
add
(
accessibleEdges
.
get
(
j
));
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
)
{
for
(
RoadNetworkEdge
roadNetworkEdge
:
edges
)
{
if
(
pEdgesToAvoid
.
contains
(
roadNetworkEdge
))
{
if
(
pEdgesToAvoid
.
contains
(
roadNetworkEdge
))
{
continue
outer
;
continue
outer
;
...
@@ -708,14 +716,6 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -708,14 +716,6 @@ public class TraciSimulationController implements VehicleController, SimulationS
RoadNetworkEdge
edge
=
getRoadNetwork
().
getEdge
(
pEdgeID
);
RoadNetworkEdge
edge
=
getRoadNetwork
().
getEdge
(
pEdgeID
);
edge
.
setMaxSpeed
(
pMaxSpeed
);
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