MATLAB: Background simulation inside simulation

model referencesimulationsimulink

I've got a problem and hopefully anyone can help me. There are 2 Simulink models. The first model ("Main Model") needs to execute another model("Submodel"), which can run in the background. The results of the submodel, need to be available for the main model (not necessarily in the next simulation step). The submodel should be realized inside the main model (one mdl file!).
The input for the submodel is a matrix which consists of time steps (e.g. [0;1;2;…10] and corresponding speed values. This matrix is created by the main model at a certain time….
At the moment I'm trying to implement the submodel as a model reference, which is running in SIL mode.
I get the following error message: "Block 'Subsystem/In1' uses continuous time, which is not supported with the current configuration. Consider selecting the support 'continuous time' option on the Configuration Parameters > Code Generation > Interface pane"
If I select the 'continous time' option I get another error message: "The referenced model "Subsystem" is configured to support continuous time. Continuous time is not supported by Model blocks in SIL or PIL mode. To avoid this error you can uncheck support for "continuous time" on the Code Generation > Interface pane of Configuration Parameters."
The subsystem consists only of an input, a gain block and an output block (for testing purposes)
Is it the right direction to realize this with a model reference block which is running in SIL mode???
Thanks a lot!

Best Answer

If you are trying to run PIL/SIL mode you cannot use continuous time blocks, such as an integrator or transfer function, because when code is generated for deployment in those applications it has to be discrete.
You can resolve the issue by replacing any continuous time blocks with discrete blocks such as discrete integrators and discrete transfer functions.