Build the Model
- Start with a new model.
- Using the Straight Path tool as explained in the introduction, create four straight paths that go around in a counter-clockwise loop. Make sure to leave gaps on the corners for the joining curved paths to be created.
Note: Path Directionality is Important. By default, paths are created one-way. If your model is working, it may be because you didn't create the paths in the right direction. In this model we create a single counter-clockwise loop. Make sure you create the loop in a consistently counter-clockwise direction. Look at the arrow indicator on each path to see its direction. - Using the Join Paths tool as explained in the introduction, join the four straight paths with curved paths. Again, make sure you connect them in a counter-clockwise direction.
- Add a Source at the bottom of the loop, a Sink at the top, and connect them with an A connect.
- In the library, drag a Control Point into the model. Position it on the bottom path, close to the Source. Using an A connect, connect that control point to the Source.
- Create a second Control Point and position it on the top path near the Sink. Again using an A connect, connect that control point to the Sink.
- From the Library, drag two TaskExecuters into the model.
- Drag a Dispatcher into the model, and connect it to the TaskExecuters using the A connect.
- Shift-Select the two AGVs and connect them to the Control Point near the Sink with the A connect. From the popup menu, choose Traveler AGV. This tells the AGV that its travel operations should be done using the AGV network.
- Tell the Source to use a transport. Use an S connect to add a center port between the Source and the Dispatcher.
Then click on the Source and check the Use Transport box in the Output panel of Quick Properties on the right.
Run the Model
Reset and run the model.
You should see one of the TaskExecuters travel to the Source, pick up an item, and then the model will show a "deadlock" message.
Control Point Allocation
This first model demonstrates a significant difference between the AGV module's logic versus the standard travel network logic in FlexSim. The AGV system's look-ahead mechanism is more sophisticated. AGVs will look ahead all the way to the next Control Point on their path and attempt to allocate, or claim, that Control Point. If an AGV cannot allocate its next Control Point, it will stop at the previous Control Point. This stop distance may span several path sections before the next Control Point's location.
Deadlock
This model contains a deadlock situation. The first AGV (TaskExecuter6) is trying to allocate the Sink's Control Point, which is currently claimed by the second AGV (TaskExecuter7). However, TaskExecuter7 is currently waiting to claim the Source's Control Point which is claimed by TaskExecuter6. This type of deadlock is called circular wait, because the allocation/allocation request chain forms a circular loop of AGVs waiting on each other. Deadlock is a situation that is encountered quite often in the design of AGV systems, and its avoidance is an important reason why simulation is used during the design process.
FlexSim provides a feature where the model will automatically detect deadlock in your system. This setting is on by default. You can configure it by right-clicking on an AGV Path or Control Point, and in the context menu choose "AGV Network Properties". Go to the General tab of the AGV Network Properties window. Check or uncheck the "Check for Deadlock" box to define this setting, then press OK to close the properties window.
The Check for Deadlock feature can be very useful in the debugging phase, but since it does require additional calculations, you may want to turn it off once your model is functioning properly and you want to run faster scenarios.
Resolving the Deadlock
There are several strategies for resolving deadlock in an AGV system. In our case we can just add extra control points into our system. This adds more potential stopping points to the system, so that AGVs don't have to stop at a control point that is blocking another AGV.
- Add Control Points on the left and right sides of the loop.
- Reset and run the model.
Now the AGVs will no longer reach deadlock.
Control Point Deallocation
With the model's new configuration, AGVs no longer reach deadlock, but you may notice that they will still occasionally wait on each other. This again is caused by the Control Point Allocation/Deallocation mechanism, specifically by each Control Point's Deallocation Type. This setting defines when the Control Point will be deallocated. The default setting is the most conservative, namely to deallocate a Control Point when the AGV reaches its next Control Point. This will essentially cause a two-Control-Point gap to be preserved between AGVs when they are actively traveling. You can change this setting.
- Shift-Select all the Control Points in your model. It's OK if you select more that just control points. Just lasso everything.
- Click on one of the Control Points.
- In Quick Properties on the right, under Deallocation Type, choose Deallocate When Past Current
- Press the popup button Apply to All Selected. This will apply that change to all selected Control Points.
- Reset and run the model.
Now AGV's will not wait on each other as much.
Deallocation Types
A basic AGV model has two Allocation Types by default. They are Deallocate At Next Control Point, and Deallocate When Past Current. You can reconfigure the settings for these Deallocation Types, or add your own, in the Deallocation Types tab of AGV Network Properties.
Finished
You're finished with this model. Move on the the next tutorial.