MATLAB: Model reference speed problem (slow)

atomic subsystemmodel referenceoutput portprotected modelsimulinkslowtime step

Hello everybody,
I am trying to convert an atomic subsystem which contains other atomic subsystems with different time steps into a model reference, see the first image.
Principal.PNG
However, when I convert directly the main atomic subsystem, the simulation runs very slow.
ModelReference1.PNG
I have realized that if I remove all the output ports, the simulation runs as fast as without model reference.
ModelReference2.PNG
I do not know why it is happening. Could someone help me with this problem, please? This model in the future will be connected with other models, so the output ports are necessaries.
Thanks in advance!

Best Answer

My guess is that it is not equal comparison. In your first picture, all the outputs are terminated. Maybe Simulink did some optimization not to calculate those outputs. When it is converted to model reference, it is different. All those outputs need to be calculated even though outside the model reference, they are still terminated.
In your first picture, connect all the outputs of the automic subsystem to Outport blcoks and then see if there is a speed difference.
Related Question