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

조회 수: 7 (최근 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