Stateflow chart Sample time miss match

6 views (last 30 days)
saman mj
saman mj on 15 Jul 2023
Answered: Marcos on 8 Dec 2023
Hello,
I have encountered an issue with the Simulink file that I have attached below (Matlab 2023a). The error message states: "Error: Sample time 0 of 'Sim_Test/Chart/model' does not match the sample time [0, 1] of the Stateflow chart in which it is contained." I would greatly appreciate any assistance in resolving this problem. Thank you in advance for your help.

Answers (1)

Marcos
Marcos on 8 Dec 2023
Hello Saman,
I believe you're encountering this issue because there are some blocks (clock and derivative blocks) inside of the Simulink Based State "model" which are continuous time based. That's not allowed in charts containing events. As replacements, you could use the Digital Clock block and the Discrete Derivative block.
After replacing these blocks, you will probably run into model loop errors. At that point you can probably modify your design so that you have both charts combined into one chart having two top level states executed in Parallel ("Parallel" decomposition as opposed to "Exclusive"). You will probably need to convert your input/output events to local events to coordinate the communication between the two top level states. Moreover, you might have to change new_kappa scope to data store memory in order to access it inside of your Simulink based state.

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!