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!
