필터 지우기
필터 지우기

How can read data of entity in queue

조회 수: 3 (최근 30일)
ozcan
ozcan 2012년 12월 12일
답변: 777777 2017년 10월 31일
Hi, please somebody help me I need to attribute values of entity which are waiting on queue at the any t time. How can read this data of entity when entity wait in queue ?
  댓글 수: 1
Ryan G
Ryan G 2012년 12월 14일
What are you trying to accomplish? You can pull the attribute off the entity before it enters the queue for later use, or perhaps use a different block to accomplish your task.

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

채택된 답변

Ryan G
Ryan G 2012년 12월 17일
편집: Ryan G 2012년 12월 17일
You can try using Decdatt's suggestion along with persistent variables in the MATLAB function block.
I would create a feedback loop with an Attribute Function block (MATLAB function block for SimEvents) and an Output switch to push blocks from the queue. One output from the Output switch would connect to a path combiner to create the loop. You can have a timer attribute attached to the entity to determine when to push that entity from the queue or you can update the position of the entities when one leaves the queue.
Furthermore, you can use assignin to push data from the Attribute Function workspace to the base workspace. Using all these tools you should be able to recreate any of the queues available in the library, however, they will probably not be as efficient and it will cost you in simulation speed.
  댓글 수: 1
ozcan
ozcan 2012년 12월 19일
thanks Ryan this solution is very helpful,

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

추가 답변 (2개)

Devdatt Lad
Devdatt Lad 2012년 12월 14일
Currently you cannot peek inside a queue to look at entity attributes. As RyanG said, you can only pull out attribute values as entities enter or leave the queue.
With that in mind, you can put together some blocks that will cause all entities in the queue to leave the queue, and be fed back to the same queue in a feedback loop. Use a signal to open a gate or something that triggers this whole feedback loop. As each entity goes round the loop, pull off any attribute values you care about and send the entity back into the same queue.
This scheme will work if you want to iterate over ALL entities in the queue. If you just want the attribute value of the last entity that entered, or last entity to leave the queue, Ryan's suggestion would be better. Use a Signal Latch to save the attribute value before the entity enters the queue.
  댓글 수: 1
ozcan
ozcan 2012년 12월 17일
yes your approach is very logical but I want to send to matlab this informations. Do you know any matlab function-code that read this data. Already my model has embeded matlab functions block and I can use this code in this block.

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


777777
777777 2017년 10월 31일
Hi,I have a similar problem with you .Can you show me how to resolve this problem ? I want to use the data I stored in Queue ,but I don't know how to do it .

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by