Phase 5. Adding buses
Our model currently contains automobiles only. In the next improvement step we will add buses to our model. They will move from the South to the North along the Tapiolavagen road making a stop at the bus stop (you can see it at the roadside after
the intersection on the layout).
Add block that will generate buses
- Add another
block from the Road Traffic Library. This block will generate buses. Name it
and connect it to the
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 need to modify the properties of the previously created block. Let us set the
for a start.
- Open the
section in the block's properties and set the
of the bus that you are creating to
- In the
kilometers per hour.
- Unlike the previously created
blocks, this block must generate buses. To make it generate buses we must create another agent type. Open the
section of the block's properties and click on
create a custom type.
- The new agent wizard will open. Type
Agent type name
- On the next page leave the
option selected and choose
from the list of animation figures below. Click
Switch back to the
flowchart and run the model. You will see that occasionally buses move from the South to the North along the road (You might 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 stop. Let us change the logic of the model to make buses stop at the bus stops.
First, we need to create a bus stop with the help of the AnyLogic
space markup element.
Draw a bus stop
- Drag the
element from the
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
block to the
block's flowchart branch (see screenshot below). Name it
busMoveToStop. It will model bus movement to the bus stop.
- Switch to the
view of the
block and choose
parameter. In the
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
block from the Process Modeling Library. Name it
and connect it as shown on the picture below.
- Go to the block's properties and specify the
triangular( 15, 30, 90 )
Run 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 specified route.
Phase 4. Adding a parking lot
Phase 6. Adding traffic lights