From: Steve Amphlett on
My problem is this. I have a C-MEX S-function that updates at a very high rate. It has no states for Simulink to solve, having a complete solver inside it. When used in a big model, with many systems that do not need this high rate, the high rate is forced on them, which slows the simulation. Ideally I'd like to partition my S-function into some kind of subsystem along with some processing blocks, so that it can run at its required high rate internally and pass harvested data to the rest of the model, which wold run at a much lower rate.

I dabble in Simulink from time to time, although I'm no expert. I expect the solution lies with non-virtual subsystems, possibly just a simple atomic subsystem. But there doesn't seem to be a way to make a subsystem update internally faster than the global timestep, by sub-stepping or similar. One alternative is to have all the rest of the model in an atomic subsystem, with a fixed (big) step and have my S-function and its post-processing blocks dictate the global timestep. I could give the S-function big steps, have it sub-step and do the harvesting internally, but that's not very general and leads to much recompiling for different models, not to mention source code traceability.

Other alternatives? I can't imagine this is a new problem.

- Steve