필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Stateflow event not making sense

조회 수: 2 (최근 30일)
Danylo Malyuta
Danylo Malyuta 2016년 6월 16일
마감: MATLAB Answer Bot 2021년 8월 20일
I have the following stateflow model (simulation time from 0 to 10 seconds, the step from 0 to 1 occurs at 5 seconds):
My expectation is to have output==1 up to 5 seconds and output==2 thereafter, since the default state (state1) sets the output to 1 and the transition to state2 occurs at 5 seconds, which is when the step occurs. However, I get instead the following output:
This does not make sense. What am I doing wrong? Thanks for helping!

답변 (1개)

Sebastian Castro
Sebastian Castro 2016년 6월 17일
If you drive a Chart block with an Event, it is executed as an event-driven chart. So, the chart doesn't wake up until t=5 which is when the first event happens. If a value is unassigned, it will take a default initial value of 0.
What you can do to start the system is go to "File > Model Properties > Chart Properties" and turn on the "Execute Chart at Initialization" option. This will make sure your chart initializes at state1 instead of waiting for the first event to occur.
- Sebastian

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by