"Invalid setting for output port dimensions" Compilation Error
Situation:
I am getting one of the following compilation errors during the subsystem separation process:
"??? Error using ==> opInitFunction>CheckSimulinkError
Invalid setting for output port dimensions of 'blablabla/Memory'. The dimensions are being set to 1. This is not valid because the total number of input and output elements are not the same."
OR
"??? Error using ==> opInitFunction>CheckSimulinkError at 229
Selected signal 'bla' in 'blablabla/Bus Selector' is not part of the bus entering the Bus Selector. A possible cause of this error is the existence of a feedback loop involving Bus Creators, Bus Selectors and bus capable blocks that Simulink is unable to resolve. Please refer the Simulink documentation on Bus signals for further information on how to resolve this error."
I do not understand why I can run my Simulink model offline without any problem, I can build (Ctrl+B) my model in Matlab without any problem but when I try to compile it in RT-LAB it crashes.
Answer/Solution:
The problem comes from an RT-LAB limitation: RT-LAB does not support exchange of semi-virtual signals between top-level subsystems. See attached file to understand what is not supported. FYI, a bus in Simulink is a virtual block while a Memory block is a semi-virtual block. Under Simulink, go to Help/Blocks and search for "virtual" to know more about this type of signals.
The common usage of a bus and a memory block right at the exit of a subsystem is not allowed in RT-LAB. We have seen some cases where it works fine when the number of signals entering the bus is low but in any case it should not be used. To solve this problem, the user must make sure to exchange only conventional or virtual signals between top-level subsystems. To do so, the memory block must be removed just before the exit of the subsystem to be added at "the beginning" of each signals or any other workaround that will allow exchange of conventional signals or virtual signals without the memory block. In any case, it is a good idea to "break" the bus, either by using mux/demux blocks or by another way (up to the user).
This behavior can be seen with most semi-virtual blocks (such as Zero-Order Hold block). This behavior has been duplicated with RT-LAB 8.2.x & 8.3.x and Matlab 7.1 & R2008a. Potentially other versions are affected.




