Why "Model arguments can not be used in non-tunable expressions"? in Referenced Simulink Models?
19 views (last 30 days)
Show older comments
I have a Simulink model which also includes SimMechanics-blocks. I would like to change it into a referenced model using "Model arguments" to pass parameters which need to be tuned. (My final goal is to get a protected model with tunable parameters.)
If I run the model (or try to convert it to create a protected model), I get a number of errors like
"Model arguments can not be used in non-tunable expressions. The expression 'mfzg' in parameter field 'Mass' of [.../Body] can not be tuned but it refers to variables (mfzg (model argument))"
The variable mfzg exists in the MATLAB base workspace and in the model workspace and is listed in the Model arguments.
Does anyone know why I get that error? Are there SimMechanics Blocks which do not allow to use tunable variables?
I use R2010b on Windows.
0 Comments
Answers (2)
Nirmal Gunaseelan
on 14 Feb 2012
Edited: John Kelly
on 2 Mar 2015
Model arguments in a referenced model are specifically designed to allow instances of referenced model to be tuned. It appears that your model uses some of these arguments in non-tunable situations and is the reason for that error. These non-tunable parameters have to be defined as global non-tunable parameters to be used in the referenced model. More info can be found at this page on parameterizing.
2 Comments
Nirmal Gunaseelan
on 14 Feb 2012
It seems to me that the model referencing issue is now solved, but some SimMechanics specific error is being thrown. I'll let someone more familiar with SimMechanics answer this. If Body/Mass are some entities that you do not create, you should also contact Tech Support at MathWorks.
C.J. Harris
on 14 Feb 2012
It would appear as if you are indexing the parameter 'mfgz' based on model parameters. Indexing of this form is not allowed if you want to generate code with tunable parameters, due to the unknown size of the indexed variable. You will need to generate a new variable (i.e. a subset of 'mfgz') if you want a tunable parameter.
See Also
Categories
Find more on Simscape Multibody 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!