question

Andrew J3 avatar image
0 Likes"
Andrew J3 asked Andrew J3 answered

Send to port by global table value

I am attempting to send flow items downstream based on a value within my global table. I created a global variable in order to increment my "row" as flow items leave the source and enter the queue, but my send to port using global look up is not working using that variable at the queue.

My intent is to have my flow items route to the location associated with the manufacturing bay (bays 1-14) based on the value in column 21 of my global table. As each item leaves the source, I want to increment the global variable so that the global look up will reference the next row/flow item. In other words each row in my global table represents a flow item.

I have attached my model for clarity.

Thanks in advance

FlexSim 18.0.0
global tablesend to portglobal variablesincrement
· 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.

Andrew J3 avatar image Andrew J3 commented ·
0 Likes 0 ·
Jeff Nordgren avatar image Jeff Nordgren commented ·
@Andrew J3

You said that you attached your model but nothing came attached with your post. Can you please resend the model?

Thanks.

0 Likes 0 ·
Andrew J3 avatar image Andrew J3 commented ·

I added it in under the comments. Are you able to see it now?

0 Likes 0 ·
Cliff King avatar image
0 Likes"
Cliff King answered Andrew J3 commented

Observations:

  1. You are assigning a label to the flow items in the OnExit trigger of SourceUnits called "LabelName" and then assigning it a value of "Table("GT_FromAreas")[1][1]". Based on your table, this will always assign the following string found in row 1, column 1 of the table: NSC9-U C220. I do not think this is what you want to do. If you are simply wanting to assign an incremental row number to each successive item leaving the source, then I would first of all give the label a more descriptive name like "RowNum", then I define the Value in the Set Label option to be current.stats.output.
  2. Assuming you make the suggested change in item 1 above, the Send To Port field on QueueUnits will use a numeric value on the "RowNum" label of the item to look up an output port number in column 19 of the GT_FromAreas table. Well column 19 is the "Bay" column and it contains text. It must contain a valid output port number to send the item to!
· 1
5 |100000

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

Andrew J3 avatar image Andrew J3 commented ·

outfittinghall032018.fsm

@Cliff King,

Thanks for your prompt response. After making the changes you suggested, I'm getting a FlexScript Exception: "Invalid Row identifier". Clicking on my flowitem, I see that the RowNumber label is incrementing and is the correct value. The row call out of item.RowNumber seems to be returning a 0 somehow on my QueueUnits send to port.

0 Likes 0 ·
vovn0.png (51.5 KiB)
pxxec.png (3.7 KiB)
Andrew J3 avatar image
0 Likes"
Andrew J3 answered

I agree with that after some further trouble shooting this morning I was able to figure it out. Screenshot below for the followers

Thanks very much Cliff

xxnnh.png (53.8 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.

Andrew J3 avatar image
0 Likes"
Andrew J3 answered Cliff King commented

Thanks Cliff. I actually noticed the .value missing first thing this morning. I was able to get it to work using this below code in the send to port as well


jneww.png (56.2 KiB)
· 1
5 |100000

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

Cliff King avatar image Cliff King commented ·

Oh good. Hey one more thing I just discovered is that when the first item leaves the source, the output of the source is actually 0 in the OnCreation (or even the OnExit trigger), so to avoid beginning with a 0 row number for the first item, you need to add 1 to the output.

0 Likes 0 ·
Cliff King avatar image
0 Likes"
Cliff King answered

Back in the OnCreation trigger of the source, you need to correct the expression for the Value. It should be:

current.stats.output.value

Without the ".value" tacked on the end, the expression was getting the pointer to the "stats_output" node, rather than the value of the node. It's a little strange that the Quick Properties window was actually showing the value rather than the pointer path, but if you look closely, the number is in purple text. This is something I've asked the FlexSim developers to look into.

5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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