How do I connect a StateFlow diagram with a subsystem made of Simscape blocks?

5 views (last 30 days)
I have been trying to connect a StateFlow diagram with a subsystem made of Simscape blocks in Simulink R2022b.
The StateFlow diagram emits a signal that triggers the subsystem that I am trying to connect.
I tried using the “Model Reference” block, the “Function-Call Subsystem” block, and the “Simulink Function” block, and the design fails in all these cases, getting the following error message:
'my_subsystem/Solver Configuration' has multiple sample times. Only constant (inf) or inherited (-1) sample times are allowed in function call subsystem 'my_subsystem'.
How can I successfully connect the StateFlow diagram with the subsystem?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 12 Jun 2023
The “Enabled Subsystem” block will allow you to componentize your Simscape model, so that the StateFlow chart provides the enabling signal to the “Enabled Subsystem” block. To achieve a successful model execution, the following steps are recommended:
  1. Select the Simscape blocks that you wish to componentize. Include the “Solver Configuration” block.
  2. Create an “Enabled Subsystem” by clicking in “Multiple” in the Simulink’s main toolstrip. Go to the “Create” tab and select “Enabled Subsystem”.Another way to create an enabled subsystem is by inserting a “Enabled Subsystem block”, located in Library>Simulink>Ports & Subsystems. Then, you can select the Simscape blocks of the previous step and drag into the “Enabled Subsystem” block that you just created.
Connect the output signal of the StateFlow chart that will control the “Enabled Subsystem” block. As per the documentation of the “Enabled Subsystem” block, a signal with value more than zero will activate the subsystem. Please refer to the following documention page for more information:

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!