Existing models, not created with the OpenECU oe_create_model
,
command can be converted to run with OpenECU with some effort. Some models which
already follow some of the guidelines set out in Chapter 8, Design and modelling
will be easier to convert than others.
When converting any model, you will need to consider the following changes (as well as those in Section 4.3.1, “Block use restrictions”):
Some of the settings are harder to configure than others. It may be easier overall to create a new model using the:
oe_create_modelcommand and copying the systems and blocks to this new model.
The OpenECU build mechanism relies on particular settings for the model, e.g., that it can be solved with a discrete solver not a continuous one. The following simulation settings should be configured when converting any model for R2015a.
Table 4.9. Model simulation settings for R2015a
Tab | Item | Parameter | Setting |
---|---|---|---|
Solver | Simulation time | Stop time | It's a good idea to set the stop time to some large number (e.g.
inf ) so that your simulation doesn't stop unexpectedly
when you're testing it (this value is ignored when the model is built
and run on target). |
Solver options | Type | OpenECU runs the model at regular periodic intervals, so set to Fixed-step. | |
Solver | And OpenECU is a discrete controller, so set the solver to discrete (not continuous states). | ||
Fixed step size | Set to auto to allow the Simulink solver find the quickest model rate. | ||
Tasking and sample time options | Periodic sample time constraint | Set to Unconstrained. | |
Tasking mode for periodic sample times | Set to auto. | ||
Automatically handle data transfers between tasks | Set to off. | ||
Higher priority value indicates higher task priority | Set to on. | ||
Optimisation | Simulation and code generation | Block reduction | Set to off. |
Implement logic signals as boolean data | Set to on to save RAM usage on the target ECU (but OpenECU will work with this parameter set to off). | ||
Use integer division to handle net slopes that are reciprocals of integers | Set to off. | ||
Use floating-point multiplication to handle net slope corrections | Set to off. | ||
Conditional input branch execution | Set to on to help improve switch and multiport switch block execution. | ||
Application lifespan | Set to inf. | ||
Data initialisation | Use memset to initialise floats and doubles to 0.0 | Set to on to improve code space. | |
Integer and fixed-point | Remove code from floating-point to integer conversions that wraps ... | Set to off | |
Remove code from floating-point to integer conversions with saturation ... | Set to on | ||
Accelerating simulations | Compiler optimisation level | Set to Optimizations off (faster builds) | |
Verbose accelerator builds | Set to off | ||
Signals and Parameters >> Simulation and code generation | Inline parameters | Set to on so that signals can be calibrated. | |
Signal storage reuse | Set to on to save RAM usage. | ||
Signals and Parameters >> Code generation | Enable local block outputs | Set to on. | |
Eliminate superfluous temporary variables | Set to on | ||
Minimize data copies between local and global variables | Set to on | ||
Reuse block outputs | Set to on | ||
Inline invariant signals | Set to on | ||
Use memcpy for vector assignment | Set to on to improve code space | ||
Memcpy threshold | Set to 64 | ||
Loop unrolling threshold | Set to 5 | ||
Maximum stack size (bytes) | Set to Inherit from target | ||
Stateflow | Use bitsets for storing state configuration | Set to off | |
Use bitsets for storing Boolean data | Set to off | ||
Hardware implementation | Embedded hardware | Device vendor | Set to Freescale. |
Device type | Set to 32-bit PowerPC. | ||
Emulation hardware | None | Set to off so that you can change the device type. | |
Device vendor | Set to Freescale. | ||
Device type | Set to 32-bit PowerPC. | ||
Code Generation | Target selection | System target file | Set to openecu.tlc. |
Build options | Template makefile | Set to openecu_r2015a.tmf (note that this option is automatically set at the start of each build based on the version of Simulink running). | |
Code Generation > Interface | Code Interface | Classic Call Interface | Set to on (note: this option only appears when building for an RTModel configuration). |
or the following simulation settings for R2015b:
Table 4.10. Model simulation settings for R2015b
Tab | Item | Parameter | Setting |
---|---|---|---|
Solver | Simulation time | Stop time | It's a good idea to set the stop time to some large number (e.g.
inf ) so that your simulation doesn't stop unexpectedly
when you're testing it (this value is ignored when the model is built
and run on target). |
Solver options | Type | OpenECU runs the model at regular periodic intervals, so set to Fixed-step. | |
Solver | And OpenECU is a discrete controller, so set the solver to discrete (not continuous states). | ||
Fixed step size | Set to auto to allow the Simulink solver find the quickest model rate. | ||
Tasking and sample time options | Periodic sample time constraint | Set to Unconstrained. | |
Tasking mode for periodic sample times | Set to auto. | ||
Automatically handle data transfers between tasks | Set to off. | ||
Higher priority value indicates higher task priority | Set to on. | ||
Optimisation | Simulation and code generation | Block reduction | Set to off. |
Implement logic signals as boolean data | Set to on to save RAM usage on the target ECU (but OpenECU will work with this parameter set to off). | ||
Use integer division to handle net slopes that are reciprocals of integers | Set to off. | ||
Use floating-point multiplication to handle net slope corrections | Set to off. | ||
Conditional input branch execution | Set to on to help improve switch and multiport switch block execution. | ||
Application lifespan | Set to inf. | ||
Data initialisation | Use memset to initialise floats and doubles to 0.0 | Set to on to improve code space. | |
Integer and fixed-point | Remove code from floating-point to integer conversions that wraps ... | Set to off | |
Remove code from floating-point to integer conversions with saturation ... | Set to on | ||
Accelerating simulations | Compiler optimisation level | Set to Optimizations off (faster builds) | |
Verbose accelerator builds | Set to off | ||
Signals and Parameters >> Simulation and code generation | Inline parameters | Set to on so that signals can be calibrated. | |
Signal storage reuse | Set to on to save RAM usage. | ||
Signals and Parameters >> Code generation | Enable local block outputs | Set to on. | |
Eliminate superfluous temporary variables | Set to on | ||
Minimize data copies between local and global variables | Set to on | ||
Reuse block outputs | Set to on | ||
Inline invariant signals | Set to on | ||
Use memcpy for vector assignment | Set to on to improve code space | ||
Memcpy threshold | Set to 64 | ||
Loop unrolling threshold | Set to 5 | ||
Maximum stack size (bytes) | Set to Inherit from target | ||
Stateflow | Use bitsets for storing state configuration | Set to off | |
Use bitsets for storing Boolean data | Set to off | ||
Hardware implementation | Embedded hardware | Device vendor | Set to Freescale. |
Device type | Set to 32-bit PowerPC. | ||
Emulation hardware | None | Set to off so that you can change the device type. | |
Device vendor | Set to Freescale. | ||
Device type | Set to 32-bit PowerPC. | ||
Code Generation | Target selection | System target file | Set to openecu.tlc. |
Build options | Template makefile | Set to openecu_r2015b.tmf (note that this option is automatically set at the start of each build based on the version of Simulink running). | |
Code Generation > Interface | Code Interface | Classic Call Interface | Set to on (note: this option only appears when building for an RTModel configuration). |
or the following simulation settings for R2016a:
Table 4.11. Model simulation settings for R2016a
Tab | Item | Parameter | Setting |
---|---|---|---|
Solver | Simulation time | Stop time | It's a good idea to set the stop time to some large number (e.g.
inf ) so that your simulation doesn't stop unexpectedly
when you're testing it (this value is ignored when the model is built
and run on target). |
Solver options | Type | OpenECU runs the model at regular periodic intervals, so set to Fixed-step. | |
Solver | And OpenECU is a discrete controller, so set the solver to discrete (not continuous states). | ||
Fixed step size | Set to auto to allow the Simulink solver find the quickest model rate. | ||
Tasking and sample time options | Periodic sample time constraint | Set to Unconstrained. | |
Tasking mode for periodic sample times | Set to auto. | ||
Show concurrent execution options | Set to off. | ||
Allow tasks to execute concurrently on target | Set to off. | ||
Automatically handle data transfers between tasks | Set to off. | ||
Higher priority value indicates higher task priority | Set to on. | ||
Optimisation | Simulation and code generation | Block reduction | Set to off. |
Implement logic signals as boolean data | Set to on to save RAM usage on the target ECU (but OpenECU will work with this parameter set to off). | ||
Use integer division to handle net slopes that are reciprocals of integers | Set to off. | ||
Use floating-point multiplication to handle net slope corrections | Set to off. | ||
Conditional input branch execution | Set to on to help improve switch and multiport switch block execution. | ||
Application lifespan | Set to inf. | ||
Data initialisation | Use memset to initialise floats and doubles to 0.0 | Set to on to improve code space. | |
Integer and fixed-point | Remove code from floating-point to integer conversions that wraps ... | Set to off | |
Remove code from floating-point to integer conversions with saturation ... | Set to on | ||
Accelerating simulations | Compiler optimisation level | Set to Optimizations off (faster builds) | |
Verbose accelerator builds | Set to off | ||
Signals and Parameters >> Simulation and code generation | Inline parameters | Set to on so that signals can be calibrated. | |
Signal storage reuse | Set to on to save RAM usage. | ||
Signals and Parameters >> Code generation | Enable local block outputs | Set to on. | |
Eliminate superfluous temporary variables | Set to on | ||
Minimize data copies between local and global variables | Set to on | ||
Reuse block outputs | Set to on | ||
Inline invariant signals | Set to on | ||
Use memcpy for vector assignment | Set to on to improve code space | ||
Memcpy threshold | Set to 64 | ||
Loop unrolling threshold | Set to 5 | ||
Maximum stack size (bytes) | Set to Inherit from target | ||
Stateflow | Use bitsets for storing state configuration | Set to off | |
Use bitsets for storing Boolean data | Set to off | ||
Hardware implementation | Embedded hardware | Device vendor | Set to Freescale. |
Device type | Set to 32-bit PowerPC. | ||
Emulation hardware | None | Set to off so that you can change the device type. | |
Device vendor | Set to Freescale. | ||
Device type | Set to 32-bit PowerPC. | ||
Code Generation | Target selection | System target file | Set to openecu.tlc. |
Build options | Template makefile | Set to openecu_r2016a.tmf (note that this option is automatically set at the start of each build based on the version of Simulink running). | |
Code Generation > Interface | Code Interface | Classic Call Interface | Set to on (note: this option only appears when building for an RTModel configuration). |
or the following simulation settings for R2016b:
Table 4.12. Model simulation settings for R2016b
Tab | Item | Parameter | Setting |
---|---|---|---|
Solver | Simulation time | Stop time | It's a good idea to set the stop time to some large number (e.g.
inf ) so that your simulation doesn't stop unexpectedly
when you're testing it (this value is ignored when the model is built
and run on target). |
Solver options | Type | OpenECU runs the model at regular periodic intervals, so set to Fixed-step. | |
Solver | And OpenECU is a discrete controller, so set the solver to discrete (not continuous states). | ||
Fixed step size | Set to auto to allow the Simulink solver find the quickest model rate. | ||
Tasking and sample time options | Periodic sample time constraint | Set to Unconstrained. | |
Tasking mode for periodic sample times | Set to auto. | ||
Automatically handle data transfers between tasks | Set to off. | ||
Higher priority value indicates higher task priority | Set to on. | ||
Optimisation | Simulation and code generation | Block reduction | Set to off. |
Implement logic signals as boolean data | Set to on to save RAM usage on the target ECU (but OpenECU will work with this parameter set to off). | ||
Use integer division to handle net slopes that are reciprocals of integers | Set to off. | ||
Use floating-point multiplication to handle net slope corrections | Set to off. | ||
Conditional input branch execution | Set to on to help improve switch and multiport switch block execution. | ||
Application lifespan | Set to inf. | ||
Data initialisation | Use memset to initialise floats and doubles to 0.0 | Set to on to improve code space. | |
Integer and fixed-point | Remove code from floating-point to integer conversions that wraps ... | Set to off | |
Remove code from floating-point to integer conversions with saturation ... | Set to on | ||
Accelerating simulations | Compiler optimisation level | Set to Optimizations off (faster builds) | |
Verbose accelerator builds | Set to off | ||
Signals and Parameters >> Simulation and code generation | Inline parameters | Set to on so that signals can be calibrated. | |
Signal storage reuse | Set to on to save RAM usage. | ||
Signals and Parameters >> Code generation | Enable local block outputs | Set to on. | |
Eliminate superfluous temporary variables | Set to on | ||
Minimize data copies between local and global variables | Set to on | ||
Reuse block outputs | Set to on | ||
Inline invariant signals | Set to on | ||
Use memcpy for vector assignment | Set to on to improve code space | ||
Memcpy threshold | Set to 64 | ||
Loop unrolling threshold | Set to 5 | ||
Maximum stack size (bytes) | Set to Inherit from target | ||
Stateflow | Use bitsets for storing state configuration | Set to off | |
Use bitsets for storing Boolean data | Set to off | ||
Hardware implementation | Embedded hardware | Device vendor | Set to Freescale. |
Device type | Set to 32-bit PowerPC. | ||
Emulation hardware | None | Set to off so that you can change the device type. | |
Device vendor | Set to Freescale. | ||
Device type | Set to 32-bit PowerPC. | ||
Code Generation | Target selection | System target file | Set to openecu.tlc. |
Build options | Template makefile | Set to openecu_r2016b.tmf (note that this option is automatically set at the start of each build based on the version of Simulink running). | |
Code Generation > Interface | Code Interface | Classic Call Interface | Set to on (note: this option only appears when building for an RTModel configuration). |
or the following simulation settings for R2017a:
Table 4.13. Model simulation settings for R2017a
Tab | Item | Parameter | Setting |
---|---|---|---|
Solver | Simulation time | Stop time | It's a good idea to set the stop time to some large number (e.g.
inf ) so that your simulation doesn't stop unexpectedly
when you're testing it (this value is ignored when the model is built
and run on target). |
Solver options | Type | OpenECU runs the model at regular periodic intervals, so set to Fixed-step. | |
Solver | And OpenECU is a discrete controller, so set the solver to discrete (not continuous states). | ||
Fixed step size | Set to auto to allow the Simulink solver find the quickest model rate. | ||
Tasking and sample time options | Periodic sample time constraint | Set to Unconstrained. | |
Tasking mode for periodic sample times | Set to auto. | ||
Automatically handle data transfers between tasks | Set to off. | ||
Higher priority value indicates higher task priority | Set to on. | ||
Optimization | Simulation and code generation | Use integer division to handle net slopes that are reciprocals of integers | Set to off. |
Use floating-point multiplication to handle net slope corrections | Set to off. | ||
Application lifespan | Set to inf. | ||
Integer and fixed-point | Remove code from floating-point to integer conversions that wraps ... | Set to off | |
Advanced parameters | Compiler optimisation level | Set to Optimizations off (faster builds) | |
Verbose accelerator builds | Set to off | ||
Block reduction | Set to off. | ||
Signal storage reuse | Set to on to save RAM usage. | ||
Conditional input branch execution | Set to on to help improve switch and multiport switch block execution. | ||
Implement logic signals as boolean data | Set to on to save RAM usage on the target ECU (but OpenECU will work with this parameter set to off). | ||
Remove code from floating-point to integer conversions with saturation ... | Set to on | ||
Use memset to initialise floats and doubles to 0.0 | Set to on to improve code space. | ||
Optimization > Signals and Parameters | Code generation | Default parameter behavior Inline parameters | Set to Inlined so that signals can be calibrated. |
Inline invariant signals | Set to on | ||
Use memcpy for vector assignment | Set to on to improve code space | ||
Memcpy threshold | Set to 64 | ||
Loop unrolling threshold | Set to 5 | ||
Maximum stack size (bytes) | Set to Inherit from target | ||
Enable local block outputs | Set to on. | ||
Reuse block outputs | Set to on | ||
Eliminate superfluous temporary variables | Set to on | ||
Optimization > Stateflow | Stateflow | Use bitsets for storing state configuration | Set to off |
Use bitsets for storing Boolean data | Set to off | ||
Hardware implementation | Embedded hardware | Device vendor | Set to Freescale. |
Device type | Set to 32-bit PowerPC. | ||
Code Generation | Target selection | System target file | Set to openecu_grt.tlc. |
Build process | Template makefile | Set to openecu_grt_r2018b_64.tmf (note that this option is automatically set at the start of each build based on the version of Simulink running). | |
Code Generation > Interface | Advanced parameters | Classic Call Interface | Set to on (note: this option only appears when building for an RTModel configuration). |
or the following simulation settings for R2017b:
Table 4.14. Model simulation settings for R2017b
Tab | Item | Parameter | Setting |
---|---|---|---|
Solver | Simulation time | Stop time | It's a good idea to set the stop time to some large number (e.g.
inf ) so that your simulation doesn't stop unexpectedly
when you're testing it (this value is ignored when the model is built
and run on target). |
Solver options | Type | OpenECU runs the model at regular periodic intervals, so set to Fixed-step. | |
Solver | And OpenECU is a discrete controller, so set the solver to discrete (not continuous states). | ||
Fixed step size | Set to auto to allow the Simulink solver find the quickest model rate. | ||
Tasking and sample time options | Periodic sample time constraint | Set to Unconstrained. | |
Tasking mode for periodic sample times | Set to auto. | ||
Automatically handle data transfers between tasks | Set to off. | ||
Higher priority value indicates higher task priority | Set to on. | ||
Optimization | Simulation and code generation | Use integer division to handle net slopes that are reciprocals of integers | Set to off. |
Use floating-point multiplication to handle net slope corrections | Set to off. | ||
Application lifespan | Set to inf. | ||
Integer and fixed-point | Remove code from floating-point to integer conversions that wraps ... | Set to off | |
Advanced parameters | Compiler optimisation level | Set to Optimizations off (faster builds) | |
Verbose accelerator builds | Set to off | ||
Block reduction | Set to off. | ||
Signal storage reuse | Set to on to save RAM usage. | ||
Conditional input branch execution | Set to on to help improve switch and multiport switch block execution. | ||
Implement logic signals as boolean data | Set to on to save RAM usage on the target ECU (but OpenECU will work with this parameter set to off). | ||
Remove code from floating-point to integer conversions with saturation ... | Set to on | ||
Use memset to initialise floats and doubles to 0.0 | Set to on to improve code space. | ||
Optimization > Signals and Parameters | Code generation | Default parameter behavior Inline parameters | Set to Inlined so that signals can be calibrated. |
Inline invariant signals | Set to on | ||
Use memcpy for vector assignment | Set to on to improve code space | ||
Memcpy threshold | Set to 64 | ||
Loop unrolling threshold | Set to 5 | ||
Maximum stack size (bytes) | Set to Inherit from target | ||
Enable local block outputs | Set to on. | ||
Reuse block outputs | Set to on | ||
Eliminate superfluous temporary variables | Set to on | ||
Optimization > Stateflow | Stateflow | Use bitsets for storing state configuration | Set to off |
Use bitsets for storing Boolean data | Set to off | ||
Hardware implementation | Embedded hardware | Device vendor | Set to Freescale. |
Device type | Set to 32-bit PowerPC. | ||
Code Generation | Target selection | System target file | Set to openecu_grt.tlc. |
Build process | Template makefile | Set to openecu_grt_r2018b_64.tmf (note that this option is automatically set at the start of each build based on the version of Simulink running). | |
Code Generation > Interface | Advanced parameters | Classic Call Interface | Set to on (note: this option only appears when building for an RTModel configuration). |
or the following simulation settings for R2018a or R2018b:
Table 4.15. Model simulation settings for R2018a and R2018b
Tab | Item | Parameter | Setting |
---|---|---|---|
Solver | Simulation time | Stop time | It's a good idea to set the stop time to some large number (e.g.
inf ) so that your simulation doesn't stop unexpectedly
when you're testing it (this value is ignored when the model is built
and run on target). |
Solver selection | Type | OpenECU runs the model at regular periodic intervals, so set to Fixed-step. | |
Solver | And OpenECU is a discrete controller, so set the solver to discrete (not continuous states). | ||
Solver details | Fixed step size | Set to auto to allow the Simulink solver find the quickest model rate. | |
Tasking and sample time options | Periodic sample time constraint | Set to Unconstrained. | |
Treat each discrete rate as a separate task | Set to on. | ||
Allow tasks to execute concurrently on target | Set to off. | ||
Automatically handle rate transition for data transfer | Set to off. | ||
Higher priority value indicates higher task priority | Set to on. | ||
Math and Data Types | Basic parameters | Default for underspecified data type: | Set to double. |
Use division for fixed-point net slope computation: | Set to off. | ||
Use floating-point multiplication to handle net slope corrections | Set to off. | ||
Use algorithms optimized for row-major array layout | Set to off. | ||
Application lifespan | Set to inf. | ||
Advanced parameters | Implement logic signals as boolean data (vs. double) | Set to on to save RAM usage on the target ECU (but OpenECU will work with this parameter set to off). | |
Hardware implementation | Embedded hardware | Hardware board: | Set to Determined by Code Generation system target file.. |
Device vendor | Set to Freescale. | ||
Device type | Set to 32-bit PowerPC. | ||
Simulation Target | Advanced parameters | Block reduction | Set to off. |
Compiler optimization level | Set to Optimizations off (faster builds) | ||
Conditional input branch execution | Set to on to help improve switch and multiport switch block execution. | ||
Signal storage reuse | Set to on to save RAM usage. | ||
Verbose accelerator builds | Set to off | ||
Code Generation | Target selection | System target file | Set to openecu_grt.tlc. (Note that this changes the active configuration, changes to other configurations are not automatically applied to this one.) |
Build process | Generate makefile | Set to on. | |
Template makefile | Set to openecu_grt_r2018a_64.tmf or openecu_grt_r2018b_64.tmf (note that this option is automatically set at the start of each build based on the version of Simulink running). | ||
Make command | Set to make_rtw. | ||
Code Generation > Optimization | Basic parameters | Default parameter behavior | Set to Inlined so that signals can be calibrated. |
Use memcpy for vector assignment | Set to on to improve code space | ||
Memcpy threshold | Set to 64 | ||
Loop unrolling threshold | Set to 5 | ||
Maximum stack size (bytes) | Set to Inherit from target | ||
Advanced parameters | Inline invariant signals | Set to on | |
Enable local block outputs | Set to on. | ||
Reuse block outputs | Set to on | ||
Eliminate superfluous temporary variables | Set to on | ||
Remove code from floating-point to integer conversions with saturation ... | Set to on | ||
Use memset to initialise floats and doubles to 0.0 | Set to on to improve code space. | ||
Remove code from floating-point to integer conversions that wraps ... | Set to off | ||
Advanced parameters > Stateflow | Use bitsets for storing state configuration | Set to off | |
Use bitsets for storing Boolean data | Set to off | ||
Code Generation > Interface | Advanced | Classic Call Interface | Set to on (note: this option only appears when building for an RTModel configuration). |
or the following simulation settings for R2019a, R2019b, or R2020a:
Table 4.16. Model simulation settings for R2019a, R2019b, and R2020a
Tab | Item | Parameter | Setting |
---|---|---|---|
Solver | Simulation time | Stop time | It's a good idea to set the stop time to some large number (e.g.
inf ) so that your simulation doesn't stop unexpectedly
when you're testing it (this value is ignored when the model is built
and run on target). |
Solver selection | Type | OpenECU runs the model at regular periodic intervals, so set to Fixed-step. | |
Solver | And OpenECU is a discrete controller, so set the solver to discrete (not continuous states). | ||
Solver details | Fixed step size | Set to auto to allow the Simulink solver find the quickest model rate. | |
Tasking and sample time options | Periodic sample time constraint | Set to Unconstrained. | |
Treat each discrete rate as a separate task | Set to on. | ||
Allow tasks to execute concurrently on target | Set to off. | ||
Automatically handle rate transition for data transfer | Set to off. | ||
Higher priority value indicates higher task priority | Set to on. | ||
Math and Data Types | Basic parameters | Default for underspecified data type: | Set to double. |
Use division for fixed-point net slope computation: | Set to off. | ||
Use floating-point multiplication to handle net slope corrections | Set to off. | ||
Use algorithms optimized for row-major array layout | Set to off. | ||
Application lifespan | Set to inf. | ||
Advanced parameters | Implement logic signals as boolean data (vs. double) | Set to on to save RAM usage on the target ECU (but OpenECU will work with this parameter set to off). | |
Hardware implementation | Embedded hardware | Hardware board: | Set to Determined by Code Generation system target file.. |
Device vendor | Set to Freescale. | ||
Device type | Set to 32-bit PowerPC. | ||
Simulation Target | Advanced parameters | Block reduction | Set to off. |
Compiler optimization level | Set to Optimizations off (faster builds) | ||
Conditional input branch execution | Set to on to help improve switch and multiport switch block execution. | ||
Signal storage reuse | Set to on to save RAM usage. | ||
Verbose accelerator builds | Set to off | ||
Code Generation | Target selection | System target file | Set to openecu_grt.tlc. (Note that this changes the active configuration, changes to other configurations are not automatically applied to this one.) |
Build process | Toolchain | Set to OpenECU Diab 5.9 | gmake (64-bit Windows). (Note the toolchain is updated automatically by the Compiler option.) | |
Build configuration | Set to Faster Builds (Note the options Faster Builds, Faster Runs, and Debug are identical). | ||
Code Generation > Optimization | Basic parameters | Default parameter behavior | Set to Inlined so that signals can be calibrated. |
Use memcpy for vector assignment | Set to on to improve code space | ||
Memcpy threshold | Set to 64 | ||
Loop unrolling threshold | Set to 5 | ||
Maximum stack size (bytes) | Set to Inherit from target | ||
Advanced parameters | Inline invariant signals | Set to on | |
Enable local block outputs | Set to on. | ||
Reuse block outputs | Set to on | ||
Eliminate superfluous temporary variables | Set to on | ||
Remove code from floating-point to integer conversions with saturation ... | Set to on | ||
Use memset to initialise floats and doubles to 0.0 | Set to on to improve code space. | ||
Remove code from floating-point to integer conversions that wraps ... | Set to off | ||
Advanced parameters > Stateflow | Use bitsets for storing state configuration | Set to off | |
Use bitsets for storing Boolean data | Set to off | ||
Code Generation > Interface | Advanced | Classic Call Interface | Set to on (note: this option only appears when building for an RTModel configuration). |
The pre-load and post-load hooks are settings in a Simulink model which are executed before the model is fully loaded and after the model has been fully loaded. OpenECU uses these hooks to perform extra actions that Simulink does not normally perform.
These settings can be set using the following commands when the model is selected:
set_param(bdroot, 'preloadfcn', 'openecu_make_rtw_hook(''model_load'', ''mn'');') set_param(bdroot, 'postloadfcn', 'openecu_make_rtw_hook(''model_loaded'', ''mn'');')
where mn
is replaced by the name of the model.
If in doubt, it may be easier to create a new model using the
oe_create_modelcommand and copying the systems and blocks to this new model.
OpenECU provides a put_Identification block which identifies the target hardware the model will run on. Before a build can complete, this block must have been added to the model. Without this block, a RTW build of the model will fail.
When adding a put_Identification block to a model for the first time, it is best to set the block's target hardware parameter then save, close and reload the model. This ensures that any other OpenECU block in the model is adjusted for the newly selected hardware target.
The OpenECU device relies on a discrete solver and therefore any block that relies on a continuous solver will not work on OpenECU. Each of these blocks must be replaced by a discrete equivalent. E.g., a continuous transfer function block to a discrete transfer function.
Some MATLAB and Simulink tools exist to help perform these
transformations, for instance, the tustin
approximation.
The OpenECU device is based on a commercial engine controller and therefore uses a commonly available processor to execute the model. Processing power is therefore a resource that must be managed well and it is important to refactor your model so that computation is spread over various model rates.
For instance, when reading a slow changing analogue input and processing its state, it is often best to place the analogue input block to a model rate which is reflects how quickly the analogue input can change. This avoids iterating portions of the model on a frequent basis that produce similar values to previous iterations. If the slow changing analogue input is subsequently used by a faster portion of the model, this can be accommodated using Simulink blocks (an example of how to transfer information between different model rates is given in the multi-rate demo, see Section 3.2, “Installed examples”).
OpenECU provides information about how long each of the model rates takes to run as well as the percentage processor loading that can be viewed over CCP (see Section 5.2.5, “Application and library task timing information”)
OpenECU requires information about display variables and calibration variables in order to generate files required by calibration tools. This information is supplied to OpenECU via a data dictionary. For further information, please see Section 4.2.2.2, “Data dictionary files”.