Real-Time Workshop User's Guide    

The Download Mechanism

When you change a parameter in the block diagram, Simulink calls the external interface MEX-file, passing new parameter values (along with other information) as arguments.

The external interface MEX-file contains code that implements one side of the interprocess communication (IPC) channel. This channel connects the Simulink process (where the MEX-file executes) to the process that is executing the external program. The MEX-file transfers the new parameter values via this channel to the external program.

The other side of the communication channel is implemented within the external program. This side writes the new parameter values into target's parameter structure (rtP).

The Simulink side initiates the parameter download operation by sending a message containing parameter information to the external program. In the terminology of client/server computing, the Simulink side is the client and the external program is the server. The two processes can be remote, or they can be local. Where the client and server are remote, a protocol such as TCP/IP is used to transfer data. Where the client and server are local, shared memory can be used to transfer data.

The following diagram illustrates this relationship.

Figure 5-11: External Mode Architecture

Simulink calls the external interface MEX-file whenever you change parameters in the block diagram. The MEX-file then downloads the parameters to the external program via the communication channel.


 Overview of External Mode Communications The TCP/IP Implementation