Code Inspector warning, tunable objects

2 views (last 30 days)
I’ve tried reading the documentation online and I have to say it’s horrendous. I haven’t been able to get a straight answer online or from the people at my work. When I run Simulink Code Inspector on our model I get a few warnings, and one of them wants:
Modify all workspace variables referenced by the model to be not tunable
My question is how can you do this? Is there a way that you can disable the fields from being used once we set the initial values? We use Simulink.Parameter to set some constant values in the model. It looks like:
VARIABLE = Simulink.Parameter;
VARIABLE.Value = uint32(190);
VARIABLE.RTWInfo.StorageClass = 'Custom';
VARIABLE.RTWInfo.CustomStorageClass = 'Define';
Is there any way to makes something like this non-tunable?

Accepted Answer

Ryan G
Ryan G on 30 Aug 2012
The reason that warning appears is because you are using a custom storage class. Since it is a warning you don't actually need to fix it to run the code inspector, but it is letting you know that, depending on how it's defined, it may not work as intended.
Your options are
1) Go ahead and try code inspector regardless of the warning 2) Change the storage class
If you see anything that doesn't make sense later on in the process and it involves this parameter, you will be able to better figure out that this was the reason.
  1 Comment
Ryan G
Ryan G on 30 Aug 2012
I'm not really sure what determines it between the many different storage classes, however, if you look at this parameter in model explorer you will see all the options. I believe a custom storage class means that when you generate code the parameter will be provided in a header file outside of the normal model.h/model.c files. Therefore, it is unknown whether or not you will be tuning it. In contrast, Simulink will code a non-tunable parameter directly into the model.c/.h or _data.h file.
As I stated above, there is nothing necessarily wrong with doing this other than you may find code inspector does not work as intended. However, it may work just fine, it really depends on application.

Sign in to comment.

More Answers (0)

Categories

Find more on Simulink Code Inspector in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!