Hi @mariuslucianand and @paulvlase ,
In our application (S32K v4.2.0 with Matlab 2020a) , the controller sends identical CAN messages with different Message IDs depending on some external board configuration.
This functionality was realized using switch case action subsystems with many 'cases' (depending on the external configuration).
We see 2 problems here:
a) It's a very inconvenient and clumsy implementation that makes the model unnecessarily complex. It would be much more convenient, in such case, to have an external signal line for message ID or to be able to parameterize the ID in the FCAN_send block using a global parameter (which doesn't seem to be possible). Is there a better way (or maybe we don't understand something) ?
b) If the switch-case-action subsystems are not explicitly set to be 'inlined' or to be realized as 'nonreusable function' and the only difference between them is the message ID in the FCAN_send block - all the different drivers blocks are optimized out in the code generation process - producing single 'send' function with single/fixed ID. Is this intended behavior ?
What's Your thoughts on this ?
Thanks
Maciek
Hello @Maciek ,
Thank you for your suggestions! I understand your use case and indeed, it is more suitable to have the message ID as an external input. Having such input would help you right now in your current project development status?
I understand the second point, but this is how the embedded coder generates the output. Probably it considers having the same content and optimizes the code by generating a reusable function.
Regards,
Marius
our current model contains 6 subsystems with 25 switch-case-action subsystems, each - to realize the mentioned functionality. It means that the FCAN_send block is used 150 times. More than 4000 lines of code are generated only for these 6 subsystems.
I expect that having the message ID as signal line should reduce these 4000 lines to around 100 lines of code (not to mention much simpler and more elegant simulink model). The current solution works fine but we would definitely switch to the simpler architecture in this and also in the coming project (that is more complex) - if there is such option.
Finally: I can imagine also different scenarios when having the 'message buffer' as a signal line or external parameter would be similarly convenient (although it's not a problem in our current projects).
Regards
Maciek
Hi @Maciek
Did you find a way to have an external ID signal? I am in the exact same scenario as you are/were.
Thanks!