fcn blocks, model referencing and workspace variables

1 Ansicht (letzte 30 Tage)
Ubaldo Tiberi
Ubaldo Tiberi am 11 Mai 2012
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

Antworten (1)

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

Kategorien

Mehr zu Simulink finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by