MATLAB Answers

0

Code Inspector warning, tunable objects

Lucas 님이 질문을 제출함. 30 Aug 2012
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?

  댓글 수: 0

로그인 to comment.

답변 수: 1

Ryan G 님의 답변 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

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.

로그인 to comment.



Translated by