17
4.2 Readability and Traceability
4.2.1 TargetLink
The generated code is well documented and follows the model designed in
TargetLink. Any block in the model can be tracked in the code by either name or
by following the code and comparing with the model.
The names of variables, blocks outputs, states or parameters in the generated code
can be defined manually in every block or automatically generated by TargetLink
using name macros. Every name macro starts with $ followed by a letter which is
replaced by the string it represents during code generation. E.g. $M$B is replaced
by <model name><block name> in the generated code. TargetLink has a total of
20 name macros.
TargetLink gives full freedom to change the code interface as desired. Any
subsystem in the model can be chosen to be generated as a function with certain
parameters and function returns if desired.
4.2.2 Real-Time Workshop Embedded Coder
RTW EC generates a code that is readable and can be traced if the Simulink
model is followed carefully.
Embedded coder generates, if selected, a html report of the generated code where
the code can be followed. In the code comments in the html report there are links
to the blocks in the model. By just pressing on the block name in the code the
corresponding block in the model is highlighted.
Any signal can be named and accessed in the code. The user can for example
name a signal between two blocks and make it defined as a global variable in the
generated code. Variables, blocks outputs, signals, states and parameters are
automatically named in the same way as for TargetLink. RTW EC has less name
macros to choose from, it has totally 6 name macros. These name macros apply to
the whole model simultaneously and the user can not specify certain name macros
for every block separately.
RTW EC is limited in the choice of code interface. Non-reusable and reusable are
the only possible options here.
Function return is not supported in RTW EC.
Kommentare zu diesen Handbüchern