Real-Time Workshop | ![]() ![]() |
Host (ext_comm) Source Files
The source files for the ext_comm
component are located in the directory matlabroot
/rtw/ext_mode
:
ext_comm.c
communicates to Simulink via a shared data structure, ExternalSim
. It communicates to the target via calls to the transport layer.
Tasks carried out by ext_comm
include establishment of a connection with the target, downloading of parameters, and termination of the connection with the target.
ext_transport.c
includes ext_transport_share.h
, which contains functions common to client and server sides.) The version of ext_transport.c
shipped with Real-Time Workshop uses TCP/IP functions including recv()
, send()
, and socket()
.
ext_main
interfaces to Simulink via the standard mexFunction
call. (See External Interfaces/API in the MATLAB online documentation for information on mexFunction
.) ext_main
contains a function dispatcher, esGetAction
, that sends requests from Simulink to ext_comm
.
ext_comm.c
and directly by Simulink (via function pointers).
ExternalSim
data structure and access macros. This structure is used for communication between Simulink and ext_comm.c
.
Target (Server) Source Files
These files are part of the run-time interface and are linked into the model
.exe
executable. They are located in the directory matlabroot
/rtw/c/src
.
ext_svr.c
is analogous to ext_comm.c
on the host, but generally is responsible for more tasks. It acts as a relay station between the host and the generated code. Like ext_comm.c
, ext_svr.c
carries out tasks such as establishing and terminating connection with the host. ext_svr.c
also contains the background task functions that either write downloaded parameters to the target model, or extract data from the target data buffers and send it back to the host.
The version of ext_svr.c
shipped with Real-Time Workshop uses TCP/IP functions including recv()
, send()
, and socket()
.
ext_svr_transport.c
includes ext_transport_share.h
, which contains functions common to client and server sides.) The version of ext_svr_transport.c
shipped with Real-Time Workshop uses TCP/IP functions including recv()
, send()
, and socket()
.
updown.c
handles the details of interacting with the target model. During parameter downloads, updown.c
does the work of installing the new parameters into the model's parameter vector. For data uploading, updown.c
contains the functions that extract data from the model's blockio
vector and write the data to the upload buffers. updown.c
provides services both to ext_svr.c
and to the model code (e.g., grt_main.c
). It contains code that is called via the background tasks of ext_svr.c
as well as code that is called as part of the higher priority model execution.
Other Files
ext_transport_share.h
shipped with Real-Time Workshop is specific to TCP/IP communications.
![]() | External Mode Communications Overview | Guidelines for Implementing the Transport Layer | ![]() |