Generate a timer from 0 to the required period and when it reaches the period the timer must reset and start again

4 次查看(过去 30 天)
I want to generate a timer which runs from 0 to the required time given and when the time is reached, the timer must reset and must start again from 0 to the time period this must happen until the stop time of the simulink is reached.
I tried with resettable system, mod and ramp block but nothing gives the required output

回答(1 个)

Umang Pandey
Umang Pandey 2023-11-28
编辑:Umang Pandey 2023-11-28
Hi,
I understand that you're trying to implement a periodic timer in Simulink, which resets after reaching a specified time and starts over until the simulation stop time is reached.
A combination of the following Simulink blocks can be used to achieve this:
  • "Clock" block to monitor the current simulation time,
  • "Constant" block to set the desired timer duration, and
  • "Mod" block to implement the periodic reset.
Here is an example:
The output from the "Mod" block yields the current simulation time modulo the specified timer duration, which is essentially performing the reset operation.
Here’s the output of the “Scope” block:
The model has been attached for reference. Hope this helps.
Best,
Umang

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by