Class EdgeManager

java.lang.Object
real_time_traffic_simulation_with_java.wrapper.EdgeManager

public class EdgeManager extends Object
Wrapper class for TraaS to manage edges in the simulation
  • Constructor Details

    • EdgeManager

      public EdgeManager(it.polito.appeal.traci.SumoTraciConnection connection)
      Wrapper class for TraaS to manage edges in the simulation
      Parameters:
      connection - connection to Sumo
  • Method Details

    • getIDList

      public List<String> getIDList() throws Exception
      Get list of edge IDs, excluding junction edges
      Returns:
      a List type String of edge IDs, excluding junction edges
      Throws:
      Exception
    • getCongestedEdgeIDList

      public List<String> getCongestedEdgeIDList()
      Get list of congested edges IDs
      Returns:
      a List type String of congested edge IDs, excluding junction edges
    • getCongestedStatus

      public boolean getCongestedStatus(String edgeID)
      Get congested status of the edge
      Parameters:
      edgeID - the ID of the edge
      Returns:
      boolean congested status of the edge
    • getCount

      public int getCount()
      Get number of edges, excluding junction edges
      Returns:
      an int number of edges, excluding junction edges
    • getLaneCount

      public int getLaneCount(String edgeID) throws Exception
      Get number of lanes on the edge
      Parameters:
      edgeID - the ID of the edge
      Returns:
      an int number of lanes on the edge
      Throws:
      Exception
    • getLaneIDList

      public List<String> getLaneIDList(String edgeID) throws Exception
      Get lane IDs on the edge
      Parameters:
      edgeID - the ID of the edge
      Returns:
      a List of lane IDs on the edge
      Throws:
      Exception
    • getLanesCoordinate

      public List<de.tudresden.sumo.objects.SumoGeometry> getLanesCoordinate(String edgeID) throws Exception
      Get coordinations of lanes the edge
      Parameters:
      edgeID - the ID of the edge
      Returns:
      a List of SumoGeometry type coordinations of the lanes on the edge
      Throws:
      Exception
    • getMaxSpeed

      public double getMaxSpeed(String edgeID)
      Get max speed allowed on the edge (km/h)
      Parameters:
      edgeID - the ID of the edge
      Returns:
      a double max speed allowed on the edge (km/h)
    • getLength

      public double getLength(String edgeID)
      Get length of the edge (m)
      Parameters:
      edgeID - the ID of the edge
      Returns:
      a double length of the edge (m)
    • getVehicleCount

      public int getVehicleCount(String edgeID)
      Get number of vehicles on the edge in the last step
      Parameters:
      edgeID - the ID of the edge
      Returns:
      an int number of vehicles on the edge in the last step
    • getAverageSpeed

      public double getAverageSpeed(String edgeID)
      Get average speed of vehicles on the edge in the last step (km/h)
      Parameters:
      edgeID - the ID of the edge
      Returns:
      a double average speed of vehicles on the edge in the last step (km/h)
    • getDensity

      public double getDensity(String edgeID)
      Get density of vehicles on the edge in the last step (vehicle/km)
      Parameters:
      edgeID - the ID of the edge
      Returns:
      a double density of vehicles on the edge in the last step (vehicle/km)
    • getTravelTime

      public double getTravelTime(String edgeID)
      Get estimate travel time on the edge in the last step (s)
      Parameters:
      edgeID - the ID of the edge
      Returns:
      a double estimate travel time on the edge in the last step (s)
    • getHaltingNumber

      public int getHaltingNumber(String edgeID) throws Exception
      Get number of halting vehicles on the edge in the last step
      Parameters:
      edgeID - the ID of the edge
      Returns:
      an int number of halting vehicles on the edge in the last step
      Throws:
      Exception
    • getEdgeDataList

      public List<EdgeData> getEdgeDataList() throws Exception
      Create and get a List of EdgeData for all edges
      Returns:
      a List of EdgeData for all edges
      Throws:
      Exception
    • updateEdgeDataList

      public void updateEdgeDataList() throws Exception
      Update congestion status for all edges based on TTI and set edge colors
      Throws:
      Exception