Execute subsystem in Simulink if condition is met for 5 seconds?

조회 수: 14 (최근 30일)
Andrew Poissant
Andrew Poissant 2019년 11월 26일
댓글: Fangjun Jiang 2024년 1월 29일
I have a subsystem that I want executed in Simulink when a variable, RC_flag, is equal to 0 for 5 seconds. I have RC_flag updating at each Simulink time step, and I have Elapsed Real Time block to output the elapsed real time since the start of the simulation (different than the Simulink time step). How do I combine these two variables to execute my subsystem when RC_flag = 0 for 5 seconds?

채택된 답변

Fangjun Jiang
Fangjun Jiang 2019년 11월 26일
Do an equal comparison (==) between RC_flag and zero, generate this int_flag. Feed int_flag to an Integrator. If the output of the Integrator is greater than 5, then execute the subsystem.
Enable the external reset of the Integrator block. Use the int_flag and specify "falling" edge to reset the Integrator. Any change of the int_flag during the 5 seconds will reset the Integrator block.
  댓글 수: 6
Sharanya
Sharanya 2024년 1월 28일
Hello
Could you please explain what you mean by generating int_flag?
Fangjun Jiang
Fangjun Jiang 2024년 1월 29일
int_flag=(RC_flag ==0)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Schedule Model Components에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by