Commit fee642a0 authored by jimonreal's avatar jimonreal Committed by Jose Ignacio Monreal Bailey
Browse files

Adding PhaseDuration

parent f9dbe74e
...@@ -268,6 +268,15 @@ public class TraciSimulationController implements VehicleController, SimulationS ...@@ -268,6 +268,15 @@ public class TraciSimulationController implements VehicleController, SimulationS
execute(phaseDurationCommand); execute(phaseDurationCommand);
} }
@Override
public double getPhaseDuration(String trafficLightId) {
SumoCommand phaseDurationCommand = Trafficlight.getPhaseDuration(trafficLightId);
Object phaseDurationObject = requestObject(phaseDurationCommand);
double phaseDuration = ((int) phaseDurationObject)/1000.0;
return phaseDuration;
}
@Override @Override
public int getProgramId(String trafficLightId) { public int getProgramId(String trafficLightId) {
SumoCommand programIdCommand = Trafficlight.getProgram(trafficLightId); SumoCommand programIdCommand = Trafficlight.getProgram(trafficLightId);
......
...@@ -232,6 +232,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet ...@@ -232,6 +232,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
} }
@Override
public double getPhaseDuration(String trafficLightId) {
return 0;
}
@Override @Override
public int getProgramId(String trafficLightId) { public int getProgramId(String trafficLightId) {
return 0; return 0;
......
...@@ -107,6 +107,11 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo ...@@ -107,6 +107,11 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
controller.setPhaseDuration(trafficLightId, extraTime); controller.setPhaseDuration(trafficLightId, extraTime);
} }
@Override
public double getPhaseDuration(String trafficLightId) {
return controller.getPhaseDuration(trafficLightId);
}
@Override @Override
public int getProgramId() { public int getProgramId() {
return controller.getProgramId(trafficLightId); return controller.getProgramId(trafficLightId);
......
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