Why does the connection order change in the top-level model, if I delete, add, or re-arrange input ports in a model reference?

1 view (last 30 days)
I start with the below model that includes 3 input ports connected to a child model reference. 
Now, I add a port called "new" inside the child model.
After refreshing the model in the top-view, the ports shift on the child model and are now mismatched (shown below).
              
I would expect the ports to update like a linked library or normal subsystem. For example when you swap ports 2 and 3 inside the linked library, in the model below, and go back to the top-level, the input ports are still connected to the corresponding port on the linked library. 
  
This behavior in the model reference is not very intuitive. This also happens with subsystem reference.
Is this expected behavior and is there any workaround to this?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Jun 2023
The behavior you described is expected behavior as of MATLAB R2023a, and a result of the different uses that subsystems and referenced subsystems commonly serve.
As a workaround, in Model configurations, please enable the 'Port and parameter mismatch' diagnostic to error, so that you are aware of any changes in parameter connections from a model reference. This will prevent accidental changes in referenced model IO to propagate to the parent model. For releases after MATLAB R2020a, the error includes a "Fix-it" button, with suggestions for correcting the mismatches. 

More Answers (0)

Categories

Find more on Large-Scale Modeling in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!