While OpenECU works with most of the functionality of Simulink and RTW, there are only a few major restrictions when using the OpenECU blockset in conjunction with RTW. Those that must be avoided are discussed in more detail below.
- Cannot use continuous blocks
For some targets the auto-code generator cannot produce code for these blocks, and for those for which it can there is significant computational overhead. See the Simulink documentation for a list of continuous time blocks (including Derivative, Integrator, Memory, State-Space, Transfer Fcn, Transport Delay, Variable Transport Delay, Zero-Pole).
- Cannot divide by zero
Division by zero, or overflow due to division by very small numbers, will cause the model running on the OpenECU target hardware to create a large number (approximately 3.4E38) which will propagate into any calculation which uses it (M110, M220, M221, M250, M460, M461, and M670 targets). Restrict division by clamping the divisor to a finite, non-zero number.
- Cannot use algebraic loops
These occur when the output of a calculation appears as one of its inputs. In many applications a variable is updated based on a previous value. In such cases a loop can be avoided by inserting a unit delay (1/z) block. RTW cannot produce code if algebraic loops exist.
For readability purposes, it is best to show a unit delay block used to avoid an algebraic loop flowing from right to left. Where a unit delay block is used for other purposes (such as comparing successive values of a flow) it should be shown flowing left to right.
- Cannot use blocks that access elapsed timers
The concept of elapsed timers is not supported. These are where instead of blocks using an absolute time reference to determine the time between successive iterations, the time between successive iterations are determined relative to each other. This is a restriction imposed by the OpenECU product, not RTW.
- Cannot use dynamic memory
Blocks that require the use of C
malloc()
or C++new()
, or other dynamic memory are not supported. This is a restriction imposed by the OpenECU product, not RTW.- Cannot use C++
Blocks that require the use of C++ are not supported. This is a restriction imposed by the OpenECU product, not RTW.
- Cannot use non-inlined S-functions
User written non-inlined S-functions or other blocks that are non-inlined are not supported. This is a restriction imposed by the OpenECU product, not RTW.
Note that inlined S-functions are supported, see Section 3.2, “Custom C code” for more.
- Shared utility source and model references
Shared utility source and model references are only supported in Embedded Coder. Model references only support the put_Identification block. No other OpenECU block is supported in model references, only native Simulink blocks. This is a restriction imposed by the OpenECU product, not RTW.
- Cannot iterate quicker than 1 millisecond
OpenECU schedules model rate tasks at a resolution of 1 millisecond. This is a restriction imposed by the OpenECU product, not RTW.