Cannot mask model with referenced model inside

조회 수: 23 (최근 30일)
Enrico Lumetti
Enrico Lumetti 2022년 1월 30일
답변: Enrico Lumetti 2022년 2월 5일
Hi, I'm not sure if my problem is unexpected or if I am missing something fundamental about creating structured models with referenced models.
Step to reproduce:
- create a model, just an identity model that sends the input directly to one output port is good enough. This would be the child model, which could possibly have parameters and a mask itself
- create an outer model which uses the model block to reference the previously created model
Now, if I try to add some simulink parameters to the model and create a mask for the outer model, I get an error window with the following message (repeated for every parameter I have added):
- Error evaluating properties of Simulink.Parameter object 'x' in workspace 'outermodel' (used by block 'outermodel/Model Mask') Unable to use model argument 'x' as an interface when model 'outerblock' is being compiled as a top model.
The error disappear if I don't use a referenced model, which isn't intuitive for me..
Any idea on what am I getting wrong?
  댓글 수: 2
Benjamin Thompson
Benjamin Thompson 2022년 1월 31일
Can you post an example model showing the problem? Note that masking hides the base workspace or top model dictionary from any reference models within the masked subsystem. Otherwise if you have more than one instance of a reference model in a masked subsystem, how is Simulink going to know which instance gets which parameters? So the mask is supposed to be the only way that you pass parameters into a masked subsystem.
Enrico Lumetti
Enrico Lumetti 2022년 2월 5일
Sorry I didn't see your comment, I'll post an example soon.

댓글을 달려면 로그인하십시오.

답변 (1개)

Enrico Lumetti
Enrico Lumetti 2022년 2월 5일
Ok, this basically boils down to this:
if a model parameter in the top model (the one including the reference inner model) is left with [] value and [0 0] dimension, the error appears.
I tried to change the value of those parameters from that to e.g. 0 default value (simulink will adjust the dimension to [1 1]). This doesn't trigger the error anymore. Note that [] value is not a problem in the inner model, so this is definitely weird.

카테고리

Help CenterFile Exchange에서 Subsystems에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by