AnyLogic
Expand
Font size

Bus stop

Using the space markup Bus Stop element you can draw a bus stop at the side of a road (in the direction of travel).

You should use CarMoveTo block to model bus movement to the bus stop. To model the presence of a bus on a bus stop for a certain period of time, the CarMoveTo block should be followed by the Delay block from the Process Modeling Library.

Demo model: Bus Stop Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).

To draw a bus stop

  1. Drag the  Bus Stop element from the Space Markup section of the  Road Traffic Library palette to the agent diagram containing a road.
    A bus stop can be drawn only if the road has been previously drawn. When moving the mouse over the agent diagram, you will see that all elements but the roads are temporarily hidden.
  2. Place the mouse beside the road just where you want to place the element. You will see that the bus stop connects to the road. Move your mouse to properly locate the element and release the mouse button when done. You may change its location by dragging it along the road.
  3. You can change the bus stop length by dragging the rectangle point located on the element’s end with the mouse or by specifying the Length value in the element’s properties. Apart from the length, the width is defined in the Lane width property of the road network (and applies to all road network elements: roads, intersections, etc.).
  4. You can now specify this bus stop as destination in the CarMoveTo block properties.

To adjust position of a bus stop

  1. Click the bus stop you need to edit.
  2. Drag the bus stop to the desired position on the current road.
    You cannot drag the bus stop to another road.
    Alternatively, you can change the bus stop position by modifying the Offset from road start parameter in the element’s properties.

Properties

General

Name — The name of this bus stop. The name is used to identify and access the element from code and Road Traffic Library blocks’ properties.

Ignore — If selected, the bus stop is excluded from the model.

Visible on upper agent — If selected, the bus stop is also visible on the upper agent where this agent lives.

Lock — If selected, the bus stop is locked. Locked shapes do not react to mouse clicks — it is impossible to select them in the graphical editor until you unlock them.

Visible — Here you specify whether the shape is visible on animation at model runtime, or not. Using the control, choose yes or no.

Length — Defines the length of the bus stop in the length units that you choose in the drop-down menu to the right of this field. The default length of the bus stop is 20 meters.

Position and size

Offset from road start — The distance (in pixels) from the start point of the road to the start point of the bus stop, in pixels.

Advanced

Show in — Here you can choose whether you want the shape to be shown both in 2D and 3D animation, or in 2D only, or in 3D only.

Show name — If selected, the element’s name is displayed on the graphical diagram.

Functions

Cars
Function Description
List<Agent> getCars() Returns ordered list of cars located on this bus stop. The first car in the list is the nearest one to the exit point from the bus stop (is the first one to exit the bus stop).
int nCars() Returns the number of cars located on this bus stop.
Length
Function Description
double getLength() Returns length of the bus stop on the adjacent side to the road, measured in pixels.
double getLength(LengthUnits units) Returns length of the bus stop on the adjacent side to the road, measured in the given length units. For example, getLength(METER)returns the length of bus stop measured in meters.

units — Length unit constant.
void setLength(double lengthInPixels) Sets length of the bus stop to lengthInPixels.

lengthInPixels — The length of the bus stop, measured in pixels.
void setLength(double length, LengthUnits units) Sets length of the bus stop, measured in the given length units. For example, setLength(15, METER) sets the length to 15 meters.

length — The length of bus stop, measured in the given length units.
units — Length unit constant.
Visibility
Function Description
void setVisible(boolean v) Sets the visibility of the bus stop.

v — visibility of the bus stop. If true, bus stop is visible, if false — not visible.
boolean isVisible() Returns the visibility of the bus stop. If it returns true, the bus stop is visible, if false — not visible.
Location
Function Description
double getOffset() Returns distance (in pixels) from the road start to the start of the bus stop.
double getOffset(LengthUnits units) Returns distance (in the given units) from the road start to the start of the bus stop.

units — length unit constant
boolean isOnForwardSide() Returns true if the bus stop is adjacent to the forward lane, false if it is adjacent to the backward lane.
Road getRoad() Returns road on which the bus stop is located.
RoadNetwork getRoadNetwork() Returns road network the bus stop belongs to.
Level
Function Description
Level getLevel() Returns the level, where this bus stop is located.
Removal
Function Description
void remove() Removes the bus stop from the presentation. If the bus stop is not a part of presentation, the function does nothing. Note, that removal from the presentation does not necessarily mean removing from the model logic, since logical networks and routes may have been created before the removal and survive it.
How can we improve this article?