フィルターのクリア

Timer to send a new message?

1 回表示 (過去 30 日間)
israa
israa 2014 年 9 月 5 日
コメント済み: israa 2014 年 9 月 6 日
Hi all
I have a system with receiver and a triggered sender. When the receiver receives a new message it will trig the sender to send the next message.So if the message lost in their way to the receiver the system will hang forever.
I need a timer that wait the message for a specific period ( 1 sec ) , if no new message received the sender will triggered to send next message. of course this timer reset when receiver has a new message.
My receiver has a trigger out port that switches between 1 and -1
  2 件のコメント
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2014 年 9 月 5 日
編集済み: Salaheddin Hosseinzadeh 2014 年 9 月 5 日
Oh! You should have mentioned simulink in your question.
I've no idea about simulink, I just know you can write a code and create a block from it.
Do your self a favor, add more details to your question and I'll remove my answer so that someone else find your question in unaswered section.
Good Luck!
israa
israa 2014 年 9 月 5 日
ok sorry for not mention that i'm using simulink, thanks a lot

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

採用された回答

C.J. Harris
C.J. Harris 2014 年 9 月 5 日
I would probably use a resettable integrator for this task. Feed the integrator a constant value of '1', that way it will act as a timer. If the timer reaches a defined value (1 sec) send a message (then reset the integrator). If you receive a message, send a new one, and just reset the integrator to zero and it will begin counting up again.
Of course - there is always the option of using Stateflow for such a task.
  3 件のコメント
C.J. Harris
C.J. Harris 2014 年 9 月 5 日
You cannot compare a floating point number using the '==' operator, even if 1 is divisible by your time-step, it is still unlikely to trigger. Instead you should just check if the output from the integrator is equal or greater than '=>' 1.
israa
israa 2014 年 9 月 6 日
Thank you C.J. Harris, it's work now

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by