Channel Selection Changed
If you are using Simulink library files to manage different components of your software, then you may run into cases where the channel selection in OpenECU I/O blocks is changed. The OpenECU blocks perform some initialization when a model is loaded, to present I/O channels for the selected target. The initialization code determines the target by searching the model for a Model Identification block.
- If the block is found, the target is determined and the I/O selections adjusted to show options for just one target.
- If the block cannot be found, the target cannot be determined, and the I/O selections are adjusted to show options for all targets.
There are 2 ways to avoid this problem:
- Place as many of the OpenECU blocks in the master model as possible, leaving the library models containing just Simulink blocks.
Place a Model Identification block at the root/top-level of each library model, configured with the same target as the master model. Then the OpenECU blocks in each library model will only present I/O channels for the target ECU, rather than I/O channels for all ECUs. It will then not be possible to select an I/O channel in a library model which cannot be used in the master model.
- When the channel selection is changed, it usually is changed to the first channel in the dropdown. If this happens to several blocks, it may cause errors due to the channel being duplicated.
- The channels may also change when switching target ECU's, or upgrading between OpenECU platform versions. There will usually be a warning printed to the MATLAB command prompt when this happens.
Channel Selection Options Not Correct
In MATLAB R2011b and later, the dropdown list in some OpenECU blocks are not populated correctly when the block is first added to a model. This affects Input Drivers and Output Drivers blocks, where the dropdown menu is supposed to be populated depending on the ECU type configured in the Model Identification.
The problem happens when the initialization code for the block doesn't run. This issue will be addressed in Case 12887. Use the following procedure as a temporary work around for this issue:
- Drag the block from the Simulink Library Browser to the model.
- Open the parameters window by double-clicking on the block
The Channel selection dropdown will contain options for all ECU's, not just the one configured in the identification.
Enter values for all the other parameters and click OK.
NOTE: this may cause a Simulink error such as Error invoking object method: Initialization commands cannot be evaluated. -->Undefined function or variable "target_type" . Just click OK.
- This will cause the initialization code to run, which will update the parameter options in the dropdown menu.
Re-open the parameters window, and the dropdown Channel options should be correct.