Reset Clock Block - Matlab/Simulink

Hello,
i have the simulation time as an input singal coming from a Clock Block. On condition (for example: when another signal x is greater or equal to a constant a) i want the time signal, that comes from the Clock Block, to be set to 0 and restart counting up again while the simulation time keeps going.
I do not know how to do this and whether it is purposeful to use the Clock Block. I hope someone can help and thank in advance!
Cheers

回答 (1 件)

Gayan
Gayan 2017 年 10 月 27 日

2 投票

Im not sure it is possible directly.
But there is a workaround. Instead of using the output of the clock directly modify it.
Method 1; Use If block in held option and substract the value. I use a pulse generator as the reset trigger. See the image below.
>>
Method 2, you can use a memory block to subtract a constant from the clock out.
Then new_clock = Clock - value stored in mem block. When ever you want to reset the clock just set the mem block value to Clock.

カテゴリ

質問済み:

2017 年 5 月 18 日

回答済み:

2017 年 10 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by