Class Simulation


  • public class Simulation
    extends Object
    The Class Simulation.
    Author:
    Mario Krumnow, Evamarie Wiessner
    • Constructor Detail

      • Simulation

        public Simulation()
    • Method Detail

      • convert2D

        public static SumoCommand convert2D​(String edgeID,
                                            double pos,
                                            byte laneIndex,
                                            String toGeo)
        convert2D.
        Parameters:
        edgeID - edge id
        pos - pos
        laneIndex - index
        toGeo - geo
        Returns:
        SumoCommand
      • convert3D

        public static SumoCommand convert3D​(String edgeID,
                                            double pos,
                                            byte laneIndex,
                                            String toGeo)
        convert3D.
        Parameters:
        edgeID - edge id
        pos - pos
        laneIndex - index
        toGeo - geo
        Returns:
        SumoCommand
      • convertGeo

        public static SumoCommand convertGeo​(double x,
                                             double y,
                                             boolean fromGeo)
        convertGeo.
        Parameters:
        x - x
        y - y
        fromGeo - geo
        Returns:
        SumoCommand
      • convertRoad

        public static SumoCommand convertRoad​(double x,
                                              double y,
                                              boolean isGeo,
                                              String vClass)
        convertRoad.
        Parameters:
        x - x
        y - y
        isGeo - geo
        vClass - the v class
        Returns:
        SumoCommand
      • getArrivedIDList

        public static SumoCommand getArrivedIDList()
        Returns a list of IDs of vehicles which arrived in this time step.
        Returns:
        list of vehicles
      • getArrivedNumber

        public static SumoCommand getArrivedNumber()
        Returns the number of vehicles which arrived in this time step.
        Returns:
        number of vehicles
      • getBusStopWaiting

        public static SumoCommand getBusStopWaiting()
        Returns the current waiting time on bus stops(in ms).
        Returns:
        waiting time
      • getParkingEndingVehiclesIDList

        public static SumoCommand getParkingEndingVehiclesIDList()
        getParkingEndingVehiclesIDList().
        Returns:
        number of vehicles
      • getParkingEndingVehiclesNumber

        public static SumoCommand getParkingEndingVehiclesNumber()
        getParkingEndingVehiclesNumber().
        Returns:
        number of vehicles
      • getParkingStartingVehiclesIDList

        public static SumoCommand getParkingStartingVehiclesIDList()
        getParkingStartingVehiclesIDList().
        Returns:
        number of vehicles
      • getParkingStartingVehiclesNumber

        public static SumoCommand getParkingStartingVehiclesNumber()
        getParkingStartingVehiclesNumber().
        Returns:
        number of vehicles
      • getStopEndingVehiclesIDList

        public static SumoCommand getStopEndingVehiclesIDList()
        getStopEndingVehiclesIDList().
        Returns:
        number of vehicles
      • getCollidingVehiclesNumber

        public static SumoCommand getCollidingVehiclesNumber()
        getCollidingVehiclesNumber().
        Returns:
        Return number of vehicles involved in a collision (typically 2 per collision).
      • getCollidingVehiclesIDList

        public static SumoCommand getCollidingVehiclesIDList()
        getCollidingVehiclesNumber().
        Returns:
        Return Ids of vehicles involved in a collision (typically 2 per collision)
      • getEmergencyStoppingVehiclesNumber

        public static SumoCommand getEmergencyStoppingVehiclesNumber()
        getEmergencyStoppingVehiclesNumber().
        Returns:
        Return number of vehicles that performed an emergency stop in the last step
      • getEmergencyStoppingVehiclesIDList

        public static SumoCommand getEmergencyStoppingVehiclesIDList()
        getEmergencyStoppingVehiclesIDList().
        Returns:
        Return Ids of vehicles that peformed an emergency stop in the last step
      • getStopEndingVehiclesNumber

        public static SumoCommand getStopEndingVehiclesNumber()
        getStopEndingVehiclesNumber().
        Returns:
        number of vehicles
      • getStopStartingVehiclesIDList

        public static SumoCommand getStopStartingVehiclesIDList()
        getStopStartingVehiclesIDList().
        Returns:
        list of vehicles
      • getStopStartingVehiclesNumber

        public static SumoCommand getStopStartingVehiclesNumber()
        getStopStartingVehiclesIDList().
        Returns:
        list of vehicles
      • getCurrentTime

        public static SumoCommand getCurrentTime()
        getCurrentTime.
        Returns:
        current time in ms (integer). Note: this method only supports a simulation time up to 24 days and is only kept for legacy reasons
      • getTime

        public static SumoCommand getTime()
        getTime.
        Returns:
        current time in s (double)
      • getDeltaT

        public static SumoCommand getDeltaT()
        getDeltaT.
        Returns:
        delat time
      • getDepartedIDList

        public static SumoCommand getDepartedIDList()
        Returns a list of IDs of vehicles which departed in this time step.
        Returns:
        list of IDs of vehicles which departed in this time step.
      • getDepartedNumber

        public static SumoCommand getDepartedNumber()
        Returns the number of vehicles which departed in this time step.
        Returns:
        the number of vehicles which departed in this time step.
      • getDistance2D

        public static SumoCommand getDistance2D​(double x1,
                                                double y1,
                                                double x2,
                                                double y2,
                                                boolean isGeo,
                                                boolean isDriving)
        Parameters:
        x1 - x1
        y1 - y1
        x2 - x2
        y2 - y2
        isGeo - is geo
        isDriving - is driving
        Returns:
        distance
      • getDistanceRoad

        public static SumoCommand getDistanceRoad​(String edgeID1,
                                                  double pos1,
                                                  String edgeID2,
                                                  double pos2,
                                                  boolean isDriving)
        Parameters:
        edgeID1 - first edge
        pos1 - first position
        edgeID2 - second edge
        pos2 - second position
        isDriving - is drinving
        Returns:
        the distance in [m]
      • getEndingTeleportIDList

        public static SumoCommand getEndingTeleportIDList()
        Returns a list of IDs of vehicles which ended to be teleported in this time step.
        Returns:
        SumoCommand
      • getEndingTeleportNumber

        public static SumoCommand getEndingTeleportNumber()
        Returns the number of vehicles which ended to be teleported in this time step.
        Returns:
        SumoCommand
      • getLoadedIDList

        public static SumoCommand getLoadedIDList()
        Returns a list of IDs of vehicles which were loaded in this time step.
        Returns:
        SumoCommand
      • getLoadedNumber

        public static SumoCommand getLoadedNumber()
        Return the number of vehicles which were loaded in this time step. * @return SumoCommand
        Returns:
        SumoCommand
      • getMinExpectedNumber

        public static SumoCommand getMinExpectedNumber()
        Returns the number of vehicles which are in the net plus the ones still waiting to start.
        Returns:
        SumoCommand
      • getNetBoundary

        public static SumoCommand getNetBoundary()
        Returns the boundary box of the simulation network.
        Returns:
        SumoCommand
      • getStartingTeleportIDList

        public static SumoCommand getStartingTeleportIDList()
        Returns a list of IDs of vehicles which started to teleport in this time step.
        Returns:
        SumoCommand
      • getStartingTeleportNumber

        public static SumoCommand getStartingTeleportNumber()
        Returns the number of vehicles which started to teleport in this time step.
        Returns:
        SumoCommand
      • clearPending

        public static SumoCommand clearPending​(String routeID)
        Clear pending.
        Parameters:
        routeID - route id
        Returns:
        SumoCommand
      • saveState

        public static SumoCommand saveState​(String filename)
        save state.
        Parameters:
        filename - the filename
        Returns:
        SumoCommand
      • findRoute

        public static SumoCommand findRoute​(String fromEdge,
                                            String toEdge,
                                            String vType,
                                            double depart,
                                            int routingMode)
        findRoute.
        Parameters:
        fromEdge - first edge
        toEdge - second edge
        vType - vehicle type
        depart - depart
        routingMode - routing mode
        Returns:
        the route
      • findIntermodalRoute

        public static SumoCommand findIntermodalRoute​(String fromEdge,
                                                      String toEdge,
                                                      String modes,
                                                      double depart,
                                                      int routingMode,
                                                      double speed,
                                                      double walkingFactor,
                                                      double departPos,
                                                      double arrivalPos,
                                                      double departPosLat,
                                                      String pType,
                                                      String vType,
                                                      String destStop)
        findIntermodalRoute.
        Parameters:
        fromEdge - first edge
        toEdge - second edge
        modes - modes
        depart - depart
        routingMode - routing mode
        speed - speed
        walkingFactor - walkingFactor
        departPos - departPos
        arrivalPos - arrivalPos
        departPosLat - departPosLat
        pType - pType
        vType - vType
        destStop - destStop
        Returns:
        the route