Takes the car agent and tries to put it as a car into the specified location inside a road network. The car can appear on the specified road or in the specified parking lot (defined by the Appears parameter).
If cars are set to appear on a road, the direction of the road should be additionally specified. Cars will appear at the beginning of the specified road and start moving in the specified direction. By default, Random lane parameter is selected, so the cars will appear at random lanes (if there is more than 1 lane on the specified road). You can explicitly specify index of lane where cars will appear by deselecting the Random lane option and using Lane index parameter.
If cars are set to appear on a road, they enter the road network only when there is enough distance on the lane ahead of the car. The more initial velocity of the car, the longer distance is needed for a car to safely enter the network. Cars that cannot enter the road network immediately are accumulated in queue inside CarEnter block and taken from the queue when there is enough space in the specified lane to place a car.
If cars are set to appear in a parking lot, they appear in free spaces of the specified parking lot and wait until they leave the road network or start moving by entering CarMoveTo block. If all parking spaces are occupied, an error will be generated.
Together with CarExit, this block is used to model part of the car movement on a higher abstraction level, namely without detailed physical level road traffic modeling.
Demo model: CarEnter and CarExit Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).- Appears
-
Here you select where the cars that entered this block will appear: on road, or in parking lot.
on road — The cars will be placed at the beginning of the road specified below in the Road parameter.
in parking lot — The cars will be placed in a randomly chosen free parking space of the parking lot specified below in the Parking lot parameter.Get value: appears
Set new value at runtime: set_appears(new value)
Valid values:
CarEnter.ON_ROAD
CarEnter.IN_PARKING_LOT -
[Visible and applies only if the on Road option is set]
Road where the car will be placed after start of movement. The car enters the Road in the specified lane (backward lane or forward lane). The Lane is specified by the Enters parameter below. Lane is picked randomly (if Random lane option is enabled), or specified explicitly at Lane index parameter below.
The car does not immediately appear at the specified location. The car appears and starts movement only when:- there is enough space at the specified position of road to prevent collision, and
- the car is sent to some destination by CarMoveTo block
Value type: Road
Local variable: car — The car that enters road network - Enters
-
[Visible and applies only if the option Appears: on road is selected]
Specifies the lane (forward lane or backward lane) of road in which the car will be placed. If the road does not have the specified lane (i.e. is one-way), the error is generated.Get value: laneDirection
Set new value at runtime: set_laneDirection(new value)
Valid values:
CarEnter.FORWARD_LANE
CarEnter.BACKWARD_LANE - Random lane
-
[Visible and applies only if the option Appears: on road is selected]
Specifies whether the car will be placed in randomly selected lane of the road. If this option is disabled, the lane will be specified by Lane index parameter below.Syntax: boolean isRandomLane
Set new value at runtime: set_israndomlane(new value) -
[Visible and applies only if the Random lane option is not selected]
Specifies the index of lane where the car should be placed. Lane indices start with 0 (the outmost lane) and increase to inmost lane. If the specified Road does not have the lane with the specified index, an error is generated.Value type: int
Local variable: car — The car that enters road network -
[Visible and applies only if the option in parking lot is selected]
Parking lot where car will be placed immediately after entering this block. If parking lot does not have free parking spaces, the error will be generated. The car will not move from parking space until it is sent to some destination by CarMoveTo block.Value type: ParkingLot
Local variable: car — The car that enters road network
- Length of the car. Length must be > 0.
Value type: double
Local variable: car — The car that enters road network. -
Initial speed of the car. Initial speed must be >= 0. If initial speed is equal to 0, the car will start accelerating to its preferred speed once it is sent to some destination by CarMoveTo block.
Value type: double
Local variable: car — The car that enters road network -
Preferred speed of the car. Preferred speed must be >= 0. If preferred speed is equal to 0 and initial speed is equal to 0, the car will not start movement even if it is sent to some destination by the CarMoveTo block. Car will only start accelerating when positive initial speed is assigned to it by call of setPreferredSpeed(speed) function. The car always tries to move with speed equal to its preferred speed. The following factors prevent car from moving with its preferred speed:
- Inability to accelerate or decelerate immediately to the preferred speed
- Car ahead that is moving slower that the preferred speed of the car
- Stop line with red light ahead
- Closeness to parking space or bus stop, where the car should decelerate to park or stop
- Speed limit
Value type: double
Local variable: car — The car that enters road network -
Maximum acceleration of the car. Maximum acceleration should be > 0.
Value type: double
Local variable: car — The car that enters road network -
Maximum deceleration of the car. Maximum deceleration should be > 0. The car decelerates with its maximum deceleration only in emergency cases. At other times, it uses some fraction of max deceleration.
Value type: double
Local variable: car — The car that enters road network
- On exit
-
Code that is executed when car exits this block.
Local variable: car — Car that exits this block
- Statistics
-
Function Description long count() Returns the number of cars that have entered the road network via this CarEnter block.
- in
- The input port.
- out
- The output port.
-
How can we improve this article?
-