Stateflow different timesteps for an embedded application
1 次查看(过去 30 天)
显示 更早的评论
I am new to Stateflow and need more information on timesteps.
My system wakes up every second to run the state chart ( rt_OneStep() ) yet some state chart transitions rely on waiting a number of milliseconds before taking a transition. This all occurs before going back to sleep. The exectution time of the state machine, most of the time, would be less than a millisecond....not that this matters.
So basically, rt_OneStep() is called every second yet I have transitions that use after(10, milliseconds)...how do I implement the millisecond part since my timestep is 1 second?
Thanks
0 个评论
回答(1 个)
Jeevan Thomas
2013-11-7
It appears that you already have a model from which you generated code and trying to run it on a platform by attaching rt_OneStep() to give the base tick (similar to sample time configured in Simulink configuration parameters. All functions that map to your implementation in Simulink model is called from rt_OneStep() [including the one from Stateflow]. So it is not possible to call your rt_OneStep() every second and do switching of transitions in Statechart (since this is part of the same model) unless you make the statechart as an standalone function and call it individually from your ISR scheduler. But in this case, be ready to compromise on functionality between MiL and PiL.
Else the only option is to bring down the sampling time to milliseconds as in your requirement.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!