Commit 7ce68180 authored by Jose Ignacio Monreal Bailey's avatar Jose Ignacio Monreal Bailey
Browse files

Adding new changes for the input of the model of DrHe

parent 73bb2041
......@@ -271,6 +271,15 @@ public class TraciSimulationController implements VehicleController, SimulationS
return (String) definitionObject;
}
@Override
public int getLastStepVehicleNumber(String edgeIdFrom) {
SumoCommand lastStepVehicleNumberCommand = Edge.getLastStepVehicleNumber(edgeIdFrom);
Object lastStepVehicleNumberObject = requestObject(lastStepVehicleNumberCommand);
int lastStepVehicleNumber = ((Integer)lastStepVehicleNumberObject).intValue();
return lastStepVehicleNumber;
}
@Override
public boolean nextStep() {
if (Simulator.getEndTime() == Simulator.getCurrentTime()) {
......@@ -345,6 +354,22 @@ public class TraciSimulationController implements VehicleController, SimulationS
execute(typeCommand);
}
@Override
public RoadNetworkLane getVehicleLaneId(String pVehicleID) {
RoadNetworkLane roadNetworkLane = null;
String laneId = "";
SumoCommand laneCommand = Vehicle.getLaneID(pVehicleID);
Object laneObject = requestObject(laneCommand);
if (laneObject != null) {
laneId = (String) laneObject;
roadNetworkLane = new RoadNetworkLane(laneId);
}
return roadNetworkLane;
}
/*
@Override
public long getWaitingTime(String vehicleID) {
......
......@@ -16,10 +16,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.api.SimulationSetupExtractor;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.api.TrafficLightController;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.api.VehicleController;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetwork;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkLink;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.*;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exception.NoAdditionalRouteAvailableException;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exception.NoExitAvailableException;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.trafficlights.TrafficLight;
......@@ -240,6 +237,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
return null;
}
@Override
public int getLastStepVehicleNumber(String edgeIdFrom) {
return 0;
}
@Override
public double getScenarioWidth() {
return -1;
......@@ -299,6 +301,11 @@ public class XMLSimulationController implements VehicleController, SimulationSet
_vehicleDataInformationHandler.getVehiclePositions().get(pVehicleID).setGap(gap);
}
@Override
public RoadNetworkLane getVehicleLaneId(String pVehicleID) {
return null;
}
/*
@Override
public long getWaitingTime(String vehicleID) {
......
......@@ -37,6 +37,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.VehicleInformati
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.api.SimulationSetupExtractor;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.api.VehicleController;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkLane;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exception.NoAdditionalRouteAvailableException;
import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.exception.NoExitAvailableException;
......@@ -183,6 +184,11 @@ public class DefaultVehicleInformationComponent implements VehicleInformationCom
return controller.getCurrentRoute(vehicleID);
}
@Override
public RoadNetworkLane getVehicleLaneId() {
return controller.getVehicleLaneId(vehicleID);
}
@Override
public boolean changeCurrentRoute(RoadNetworkRoute pRoute) {
controller.rerouteVehicle(vehicleID, pRoute);
......
......@@ -93,7 +93,7 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
}
@Override
public void setPhasaeDuration(String trafficLightId, int extraTime) {
public void setPhaseDuration(String trafficLightId, int extraTime) {
controller.setPhaseDuration(trafficLightId, extraTime);
}
......@@ -107,6 +107,11 @@ public class DefaultTrafficLightInformationComponent implements TrafficLightInfo
return controller.getDefinition(trafficLightId);
}
@Override
public int getLastStepVehicleNumber(String edgeIdFrom) {
return controller.getLastStepVehicleNumber(edgeIdFrom);
}
@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