필터 지우기
필터 지우기

Stateflow different timesteps for an embedded application

조회 수: 2 (최근 30일)
Duane
Duane 2013년 7월 29일
댓글: Duane 2013년 11월 19일
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

답변 (1개)

Jeevan Thomas
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.
  댓글 수: 1
Duane
Duane 2013년 11월 19일
I am having a hard time believing that, for embedded development, you cannot have multiple time periods. How then, do developers with battery operated systems wake up every second, perform what they need to perform (which is running a statechart dependent on mSec timing for delays) and then go to sleep for the remaining part of the one second? I currently use VisualSTATE from IAR. It has an API that adds events to the queue which could be a mSec event. I was really hoping to use Superstep and an API for a mSec event that occurred in an ISR. My intention is to use Stateflow only and not Simulink (functions etc).
Thanks...it seems I am missing something very basic and/or am used to a different structure.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by