필터 지우기
필터 지우기

Column-by-Column (SIMULINK)

조회 수: 4 (최근 30일)
Domi
Domi 2020년 4월 6일
댓글: Domi 2020년 4월 10일
Hey guys,
I would like to do a "slow" iteration..
As far as I know Simulink first executes a block and passes its value over. Which means, If I have a loop it finishes the loop and gives out the last value. But I need to give specific elements from my array as a command and send it. Which means I need to execute element 1 followed by element 2 in a ordered manner.
I would like to have sth like this pseudocode
A = 2x6 (like a constant block [1 2 3 4 5 6; 0 0 0 0 0 0])
for i = 1:6 do / or while loop
output col 1 of A
wait like 5 seconds or if-condition (like if trigger == 1 -> only(!) next col and wait for next trigger to output next col)
output col 2 of A
wait like 5 seconds or if-condition
output col 3 of A
..etc..
end loop
I already tried an assignment block.. but it outputs the full matrix
..and I tried direct look-up table... but I do not know how to get a right counter/incrementer for it.. sth like a triggered or slow incrementation..
In MATLAB you can write a pause and some commands in each loop step but a pause in simulink pauses the whole simulation and that is not what I want at all..
any tips?
  댓글 수: 1
Domi
Domi 2020년 4월 6일
I need this because I have a 2xN array of pathpoints which I want to send via UDP Send/Receive from my raspberry to my robot, both running simulink. I know I can send a hugh Nx1 array and make it back to 2xN on the robot side.. but the next problem is, that I need to go through every column on robot.. which leads to the same problem as above :/

댓글을 달려면 로그인하십시오.

채택된 답변

Jonas
Jonas 2020년 4월 7일
편집: Jonas 2020년 4월 7일
You need the Selector block to capture the column you need, and then a Trigger Subsystem which executes on your command. You can also use a subsystem triggered by a function call. You can control the time delay between executions by using a Stateflow with the state transition 'after(5,sec)' for example, or implement an integrator block with gain 1, which will build up in real-time and you then trigger based on when it reaches a threshold.
You can also in Stateflow maintain a counter and increment with each sample time. Since you know your sample time, you can let the UDP Send trigger after the counter has reached a value.
  댓글 수: 1
Domi
Domi 2020년 4월 10일
Thank you sir! I managed to get it done with the direct lookup table and a resetable counter system based on switches and delays. Stateflow was a good input for me, because I looked up how it works. Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by