User`s guide

5 Data Logging and Signal Monitoring
5-4
C API for Signal Monitoring
Signal monitoring provides a second method for accessing block outputs in an
externally running program. All block output data is written to the
SimStruct
with each time step in the model code. However, to access the output of any
given block in the
SimStruct, you must know the address of the BlockIO vector
where the data is stored, how many output ports the block has, and the width
of each output. All of this information is contained in the
BlockIOSignals data
structure. This is the mechanism that the StethoScope Graphical Monitoring/
Data Analysis Tool uses to collect signal information in Tornado targets. See
“Targeting Tornado for Real-Time Applications” in Chapter 8 for more
information on using StethoScope.
The
BlockIOSignals data structure is created during code generation by
appending
-aBlockIOSignals=1
to the system target file field on the Real-Time Workshop page of the
Simulation Parameters dialog box. Otherwise, BlockIOSignals is not
created. If included, the TLC file
matlabroot/rtw/c/tlc/biosig.tlc creates
the file
model.bio that contains the information on all block outputs in the
model in an array of structures. This array can then be used to monitor the
value of any output while the program is running. The structure definition for
the elements of the array is in
matlabroot/rtw/c/src/bio_sig.h. This file is
included by
model.bio and should also be included by any source file that uses
the array (for example,
rt_main.c). Note that, depending on the size of your
model, the
BlockIOSignals array can consume a considerable amount of
memory.