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

Fixing extension

parent 12ca8f35
...@@ -129,11 +129,17 @@ public class TraciSimulationController implements VehicleController, SimulationS ...@@ -129,11 +129,17 @@ public class TraciSimulationController implements VehicleController, SimulationS
/* /*
* prevent vehicles form teleporting (http://sumo.dlr.de/wiki/Simulation/Why_Vehicles_are_teleporting) * prevent vehicles form teleporting (http://sumo.dlr.de/wiki/Simulation/Why_Vehicles_are_teleporting)
*/ */
if (_tripOutputFile.contains("basic")) {
_connection.addOption("additional-files", getAdditionalsFilename("basic-additional.xml"));
}
_connection.addOption("time-to-teleport", Integer.toString(-1)); _connection.addOption("time-to-teleport", Integer.toString(-1));
_connection.addOption("tripinfo-output.write-unfinished", "t"); _connection.addOption("tripinfo-output.write-unfinished", "t");
String outputTripFileName = getTripOutputFilename(_tripOutputFile); String outputTripFileName = getTripOutputFilename(_tripOutputFile);
String summaryFile = getSummaryFilename(_tripOutputFile); String summaryFile = getSummaryFilename(_tripOutputFile);
_connection.addOption("tripinfo-output", outputTripFileName); _connection.addOption("tripinfo-output", outputTripFileName);
_connection.addOption("device.emissions.probability", "1.0");
_connection.addOption("duration-log.statistics", "t"); _connection.addOption("duration-log.statistics", "t");
_connection.addOption("summary", summaryFile); _connection.addOption("summary", summaryFile);
_connection.printSumoError(true); _connection.printSumoError(true);
...@@ -162,6 +168,11 @@ public class TraciSimulationController implements VehicleController, SimulationS ...@@ -162,6 +168,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
return path.getParent().toString() + "/results/" + filename; return path.getParent().toString() + "/results/" + filename;
} }
private String getAdditionalsFilename(String filename) {
Path path = Paths.get(_configFile);
return path.getParent().toString() + "/" + filename;
}
@Override @Override
public void simulationFinished() { public void simulationFinished() {
/* /*
...@@ -208,7 +219,7 @@ public class TraciSimulationController implements VehicleController, SimulationS ...@@ -208,7 +219,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
} }
@Override @Override
public Location getVehiclePosition(double pStep, String pVehicleID) { public Location getVehiclePosition(double pStep, String pVehicleID) {
if (pStep == _step) { if (pStep == _step) {
return getVehiclePosition(pVehicleID); return getVehiclePosition(pVehicleID);
...@@ -312,6 +323,12 @@ public class TraciSimulationController implements VehicleController, SimulationS ...@@ -312,6 +323,12 @@ public class TraciSimulationController implements VehicleController, SimulationS
return programId; return programId;
} }
@Override
public void setCompleteRedYellowGreenDefinition(String trafficLightId, SumoTLSProgram sumoTLSProgram) {
SumoCommand definitionCommand = Trafficlight.setCompleteRedYellowGreenDefinition(trafficLightId, sumoTLSProgram);
execute(definitionCommand);
}
@Override @Override
public String getDefinition(String trafficLightId) { public String getDefinition(String trafficLightId) {
SumoCommand definitionCommand = Trafficlight.getCompleteRedYellowGreenDefinition(trafficLightId); SumoCommand definitionCommand = Trafficlight.getCompleteRedYellowGreenDefinition(trafficLightId);
...@@ -332,10 +349,11 @@ public class TraciSimulationController implements VehicleController, SimulationS ...@@ -332,10 +349,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
} }
@Override @Override
public void getCompleteDefinition(String trafficLightId) { public SumoTLSController getCompleteDefinition(String trafficLightId) {
SumoCommand completeTrafficLightDefinitionCommand = Trafficlight.getCompleteRedYellowGreenDefinition(trafficLightId); SumoCommand completeTrafficLightDefinitionCommand = Trafficlight.getCompleteRedYellowGreenDefinition(trafficLightId);
Object completeTrafficLightDefinitionObject = requestObject(completeTrafficLightDefinitionCommand); Object completeTrafficLightDefinitionObject = requestObject(completeTrafficLightDefinitionCommand);
return ((SumoTLSController) completeTrafficLightDefinitionObject);
} }
@Override @Override
......
...@@ -21,6 +21,8 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exce ...@@ -21,6 +21,8 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exce
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exception.NoExitAvailableException; import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exception.NoExitAvailableException;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLight; import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLight;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLightState; import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLightState;
import de.tudresden.ws.container.SumoTLSController;
import de.tudresden.ws.container.SumoTLSProgram;
public class XMLSimulationController implements VehicleController, SimulationSetupExtractor, Runnable, TrafficLightController { public class XMLSimulationController implements VehicleController, SimulationSetupExtractor, Runnable, TrafficLightController {
private String _vehicleDataPath; private String _vehicleDataPath;
...@@ -113,6 +115,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet ...@@ -113,6 +115,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
return 0; return 0;
} }
@Override
public void setCompleteRedYellowGreenDefinition(String trafficLightId, SumoTLSProgram sumoTLSProgram) {
}
public VehicleInformationContainer requestVehicleInformation(String pVehicleID) { public VehicleInformationContainer requestVehicleInformation(String pVehicleID) {
return _vehicleDataInformationHandler.getVehiclePositions().get(pVehicleID); return _vehicleDataInformationHandler.getVehiclePositions().get(pVehicleID);
} }
...@@ -263,8 +270,8 @@ public class XMLSimulationController implements VehicleController, SimulationSet ...@@ -263,8 +270,8 @@ public class XMLSimulationController implements VehicleController, SimulationSet
} }
@Override @Override
public void getCompleteDefinition(String trafficLightId) { public SumoTLSController getCompleteDefinition(String trafficLightId) {
return null;
} }
@Override @Override
......
...@@ -8,6 +8,8 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road ...@@ -8,6 +8,8 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLight; import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLight;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLightInformationComponent; import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLightInformationComponent;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLightState; import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLightState;
import de.tudresden.ws.container.SumoTLSController;
import de.tudresden.ws.container.SumoTLSProgram;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -92,13 +94,13 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo ...@@ -92,13 +94,13 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
} }
@Override @Override
public int getPhase() { public int getPhase(String pTrafficLightId) {
return controller.getPhase(trafficLightId); return controller.getPhase(pTrafficLightId);
} }
@Override @Override
public void setPhase(int phase) { public void setPhase(String pTrafficLightId, int phase) {
controller.setPhase(trafficLightId, phase); controller.setPhase(pTrafficLightId, phase);
} }
@Override @Override
...@@ -132,8 +134,8 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo ...@@ -132,8 +134,8 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
} }
@Override @Override
public void getCompleteDefinition(String trafficLightId) { public SumoTLSController getCompleteDefinition(String trafficLightId) {
controller.getCompleteDefinition(trafficLightId); return controller.getCompleteDefinition(trafficLightId);
} }
@Override @Override
...@@ -166,6 +168,11 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo ...@@ -166,6 +168,11 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
return controller.getEdgeOccupancyRate(edgeIdFrom); return controller.getEdgeOccupancyRate(edgeIdFrom);
} }
@Override
public void setCompleteRedYellowGreenDefinition(String trafficLightId, SumoTLSProgram sumoTLSProgram) {
controller.setCompleteRedYellowGreenDefinition(trafficLightId, sumoTLSProgram);
}
@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