Package de.tudresden.sumo.cmd
Class Person
- java.lang.Object
-
- de.tudresden.sumo.cmd.Person
-
public class Person extends Object
The Class Person.- Author:
- Mario Krumnow
-
-
Constructor Summary
Constructors Constructor Description Person()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SumoCommandadd(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).static SumoCommandappendDrivingStage(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 SumoCommandappendWaitingStage(String personID, double duration, String description, String stopID)Appends a waiting stage with duration in s to the plan of the given person.static SumoCommandappendWalkingStage(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 SumoCommandgetAngle(String personID)get angle.static SumoCommandgetColor(String personID)get lane position.static SumoCommandgetEdges(String personID)get edges.static SumoCommandgetEdges(String personID, int nextStageIndex)get edges.static SumoCommandgetIDCount()Returns the number of all persons in the network.static SumoCommandgetIDList()Returns a list of personIDs of all persons.static SumoCommandgetLanePosition(String personID)get lane position.static SumoCommandgetLength(String personID)get length.static SumoCommandgetMinGap(String personID)get minGap.static SumoCommandgetNextEdge(String personID)get next edge.static SumoCommandgetParameter(String personID, String param)Returns the chosen parameter.static SumoCommandgetPersonNumber(String personID)get person number.static SumoCommandgetPosition(String personID)get position.static SumoCommandgetPosition3D(String personID)get position3D.static SumoCommandgetRemainingStages(String personID)get remaining stages.static SumoCommandgetRoadID(String personID)get road ID.static SumoCommandgetSpeed(String personID)get speed.static SumoCommandgetStage(String personID, int nextStageIndex)get stage.static SumoCommandgetTypeID(String personID)get type ID.static SumoCommandgetVehicle(String personID)get vehicle.static SumoCommandgetWaitingTime(String personID)get waiting time.static SumoCommandgetWidth(String personID)get width.static SumoCommandmoveToXY(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).static SumoCommandremoveStage(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 SumoCommandrerouteTraveltime(String personID)rerouteTraveltime Computes a new route for the person using the global edge traveltime information.static SumoCommandsetColor(String personID, SumoColor color)sets color for person with the given ID.static SumoCommandsetHeight(String personID, double height)Sets the height in m for this person.static SumoCommandsetLength(String personID, double length)Sets the length in m for the given person.static SumoCommandsetMinGap(String personID, double minGap)Sets the offset (gap to front person if halting) for this vehicle.static SumoCommandsetParameter(String personID, String param, String value)Sets the chosen parameter.static SumoCommandsetSpeed(String personID, double speed)Sets the maximum speed in m/s for the named person for subsequent step.static SumoCommandsetType(String personID, String typeID)Sets the id of the type for the named person.static SumoCommandsetWidth(String personID, double width)Sets the width in m for this person.
-
-
-
Method Detail
-
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
public 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.- Parameters:
personID- a string personIDentifying the personnextStageIndex- nextStageIndex- Returns:
- the sumo command
-
setSpeed
public static SumoCommand setSpeed(String personID, double speed)
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
public static SumoCommand setType(String personID, String typeID)
Sets the id of the type for the named person.- Parameters:
personID- a string personIDentifying the persontypeID- typeID- Returns:
- the sumo command
-
setWidth
public static SumoCommand setWidth(String personID, double width)
Sets the width in m for this person.- Parameters:
personID- a string personIDentifying the personwidth- width- Returns:
- the sumo command
-
setHeight
public static SumoCommand setHeight(String personID, double height)
Sets the height in m for this person.- Parameters:
personID- a string personIDentifying the personheight- height- Returns:
- the sumo command
-
setLength
public static SumoCommand setLength(String personID, double length)
Sets the length in m for the given person.- Parameters:
personID- a string personIDentifying the personlength- length- Returns:
- the sumo command
-
setMinGap
public static SumoCommand setMinGap(String personID, double minGap)
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
public static SumoCommand setColor(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 personcolor- color- Returns:
- the sumo command
-
getColor
public static SumoCommand getColor(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(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(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(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(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(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(String personID, int nextStageIndex)
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
public static SumoCommand getStage(String personID, int nextStageIndex)
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
public static SumoCommand getRemainingStages(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(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(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(String personID, String param)
Returns the chosen parameter.- Parameters:
personID- a string personIDentifying the personparam- a string personIDentifying the parameter- Returns:
- the specific parameter
-
setParameter
public static SumoCommand setParameter(String personID, String param, String value)
Sets the chosen parameter.- Parameters:
personID- the person IDparam- a string identifying the parametervalue- a string identifying the new value- Returns:
- SumoCommand
-
getSpeed
public static SumoCommand getSpeed(String personID)
get speed.- Parameters:
personID- a string personIDentifying the person- Returns:
- the speed in m/s
-
getPosition
public static SumoCommand getPosition(String personID)
get position.- Parameters:
personID- a string personIDentifying the person- Returns:
- the position 2D
-
getPosition3D
public static SumoCommand getPosition3D(String personID)
get position3D.- Parameters:
personID- a string personIDentifying the person- Returns:
- the position 3D
-
getAngle
public static SumoCommand getAngle(String personID)
get angle.- Parameters:
personID- a string personIDentifying the person- Returns:
- the angle
-
getRoadID
public static SumoCommand getRoadID(String personID)
get road ID.- Parameters:
personID- a string personIDentifying the person- Returns:
- the personID of the road
-
getTypeID
public static SumoCommand getTypeID(String personID)
get type ID.- Parameters:
personID- a string personIDentifying the person- Returns:
- the type ID of the person
-
getPersonNumber
public static SumoCommand getPersonNumber(String personID)
get person number.- Parameters:
personID- a string personIDentifying the person- Returns:
- the person number
-
getMinGap
public static SumoCommand getMinGap(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(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(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
-
-