Cannot mask model with referenced model inside

23 views (last 30 days)
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 Comments
Benjamin Thompson
Benjamin Thompson on 31 Jan 2022
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 on 5 Feb 2022
Sorry I didn't see your comment, I'll post an example soon.

Sign in to comment.

Answers (1)

Enrico Lumetti
Enrico Lumetti on 5 Feb 2022
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.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!