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
/*
* 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("tripinfo-output.write-unfinished", "t");
String outputTripFileName = getTripOutputFilename(_tripOutputFile);
String summaryFile = getSummaryFilename(_tripOutputFile);
_connection.addOption("tripinfo-output", outputTripFileName);
_connection.addOption("device.emissions.probability", "1.0");
_connection.addOption("duration-log.statistics", "t");
_connection.addOption("summary", summaryFile);
_connection.printSumoError(true);
......@@ -162,6 +168,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
return path.getParent().toString() + "/results/" + filename;
}
private String getAdditionalsFilename(String filename) {
Path path = Paths.get(_configFile);
return path.getParent().toString() + "/" + filename;
}
@Override
public void simulationFinished() {
/*
......@@ -208,7 +219,7 @@ public class TraciSimulationController implements VehicleController, SimulationS
}
@Override
@Override
public Location getVehiclePosition(double pStep, String pVehicleID) {
if (pStep == _step) {
return getVehiclePosition(pVehicleID);
......@@ -312,6 +323,12 @@ public class TraciSimulationController implements VehicleController, SimulationS
return programId;
}
@Override
public void setCompleteRedYellowGreenDefinition(String trafficLightId, SumoTLSProgram sumoTLSProgram) {
SumoCommand definitionCommand = Trafficlight.setCompleteRedYellowGreenDefinition(trafficLightId, sumoTLSProgram);
execute(definitionCommand);
}
@Override
public String getDefinition(String trafficLightId) {
SumoCommand definitionCommand = Trafficlight.getCompleteRedYellowGreenDefinition(trafficLightId);
......@@ -332,10 +349,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
}
@Override
public void getCompleteDefinition(String trafficLightId) {
public SumoTLSController getCompleteDefinition(String trafficLightId) {
SumoCommand completeTrafficLightDefinitionCommand = Trafficlight.getCompleteRedYellowGreenDefinition(trafficLightId);
Object completeTrafficLightDefinitionObject = requestObject(completeTrafficLightDefinitionCommand);
return ((SumoTLSController) completeTrafficLightDefinitionObject);
}
@Override
......
......@@ -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.trafficlights.TrafficLight;
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 {
private String _vehicleDataPath;
......@@ -113,6 +115,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
return 0;
}
@Override
public void setCompleteRedYellowGreenDefinition(String trafficLightId, SumoTLSProgram sumoTLSProgram) {
}
public VehicleInformationContainer requestVehicleInformation(String pVehicleID) {
return _vehicleDataInformationHandler.getVehiclePositions().get(pVehicleID);
}
......@@ -263,8 +270,8 @@ public class XMLSimulationController implements VehicleController, SimulationSet
}
@Override
public void getCompleteDefinition(String trafficLightId) {
public SumoTLSController getCompleteDefinition(String trafficLightId) {
return null;
}
@Override
......
......@@ -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.TrafficLightInformationComponent;
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.Map;
......@@ -92,13 +94,13 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
}
@Override
public int getPhase() {
return controller.getPhase(trafficLightId);
public int getPhase(String pTrafficLightId) {
return controller.getPhase(pTrafficLightId);
}
@Override
public void setPhase(int phase) {
controller.setPhase(trafficLightId, phase);
public void setPhase(String pTrafficLightId, int phase) {
controller.setPhase(pTrafficLightId, phase);
}
@Override
......@@ -132,8 +134,8 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
}
@Override
public void getCompleteDefinition(String trafficLightId) {
controller.getCompleteDefinition(trafficLightId);
public SumoTLSController getCompleteDefinition(String trafficLightId) {
return controller.getCompleteDefinition(trafficLightId);
}
@Override
......@@ -166,6 +168,11 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
return controller.getEdgeOccupancyRate(edgeIdFrom);
}
@Override
public void setCompleteRedYellowGreenDefinition(String trafficLightId, SumoTLSProgram sumoTLSProgram) {
controller.setCompleteRedYellowGreenDefinition(trafficLightId, sumoTLSProgram);
}
@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