10
3.2 Real-Time Workshop Embedded Coder
Real-Time Workshop Embedded Coder is a well integrated tool in Simulink. To
generate code for fixed-point another Matlab tool, called Fixed-Point Toolbox,
has to be used. This tool is used for scaling parameters and signals. The user
chooses the signal/parameter type, scaling factor and offset value directly in every
block in the model. Some blocks do not need to be scaled, e.g. saturation block
which automatically gives an output that has the same scaling as the input.
3.2.1 Automatic Scaling
Automatic scaling is supported in Real-Time Workshop Embedded Coder, but
worst case automatic scaling is not. An automatic scaling can be performed based
on simulation inputs. A simulation must first be run to log in the maximum and
minimum values of every signal in the model. The maximum and minimum
simulation values must cover the full intended operating range of the design in
order to obtain meaningful results. It is the user’s responsibility to run and find the
worst case input values for the simulation which guarantee a full coverage of the
worst case ranges.
3.2.2 Generating Code for One Subsystem
To make the generation of the code easy, it is recommended to use a model
reference for that part of the main model that code will be generated for. In that
way, the code will be generated easily and independently from the rest of the
Simulink model that may have been added for testing reasons. For traceability
reasons every subsystem can have its own function. This is possible if the user
chooses the right options in the Subsystem Parameters dialog, a precondition is
that the subsystem is atomic. See Figure 3. If a subsystem is atomic it will be
treated as having direct feedthrough and thus be sorted to execute before any
blocks that depend on it.
Kommentare zu diesen Handbüchern