MATLAB Examples

Magnetic Levitation Model with Simulink Desktop Real-Time™

In addition to the vrmaglev example, the vrmaglev_sldrt model works directly with the actual CE 152 lab experiment hardware in real time. We created this model to work with Simulink® Coder™, Simulink Desktop Real-Time, and the HUMUSOFT® MF 644 multifunction I/O board. However, you can adapt this model for other targets and acquisition boards.

A digital IIR filter, from Signal Processing Toolbox™, filters the physical system output. You can bypass the physical system by using the built-in plant model.

Running this model in real time is an example showing the capabilities of Simulink® in control systems design and rapid prototyping. When you push the real ball up or down against the coil force, the position of the virtual ball changes in the virtual world. If you remove the ball from the real system, the ball also disappears from the virtual world. The changes to the real system are reflected in real time in its virtual reality representation.

Note that after enabling the remote view in the VR Sink block dialog box, you can visualize the Simulink model even at a remote client computer. This can be useful for distributing the computing power between a real-time Simulink model running on one machine and the rendering of a virtual reality world on another machine.

Note: This model requires the following software and hardware components:

  • Simulink Coder
  • Simulink Desktop Real-Time™
  • Signal Processing Toolbox
  • DSP System Toolbox™
  • CE 152 Magnetic Levitation scale model (optional).

More information on the scale model hardware can be found at: