trigger block in simulink
Mostrar comentarios más antiguos
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 comentarios
TAB
el 5 de Sept. de 2012
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
el 5 de Sept. de 2012
Rahul kumar
el 5 de Sept. de 2012
Editada: Rahul kumar
el 5 de Sept. de 2012
Respuesta aceptada
Más respuestas (1)
Azzi Abdelmalek
el 4 de Sept. de 2012
Editada: Azzi Abdelmalek
el 4 de Sept. de 2012
1 voto
try this

- set all sample time block to ts
- set initial value of unit delay block to 1
35 comentarios
Rahul kumar
el 4 de Sept. de 2012
Azzi Abdelmalek
el 4 de Sept. de 2012
- 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
el 4 de Sept. de 2012
can you explain how are you triggering your blocks
Rahul kumar
el 4 de Sept. de 2012
Azzi Abdelmalek
el 4 de Sept. de 2012
are you working with specified sample time?
Rahul kumar
el 4 de Sept. de 2012
Azzi Abdelmalek
el 4 de Sept. de 2012
depends on what system are you working on? check the updated model
Azzi Abdelmalek
el 4 de Sept. de 2012
I think you can do it with inherited sampe time
Rahul kumar
el 4 de Sept. de 2012
Editada: Rahul kumar
el 4 de Sept. de 2012
Azzi Abdelmalek
el 4 de Sept. de 2012
Editada: Azzi Abdelmalek
el 4 de Sept. de 2012
- 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
el 4 de Sept. de 2012
Azzi Abdelmalek
el 4 de Sept. de 2012
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
el 4 de Sept. de 2012
Rahul kumar
el 5 de Sept. de 2012
Rahul kumar
el 5 de Sept. de 2012
Editada: Rahul kumar
el 5 de Sept. de 2012
Rahul kumar
el 5 de Sept. de 2012
Azzi Abdelmalek
el 5 de Sept. de 2012
- 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
el 5 de Sept. de 2012
Azzi Abdelmalek
el 5 de Sept. de 2012
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
el 5 de Sept. de 2012
Editada: Rahul kumar
el 5 de Sept. de 2012
Azzi Abdelmalek
el 5 de Sept. de 2012
because you are not runing on real time
Azzi Abdelmalek
el 5 de Sept. de 2012
Editada: Azzi Abdelmalek
el 5 de Sept. de 2012
if you have a "real time windows target" toolbox, you can simulate on real time
Rahul kumar
el 5 de Sept. de 2012
Azzi Abdelmalek
el 5 de Sept. de 2012
Editada: Azzi Abdelmalek
el 5 de Sept. de 2012
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
el 5 de Sept. de 2012
when I added 2 not blocks I 'm not getting triangular signal(above model)
Rahul kumar
el 6 de Sept. de 2012
Azzi Abdelmalek
el 6 de Sept. de 2012
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
el 6 de Sept. de 2012
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
el 9 de Sept. de 2012
Azzi Abdelmalek
el 9 de Sept. de 2012
why do'nt you post it in another question?
Rahul kumar
el 9 de Sept. de 2012
Rahul kumar
el 9 de Sept. de 2012
Rahul kumar
el 10 de Sept. de 2012
Categorías
Más información sobre Schedule Model Components en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
