How can i run two different clock at different (desired) times in simulink?

2 ビュー (過去 30 日間)
Siavash
Siavash 2014 年 7 月 5 日
コメント済み: Siavash 2014 年 7 月 7 日
Hi guys.
I have a model. I want to run two different clock separately and with different starting points. For example: My model starts at t=0. one of the clocks should start immediately and produce a signal. When the signal reaches a defined value, I want my second clock to start.
I used enabled and triggered subsystems but it didn't work. I also prefer not to use ramp with initial value.
It would be more pleasant if I can start the second clock by other means.
Thank you for your time.

採用された回答

C.J. Harris
C.J. Harris 2014 年 7 月 7 日
You can create a 'clock' using a discrete integrator. For example if you can set the time-step of the integrator equal to model sample time, and feed it a constant input of 1 it will act like a clock.
The initial condition of the integrator can be used to control the starting value of the 'clock', and the reset condition can be used to control when the timer starts (or resets). Therefore you can feed the output from your first 'clock' into a compare block in order to generate the necessary reset signal (to start your second 'clock').
  1 件のコメント
Siavash
Siavash 2014 年 7 月 7 日
Dear Friend
Thank you for your answer. It worked great. Now I can control the condition with level option and external signal. I've attached my model for you. Hope you can find it correct.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSwitches and Breakers についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by