trigger block in simulink
古いコメントを表示
I need to have a trigger block, which should trigger only one block at a time.
For example
I have 2 blocks A , B connected to the trigger block T, this triggering block T should trigger one of these A, B blocks at different instances. i.e trigger A at instant 0, A at instant 1, B at instant 2, A at instant 2 and so on.
which triggering block should i use?
And should i use any code to have this timed triggering
waiting fr ur valuable response
Thank you
3 件のコメント
TAB
2012 年 9 月 5 日
Can you clarify the exact trigger pattern you want?
A,A,B,A,B,A,B,A,B....... contiuously
OR
A,A,B,A,B ie only five triggers ?
Rahul kumar
2012 年 9 月 5 日
Rahul kumar
2012 年 9 月 5 日
編集済み: Rahul kumar
2012 年 9 月 5 日
採用された回答
その他の回答 (1 件)
Azzi Abdelmalek
2012 年 9 月 4 日
編集済み: Azzi Abdelmalek
2012 年 9 月 4 日
1 投票
try this

- set all sample time block to ts
- set initial value of unit delay block to 1
35 件のコメント
Rahul kumar
2012 年 9 月 4 日
Azzi Abdelmalek
2012 年 9 月 4 日
- the initial value of "unit delay" block is set to 0 by default. you can change it.
- then the first value of signal 1 is 0 while the first value of signal 2 is 1 not(0)
- at the next step signal1=1 while signal2=0 and so
Azzi Abdelmalek
2012 年 9 月 4 日
can you explain how are you triggering your blocks
Rahul kumar
2012 年 9 月 4 日
Azzi Abdelmalek
2012 年 9 月 4 日
are you working with specified sample time?
Rahul kumar
2012 年 9 月 4 日
Azzi Abdelmalek
2012 年 9 月 4 日
depends on what system are you working on? check the updated model
Azzi Abdelmalek
2012 年 9 月 4 日
I think you can do it with inherited sampe time
Rahul kumar
2012 年 9 月 4 日
編集済み: Rahul kumar
2012 年 9 月 4 日
Azzi Abdelmalek
2012 年 9 月 4 日
編集済み: Azzi Abdelmalek
2012 年 9 月 4 日
- the clock block is calculating time
- the switch block output is from constant 1(third input) when time(second input)>0 ;else its from the (unit delay-not) block (first iput)
that means at step 1 the signal1=1 and signal2=0; at step 2: sgnal1=1 ; signal2=0; at step3: signal1=0;signl2=1
do not forget to set initial value of unit delay block to 1 and the threshold of switch block to 0 and threshold condition of switch block to >threshold
Rahul kumar
2012 年 9 月 4 日
Azzi Abdelmalek
2012 年 9 月 4 日
you don't bother me. but I ask you to connect signals to a scope, and simulate and look what is going on
Rahul kumar
2012 年 9 月 4 日
Rahul kumar
2012 年 9 月 5 日
Rahul kumar
2012 年 9 月 5 日
編集済み: Rahul kumar
2012 年 9 月 5 日
Rahul kumar
2012 年 9 月 5 日
Azzi Abdelmalek
2012 年 9 月 5 日
- Exactly. I can't explain the differents shapes, from the modlel: signal2=not(signal1), maby someone else can explain this.
- Now use "to workspace" block, you will observe that signal1= 1 1 0 1 0 1 and |signal2= 0 0 1 0 1 0 1 0 thats what we were looking for.
- Then try to use these signals and tell us what is the rsult
Rahul kumar
2012 年 9 月 5 日
Azzi Abdelmalek
2012 年 9 月 5 日
you can view it on workspace, just set the parameters of "to workspace" blocks
- Variable Name = y1 for example for the first signal
- Save format to array
Rahul kumar
2012 年 9 月 5 日
編集済み: Rahul kumar
2012 年 9 月 5 日
Azzi Abdelmalek
2012 年 9 月 5 日
because you are not runing on real time
Azzi Abdelmalek
2012 年 9 月 5 日
編集済み: Azzi Abdelmalek
2012 年 9 月 5 日
if you have a "real time windows target" toolbox, you can simulate on real time
Rahul kumar
2012 年 9 月 5 日
Azzi Abdelmalek
2012 年 9 月 5 日
編集済み: Azzi Abdelmalek
2012 年 9 月 5 日
yes, if you are on 64 bit you can do it just on normal, the extarnal mode is allowed only on 32 bit (its more efficient)
Azzi Abdelmalek
2012 年 9 月 5 日
when I added 2 not blocks I 'm not getting triangular signal(above model)
Rahul kumar
2012 年 9 月 6 日
Azzi Abdelmalek
2012 年 9 月 6 日
you can't accept two answers
I think the first output (trigger block 1) was showing ramp because it's type was double. Now after connecting to logical block (2 NOT blocks) output is as expected as is it converted to boolean.
Alternative of adding 2 NOT block is change the datatype of Constant block to boolean.
Azzi Abdelmalek
2012 年 9 月 6 日
Exactly, that what I was going to post. I set data type of a constant block to boolean and now it works. Thanks TAB
Rahul kumar
2012 年 9 月 9 日
Azzi Abdelmalek
2012 年 9 月 9 日
why do'nt you post it in another question?
Rahul kumar
2012 年 9 月 9 日
Rahul kumar
2012 年 9 月 9 日
Rahul kumar
2012 年 9 月 10 日
カテゴリ
ヘルプ センター および File Exchange で Schedule Model Components についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
