Applying different sample times in model containing simulink and simscape subsystems

10 views (last 30 days)
Hello, my model is composed of multiple subsystems, and one among them is a simcape circuit. I'm trying to apply different sample times for each subsystems. When the whole model is composed of just simulink models, I can just use the trigger block to do that. However, one of the subsystem in my model has simscape circuit, which requires solver configuration block.
I tried to add trigger block in the simcape subsystem, but the error pops up saying 'solver configuration block has multiple sample times. Only constant (inf) or inherited (-1) sample times are allowed in triggered subsystem'.
How can I handle this error? Is there any way to apply different sample times in model containing simulink and simscape subsystems?

Answers (1)

Yifeng Tang
Yifeng Tang on 8 Apr 2025
Moved: Sabin on 5 Aug 2025
Two ideas:
(1) depending on the nature of your Simscape circuit, you may be able to use the Simscape local solver, from the Solver configuration block. That allows the Simscape part to run at a different rate. You may need to set up the interface between Simulink and Simscape to avoid excessive solver resets.
(2) start R2024a, it's possible to use a local solver (not Simscape Local Solver) for a model reference. It can be a different solver from the whole model, and can use a different time step. See this: https://www.mathworks.com/help/simulink/ug/local-solver-basics.html. I saw you put the release info as R2022b, but just in case updating is an option.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!