Input as delays for temporal logic (Stateflow)
이전 댓글 표시
Hello,
I have a Stateflow chart with many temporal logic transitions. It uses fixed step solver with 0.2 step size. I use integer numbers 1, 2 to represent delays
after(1, sec)
When I use only integer numbers as delays, everything works fine. But after I decided to apply delay as an integer input of a chart
after(delay1, sec)
(Delay1 is integer input of chart) I receive the message:
The following expression contains non-integer code. The option 'Support
floating-point numbers' has not been set in Code Generation configuration
options. Hence, only integer code/data is allowed.
Transition #1 in Chart 'Logic' (#2): after(delay1, sec)[..]
So, if I check an option 'Support floating-point numbers' the compiled code size bloats because of floating point math. How could I set delays as int inputs and get rid from floating point math? Thank you.
답변 (1개)
Corey Lagunowich
2026년 7월 7일 11:49
0 개 추천
You can specify that the data type of input delay1 is an integer type, either in the Property Inspector or by using the Stateflow API.
Note that using a (possibly) varying threshold like this can lead to non-intuitive results. For example,
- At time t = 1, State "Off" is entered. It is guarded by an outgoing transition "after(delay1,sec)". At t = 1, the value of delay1 is 10.
- At time t = 9, the value of delay1 changes to 2. The after() operator is now evaluated as true, and State Off is exited after 8 seconds instead of 10. But, of course, it was also exited much later than had the threshold been 2 seconds to begin with.
카테고리
도움말 센터 및 File Exchange에서 Syntax for States and Transitions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!