Phase 5. Adding buses
Our model currently contains automobiles only. In the
improvement step we will add buses to our model. They will
from the South to the North along the Tapiolavagen road making a stop
at the bus stop (you can see it at the roadsideafter the
intersection on the layout).
Add block that will generate buses
- Add another CarSource
block from the Road Traffic Library.
This block will generate buses. Name it busSource
and connect it to the carMoveToN
Make sure to compare your properties with the screenshot below to check
if all the parameters are specified correctly.
- Since buses will appear more rarely than cars we
modify the properties of the previously created block. Let us set the Arrival
rate to 20 per hour
for a start.
- Choose roadSouth
in the Road
- Open the Car section in the block's
properties and set the Length of the bus that you
are creating to 10 meters.
- In the Initial speed field type 40 kilometers per hour.
- Unlike the previously created CarSource blocks,
this block must generate buses. To make it generate buses we
must create another agent type. Open the Car
section of the block's properties and click on create a
- The new agent wizard will open.
Type Bus into the Agent type name
and press Next.
- On the next page leave the 3D option
selected and choose
1 from the list of animation figures below. Click Finish.
Switch back to the Main flowchart and run
the model. You will see that occasionally
buses move from the South to the North along the road (You
actually have to wait for a bus to appear like in real life).
On the screenshot above a bus is currently passing by the bus
Let us change the logic of the model to make buses stop at the bus
First, we need to create a bus stop with the help of the
AnyLogic Bus Stop space markup element.
Draw a bus stop
- Drag the
element from the Space Markup
section of the Road
Traffic Library palette to the graphical editor. Place it
at the roadside as shown on the picture below.
- Increase the length of the bus stop. Click the bus stop to
select it and then drag the rectangle marker on its edge.
Now we shall add new blocks to the flowchart.
Adjust the flowchart
- Add another CarMoveTo
block to the busSource
block's flowchart branch
(see screenshot below). Name it busMoveToStop.
It will model bus movement to the bus stop.
- Switch to the Properties view of
block and choose bus stop in the Moves to
parameter. In the Bus stop option
below specify the name of the previously created bus stop (busStop).
- Now we need to model the certain period of time that buses
spend at the bus stop. Add the Delay block from the
Process Modeling Library. Name it stop and connect it
as shown on the picture below.
- Go to the block's properties and specify the Delay time: triangular( 15, 30, 90 ) seconds.
the model. You will see
that buses arrive at the bus stop and wait for passengers to get on and
off. Afterwards, buses continue to move according to the
Phase 4. Adding a parking lot
Phase 6. Adding traffic lights