Stateflow different timesteps for an embedded application
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Jeevan Thomas
il 7 Nov 2013
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.
Vedere anche
Categorie
Scopri di più su Simulink Functions in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!