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

13 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 26 de Nov. de 2019
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 comentarios
Sharanya
Sharanya el 28 de En. de 2024
Hello
Could you please explain what you mean by generating int_flag?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Schedule Model Components en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by