Simulink bus element name same as Bus name, problem with code generation
25 次查看(过去 30 天)
显示 更早的评论
Hi, I'm trying to use Embedded Coder to autocode a Simulink model in which there is a huge usage of buses. Many of these buses have elements that are buses too, and unfortunately the name of the element in the bus is always the same as the name of the bus delcared in the bus element. For instance I have a bus named 'pippo', one element of this bus is a second bus. This element in 'pippo' is called 'pluto', but 'pluto' is also the name associated to the second bus in the bus editor. With Simulink 2017b I only have warnings due to this situation, but Simulink 2021b gives me the following error: both name and data type of element 'pluto' int he bus 'pippo' are same.
Is there a way in Matlab/Simulink 2021b to treat these situation as a warning instead of an error?
Thank you in advance
1 个评论
Adison Vanina
2023-9-30
Antonio,
Did you get an answer to this or figure it out? I am in the same boat and do not want to rename things.
Thanks,
采纳的回答
prabhat kumar sharma
2024-1-25
Hi Antonio,
I understand that you've encountered an error in Simulink 2021b due to a nested bus element sharing the same name as its containing bus.
I will suggest you couple of ways to resolve this issue:
- Renaming: The simplest solution is to rename the element within the ‘pippo’ bus or If renaming the element is not feasible, consider renaming the pippo bus.
- Bus object: Use a Bus object to define the pippo bus explicitly. Within the Bus object, ensure the element with the same name has a different data type and In the Bus object creation, clear the "Use names from inputs instead of from bus object" checkbox. This forces reliance on the explicitly defined element names and data types.
- Setting configuration parameter: In Simulink 2021b, there is an "Element name mismatch configuration" parameter for bus objects. Setting this to "warning" instead of "error" will allow compilation with a warning instead of an error for cases like yours. However, this might mask potential future bugs due to name conflicts, so I will suggest using it with caution.
You can refer this documentation to know more about "Element name mismatch": https://www.mathworks.com/help/simulink/gui/element-name-mismatch.html
I hope it helps!
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!