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

Integrating model and simulation.

parent 846d2e66
......@@ -252,7 +252,26 @@ public class TraciSimulationController implements VehicleController, SimulationS
execute(phaseDurationCommand);
}
@Override
@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
public boolean nextStep() {
if (Simulator.getEndTime() == Simulator.getCurrentTime()) {
return false;
......
......@@ -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
public double getScenarioWidth() {
return -1;
......
......@@ -97,6 +97,16 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
controller.setPhaseDuration(trafficLightId, extraTime);
}
@Override
public int getProgramId() {
return controller.getProgramId(trafficLightId);
}
@Override
public String getDefinition() {
return controller.getDefinition(trafficLightId);
}
@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