Commit a3354fcb authored by Jose Ignacio Monreal Bailey's avatar Jose Ignacio Monreal Bailey
Browse files

Adding extension based on edge occupancy

parent 5c1198c6
......@@ -179,7 +179,18 @@ public class TraciSimulationController implements VehicleController, SimulationS
return (Double)object;
}
@Override
@Override
public int getEdgeOccupancyRate(String edgeIdFrom) {
SumoCommand edgeCommand = Edge.getLastStepOccupancy(edgeIdFrom);
Object edgeObject = requestObject(edgeCommand);
int edgeOccupancyRate = (int)Math.round(((Double)edgeObject)*100.0);
return edgeOccupancyRate;
}
@Override
public Location getVehiclePosition(double pStep, String pVehicleID) {
if (pStep == _step) {
return getVehiclePosition(pVehicleID);
......
......@@ -108,7 +108,12 @@ public class XMLSimulationController implements VehicleController, SimulationSet
return 0;
}
public VehicleInformationContainer requestVehicleInformation(String pVehicleID) {
@Override
public int getEdgeOccupancyRate(String edgeIdFrom) {
return 0;
}
public VehicleInformationContainer requestVehicleInformation(String pVehicleID) {
return _vehicleDataInformationHandler.getVehiclePositions().get(pVehicleID);
}
......
......@@ -161,6 +161,11 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
return controller.getMinExpectedNumber();
}
@Override
public int getEdgeOccupancyRate(String edgeIdFrom) {
return controller.getEdgeOccupancyRate(edgeIdFrom);
}
@Override
public void initialize() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment