Maximum identifier length '31' does not provide sufficient space to make symbol names unique
43 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am getting the following warning when generating code from my model:
- Insufficient space for computing symbol names in model 'controller'. The maximum identifier length '31' does not provide sufficient space to make symbol names unique using the symbol format string in 'Global variables'. This is required when using model reference. Consider increasing the maximum identifier length. To eliminate this message enter the command set_param('controller', 'ModelReferenceSymbolNameMessage', 'none') at the MATLAB prompt
I have a similar warning for 'Global types' and 'Subsystem methods'. I believe some names are too long and it does not fit in identifier length '31'.
I do not want to increase the maxmum identifier length because it is required in certain standards. So I want to find and identify which names are too long. How can I find those?
10 comentarios
Walter Roberson
el 12 de Abr. de 2022
Was there something like Input::IO::CAN::ReadMsg::CleanupRTR ?
Are you using CAN messages ?
Bogdan Bodnarescu
el 19 de Abr. de 2022
Hello, like I said I am using CAN messages.
Is there any solution for my problem, outside from making the identifier names longer?
Respuestas (2)
Bogdan Bodnarescu
el 12 de Abr. de 2022
Omg this was exactly the name. Yes I am using some CAN libraries
0 comentarios
Walter Roberson
el 19 de Abr. de 2022
@Bogdan Bodnarescu
This is not something that I have had to deal with.
I get the impression that you are using model reference to the CAN blocks in two different places in your model, and that CAN blocks have global variables. In such a case, in order to differentiate between the global variables for the different locations, Simulink would try to qualify the variable name with information about where in the model it was occurring -- for example it might take
/Project7/Control Loop/Subsystem1/CAN_Receive/Input::IO::CAN::ReadMsg::CleanupRTR
/Project7/Control Loop/Subsystem1/CAN_Receive/Input::IO::CAN::ReadMsg::MsgLength
/Project7/Control Loop2/Subsystem1/CAN_Receive/Input::IO::CAN::ReadMsg::CleanupRTR
/Project7/Control Loop2/Subsystem1/CAN_Receive/Input::IO::CAN::ReadMsg::MsgLength
and try to create variables
ControlLoop_Subsystem1_CAN_Receive_Input_IO_CAN_ReadMsg_CleanupRTR
ControlLoop_Subsystem1_CAN_Receive_Input_IO_CAN_ReadMsg_MsgLength
ControlLoop2_Subsystem1_CAN_Receive_Input_IO_CAN_ReadMsg_CleanupRTR
ControlLoop2_Subsystem1_CAN_Receive_Input_IO_CAN_ReadMsg_MsgLength
and then it would have a problem that these were not unique with the first 31 characters.
If that is what is happening, then you could proceed in a small number of different ways:
- Increase the identifier length. MISRA warning about this are warnings that there might come a day when you want to port the code to a device but be unable to because the compilers for the device only support 31 characters (the minimum for C or C++ compliance) -- that the compiler might not even notice that the names are different. This is a hypothetical long-term problem but depending on your needs and business plans it might turn out to be irrelevant completely, or might be something that could be postponed for years until it becomes and actual need; or
- copy the CAN blocks and change the variable names in the copy; or
- turn off model referencing, so that these model-referencing messages go away (might cause different problems); or
- rework your model so that CAN blocks are only used in one place. This could potentially be workable if what you are modeling is a system with a single central point that is processing all the CAN block messages -- but it might not be workable at all if you are modeling a system with multiple consumers of CAN block messages. For example do you have a single central location that is processing a number of messages and making decisions about spin rates for all four tires for 4WD? or do you have one processor for each tire each receiving much the same stream of messages but each making independent decisions about one tire for 4WD ? (Increase the number of drive wheels because it is a tractor or semi trailor, and ask yourself what happens if you have a single processor making decisions and that processor fails or is damaged... having multiple systems making semi-independent decisions might be important in some cases.)
2 comentarios
Bogdan Bodnarescu
el 19 de Abr. de 2022
Wow, this is an amazing answer and a perfect reading of my situation.
I am using referenced models for reading lots of CAN messages from different ECUs, and the vendor made a scripts that automatically generates these Libraries that read the data.
I can't rework to put them all in one block.
I checked the MAAB guide and it seems that 63 Identifier length is ok, so I will go with this solution for the moment.
I still have to check with my compiler manual.
The funny thing is that I can't see the variables in any of the generated code, this is really strange, any clue how I could find them?
Maybe if I find them then I can find a way to generate the names so that they are unique even with 31 Identifier length.
Walter Roberson
el 19 de Abr. de 2022
Class hierarchies such as Input::IO::CAN::ReadMsg::CleanupRTR appear to be having the :: scope resolution operator transformed into _ characters, so when you see _ in the error messages, the first thing to try is substituting :: for each _ . Not fool-proof if the name itself happens to have _ in it, but should provide a starting place to look.
Ver también
Categorías
Más información sobre Naming Conventions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!