MATLAB: How to correct the ‘Invalid root outport connection in the referenced model ‘referenced_model’ error in Simulink 7.2 (R2008a)

simulink

I have a model, which contains a referenced model. When I update the main model I receive the following error:
Invalid root outport connection in the referenced model 'referenced_model'. Two different blocks drive the root Outport block 1. To be a valid connection, the root Outport block must be driven by one source port.
Use the 'Invalid Root Inport and Outport block connection' option on the 'Model Referencing' group of the Diagnostics page of the Configuration Parameters dialog box to control reporting of this condition.
What can I do in order to avoid this error?

Best Answer

As your referenced model has the 'Invalid root Inport/Outport block connection' diagnostic set to error, Simulink will not automatically fix any problems regarding Inport/Outport connections. Your model violates one of the rules by muxing the outputs of two different blocks and feeding it directly to the outport. As stated in the documentation it is now allowed to have the following situation in your model: "A root Output port is connected directly or indirectly to more than one nonvirtual block port".
In order to resolve this problem, you can use one of the following approaches:
1) Set the diagnostic 'Invalid root Inport/Outport block connection' to 'none', which will cause Simulink to automatically handle this kind of situations by inserting additional blocks. The diagnostic can be found under: Simulation > Configuration Parameters... > Diagnostics > Model Referencing
2) Insert a gain block with value 1 between the Mux and Outport block. This will make sure only one block is directly fed into the Outport