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
019d1168
Commit
019d1168
authored
Jun 12, 2018
by
jimonreal
Committed by
Jose Ignacio Monreal Bailey
Aug 20, 2019
Browse files
Adding functionality to discover edges controlled by traffic light
parent
43ef5b62
Changes
3
Show whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/traci/TraciSimulationController.java
View file @
019d1168
...
...
@@ -6,12 +6,7 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
java.io.ObjectOutputStream
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.*
;
import
de.tud.kom.p2psim.api.simengine.SimulatorObserver
;
import
de.tud.kom.p2psim.impl.simengine.Simulator
;
...
...
@@ -958,6 +953,28 @@ public class TraciSimulationController implements VehicleController, SimulationS
return
result
;
}
@Override
public
List
<
String
>
getControlledEdges
(
String
pTrafficLightID
)
{
List
<
String
>
controlledLanesList
=
getControlledLanes
(
pTrafficLightID
);
Map
<
String
,
String
>
controlledEdgeHash
=
new
HashMap
<>();
List
<
String
>
controlledEdgeList
=
new
ArrayList
<>();
controlledLanesList
.
removeIf
(
lane
->
lane
.
charAt
(
0
)
==
':'
);
for
(
String
lane
:
controlledLanesList
)
{
String
edge
=
lane
.
split
(
"_"
)[
0
];
if
(!
controlledEdgeHash
.
containsKey
(
edge
))
{
controlledEdgeHash
.
put
(
edge
,
""
);
}
}
for
(
String
edge
:
controlledEdgeHash
.
keySet
())
{
controlledEdgeList
.
add
(
edge
);
}
return
controlledEdgeList
;
}
@Override
public
Map
<
RoadNetworkLink
,
TrafficLightState
>
getTrafficLightStateForEachLane
(
String
pTrafficLightID
)
{
SumoCommand
trafficLightCommand
=
Trafficlight
.
getRedYellowGreenState
(
pTrafficLightID
);
...
...
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/xml/XMLSimulationController.java
View file @
019d1168
...
...
@@ -115,6 +115,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
return
null
;
}
@Override
public
List
<
String
>
getControlledEdges
(
String
pTrafficLightID
)
{
return
null
;
}
@Override
public
Map
<
RoadNetworkLink
,
TrafficLightState
>
getTrafficLightStateForEachLane
(
String
pTrafficLightID
)
{
return
null
;
...
...
src/de/tud/kom/p2psim/impl/vehicular/trafficlights/DefaultTrafficLightInformationComponent.java
View file @
019d1168
...
...
@@ -59,6 +59,16 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
return
trafficLightId
;
}
@Override
public
List
<
String
>
getControlledLanes
(
String
pTrafficLightID
)
{
return
controller
.
getControlledLanes
(
pTrafficLightID
);
}
@Override
public
List
<
String
>
getControlledEdges
(
String
pTrafficLightId
)
{
return
controller
.
getControlledEdges
(
pTrafficLightId
);
}
@Override
public
void
initialize
()
{
...
...
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