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!
