question

Sunny avatar image
0 Likes"
Sunny asked Steven Hamoen commented

Is it possible to lookup Global Table that a cell has multiple value?

Hello,everyone! This passage is asking help for the global table .

At the model ,the items enters into different machine according to the Global Table- "Steps ".The numbers in table represent which machine items would enter.I have tried to use the itemlist to realize this with only one number at one cell.

I wonder is it possible to lookup Global Table that a cell has multiple value?

For example ,if we could look up the Global Table like the following Table in FlexSim to control the number of Machine and the process time .

Is it possible to lookup Global Table in FlexSim that a cell has multiple value?

Thanks for your reply in advance!

FlexSim 19.0.0
global tablelookup
ao96j.png (9.4 KiB)
j5ep6.png (8.6 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.

Steven Hamoen avatar image
1 Like"
Steven Hamoen answered Steven Hamoen commented

@Sunny

The problem is that your array is not always 2 but sometimes also 1. So you should first get the size of your array and use that size in the random function. So your code could look something like this:

int arraySize = Table("Step")[value.Type][value.process].as(Array).length;

int theMachine = duniform(1, arraySize);

int arraySize = Table("Step")[value.Type][value.process].as(Array)[theMachine];
· 8
5 |100000

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

Sunny avatar image Sunny commented ·

@steven.hamoen

Wow,I got it! That sounds reasonable.

Thank you very ,very much !

0 Likes 0 ·
Sunny avatar image Sunny commented ·
@steven.hamoen

Hello,I am sorry to bother you again .I tried to use the code as what you said .

However,it seems that it did not choose a random number from the array...

Could you please tell me how the processors match the"Machine " in Itemlist ?

Thank you in advance.

Best wishes.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Sunny commented ·

@Sunny, now I am confused. If I look at tables “Number of Machine” and “Process Time”, I see two values in each cell where in one table there are two values. Are those values directly linked? If you randomly choose the second value of “Number of Machine”, the logic must choose directly the second value of “Process Time”, too? Is this your intention? The current answer choose in both tables a random value without a relation.

Your last comment is related to lists, pull from list and query clauses and/or acquire a resource. I think your initial question has been answered! If you need help on SQL clauses, please ask a new question! Thanks.

0 Likes 0 ·
Sunny avatar image Sunny Joerg Vogel commented ·

@Jörg VogelI am sorry to make you confused.In fact,the two value are directly linked.If different machine was chosen , the time should also change following the machine .The process time should also lookup the table as same logic as the machine table.

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen Sunny commented ·

@Sunny

I thought that you made a post yesterday showing your table with the arrays? Because of that I could see that there where sometimes 1 value and sometime 2 values. But I don't see that post or that picture anymore. Then you say that a random number isn't chosen. How do you know? Could you post the code that you have written. Or are you just looking at the outcome? Because then you might have repeat randomstreams on so that you get the same outcome everytime.

So please provide more information (and don't take info away ;-) )

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Steven Hamoen commented ·

@steven.hamoen, I deleted my comment and some other info got lost. Jörg

0 Likes 0 ·
Show more comments
Steven Hamoen avatar image
0 Likes"
Steven Hamoen answered Sunny commented

@Sunny

I think you should solve it like this:

return Table("Step")[value.Type][value.process].as(Array)[1]

Of course the last 1 could also be 2 if you want to get the 2nd value out of the array

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

Sunny avatar image Sunny commented ·

@Steven.hamoen

Thank you again.I wonder whether 1 and 2 can be used at the same time? Like this

.as (Array)[1]or[2] 

it means that choose the first value or the second value at random .Because some item would chose the machine with first value while others chose the second.How to describe this in code expression ?

I am looking forward to your reply.

Best wishes!

0 Likes 0 ·
Steven Hamoen avatar image
0 Likes"
Steven Hamoen answered Sunny edited

@Sunny Looks like you are looking for a multidimension table. I think there are at least 2 solutions:

1. Use an array to put in a global table: (this could actually also be done with a list)

2. Use the treestructure of a table to actually generate a real 3 dimensional table:


arrayintable.png (5.9 KiB)
treeintable.png (8.1 KiB)
· 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.

Sunny avatar image Sunny commented ·

@steven.hamoen

Thanks a lot for your reply.Your first solution is easier for me . But...could you please tell me how to visit the arrayin table? . For example,I want to look up the values of rows and column .

Thank you again!

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen Sunny commented ·

@Sunny

filling the array can be done as follows:

Array myArray = [3, 1.35];
Table("Test")[1][1] = myArray;

Getting the value out can also be done in different ways:

Array myArray = Table("Test")[1][1];
return myArray[2];

Or in one go:

int noOfMachines = Table("Test")[1][1].as(Array)[1];

0 Likes 0 ·
Sunny avatar image Sunny Steven Hamoen commented ·

@steven.hamoen

Thank you for your reply.

I assign the data to global table as you said before.I finished filling the array that included series of number in the the “Global Table ”.

The “Global Table ”I used before only include one number every cell.Now I am trying to use the Global table like the pictures.Then I need to get the number to match the machine.If the number is more then one, it means that item would have serial chooses. I used the Item list to pull flow items to different machine .

Finally,I need it to lookup every rows and columns.I am confused about looking up the “Global Table ” included array.

What you get out is only one cell?It represents the value of first row and the first column .

Could you please tell me more clear to how to look up every rows and column in the “Global Table ” when using item list?

Thanks for your kind heart!

0 Likes 0 ·
2stgm.png (10.4 KiB)
mwyt1.png (10.0 KiB)