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

Integrating model and simulation.

parent 846d2e66
...@@ -252,6 +252,25 @@ public class TraciSimulationController implements VehicleController, SimulationS ...@@ -252,6 +252,25 @@ public class TraciSimulationController implements VehicleController, SimulationS
execute(phaseDurationCommand); execute(phaseDurationCommand);
} }
@Override
public int getProgramId(String trafficLightId) {
SumoCommand programIdCommand = Trafficlight.getProgram(trafficLightId);
Object programIdObject = requestObject(programIdCommand);
int programId = Integer.parseInt((String)programIdObject);
return programId;
}
@Override
public String getDefinition(String trafficLightId) {
SumoCommand definitionCommand = Trafficlight.getCompleteRedYellowGreenDefinition(trafficLightId);
Object definitionObject = requestObject(definitionCommand);
//((SumoTLSController) definitionObject).programs.get("1")
return (String) definitionObject;
}
@Override @Override
public boolean nextStep() { public boolean nextStep() {
if (Simulator.getEndTime() == Simulator.getCurrentTime()) { if (Simulator.getEndTime() == Simulator.getCurrentTime()) {
......
...@@ -230,6 +230,16 @@ public class XMLSimulationController implements VehicleController, SimulationSet ...@@ -230,6 +230,16 @@ public class XMLSimulationController implements VehicleController, SimulationSet
} }
@Override
public int getProgramId(String trafficLightId) {
return 0;
}
@Override
public String getDefinition(String trafficLightId) {
return null;
}
@Override @Override
public double getScenarioWidth() { public double getScenarioWidth() {
return -1; return -1;
......
...@@ -97,6 +97,16 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo ...@@ -97,6 +97,16 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
controller.setPhaseDuration(trafficLightId, extraTime); controller.setPhaseDuration(trafficLightId, extraTime);
} }
@Override
public int getProgramId() {
return controller.getProgramId(trafficLightId);
}
@Override
public String getDefinition() {
return controller.getDefinition(trafficLightId);
}
@Override @Override
public void initialize() { 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