4.7. Adapting an existing model for OpenECU

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”):

Note

Some of the settings are harder to configure than others. It may be easier overall to create a new model using the:

oe_create_model

command and copying the systems and blocks to this new model.

Simulink model simulation settings

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

TabItemParameterSetting
SolverSimulation timeStop timeIt'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 optionsTypeOpenECU runs the model at regular periodic intervals, so set to Fixed-step.
SolverAnd OpenECU is a discrete controller, so set the solver to discrete (not continuous states).
Fixed step sizeSet to auto to allow the Simulink solver find the quickest model rate.
Tasking and sample time optionsPeriodic sample time constraintSet to Unconstrained.
Tasking mode for periodic sample timesSet to auto.
Automatically handle data transfers between tasksSet to off.
Higher priority value indicates higher task prioritySet to on.
OptimisationSimulation and code generationBlock reductionSet to off.
Implement logic signals as boolean dataSet 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 integersSet to off.
Use floating-point multiplication to handle net slope correctionsSet to off.
Conditional input branch executionSet to on to help improve switch and multiport switch block execution.
Application lifespanSet to inf.
Data initialisationUse memset to initialise floats and doubles to 0.0Set to on to improve code space.
Integer and fixed-pointRemove 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 simulationsCompiler optimisation levelSet to Optimizations off (faster builds)
Verbose accelerator buildsSet to off
Signals and Parameters >> Simulation and code generationInline parametersSet to on so that signals can be calibrated.
Signal storage reuseSet to on to save RAM usage.
Signals and Parameters >> Code generationEnable local block outputsSet to on.
Eliminate superfluous temporary variablesSet to on
Minimize data copies between local and global variablesSet to on
Reuse block outputsSet to on
Inline invariant signalsSet to on
Use memcpy for vector assignmentSet to on to improve code space
Memcpy thresholdSet to 64
Loop unrolling thresholdSet to 5
Maximum stack size (bytes)Set to Inherit from target
StateflowUse bitsets for storing state configurationSet to off
Use bitsets for storing Boolean dataSet to off
Hardware implementationEmbedded hardwareDevice vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Emulation hardwareNoneSet to off so that you can change the device type.
Device vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Code GenerationTarget selectionSystem target fileSet to openecu.tlc.
Build optionsTemplate makefileSet 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 > InterfaceCode InterfaceClassic Call InterfaceSet 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

TabItemParameterSetting
SolverSimulation timeStop timeIt'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 optionsTypeOpenECU runs the model at regular periodic intervals, so set to Fixed-step.
SolverAnd OpenECU is a discrete controller, so set the solver to discrete (not continuous states).
Fixed step sizeSet to auto to allow the Simulink solver find the quickest model rate.
Tasking and sample time optionsPeriodic sample time constraintSet to Unconstrained.
Tasking mode for periodic sample timesSet to auto.
Automatically handle data transfers between tasksSet to off.
Higher priority value indicates higher task prioritySet to on.
OptimisationSimulation and code generationBlock reductionSet to off.
Implement logic signals as boolean dataSet 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 integersSet to off.
Use floating-point multiplication to handle net slope correctionsSet to off.
Conditional input branch executionSet to on to help improve switch and multiport switch block execution.
Application lifespanSet to inf.
Data initialisationUse memset to initialise floats and doubles to 0.0Set to on to improve code space.
Integer and fixed-pointRemove 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 simulationsCompiler optimisation levelSet to Optimizations off (faster builds)
Verbose accelerator buildsSet to off
Signals and Parameters >> Simulation and code generationInline parametersSet to on so that signals can be calibrated.
Signal storage reuseSet to on to save RAM usage.
Signals and Parameters >> Code generationEnable local block outputsSet to on.
Eliminate superfluous temporary variablesSet to on
Minimize data copies between local and global variablesSet to on
Reuse block outputsSet to on
Inline invariant signalsSet to on
Use memcpy for vector assignmentSet to on to improve code space
Memcpy thresholdSet to 64
Loop unrolling thresholdSet to 5
Maximum stack size (bytes)Set to Inherit from target
StateflowUse bitsets for storing state configurationSet to off
Use bitsets for storing Boolean dataSet to off
Hardware implementationEmbedded hardwareDevice vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Emulation hardwareNoneSet to off so that you can change the device type.
Device vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Code GenerationTarget selectionSystem target fileSet to openecu.tlc.
Build optionsTemplate makefileSet 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 > InterfaceCode InterfaceClassic Call InterfaceSet 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

TabItemParameterSetting
SolverSimulation timeStop timeIt'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 optionsTypeOpenECU runs the model at regular periodic intervals, so set to Fixed-step.
SolverAnd OpenECU is a discrete controller, so set the solver to discrete (not continuous states).
Fixed step sizeSet to auto to allow the Simulink solver find the quickest model rate.
Tasking and sample time optionsPeriodic sample time constraintSet to Unconstrained.
Tasking mode for periodic sample timesSet to auto.
Show concurrent execution optionsSet to off.
Allow tasks to execute concurrently on targetSet to off.
 Automatically handle data transfers between tasksSet to off.
 Higher priority value indicates higher task prioritySet to on.
OptimisationSimulation and code generationBlock reductionSet to off.
Implement logic signals as boolean dataSet 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 integersSet to off.
Use floating-point multiplication to handle net slope correctionsSet to off.
Conditional input branch executionSet to on to help improve switch and multiport switch block execution.
Application lifespanSet to inf.
Data initialisationUse memset to initialise floats and doubles to 0.0Set to on to improve code space.
Integer and fixed-pointRemove 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 simulationsCompiler optimisation levelSet to Optimizations off (faster builds)
Verbose accelerator buildsSet to off
Signals and Parameters >> Simulation and code generationInline parametersSet to on so that signals can be calibrated.
Signal storage reuseSet to on to save RAM usage.
Signals and Parameters >> Code generationEnable local block outputsSet to on.
Eliminate superfluous temporary variablesSet to on
Minimize data copies between local and global variablesSet to on
Reuse block outputsSet to on
Inline invariant signalsSet to on
Use memcpy for vector assignmentSet to on to improve code space
Memcpy thresholdSet to 64
Loop unrolling thresholdSet to 5
Maximum stack size (bytes)Set to Inherit from target
StateflowUse bitsets for storing state configurationSet to off
Use bitsets for storing Boolean dataSet to off
Hardware implementationEmbedded hardwareDevice vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Emulation hardwareNoneSet to off so that you can change the device type.
Device vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Code GenerationTarget selectionSystem target fileSet to openecu.tlc.
Build optionsTemplate makefileSet 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 > InterfaceCode InterfaceClassic Call InterfaceSet 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

TabItemParameterSetting
SolverSimulation timeStop timeIt'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 optionsTypeOpenECU runs the model at regular periodic intervals, so set to Fixed-step.
SolverAnd OpenECU is a discrete controller, so set the solver to discrete (not continuous states).
Fixed step sizeSet to auto to allow the Simulink solver find the quickest model rate.
Tasking and sample time optionsPeriodic sample time constraintSet to Unconstrained.
Tasking mode for periodic sample timesSet to auto.
Automatically handle data transfers between tasksSet to off.
Higher priority value indicates higher task prioritySet to on.
OptimisationSimulation and code generationBlock reductionSet to off.
Implement logic signals as boolean dataSet 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 integersSet to off.
Use floating-point multiplication to handle net slope correctionsSet to off.
Conditional input branch executionSet to on to help improve switch and multiport switch block execution.
Application lifespanSet to inf.
Data initialisationUse memset to initialise floats and doubles to 0.0Set to on to improve code space.
Integer and fixed-pointRemove 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 simulationsCompiler optimisation levelSet to Optimizations off (faster builds)
Verbose accelerator buildsSet to off
Signals and Parameters >> Simulation and code generationInline parametersSet to on so that signals can be calibrated.
Signal storage reuseSet to on to save RAM usage.
Signals and Parameters >> Code generationEnable local block outputsSet to on.
Eliminate superfluous temporary variablesSet to on
Minimize data copies between local and global variablesSet to on
Reuse block outputsSet to on
Inline invariant signalsSet to on
Use memcpy for vector assignmentSet to on to improve code space
Memcpy thresholdSet to 64
Loop unrolling thresholdSet to 5
Maximum stack size (bytes)Set to Inherit from target
StateflowUse bitsets for storing state configurationSet to off
Use bitsets for storing Boolean dataSet to off
Hardware implementationEmbedded hardwareDevice vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Emulation hardwareNoneSet to off so that you can change the device type.
Device vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Code GenerationTarget selectionSystem target fileSet to openecu.tlc.
Build optionsTemplate makefileSet 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 > InterfaceCode InterfaceClassic Call InterfaceSet 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

TabItemParameterSetting
SolverSimulation timeStop timeIt'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 optionsTypeOpenECU runs the model at regular periodic intervals, so set to Fixed-step.
SolverAnd OpenECU is a discrete controller, so set the solver to discrete (not continuous states).
Fixed step sizeSet to auto to allow the Simulink solver find the quickest model rate.
Tasking and sample time optionsPeriodic sample time constraintSet to Unconstrained.
Tasking mode for periodic sample timesSet to auto.
Automatically handle data transfers between tasksSet to off.
Higher priority value indicates higher task prioritySet to on.
OptimizationSimulation and code generationUse integer division to handle net slopes that are reciprocals of integersSet to off.
Use floating-point multiplication to handle net slope correctionsSet to off.
Application lifespanSet to inf.
Integer and fixed-pointRemove code from floating-point to integer conversions that wraps ...Set to off
Advanced parametersCompiler optimisation levelSet to Optimizations off (faster builds)
Verbose accelerator buildsSet to off
Block reductionSet to off.
Signal storage reuseSet to on to save RAM usage.
Conditional input branch executionSet to on to help improve switch and multiport switch block execution.
Implement logic signals as boolean dataSet 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.0Set to on to improve code space.
Optimization > Signals and ParametersCode generationDefault parameter behavior Inline parametersSet to Inlined so that signals can be calibrated.
Inline invariant signalsSet to on
Use memcpy for vector assignmentSet to on to improve code space
Memcpy thresholdSet to 64
Loop unrolling thresholdSet to 5
Maximum stack size (bytes)Set to Inherit from target
Enable local block outputsSet to on.
Reuse block outputsSet to on
Eliminate superfluous temporary variablesSet to on
Optimization > StateflowStateflowUse bitsets for storing state configurationSet to off
Use bitsets for storing Boolean dataSet to off
Hardware implementationEmbedded hardwareDevice vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Code GenerationTarget selectionSystem target fileSet to openecu_grt.tlc.
Build processTemplate makefileSet 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 > InterfaceAdvanced parametersClassic Call InterfaceSet 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

TabItemParameterSetting
SolverSimulation timeStop timeIt'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 optionsTypeOpenECU runs the model at regular periodic intervals, so set to Fixed-step.
SolverAnd OpenECU is a discrete controller, so set the solver to discrete (not continuous states).
Fixed step sizeSet to auto to allow the Simulink solver find the quickest model rate.
Tasking and sample time optionsPeriodic sample time constraintSet to Unconstrained.
Tasking mode for periodic sample timesSet to auto.
Automatically handle data transfers between tasksSet to off.
Higher priority value indicates higher task prioritySet to on.
OptimizationSimulation and code generationUse integer division to handle net slopes that are reciprocals of integersSet to off.
Use floating-point multiplication to handle net slope correctionsSet to off.
Application lifespanSet to inf.
Integer and fixed-pointRemove code from floating-point to integer conversions that wraps ...Set to off
Advanced parametersCompiler optimisation levelSet to Optimizations off (faster builds)
Verbose accelerator buildsSet to off
Block reductionSet to off.
Signal storage reuseSet to on to save RAM usage.
Conditional input branch executionSet to on to help improve switch and multiport switch block execution.
Implement logic signals as boolean dataSet 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.0Set to on to improve code space.
Optimization > Signals and ParametersCode generationDefault parameter behavior Inline parametersSet to Inlined so that signals can be calibrated.
Inline invariant signalsSet to on
Use memcpy for vector assignmentSet to on to improve code space
Memcpy thresholdSet to 64
Loop unrolling thresholdSet to 5
Maximum stack size (bytes)Set to Inherit from target
Enable local block outputsSet to on.
Reuse block outputsSet to on
Eliminate superfluous temporary variablesSet to on
Optimization > StateflowStateflowUse bitsets for storing state configurationSet to off
Use bitsets for storing Boolean dataSet to off
Hardware implementationEmbedded hardwareDevice vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Code GenerationTarget selectionSystem target fileSet to openecu_grt.tlc.
Build processTemplate makefileSet 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 > InterfaceAdvanced parametersClassic Call InterfaceSet 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

TabItemParameterSetting
SolverSimulation timeStop timeIt'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 selectionTypeOpenECU runs the model at regular periodic intervals, so set to Fixed-step.
SolverAnd OpenECU is a discrete controller, so set the solver to discrete (not continuous states).
Solver detailsFixed step sizeSet to auto to allow the Simulink solver find the quickest model rate.
Tasking and sample time optionsPeriodic sample time constraintSet to Unconstrained.
Treat each discrete rate as a separate taskSet to on.
Allow tasks to execute concurrently on targetSet to off.
Automatically handle rate transition for data transferSet to off.
Higher priority value indicates higher task prioritySet to on.
Math and Data TypesBasic parametersDefault 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 correctionsSet to off.
Use algorithms optimized for row-major array layoutSet to off.
Application lifespanSet to inf.
Advanced parametersImplement 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 implementationEmbedded hardwareHardware board:Set to Determined by Code Generation system target file..
Device vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Simulation TargetAdvanced parametersBlock reductionSet to off.
Compiler optimization levelSet to Optimizations off (faster builds)
Conditional input branch executionSet to on to help improve switch and multiport switch block execution.
Signal storage reuseSet to on to save RAM usage.
Verbose accelerator buildsSet to off
Code GenerationTarget selectionSystem target fileSet to openecu_grt.tlc. (Note that this changes the active configuration, changes to other configurations are not automatically applied to this one.)
Build processGenerate makefileSet to on.
Template makefileSet 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 commandSet to make_rtw.
Code Generation > OptimizationBasic parametersDefault parameter behaviorSet to Inlined so that signals can be calibrated.
Use memcpy for vector assignmentSet to on to improve code space
Memcpy thresholdSet to 64
Loop unrolling thresholdSet to 5
Maximum stack size (bytes)Set to Inherit from target
Advanced parametersInline invariant signalsSet to on
Enable local block outputsSet to on.
Reuse block outputsSet to on
Eliminate superfluous temporary variablesSet to on
Remove code from floating-point to integer conversions with saturation ...Set to on
Use memset to initialise floats and doubles to 0.0Set to on to improve code space.
Remove code from floating-point to integer conversions that wraps ...Set to off
Advanced parameters > StateflowUse bitsets for storing state configurationSet to off
Use bitsets for storing Boolean dataSet to off
Code Generation > InterfaceAdvancedClassic Call InterfaceSet 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

TabItemParameterSetting
SolverSimulation timeStop timeIt'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 selectionTypeOpenECU runs the model at regular periodic intervals, so set to Fixed-step.
SolverAnd OpenECU is a discrete controller, so set the solver to discrete (not continuous states).
Solver detailsFixed step sizeSet to auto to allow the Simulink solver find the quickest model rate.
Tasking and sample time optionsPeriodic sample time constraintSet to Unconstrained.
Treat each discrete rate as a separate taskSet to on.
Allow tasks to execute concurrently on targetSet to off.
Automatically handle rate transition for data transferSet to off.
Higher priority value indicates higher task prioritySet to on.
Math and Data TypesBasic parametersDefault 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 correctionsSet to off.
Use algorithms optimized for row-major array layoutSet to off.
Application lifespanSet to inf.
Advanced parametersImplement 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 implementationEmbedded hardwareHardware board:Set to Determined by Code Generation system target file..
Device vendorSet to Freescale.
Device typeSet to 32-bit PowerPC.
Simulation TargetAdvanced parametersBlock reductionSet to off.
Compiler optimization levelSet to Optimizations off (faster builds)
Conditional input branch executionSet to on to help improve switch and multiport switch block execution.
Signal storage reuseSet to on to save RAM usage.
Verbose accelerator buildsSet to off
Code GenerationTarget selectionSystem target fileSet to openecu_grt.tlc. (Note that this changes the active configuration, changes to other configurations are not automatically applied to this one.)
Build processToolchainSet to OpenECU Diab 5.9 | gmake (64-bit Windows). (Note the toolchain is updated automatically by the Compiler option.)
Build configurationSet to Faster Builds (Note the options Faster Builds, Faster Runs, and Debug are identical).
Code Generation > OptimizationBasic parametersDefault parameter behaviorSet to Inlined so that signals can be calibrated.
Use memcpy for vector assignmentSet to on to improve code space
Memcpy thresholdSet to 64
Loop unrolling thresholdSet to 5
Maximum stack size (bytes)Set to Inherit from target
Advanced parametersInline invariant signalsSet to on
Enable local block outputsSet to on.
Reuse block outputsSet to on
Eliminate superfluous temporary variablesSet to on
Remove code from floating-point to integer conversions with saturation ...Set to on
Use memset to initialise floats and doubles to 0.0Set to on to improve code space.
Remove code from floating-point to integer conversions that wraps ...Set to off
Advanced parameters > StateflowUse bitsets for storing state configurationSet to off
Use bitsets for storing Boolean dataSet to off
Code Generation > InterfaceAdvancedClassic Call InterfaceSet to on (note: this option only appears when building for an RTModel configuration).


Model pre-load and post-load hooks

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_model

command and copying the systems and blocks to this new model.

Model identification

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.

Continuous blocks

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.

Computation load

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”)

Create data dictionary

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”.