fcn blocks, model referencing and workspace variables

1 回表示 (過去 30 日間)
Ubaldo Tiberi
Ubaldo Tiberi 2012 年 5 月 11 日
Hello there,
I created a model (say TestModel) composed just by a Fcn simulink block. This fcn block has just one input and one output. The function is something like this
f(u)=c1*exp(u)
By defining a variable c1 with a certain numerical value in the TestModel workspace everything works fine. However, I wish to use TestModel in another model via model referencing. Hence, I defined the variable c1 in the workspace of TestModel and I assigned this variable as model reference parameter. However, when defining a Matlab variable in a local workspace, this variable must have a numerical value. When using model referencing, this variable is considered as a model parameter, and I expect that its default numerical value will be overwritten by the parameter passed from the ModelReference Parameters pane, right?
Unfortunately this is not the case: I set c1 with value 0 as a Matlab variable in the workspace of TestModel, and I also considered c1 as a parameter. Now, from the ModelReference Parameters pane, I pass the numerical value 8, expecting that the model TestModel is referenced c1=8. However, this is not the case. The value of c1 gets stuck to 0 independently to the numerical value that I pass through the ModelReference Parameters pane. How can I solve this problem in a very clean way?
Thanks, Ubaldo

回答 (1 件)

Kaustubha Govind
Kaustubha Govind 2012 年 5 月 11 日
I think you might need to declare c1 as a Simulink.Parameter object and define it in the base workspace. See Global Tunable Parameters.

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by