Why "Model arguments can not be used in non-tunable expressions"? in Referenced Simulink Models?
32 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
Nirmal Gunaseelan
2012-2-14
编辑:John Kelly
2015-3-2
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 个评论
Nirmal Gunaseelan
2012-2-14
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
2012-2-14
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Model Preparation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!