Real-Time Workshop | ![]() ![]() |
Tracing Generated Code Back to Your
Simulink Model
Real-Time Workshop writes system/block identification tags in the generated code. The tags are designed to help you identify the block, in your source model, that generated a given line of code. Tags are located in comment lines above each line of generated code, and are provided with hyperlinks in HTML codee generation reports that you can optionally generate.
The tag format is <system>/block_name
, where:
The following code fragment illustrates a tag comment adjacent to a line of code generated by a Gain block at the root level of the source model.
The following code fragment illustrates a tag comment adjacent to a line of code generated by a Gain block within a subsystem one level below the root level of the source model:
In addition to the tags, Real-Time Workshop documents the tags for each model in comments in the generated header file model
.h
. The following illustrates such a comment, generated from a source model, foo
, which
has a subsystem Outer
with a nested subsystem Inner
:
/* Here is the system hierarchy for this model. * * <Root> : foo * <S1> : foo/Outer * <S2> : foo/Outer/Inner */
There are two ways to trace code back to subsystems, blocks and parameters in your model:
hilite_system
commands to MATLAB.
The HTML report for your model
.c
file displays hyperlinks in "Regarding," "Ouport," and other comment lines such as are shown above. Clicking on such links in comments will cause the associated block or subsystem to be highlighted in the model diagram. For further information, see HTML Code Generation Reports of the Real-Time Workshop Getting Started Guide.
Using HTML reports is generally the fastest way to trace code back to the model, but when you know what you are looking for you may achieve the same result by at the command line. To manually trace a tag back to the generating block using the hilite_system
command:
hilite_system
command to view the desired system and block.
As an example, consider the model foo
mentioned above. If foo
is open,
opens the subsystem Outer
and selects and highlights the Gain block Gain1
within that subsystem.
![]() | Advanced Options Pane | Other Interactions Between Simulink and Real-Time Workshop | ![]() |