question

Ander N2 avatar image
0 Likes"
Ander N2 asked Joerg Vogel answered

Choosing ports with a GlobalTable

How can I take the destination ports of an ítem using a Global table? Is just to decide if the ítem goes to the first or to the second processor.


Example.fsm

FlexSim 20.1.0
global tableflexsim 20.1.0
1591769524719.png (13.3 KiB)
example.fsm (26.5 KiB)
· 5
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 ·

@Ander N2, can you attach an example or a part of your table?

0 Likes 0 ·
Ander N2 avatar image Ander N2 Joerg Vogel commented ·

Here you have an example with a table example too

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Ander N2 commented ·

It gets easier, if you add or replace the port column with number values instead of strings.

0 Likes 0 ·
Show more comments
tannerp avatar image
0 Likes"
tannerp answered

@Ander N2,

I set up the example model you attached to use port numbers as integers rather than strings, as per Jörg's suggestion. The row number of the table is determined by the "Type" label on the objects.

example (3)_2.fsm


port-from-table.png (10.3 KiB)
example-3-2.fsm (144.9 KiB)
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
1 Like"
Joerg Vogel answered

"myTab" Table to define an ID label at items and the output port for a queue.

partID Port
100 2
200 3
300 1
400 1
500 3
600 2
700 2

Add label "anID" On Creation in source at item with value:

Table("myTab")[duniform(1,Table("myTab").numRows)][1]

Here I choose randomly one of the value of column "partID"


Queue Tab Flow Function Send to Port:

Table.query("SELECT Port FROM myTab WHERE $1.anID = partID",item)[1][1]

Here I do a table query to get the port number by a match of anID label on item with partID in global table "myTab".

Port_by_table_with_match_of_label_value_20_jv.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.