Specify whether to generate the
function.model
_step
Category: Code Generation > Interface
Default: on
Generates the
function
for a model. This function contains the output and update function code
for the blocks in the model and is called by
model
_steprt_OneStep
to execute processing for one clock
period of the model at interrupt level.
Does not combine output and update function code into a single
function, and instead generates the code in separate
and
model
_output
functions.model
_update
Errors or unexpected behavior can occur if a Model block is part of a cycle, the Model block is a direct feedthrough block, and an algebraic loop results. For more information about direct feed through, see Algebraic Loop Concepts.
Simulink® Coder™ ignores this parameter for a referenced model if any of the following conditions apply to that model:
Is multi-rate
Has a continuous sample time
Is logging states (using the States or Final states parameters in the Configuration Parameters > Data Import/Export pane
Setting Code interface packaging to C++
class
forces on and disables this option.
This option and Classic call interface are mutually incompatible and cannot both be selected through the GUI. Selecting Classic call interface forces off and disables this option and clearing Classic call interface enables (but does not select) this option.
When you use this option, you must clear the option Minimize algebraic loop occurrences on the Model Referencing pane.
If you customize ert_main.c
or .cpp
to read model outputs after each base-rate model step, selecting both
parameters Support: continuous time and
Single output/update function can cause output
values read from ert_main
for a continuous output port to
differ from the corresponding output values in the logged data for the
model. This is because, while logged data is a snapshot of output at major
time steps, output read from ert_main
after the base-rate
model step potentially reflects intervening minor time steps. The following
table lists workarounds that eliminate the discrepancy.
Work Around | Customized ert_main.c | Customized ert_main.cpp |
---|---|---|
Separate the generated output and update functions (clear
the Single output/update function
parameter), and insert code in ert_main
to read model output values reflecting only the major time
steps. For example, in ert_main , between
the
call and the
call, read the model External outputs
global data structure (defined in
). | X | |
Select the Single output/update
function parameter and insert code in the
generated
or
.cpp file to return model output
values reflecting only major time steps. For example, in the
model step function, between the output code and the update
code, save the value of the model External
outputs global data structure (defined in
).
Then, restore the value after the update code
completes. | X | X |
Place a Zero-Order Hold block before the continuous output port. | X | X |
Parameter:
CombineOutputUpdateFcns |
Type: character vector |
Value:
'on' | 'off' |
Default:
'on' |
Application | Setting |
---|---|
Debugging | On |
Traceability | On |
Efficiency | On |
Safety precaution | No recommendation |