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
84e9b991
Commit
84e9b991
authored
Sep 18, 2017
by
Tobias Meuser
Committed by
Jose Ignacio Monreal Bailey
Aug 20, 2019
Browse files
Added option to block edges without failures in SUMO
parent
ebdc2a8b
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 @
84e9b991
...
...
@@ -44,6 +44,8 @@ import it.polito.appeal.traci.SumoTraciConnection;
public
class
TraciSimulationController
implements
VehicleController
,
SimulationSetupExtractor
,
EdgeController
{
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
static
final
Map
<
String
,
TraciSimulationController
>
CONTROLLER
=
new
HashMap
<>();
private
static
final
double
CLUSTERING_DISTANCE
=
50
;
...
...
@@ -182,6 +184,13 @@ public class TraciSimulationController implements VehicleController, SimulationS
@Override
public
boolean
nextStep
()
{
try
{
for
(
RoadNetworkEdge
roadNetworkEdge
:
modifiedEdges
)
{
SumoCommand
setMaxSpeedCommand
=
Edge
.
setMaxSpeed
(
roadNetworkEdge
.
getEdgeID
(),
roadNetworkEdge
.
getOriginalMaxSpeed
());
execute
(
setMaxSpeedCommand
);
}
_connection
.
do_timestep
();
try
{
...
...
@@ -214,6 +223,12 @@ public class TraciSimulationController implements VehicleController, SimulationS
e
.
printStackTrace
();
}
for
(
RoadNetworkEdge
roadNetworkEdge
:
modifiedEdges
)
{
SumoCommand
setMaxSpeedCommand
=
Edge
.
setMaxSpeed
(
roadNetworkEdge
.
getEdgeID
(),
roadNetworkEdge
.
getMaxSpeed
());
execute
(
setMaxSpeedCommand
);
}
return
true
;
}
catch
(
RuntimeException
e
)
{
throw
e
;
...
...
@@ -672,6 +687,18 @@ public class TraciSimulationController implements VehicleController, SimulationS
SumoCommand
setMaxSpeedCommand
=
Edge
.
setMaxSpeed
(
pEdgeID
,
pMaxSpeed
);
execute
(
setMaxSpeedCommand
);
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