Step routine entry point in generated code for Simulink model
voidmodel
_step(void) voidmodel
_stepN
(void)
The
default function prototype varies
depending on the setting of model configuration parameter Treat each discrete
rate as a separate task (Simulink)
(model
_stepEnableMultiTasking
) :
Parameter Value | Function Prototype |
---|---|
Off (single rate or multirate) | void |
On (multirate) | void ( is a task
identifier) |
The calling interface generated for this function also differs depending on the value of the model configuration parameter Code interface packaging:
C++ class
(default for
C++ language) — Generated function is encapsulated into a C++
class method. Required model data is encapsulated into C++ class attributes.
Nonreusable function
(default
for C language) — Generated function passes (void)
.
Model data structures are statically allocated, global, and accessed
directly in the model code.
Reusable function
—
Generated function passes the real-time model data structure, by reference,
as an input argument. The real-time model data structure is exported
with the
header
file.model
.h
For an ERT-based model, you can use model configuration parameter Pass root-level I/O as to control how root-level input and output arguments are passed to the function. They can be included in the real-time model data structure, passed as individual arguments, or passed as references to an input structure and an output structure.
If you have an Embedded Coder® license:
For Nonreusable function
code interface packaging,
you can use the Configure C Step Function Interface dialog box to customize a C
step function interface. See Override Default C Step Function Interface (Embedded Coder)Customize Generated C Function Interfaces (Embedded Coder).
For C++ class
code interface packaging, you can use
the Configure C++ Class Interface button and related
controls on the Interface pane of the Configuration
Parameters dialog box. For more information, see Customize Generated C++ Class Interfaces (Embedded Coder).
The generated
function
contains the output and update code for the blocks in a Simulink® model.
The model
_step
function
computes the current value of the blocks. If logging is enabled, model
_step
updates
logging variables. If the model's stop time is finite, model
_step
signals
the end of execution when the current time equals the stop time.model
_step
Under the following conditions,
does
not check the current time against the stop time:model
_step
The model's stop time is set to inf
.
Logging is disabled.
Parameter Terminate function required is not selected.
If one or more of these conditions are true, the program runs indefinitely.
For a GRT- or ERT-based model, the software generates a
function when model
configuration parameter Single output/update function is selected
(the default).model
_step
is
designed to be called at interrupt level from model
_steprt_OneStep
,
which is assumed to be invoked as a timer ISR. rt_OneStep
calls
to
execute processing for one clock period of the model. For a description
of how calls to model
_step
are
generated and scheduled, see rt_OneStep and Scheduling Considerations (Embedded Coder).model
_step
If model configuration parameter Single output/update function is
not selected, the software generates these model entry-point functions in place of
:model
_step