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
c4cf3da1
Commit
c4cf3da1
authored
Apr 18, 2018
by
jimonreal
Committed by
Jose Ignacio Monreal Bailey
Aug 20, 2019
Browse files
Adding speed control methods
parent
17c5d7d6
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/VehicleInformationContainer.java
View file @
c4cf3da1
...
@@ -52,4 +52,8 @@ public class VehicleInformationContainer {
...
@@ -52,4 +52,8 @@ public class VehicleInformationContainer {
public
RoadNetworkRoute
getRoute
()
{
public
RoadNetworkRoute
getRoute
()
{
return
_route
;
return
_route
;
}
}
public
void
setSpeed
(
double
vehicleSpeed
)
{
_speed
=
vehicleSpeed
;
}
}
}
\ No newline at end of file
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/traci/TraciSimulationController.java
View file @
c4cf3da1
...
@@ -246,7 +246,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -246,7 +246,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
}
}
public
String
getVehicleType
(
String
pVehicleID
)
{
public
String
getVehicleType
(
String
pVehicleID
)
{
String
vehicleType
=
"
private
"
;
String
vehicleType
=
"
default
"
;
SumoCommand
typeCommand
=
Vehicle
.
getTypeID
(
pVehicleID
);
SumoCommand
typeCommand
=
Vehicle
.
getTypeID
(
pVehicleID
);
...
@@ -259,6 +259,12 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -259,6 +259,12 @@ public class TraciSimulationController implements VehicleController, SimulationS
return
vehicleType
;
return
vehicleType
;
}
}
@Override
public
void
setVehicleSpeed
(
String
pVehicleID
,
double
pVehicleSpeed
)
{
SumoCommand
typeCommand
=
Vehicle
.
setSpeed
(
pVehicleID
,
pVehicleSpeed
);
execute
(
typeCommand
);
}
private
Location
requestVehiclePosition
(
String
pVehicleID
)
{
private
Location
requestVehiclePosition
(
String
pVehicleID
)
{
if
(
_vehiclesOutOfRange
.
containsKey
(
pVehicleID
))
{
if
(
_vehiclesOutOfRange
.
containsKey
(
pVehicleID
))
{
if
(
_vehiclesOutOfRange
.
get
(
pVehicleID
)
<
_step
)
{
if
(
_vehiclesOutOfRange
.
get
(
pVehicleID
)
<
_step
)
{
...
@@ -296,7 +302,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
...
@@ -296,7 +302,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
double
timeTillNextJoin
=
diff
/
50
;
double
timeTillNextJoin
=
diff
/
50
;
//
_vehiclesOutOfRange.put(pVehicleID, _step + timeTillNextJoin);
//_vehiclesOutOfRange.put(pVehicleID, _step + timeTillNextJoin);
return
null
;
return
null
;
}
}
...
...
src/de/tud/kom/p2psim/impl/topology/movement/vehicular/sumo/simulation/controller/xml/XMLSimulationController.java
View file @
c4cf3da1
...
@@ -210,6 +210,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
...
@@ -210,6 +210,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
return
null
;
return
null
;
}
}
@Override
public
void
setVehicleSpeed
(
String
pVehicleID
,
double
pVehicleSpeed
)
{
_vehicleDataInformationHandler
.
getVehiclePositions
().
get
(
pVehicleID
).
setSpeed
(
pVehicleSpeed
);
}
@Override
@Override
public
double
getVehicleSpeed
(
String
pVehicleID
)
{
public
double
getVehicleSpeed
(
String
pVehicleID
)
{
return
_vehicleDataInformationHandler
.
getVehiclePositions
().
get
(
pVehicleID
).
getSpeed
();
return
_vehicleDataInformationHandler
.
getVehiclePositions
().
get
(
pVehicleID
).
getSpeed
();
...
...
src/de/tud/kom/p2psim/impl/vehicular/DefaultVehicleInformationComponent.java
View file @
c4cf3da1
...
@@ -124,6 +124,21 @@ public class DefaultVehicleInformationComponent implements VehicleInformationCom
...
@@ -124,6 +124,21 @@ public class DefaultVehicleInformationComponent implements VehicleInformationCom
vehicleID
=
pVehicleID
;
vehicleID
=
pVehicleID
;
}
}
@Override
public
String
getVehicleID
()
{
return
vehicleID
;
}
@Override
public
String
getVehicleType
()
{
return
controller
.
getVehicleType
(
vehicleID
);
}
@Override
public
void
setVehicleSpeed
(
String
vehicleID
,
double
vehicleSpeed
)
{
controller
.
setVehicleSpeed
(
vehicleID
,
vehicleSpeed
);
}
@Override
@Override
public
void
resetVehicleID
()
{
public
void
resetVehicleID
()
{
vehicleID
=
null
;
vehicleID
=
null
;
...
...
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