Azzera filtri
Azzera filtri

Simulink bus element name same as Bus name, problem with code generation

30 visualizzazioni (ultimi 30 giorni)
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 Commento
Adison Vanina
Adison Vanina il 30 Set 2023
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,

Accedi per commentare.

Risposta accettata

prabhat kumar sharma
prabhat kumar sharma il 25 Gen 2024
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!

Più risposte (0)

Categorie

Scopri di più su Deployment, Integration, and Supported Hardware in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by