Use the Stop Line space markup element to control road traffic: it will stop in front of the stop line or pass through it, depending on the option set in the CarMoveTo block, which is used to direct traffic to a stop line.
The stop line element can add the following road signs to the locations where it is placed: Speed limit, End of speed limit, and Yield. The road signs will affect traffic at this stop line. The signs are described below in the Road signs section of the element’s properties.
Demo model: Stop Line Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files). Demo model: Stop LineOpen the model in your AnyLogic desktop installation.To draw a stop line
-
Drag the
Stop Line element from the Space Markup section of the
Road Traffic Library palette onto the agent diagram containing a road.
A stop line cannot be drawn until the road has been drawn.As you move the mouse over the agent diagram, you will see that all elements other than the roads are greyed out. - Place the mouse over the road exactly where you want to place the stop line and release the mouse button. You will see that the element is placed at the specified location. You can change its position by dragging it along the road.
-
If necessary, set the road signs by selecting the appropriate options in the Road signs section of the element’s properties. This defines the traffic behavior at this stop line.
You can now set this stop line as the destination in the CarMoveTo block properties.
To adjust the position of a stop line on a road
- Click the stop line you need to edit.
-
Drag the stop line to the desired position.
Alternatively, you can move it by changing the value of the Offset from road start property of the element, which defines its exact position.
You can associate road signs with stop lines in the road network to modify the traffic behavior. You can combine road signs as needed, for example, Speed limit + Yield.
To add a road sign to a stop line
- Draw a stop line on the road or select an existing stop line.
- Select the road sign you need to add to this stop line from the Road Signs section of the element’s properties. If you select the Speed limit sign, the editable field for the maximum speed value and the drop-down list with speed units will appear to the right of it.
- You can also select the Yield sign to combine it with the previously selected Speed limit or End of speed limit signs.
- General
-
Name — The name of this stop line. The name is used to identify and access the element from the code and properties of the flowchart blocks.
Show name — If selected, the name of the stop line is displayed on the graphical diagram.
Lock — If selected, the stop line is locked. Locked elements do not respond to mouse clicks, and they cannot be selected in the graphical editor until you unlock them. This is often needed when you want to prevent the element from being edited while other elements are placed over it.
Ignore — If selected, the stop line is excluded from the model.
Car type — Allows you to select a custom car type from the drop-down list.
- Actions
-
On car passed — The code that will be executed for each car that passes through this stop line. You can refer to a car using the local variable, car. The lane on which the car is located can be referred to as laneIndex. The lanes are numbered from the outermost (which has index 0) to the innermost.
- Road signs
-
Speed limit — If selected, this stop line marks the beginning of the speed limit area. The field for maximum speed value and the drop-down list with speed units will appear to the right of this option when selected.
End of speed limit — If selected, this stop line ends the speed limit area.
Yield — If selected, places a yield sign on the current stop line, stopping traffic if necessary and allowing a driver on another approach to proceed.
- Position and size
-
Offset from road start — The distance from the starting point of the road to the stop line.
- Visibility and presentation
-
Visible — If selected, the stop line is visible during animation at model runtime.
Show in — Select whether the shape is displayed in both 2D and 3D animation, 2D only, or 3D only.
Agent presentation — If selected, the stop line is also visible on the upper-level agent that hosts the agent containing this stop line.
- Signs
-
Function Description addSpeedLimitSign(double speedLimit, SpeedUnits units) Adds the “speed limit” sign to this stop line. For example, addSpeedLimitSign(90, KPH) adds the “90 kilometers per hour speed limit” sign.
speedLimit — the speed limit value, measured in the given speed units
units — the speed unit constantdouble getSpeedLimit(SpeedUnits units) If this stop line has the “speed limit” sign, the function returns the actual speed limit value, measured in the given speed units. For example, getSpeedLimit(KPH) returns the speed limit value in kilometers per hour.
units — speed unit constantaddEndOfSpeedLimitSign() Adds the “end of speed limit” sign to this stop line. boolean isSpeedLimitSign() Returns true if this stop line has the “speed limit” sign, false otherwise. boolean isEndOfSpeedLimitSign() Returns true if this stop line has the “end of speed limit” sign, false otherwise. addYieldSign() Adds the “yield” sign to this stop line. boolean isYieldSign() Returns true if this stop line has the “yield” sign, false otherwise. - Traffic light
-
Function Description TrafficLightSignal getSignal() Returns the current signal of the traffic light on the road (SIGNAL_RED, SIGNAL_YELLOW, SIGNAL_GREEN), or SIGNAL_NONE if no signal is set. setSignal(TrafficLightSignal signal) Changes the current signal of the traffic light to newSignal. Applies if this position is not controlled by a traffic light.
signal — A new signal that is set to the position on road.
Valid values:
SIGNAL_RED
SIGNAL_YELLOW
SIGNAL_GREEN
SIGNAL_NONE - Speed
-
Function Description double averageSpeed() Returns the actual average speed (in meters per second) in the position defined by the stop line. double averageSpeed(SpeedUnits units) Returns the actual average speed (in the given speed units) in the position defined by the stop line.
units — Speed units constant - Position
-
Function Description int getLaneIndexFrom() Returns the index of the starting lane covered by the stop line. The lane with index 0 is the lane at the road side. int getLaneIndexTo() Returns the index of the ending lane covered by the stop line. The lane with index 0 is the lane at the road side. setLaneIndexFrom(int laneIndexFrom) Sets the starting lane covered by the stop line.
laneIndexFrom — The lane index. The lane with index 0 is the lane at the road side.setLaneIndexTo(int laneIndexTo) Sets the ending lane covered by stop line.
laneIndexTo — The lane index. The lane with index 0 is the lane at the road side. - Visibility
-
Function Description void setVisible(boolean v) Sets the visibility of the stop line.
v — the visibility of the stop line. If true, the stop line is visible, if false — not visible.boolean isVisible() Returns the visibility of the stop line. If it returns true, the stop line is visible, if false — not visible. - Advanced
-
Function Description double getOffset() Returns the distance (in pixels) from the road start to the stop-line. double getOffset(LengthUnits units) Returns the distance (in the given units) from the road start to the stop-line.
units — a length unit constantboolean isOnForwardSide() Returns true if the stop line is located on the forward lane, false if it is located on the backward lane. Road getRoad() Returns the road on which the stop line is located. RoadNetwork getRoadNetwork() Returns the road network the stop line belongs to. - Level
-
Function Description Level getLevel() Returns the level on which this stopline is located. - Removal
-
Function Description void remove() Removes the stopline from the presentation. If the stopline is not a part of presentation, the function does nothing. Removal from the presentation does not necessarily mean removal from the model logic, since logical networks and routes may have been created prior to removal and survive.
-
How can we improve this article?
-