Package de.tudresden.sumo.cmd
Class Person
java.lang.Object
de.tudresden.sumo.cmd.Person
The Class Person.
- Author:
- Mario Krumnow
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SumoCommand
Inserts a new person to the simulation at the given edge, position and time (in s).static SumoCommand
appendDrivingStage
(String personID, String toEdge, String lines, 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
(String personID, double duration, String description, String stopID) Appends a waiting stage with duration in s to the plan of the given person.static SumoCommand
appendWalkingStage
(String personID, SumoStringList edges, double arrivalPos, double duration, double speed, 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
get angle.static SumoCommand
get lane position.static SumoCommand
get edges.static SumoCommand
get edges.static SumoCommand
Returns the number of all persons in the network.static SumoCommand
Returns a list of personIDs of all persons.static SumoCommand
getLanePosition
(String personID) get lane position.static SumoCommand
get length.static SumoCommand
get minGap.static SumoCommand
getNextEdge
(String personID) get next edge.static SumoCommand
getParameter
(String personID, String param) Returns the chosen parameter.static SumoCommand
getPersonNumber
(String personID) get person number.static SumoCommand
getPosition
(String personID) get position.static SumoCommand
getPosition3D
(String personID) get position3D.static SumoCommand
getRemainingStages
(String personID) get remaining stages.static SumoCommand
get road ID.static SumoCommand
get speed.static SumoCommand
get stage.static SumoCommand
get type ID.static SumoCommand
getVehicle
(String personID) get vehicle.static SumoCommand
getWaitingTime
(String personID) get waiting time.static SumoCommand
get width.static SumoCommand
Place person at the given x,y coordinates and force it's angle to the given value (for drawing).static SumoCommand
removeStage
(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
(String personID) rerouteTraveltime Computes a new route for the person using the global edge traveltime information.static SumoCommand
sets color for person with the given ID.static SumoCommand
Sets the height in m for this person.static SumoCommand
Sets the length in m for the given person.static SumoCommand
Sets the offset (gap to front person if halting) for this vehicle.static SumoCommand
setParameter
(String personID, String param, String value) Sets the chosen parameter.static SumoCommand
Sets the maximum speed in m/s for the named person for subsequent step.static SumoCommand
Sets the id of the type for the named person.static SumoCommand
Sets the width in m for this person.
-
Constructor Details
-
Person
public Person()
-
-
Method Details
-
add
public static SumoCommand add(String personID, String edgeID, double pos, double depart, 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 personedgeID
- edgeIDpos
- posdepart
- departtypeID
- typeID- Returns:
- the sumo command
-
appendWaitingStage
public static SumoCommand appendWaitingStage(String personID, double duration, String description, String stopID) Appends a waiting stage with duration in s to the plan of the given person.- Parameters:
personID
- a string personIDentifying the personduration
- durationdescription
- descriptionstopID
- stopID- Returns:
- the sumo command
-
appendWalkingStage
public static SumoCommand appendWalkingStage(String personID, SumoStringList edges, double arrivalPos, double duration, double speed, 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 personedges
- edgesarrivalPos
- arrivalPosduration
- durationspeed
- speedstopID
- stopID- Returns:
- the sumo command
-
appendDrivingStage
public static SumoCommand appendDrivingStage(String personID, String toEdge, String lines, 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 persontoEdge
- toEdgelines
- linesstopID
- stopID- Returns:
- the sumo command
-
removeStage
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 personnextStageIndex
- nextStageIndex- Returns:
- the sumo command
-
setSpeed
Sets the maximum speed in m/s for the named person for subsequent step.- Parameters:
personID
- a string personIDentifying the personspeed
- speed- Returns:
- the sumo command
-
setType
Sets the id of the type for the named person.- Parameters:
personID
- a string personIDentifying the persontypeID
- typeID- Returns:
- the sumo command
-
setWidth
Sets the width in m for this person.- Parameters:
personID
- a string personIDentifying the personwidth
- width- Returns:
- the sumo command
-
setHeight
Sets the height in m for this person.- Parameters:
personID
- a string personIDentifying the personheight
- height- Returns:
- the sumo command
-
setLength
Sets the length in m for the given person.- Parameters:
personID
- a string personIDentifying the personlength
- length- Returns:
- the sumo command
-
setMinGap
Sets the offset (gap to front person if halting) for this vehicle.- Parameters:
personID
- a string personIDentifying the personminGap
- minGap- Returns:
- the sumo command
-
setColor
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 personcolor
- color- Returns:
- the sumo command
-
getColor
get lane position.- Parameters:
personID
- a string personIDentifying the person- Returns:
- The position of the person along the lane measured in m.
-
getLength
get length.- Parameters:
personID
- a string personIDentifying the person- Returns:
- Returns the length in m of the given person.
-
getWaitingTime
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
get width.- Parameters:
personID
- a string personIDentifying the person- Returns:
- Returns the width in m of this person.
-
getNextEdge
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
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
get edges.- Parameters:
personID
- a string personIDentifying the personnextStageIndex
- the next stage index- 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
get stage.- Parameters:
personID
- a string personIDentifying the personnextStageIndex
- the next stage index- 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
get remaining stages.- Parameters:
personID
- a string personIDentifying the person- Returns:
- Returns the number of remaining stages (at least 1)
-
getVehicle
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
get lane position.- Parameters:
personID
- a string personIDentifying the person- Returns:
- The position of the person along the lane measured in m.
-
getIDCount
Returns the number of all persons in the network.- Returns:
- the number of persons in the network
-
getIDList
Returns a list of personIDs of all persons.- Returns:
- list of IDs of all persons
-
getParameter
Returns the chosen parameter.- Parameters:
personID
- a string personIDentifying the personparam
- a string personIDentifying the parameter- Returns:
- the specific parameter
-
setParameter
Sets the chosen parameter.- Parameters:
personID
- the person IDparam
- a string identifying the parametervalue
- a string identifying the new value- Returns:
- SumoCommand
-
getSpeed
get speed.- Parameters:
personID
- a string personIDentifying the person- Returns:
- the speed in m/s
-
getPosition
get position.- Parameters:
personID
- a string personIDentifying the person- Returns:
- the position 2D
-
getPosition3D
get position3D.- Parameters:
personID
- a string personIDentifying the person- Returns:
- the position 3D
-
getAngle
get angle.- Parameters:
personID
- a string personIDentifying the person- Returns:
- the angle
-
getRoadID
get road ID.- Parameters:
personID
- a string personIDentifying the person- Returns:
- the personID of the road
-
getTypeID
get type ID.- Parameters:
personID
- a string personIDentifying the person- Returns:
- the type ID of the person
-
getPersonNumber
get person number.- Parameters:
personID
- a string personIDentifying the person- Returns:
- the person number
-
getMinGap
get minGap.- Parameters:
personID
- a string personIDentifying the person- Returns:
- the value for the minimum Ggap of the person
-
rerouteTraveltime
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(String personID, 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 idedgeID
- edge idx
- xy
- yangle
- anglekeepRoute
- the keep route- Returns:
- SumoCommand
-