next up previous
Next: Design Projects Up: Laboratory Description Previous: Hardware and Software

Simulation and Real-Time Execution

Once an algorithm or system is described by a block diagram in Simulink, it can either be simulated on the Sun workstation, or compiled, downloaded, and executed in real-time on a dSPACE Minibox. The simulation runs on the workstation only, while the real-time algorithm is executed on the dSPACE Minibox and is used to process external signals and connect to physical systems. The real-time version can be developed rapidly from the simulation version, as described next.


A simple example to illustrate the easy migration from simulation to real-time implementation is shown in Figure 1. Figure 1a is the block diagram for simulation of a low-pass digital filter, and Figure 1b is the block diagram for real-time execution of the same digital filter. Both diagrams contain analog-to-digital converters (ADC) and digital-to-analog converters (DAC) that sample the signals in time and quantize the sample values. Note that four channels are available on the ADC and DAC. The only difference between the two diagrams is that the input signal in Figure 1a is a computer-generated signal for the simulation, while the input signal in Figure 1b is a real signal that is physically connected to the dSPACE hardware. This connection is represented by a plug in Figure 1b. Similarly, the output in Figure 1a is a simulated oscilloscope, while the output in Figure 1b is a plug that signifies the connection to a physical hardware device, such as an oscilloscope or audio speaker. All of the processing in the real-time implementation must occur between the ADC block and the DAC block, since this represents the data available inside the dSPACE Minibox.


 
Figure: (a) Simulink block diagram for simulation of a low-pass digital filter. (b) Simulink block diagram for real-time implementation of same digital filter on dSPACE hardware.
\begin{figure}
\vspace{-.2in}
\begin{center}
\parbox[c]{3.3in}{ \epsfxsize=3.3in...
 ...\end{center}
\vspace{-.2in}
\hspace{1.85in} (a) \hspace{3.15in} (b)
\end{figure}


Any simulation block diagram is converted to a real-time block diagram using the same principle of adding plugs to denote the input/output of real signals to/from the dSPACE hardware. The close connection between simulation and implementation encourages students to iterate back and forth between the two modes. For example, a system model in the simulation may be revised in response to real-time testing with an actual system. Iteration of this type improves the system model, and also provides the student with greater understanding of the system and the modeling process. Similarly, once an algorithm is developed and tested in the convenient framework of the simulation, it usually works as expected in the real-time implementation. This facilitates rapid prototyping of real-time algorithms.


An interesting feature of the interface between the Simulink software and the dSPACE hardware is on-the-fly updating of parameters during real-time execution. For example, suppose the cutoff frequency of the digital filter in Figure 1b is changed in the Simulink diagram while the filter is executing on the dSPACE hardware. This change takes effect in real-time on the dSPACE hardware, without recompiling or restarting the filter. This capability is useful for parameter tuning during real-time execution.


next up previous
Next: Design Projects Up: Laboratory Description Previous: Hardware and Software
Kozick Rich
10/22/1998