Why are my bus element names being replaced by data type names in my generated struct?

2 views (last 30 days)
I am generating code using the "autosar.tlc" file and seeing that in the shared header file "ExampleBusInterface.h," the following struct is generated for the bus "bus1."
typedef struct {
 boolean element1;
 int32_t element2;
 boolean element3[3];
 float32 Float[3];
 float32 Float[3];
 float32 element6;
 float32 Float[3];
} Bus1;
Why are the bus element names being replaced by the data type names in the struct and how can I resolve this issue?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 4 May 2022
The bus element name replacement is happening due to a name clash between alias datatypes and the bus element names for "bus1."  The elements in the bus that are named after a Simulink.AliasType objects are the ones that are replaced incorrectly with "FLOAT" element names. There are two possible workarounds that will resolve the bus element name replacement issue.
1. Update the bus element names or the alias types to have different names. For example, after adding "Type" to the end of the Simulink.AliasType data type names, you will be able to generate code with the structure definitions correctly defined.
2.  Import the entire bus as a structure to the AUTOSAR component from "Rte_Type.h" rather than importing the signals one by one. This will greatly simplify your interface, since you will not need to re-combine the signals using bus creator and split them using bus selector at the I/O interfaces. It will also also generate the correct structure definition in "Rte_Type.h."

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!