Main Content

Modeling Cyber-Physical Systems

Cyber-physical systems combine computer and physical systems to achieve design goals. Simulation of cyber-physical systems requires a combination of modeling techniques such as continuous-time, discrete-time, discrete-event, and finite state modeling. Simulink® and its companion products provide functionality to apply a wide range of modeling techniques and seamlessly integrate them in one simulation environment, which is ideal for modeling cyber-physical systems.

This example shows how continuous-time, discrete-event, and finite-state modeling techniques combine to simulate the behavior of a variable speed conveyor belt system. In SimEvents®, entities are discrete items of interest in a discrete-event simulation. Because passengers are discrete individuals, they are modeled by SimEvents® entities, created by the Entity Generator block. A Stateflow® chart models the operational modes and motor dynamics of the variable speed conveyor belt. Finally, the Entity Transport Delay block models passenger throughput as a function of conveyor belt dynamics, providing a bridge between the discrete-event and continuous-time domains.

Note: The example uses blocks from SimEvents® and Stateflow®. If you do not have a SimEvents or Stateflow license, you can open and simulate the model but only make basic changes such as modifying block parameters.

Model Structure

The model includes these key components:

  • Passengers — Models the arrival of passengers as a Poisson process. The output is a sequence of SimEvents® entities corresponding to the passengers who step on the conveyor belt. The distribution of inter-arrival time ($\Delta t$) of a Poisson process is $P(\Delta t) = \lambda e^{-\lambda \Delta t}$, where $\lambda$ is the arrival rate. $\lambda$ is modeled by a MATLAB action in the Entity Generator block for rush hour, normal hour, and free hour. The passenger arrival rate changes with time as:

\lambda(t) = \left\{
& 2, \hspace{1em} mod(t, 300) \subset [0, 180), \hspace{1em}
\textrm{rush hour} \\
& 0.5, \hspace{1em} mod(t, 300) \subset [180, 240), \hspace{1em}
\textrm{normal hour} \\
& 0.1, \hspace{1em} mod(t, 300) \subset [240, 300), \hspace{1em}
\textrm{free hour}

  • Entity Transport Delay — Holds the passengers on the conveyor belt until they arrive at the other terminal, based on the time delay calculated by the Stateflow chart.

  • Dynamics of conveyor belt — Models the operation of a variable speed conveyor belt. See the Conveyor Belt Dynamics section for more details.

  • Dashboard — Shows the runtime status of the conveyor belt. The color of the Mode Lamp indicates the mode of the conveyor belt.

Conveyor Belt Dynamics

A Stateflow® chart models the dynamics of the variable speed conveyor belt. Note in the chart that the velocity and power of the belt are plotted against a logarithmic scale of the load weight. The conveyor belt has these modes:

  • Idle — The weight of the load is small. The belt maintains a low velocity to save energy. The Mode Lamp is gray in this mode.

  • OnDemand — This is the normal operating mode, which maintains the optimal velocity for passenger comfort and throughput. The power will proportionally increase with the weight of the load. The Mode Lamp is green in this mode.

  • Max — Maximum power mode. The weight of the load is too large for the conveyor belt to maintain the optimal velocity. The conveyor belt operates at the maximum possible velocity that does not exceed the maximum power. The Mode Lamp is red in this mode.


The Scope and blocks in the DashBoard show the simulation results.

Simulation results: 1. Number of passengers versus simulation time. 2. Velocity (blue) and power (red) versus simulation time.

Three operation cycles are observed within a time span of 900. Each cycle has a period of 300, which aligns with the period of the arrival rate. The top plot shows the number of passengers on the conveyor belt over time, and the bottom plot shows the velocity and power of the conveyor belt. The velocity and power are normalized for better visualization.

The first two thirds of each period correspond to rush hour, and the number of passengers on the conveyor belt increases dramatically. Consequently, the conveyor belt enters into the Max mode quickly, which is characterized by the maximum output power with a velocity that is inversely proportional to the number of passengers. In the last third of each period, the airport is in the normal hour followed by the free hour. Therefore, the number of passengers on the conveyor belt drops and even becomes zero for some time.

The conveyor belt then operates in OnDemand and Idle modes accordingly. In OnDemand mode, the velocity is locked to a default value, and the power is proportional to the number of passengers. In Idle mode, both the velocity and power are maintained at low values to reduce energy consumption. Overall, the conveyor belt operates according to the load of the airport.