question

shanice.c avatar image
1 Like"
shanice.c asked Felix Möhlmann edited

Write to Global table

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


FlexSim 20.1.3
global tableflexsim 20.1.3position
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image Joerg Vogel commented ·
Do your items still exists on simulation end?
0 Likes 0 ·
shanice.c avatar image shanice.c Joerg Vogel commented ·

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

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel shanice.c commented ·
Fiona, yies, that was what I asked. The reference to each item is destroyed. I can't use it anymore.
0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann edited

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.

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


5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.