Difference between revisions of "Simulink Execution on the ARM7 target"
Line 16: | Line 16: | ||
The following pseudo-code illustrates how the generated code is executed: | The following pseudo-code illustrates how the generated code is executed: | ||
− | < | + | <source> |
call simulink_initialize() | call simulink_initialize() | ||
each n milliseconds do | each n milliseconds do | ||
Line 23: | Line 23: | ||
propagate model's outports to environment | propagate model's outports to environment | ||
done | done | ||
− | </ | + | </source> |
Revision as of 20:26, 18 March 2009
A simulink model can be deployed on an embedded target when the Realtime Workshop and Embedded Coder plugins are used for Code creation.
Code/Model Execution Semantics
The execution semantic of a dataflow model is a continuous dataflow between the simulink blocks on the channels and each block is continuously processing its input data and generating output data. Since continuous execution is not feasible, it is approximated by updating the model in discrete steps. If the time distance between these steps is chosen small enough, the approximation is good enough.
Generated Code
The Embedded Coder produces code whose execution is triggered by 2 functions: 1. an initialization function, called once before model execution 2. a step function, called in a regular interval to update the model Interaction with the environment is done via the model's ports. The coder maps these to two structs, one for the inports and one for the outports.
Executing the Generated Code
The following pseudo-code illustrates how the generated code is executed:
<source> call simulink_initialize() each n milliseconds do
update model inports from environment call simulink_step() propagate model's outports to environment
done </source>