Write to Global table

Write to Global table

shanice_c
Not applicable
1,055 Views
4 Replies
Message 1 of 5

Write to Global table

shanice_c
Not applicable

[ FlexSim 20.1.3 ]

I'd like to use global table recording every items enter and exit a Processor or Queue. There are 3 GlobalTables in my model.

First, I use Entry ID List to keep all items.

Then using QueueRecord to keep which item(ID) enters and exits which queue(QLocation).

EQRecord is similar to QueueRecord, it record which item(ID) enters and exits which Equipment(EQLocation).

Now I have no idea why only exitEQtime has been recorded. Other GlobalTables can not reach those Label I assigned in Triggers. And I can't find the script to get where item at. I only found Position and Location, but Position is presented in XYZ axis. Now in my model I use item.location to get information where item is, but not sure if this works. Because in my other works, there are many Processors and Queues in model, so I'd like to gain information from GlobalTable that the specific location each item is at (ex: item ID=1 enters Processor1 at time=10sec).

(I update again!)

Write to Table Example.fsm


Accepted solutions (1)
1,056 Views
4 Replies
Replies (4)
Message 2 of 5

joerg_vogel_HsH
Mentor
Mentor
Do your items still exists on simulation end?
0 Likes
Message 3 of 5

shanice_c
Not applicable

I saw there are Input in my Sink. Sorry, Are are asking this?

0 Likes
Message 4 of 5

FelixMoehlmann
Collaborator
Collaborator
Accepted solution

When I open your model I get a lot error messages as the order of code in some triggers seems to be scrambled. (Wrong number of {} brackets)

Anyway, my suggestion would be to do it as follows:

1. Set all tables to delete all rows on model reset. We will add these dynamically when needed, so you don't have to know how many rows you will need in advance.

2. In the creation trigger of the queue, only set the "ID" label of the item.

3. In the exit trigger of the queue, use "Data" -> "Add Row and Data to GlobalTable" to add a new row to the "Entry ID List" table and set the value of the first colums to the item ID.

4. Similarly, in the entry trigger of the other objects, add a new row to the respective table and fill in the information you can (ID, Entrytime, location). For the location you can use "current", a reference to the object the trigger belongs to. (This returns a pointer to the object, if you only want the name you can use "current.name" instead).
Also, a label "TableRow" on the item gets set to the last row in the table (the one that just go added), which will be needing later.

40631-addrowanddata.png

5. In the exit trigger of queue and processor the exit time gets filled in with the "Write to GlobalTable" option, using the "TableRow" label on the item to identify the correct row.

fillinexittime.png

write-to-table-example_FM.fsm

Message 5 of 5

joerg_vogel_HsH
Mentor
Mentor
Fiona, yies, that was what I asked. The reference to each item is destroyed. I can't use it anymore.
0 Likes