Class Person


  • public class Person
    extends java.lang.Object
    Author:
    Mario Krumnow
    • Constructor Summary

      Constructors 
      Constructor Description
      Person()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static SumoCommand add​(java.lang.String personID, java.lang.String edgeID, double pos, double depart, java.lang.String typeID)
      Inserts a new person to the simulation at the given edge, position and time (in s).
      static SumoCommand appendDrivingStage​(java.lang.String personID, java.lang.String toEdge, java.lang.String lines, java.lang.String stopID)
      Appends a driving stage to the plan of the given person The lines parameter should be a space-separated list of line ids
      static SumoCommand appendWaitingStage​(java.lang.String personID, double duration, java.lang.String description, java.lang.String stopID)
      Appends a waiting stage with duration in s to the plan of the given person
      static SumoCommand appendWalkingStage​(java.lang.String personID, SumoStringList edges, double arrivalPos, double duration, double speed, java.lang.String stopID)
      Appends a walking stage to the plan of the given person The walking speed can either be specified, computed from the duration parameter (in s) or taken from the type of the person
      static SumoCommand getAngle​(java.lang.String personID)
      get angle
      static SumoCommand getColor​(java.lang.String personID)
      get lane position
      static SumoCommand getEdges​(java.lang.String personID)
      get edges
      static SumoCommand getEdges​(java.lang.String personID, int nextStageIndex)
      get edges
      static SumoCommand getIDCount()
      Returns the number of all persons in the network.
      static SumoCommand getIDList()
      Returns a list of personIDs of all persons
      static SumoCommand getLanePosition​(java.lang.String personID)
      get lane position
      static SumoCommand getLength​(java.lang.String personID)
      get length
      static SumoCommand getMinGap​(java.lang.String personID)
      get minGap
      static SumoCommand getNextEdge​(java.lang.String personID)
      get next edge
      static SumoCommand getParameter​(java.lang.String personID, java.lang.String param)
      Returns the chosen parameter
      static SumoCommand getPersonNumber​(java.lang.String personID)
      get person number
      static SumoCommand getPosition​(java.lang.String personID)
      get position
      static SumoCommand getPosition3D​(java.lang.String personID)
      get position3D
      static SumoCommand getRemainingStages​(java.lang.String personID)
      get remaining stages
      static SumoCommand getRoadID​(java.lang.String personID)
      get road ID
      static SumoCommand getSpeed​(java.lang.String personID)
      get speed
      static SumoCommand getStage​(java.lang.String personID, int nextStageIndex)
      get stage
      static SumoCommand getTypeID​(java.lang.String personID)
      get type ID
      static SumoCommand getVehicle​(java.lang.String personID)
      get vehicle
      static SumoCommand getWaitingTime​(java.lang.String personID)
      get waiting time
      static SumoCommand getWidth​(java.lang.String personID)
      get width
      static SumoCommand moveToXY​(java.lang.String personID, java.lang.String edgeID, double x, double y, double angle, byte keepRoute)
      Place person at the given x,y coordinates and force it's angle to the given value (for drawing).
      static SumoCommand removeStage​(java.lang.String personID, int nextStageIndex)
      Removes the nth next stage nextStageIndex must be lower then value of getRemainingStages(personID) nextStageIndex 0 immediately aborts the current stage and proceeds to the next stage
      static SumoCommand rerouteTraveltime​(java.lang.String personID)
      rerouteTraveltime Computes a new route for the person using the global edge traveltime information.
      static SumoCommand setColor​(java.lang.String personID, SumoColor color)
      sets color for person with the given ID.
      static SumoCommand setHeight​(java.lang.String personID, double height)
      Sets the height in m for this person.
      static SumoCommand setLength​(java.lang.String personID, double length)
      Sets the length in m for the given person.
      static SumoCommand setMinGap​(java.lang.String personID, double minGap)
      Sets the offset (gap to front person if halting) for this vehicle.
      static SumoCommand setParameter​(java.lang.String personID, java.lang.String param, java.lang.String value)
      Sets the chosen parameter
      static SumoCommand setSpeed​(java.lang.String personID, double speed)
      Sets the maximum speed in m/s for the named person for subsequent step.
      static SumoCommand setType​(java.lang.String personID, java.lang.String typeID)
      Sets the id of the type for the named person.
      static SumoCommand setWidth​(java.lang.String personID, double width)
      Sets the width in m for this person.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Person

        public Person()
    • Method Detail

      • add

        public static SumoCommand add​(java.lang.String personID,
                                      java.lang.String edgeID,
                                      double pos,
                                      double depart,
                                      java.lang.String typeID)
        Inserts a new person to the simulation at the given edge, position and time (in s). This function should be followed by appending Stages or the person will immediatly vanish on departure.
        Parameters:
        personID - a string personIDentifying the person
        edgeID - edgeID
        pos - pos
        depart - depart
        typeID - typeID
      • appendWaitingStage

        public static SumoCommand appendWaitingStage​(java.lang.String personID,
                                                     double duration,
                                                     java.lang.String description,
                                                     java.lang.String stopID)
        Appends a waiting stage with duration in s to the plan of the given person
        Parameters:
        personID - a string personIDentifying the person
        duration - duration
        description - description
        stopID - stopID
      • appendWalkingStage

        public static SumoCommand appendWalkingStage​(java.lang.String personID,
                                                     SumoStringList edges,
                                                     double arrivalPos,
                                                     double duration,
                                                     double speed,
                                                     java.lang.String stopID)
        Appends a walking stage to the plan of the given person The walking speed can either be specified, computed from the duration parameter (in s) or taken from the type of the person
        Parameters:
        personID - a string personIDentifying the person
        edges - edges
        arrivalPos - arrivalPos
        duration - duration
        speed - speed
        stopID - stopID
      • appendDrivingStage

        public static SumoCommand appendDrivingStage​(java.lang.String personID,
                                                     java.lang.String toEdge,
                                                     java.lang.String lines,
                                                     java.lang.String stopID)
        Appends a driving stage to the plan of the given person The lines parameter should be a space-separated list of line ids
        Parameters:
        personID - a string personIDentifying the person
        toEdge - toEdge
        lines - lines
        stopID - stopID
      • removeStage

        public static SumoCommand removeStage​(java.lang.String personID,
                                              int nextStageIndex)
        Removes the nth next stage nextStageIndex must be lower then value of getRemainingStages(personID) nextStageIndex 0 immediately aborts the current stage and proceeds to the next stage
        Parameters:
        personID - a string personIDentifying the person
        nextStageIndex - nextStageIndex
      • setSpeed

        public static SumoCommand setSpeed​(java.lang.String personID,
                                           double speed)
        Sets the maximum speed in m/s for the named person for subsequent step.
        Parameters:
        personID - a string personIDentifying the person
        speed - speed
      • setType

        public static SumoCommand setType​(java.lang.String personID,
                                          java.lang.String typeID)
        Sets the id of the type for the named person.
        Parameters:
        personID - a string personIDentifying the person
        typeID - typeID
      • setWidth

        public static SumoCommand setWidth​(java.lang.String personID,
                                           double width)
        Sets the width in m for this person.
        Parameters:
        personID - a string personIDentifying the person
        width - width
      • setHeight

        public static SumoCommand setHeight​(java.lang.String personID,
                                            double height)
        Sets the height in m for this person.
        Parameters:
        personID - a string personIDentifying the person
        height - height
      • setLength

        public static SumoCommand setLength​(java.lang.String personID,
                                            double length)
        Sets the length in m for the given person.
        Parameters:
        personID - a string personIDentifying the person
        length - length
      • setMinGap

        public static SumoCommand setMinGap​(java.lang.String personID,
                                            double minGap)
        Sets the offset (gap to front person if halting) for this vehicle.
        Parameters:
        personID - a string personIDentifying the person
        minGap - minGap
      • setColor

        public static SumoCommand setColor​(java.lang.String personID,
                                           SumoColor color)
        sets color for person with the given ID. i.e. (255,0,0,0) for the color red. The fourth integer (alpha) is only used when drawing persons with raster images
        Parameters:
        personID - a string personIDentifying the person
        color - color
      • getColor

        public static SumoCommand getColor​(java.lang.String personID)
        get lane position
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        The position of the person along the lane measured in m.
      • getLength

        public static SumoCommand getLength​(java.lang.String personID)
        get length
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        Returns the length in m of the given person.
      • getWaitingTime

        public static SumoCommand getWaitingTime​(java.lang.String personID)
        get waiting time
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        The waiting time of a person is defined as the time (in seconds) spent with a speed below 0.1m/s since the last time it was faster than 0.1m/s. (basically, the waiting time of a person is reset to 0 every time it moves).
      • getWidth

        public static SumoCommand getWidth​(java.lang.String personID)
        get width
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        Returns the width in m of this person.
      • getNextEdge

        public static SumoCommand getNextEdge​(java.lang.String personID)
        get next edge
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        If the person is walking, returns the next edge on the persons route (including crossing and walkingareas). If there is no further edge or the person is in another stage, returns the empty string.
      • getEdges

        public static SumoCommand getEdges​(java.lang.String personID)
        get edges
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        If the person is walking, returns the next edge on the persons route (including crossing and walkingareas). If there is no further edge or the person is in another stage, returns the empty string.
      • getEdges

        public static SumoCommand getEdges​(java.lang.String personID,
                                           int nextStageIndex)
        get edges
        Parameters:
        personID - a string personIDentifying the person
        nextStageIndex -
        Returns:
        Returns a list of all edges in the next stage. For waiting stages this is a single edge For walking stages this is the complete route For driving stages this is [origin, destination] nextStageIndex 0 retrieves value for the current stage. nextStageIndex must be lower then value of getRemainingStages(personID)
      • getStage

        public static SumoCommand getStage​(java.lang.String personID,
                                           int nextStageIndex)
        get stage
        Parameters:
        personID - a string personIDentifying the person
        nextStageIndex -
        Returns:
        Returns the type of the nth next stage 0 for not-yet-departed 1 for waiting 2 for walking 3 for driving nextStageIndex 0 retrieves value for the current stage. nextStageIndex must be lower then value of getRemainingStages(personID)
      • getRemainingStages

        public static SumoCommand getRemainingStages​(java.lang.String personID)
        get remaining stages
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        Returns the number of remaining stages (at least 1)
      • getVehicle

        public static SumoCommand getVehicle​(java.lang.String personID)
        get vehicle
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        Returns the id of the current vehicle if the person is in stage driving and has entered a vehicle. Return the empty string otherwise
      • getLanePosition

        public static SumoCommand getLanePosition​(java.lang.String personID)
        get lane position
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        The position of the person along the lane measured in m.
      • getIDCount

        public static SumoCommand getIDCount()
        Returns the number of all persons in the network.
        Returns:
        the number of persons in the network
      • getIDList

        public static SumoCommand getIDList()
        Returns a list of personIDs of all persons
        Returns:
        list of IDs of all persons
      • getParameter

        public static SumoCommand getParameter​(java.lang.String personID,
                                               java.lang.String param)
        Returns the chosen parameter
        Parameters:
        personID - a string personIDentifying the person
        param - a string personIDentifying the parameter
        Returns:
        the specific parameter
      • setParameter

        public static SumoCommand setParameter​(java.lang.String personID,
                                               java.lang.String param,
                                               java.lang.String value)
        Sets the chosen parameter
        Parameters:
        vehID - a string identifying the vehicle
        param - a string identifying the parameter
        value - a string identifying the new value
        Returns:
        SumoCommand
      • getSpeed

        public static SumoCommand getSpeed​(java.lang.String personID)
        get speed
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        the speed in m/s
      • getPosition

        public static SumoCommand getPosition​(java.lang.String personID)
        get position
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        the position 2D
      • getPosition3D

        public static SumoCommand getPosition3D​(java.lang.String personID)
        get position3D
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        the position 3D
      • getAngle

        public static SumoCommand getAngle​(java.lang.String personID)
        get angle
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        the angle
      • getRoadID

        public static SumoCommand getRoadID​(java.lang.String personID)
        get road ID
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        the personID of the road
      • getTypeID

        public static SumoCommand getTypeID​(java.lang.String personID)
        get type ID
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        the type ID of the person
      • getPersonNumber

        public static SumoCommand getPersonNumber​(java.lang.String personID)
        get person number
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        the person number
      • getMinGap

        public static SumoCommand getMinGap​(java.lang.String personID)
        get minGap
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        the value for the minimum Ggap of the person
      • rerouteTraveltime

        public static SumoCommand rerouteTraveltime​(java.lang.String personID)
        rerouteTraveltime Computes a new route for the person using the global edge traveltime information.
        Parameters:
        personID - a string personIDentifying the person
        Returns:
        SumoComand
      • moveToXY

        public static SumoCommand moveToXY​(java.lang.String personID,
                                           java.lang.String edgeID,
                                           double x,
                                           double y,
                                           double angle,
                                           byte keepRoute)
        Place person at the given x,y coordinates and force it's angle to the given value (for drawing). If the angle is set to INVALID_DOUBLE_VALUE, the vehicle assumes the natural angle of the edge on which it is driving. If keepRoute is set to 1, the closest position within the existing route is taken. If keepRoute is set to 0, the vehicle may move to any edge in the network but it's route then only consists of that edge. If keepRoute is set to 2 the person has all the freedom of keepRoute=0 but in addition to that may even move outside the road network. edgeID is an optional placement hint to resolve ambiguities
        Parameters:
        personID - person id
        edgeID - edge id
        x - x
        y - y
        angle - angle
        keepRoute - keepRoute
        Returns:
        SumoCommand