This example shows how event-driven modeling in SimEvents can be integrated with Stateflow and Simulink, to simulate and control a conveyor belt system. In this example, the conveyor belt system shown represents the type used in an airport to carry luggage.
The model contains the following subsystem blocks:
A Control subsystem containing Stateflow charts that execute control of the overall conveyor belt system.
An Animation subsystem that provides a 2D visualization of the system dynamics.
A Luggage Generator subsystem that generates SimEvents entities to represent discrete items of luggage.
A Feeder Belt subsystem that represents the linear conveyor belt used to load items of luggage into the system. The feeder belt has fixed entry and exit points and a fixed length.
A Main Belt subsystem that represents the rotational belt used to accumulate items and circulate them in a closed-loop until they are picked up by passengers.
The Feeder Belt and Main Belt subsystems contain both SimEvents and Simulink blocks.
The Luggage Generator subsystem contains a Time-Based Entity Generator block that generates entities-representing discrete items of luggage-in a time-based fashion. The time duration between entities is based on a uniform and independent-and-identically-distributed (IID) random sequence.
Both the Feeder Belt and Main Belt subsystems contain a SimEvents N-Server block that can service a number of entities at any time.
For each belt subsystem, the value of N specified for the N-Server block represents the capacity of the belt.
Each N-Server block uses built-in server control and server-occupancy-monitoring capabilities to pause service when likely collisions are detected by the control unit, or when an emergency stop of the system is requested by an operator.
Simulink blocks are used to:
Calculate the position of items on both belts, based on a fixed belt speed.
Simulate the dynamics of both belts. These dynamics are used by the Animation subsystem to provide a visualization of the complete moving system.
Model the behavior of light sensors that detect items of luggage at the entry and exit points of the feeder belt, and at the junction of the feeder belt with the main belt.
Stateflow charts are used in the Control subsystem. This subsystem models a supervisory control unit that executes the following control tasks:
Start: Simulates an operator request to turn on both belts.
Emergency stop: Simulates an operator request to stop both belts.
Monitoring of space between items on feeder belt: When an item is loaded at the entry point of the feeder belt, the next item cannot be loaded until the first item has been transported a certain distance. A light sensor is modeled that detects the loading of an item.
Collision and space control on main belt: A "collision zone" is specified for the main belt near its junction with the feeder belt. Whenever an item appears in this segment of the main belt, as detected by a light sensor, AND an item has been detected at the exit point of the feeder belt, the feeder belt is stopped to avoid a collision.
Stop main belt for maintenance: When the main belt has transported a certain number of items AND has completed a certain number of cycles, it is stopped for maintenance for a period of time.
The simulation produces the following results:
Animation (2D) showing:
The motion of items on both conveyor belts.
Activities such as the loading of items by operators, transfer of items from the feeder belt to the main belt, emergency stopping of the system by an operator, and removal of luggage items by passengers.
The status of the supervisory control unit, such as any existing blockages at the entry point of the feeder belt or active collision control at the junction of both belts.
The changing number of items on each belt.
The operating status of each belt, such as running, paused, etc.
The detection of items by light sensors on each belt.