2) Make sure to set the sampling mode of all affected inports to be 'Frame based' as described above and let the signal that comes out resolve to a Simulink.Signal object in the workspace that has the correct Dimensions and SamplingMode properties set. In this way, Real-Time Workshop will resolve all signals to Simulink.Signal objects in the workspace and regenerate the code when necessary. The benefits and drawbacks are similar for the above mentioned approach, however, with the additional benefit of easier maintainability of your code by bookkeeping in an initialization .m file.
3) Do not use model referencing at all, but a use subsystem instead. This approach will result in less speed during simulation and not allow for incremental code generation, however it will allow Real-Time Workshop to determine the size of all signals at compile time. So a single subsystem can be reused many times from a library without changing its contents. Besides, this will allow your final system to contain differently sized frame-based signals and still use a single subsystem.
In the attached .zip-file there are several examples of how the above techniques can be applied:
- model_to_implement.mdl - Shows the full model that is to be implemented
- model_with_subsys.mdl - Shows how this can be done with a simple subsystem
- model_with_ref_default.mdl and ref_model_default.mdl - Show how just copying the contents of the subsystem to a new model leads to the error that you are getting
- model_with_ref_inports_set.mdl and ref_model_inports_set.mdl - Show how the first mentioned method is applied
- model_with_ref_simulinksignal.mdl and ref_model_simulinksignal.mdl - Show how the second mentioned method is applied
Neeta Dsouza