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

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

sunny_z
Not applicable
313 Views
15 Replies
Message 1 of 16

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

sunny_z
Not applicable

[ FlexSim 19.0.0 ]

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 .21766-ao96j.png

21765-j5ep6.png

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

Thanks for your reply in advance!

0 Likes
Accepted solutions (1)
314 Views
15 Replies
Replies (15)
Message 2 of 16

SCHamoen
Advisor
Advisor

@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)

21770-arrayintable.png

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

21771-treeintable.png

0 Likes
Message 3 of 16

sunny_z
Not applicable

@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
Message 4 of 16

SCHamoen
Advisor
Advisor

@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
Message 5 of 16

sunny_z
Not applicable

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

21817-2stgm.png21818-mwyt1.png

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
Message 6 of 16

SCHamoen
Advisor
Advisor

@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

0 Likes
Message 7 of 16

sunny_z
Not applicable

@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
Message 8 of 16

SCHamoen
Advisor
Advisor
Accepted solution

@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];
Message 9 of 16

sunny_z
Not applicable

@steven.hamoen

Wow,I got it! That sounds reasonable.

Thank you very ,very much !

0 Likes
Message 10 of 16

sunny_z
Not applicable
@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
Message 11 of 16

joerg_vogel_HsH
Mentor
Mentor

@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
Message 12 of 16

sunny_z
Not applicable

@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
Message 13 of 16

SCHamoen
Advisor
Advisor

@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
Message 14 of 16

joerg_vogel_HsH
Mentor
Mentor

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

0 Likes
Message 15 of 16

sunny_z
Not applicable

@steven.hamoen

I attached the model and picture in the past ,but they did't appear now .I am sorry for this .You can see from the model I attach this time .The model did'nt run as what I ecpected that the item choose a random machine that the number in the array.

global-table-and-list.fsm
0 Likes
Message 16 of 16

SCHamoen
Advisor
Advisor

@Sunny

You made a mistake with filling the arrays. Please take a look at the picture I attached. All your arrays contained only 1 value. You can see that because after the word array it shows [1] everywhere except for the first cell, where I changed it.

If you had 2 values it was only 1 value with a comma (so "1,2") so if you check if the machine is 1 it will not work because the machine on the list is 1,2. So I've changed this and now your model runs.

21973-arraysize.png

I also attached the model.

arraymodel.fsm


0 Likes