How to use the number of tokens with label X waiting to be pulled?

jouky_d
Not applicable
0 Views
6 Replies
Message 1 of 7

How to use the number of tokens with label X waiting to be pulled?

jouky_d
Not applicable

[ FlexSim 20.0.5 ]

Hello everyone!

I am trying to optimize Stock using simulation. Until now, I have bought the optimal stock everytime the command point is reached. But now, I would like to buy the needed units to reach the optimal Stock depending on the actual units. For example:

If I have an optimal stock of 300 units of D, and I have 30 units in the warehouse of label D, and the command point is when the warehouse' stock is less than 40 units of D, then I have to send to the warehouse 300 units of D (optimal stock) - 30 units of D (actual Stock) =270 units of D.

I am doing it using a List in Process Flow. My question is: How can I get the value of tokens that are pushed into the list (waiting to be pulled) and take it to calculate the units of D to send to the warehouse? I have remarked the units of D, because I do not want the total tokens that are waiting to be pulled, I want for each label (30 tokens of A, 20 tokens of B, etc. are waiting to be pulled) and use them to the calculus.

Thank you!

0 Likes
Accepted solutions (1)
1 View
6 Replies
Replies (6)
Message 2 of 7

jeff_nordgren
Not applicable

@jouky.d,

To receive a more accurate solution, please post your model or something similar that demonstrates your question. Proprietary models can be posted as a private question for FlexSim U.S. support only.

Thanks.,

0 Likes
Message 3 of 7

jouky_d
Not applicable

Sorry I disconnected the mail during holiday. This is my model:
SDI4FlexSimQ.fsm

Thank you!

0 Likes
Message 4 of 7

benjamin_w2
Not applicable

Hi @jouky.d,

I think all you need to do is check the "Leave Entries On List" box in your "Pull from List" activity. This will create a reference to the pulled tokens without actually pulling them off the list. Take a look at the attached example model:

32302-1599080495943.png

LeaveEntriesOnList.fsm

0 Likes
Message 5 of 7

jouky_d
Not applicable

@benjamin.w2,

I have taken a look at your model, but I don't see the labels with its length like:

Label X Number of tokens with label X

1 4

2 6

3 8

for example.

I only want to send to the List the substract of Value of optimal stock (different value for each label) - Number of Tokens (with Label == 1, for example)

Do you know how to do it? I've noticed that an important thing is to Leave Entries On List, however it's not enough to do what I need. If it's not possible, don't worry.

Thank you for your time!


0 Likes
Message 6 of 7

tanner_p
Not applicable
Accepted solution

@jouky.d,

I can offer some guidance as to how you can retrieve the entries on the list. However, I'm not sure how your stock re-filling works, so I'll leave that up to you. Here's how I would check to see the contents of the list, assuming that each item type has its own partition. You could alter the logic a little bit if they aren't sorted by partition. Let me know if you'd like to do that instead.

In my example model, I am pushing 10 items of three different types to a list. Then, the token in Process Flow is created at 10 seconds and grabs the items on the list in the Custom Code activity.

The "entries()" function allows you to get the entries on a list in Array form. You can then check the array's length to know how many items are currently on the list for each type. I've simply taken the length and assigned it to a token label for each item type, as seen in the example model. You don't even need to pull the entries to get this data. I hope I understood correctly and that this helps!

32536-entries-length-by-type.png

Here's the code used:

List itemList = List("ItemList1");
Array itemArray;
int lengthArray;
string labelName;

//Check each partition for Types 1-3
for (int i = 1; i <= 3; i++)    {
    itemArray = itemList.entries(i).toArray(); //Save entries from partition "i" to array
    lengthArray = itemArray.length; //Calculate length (number) of items in array of Type "i" items
    
    labelName = "Type"+i+"Length"; //Create label for Type "i"
    token.labels.assert(labelName, lengthArray); //Assert label to token
}

pull length list entries.fsm

Message 7 of 7

ben_wilson5K2EV
Autodesk
Autodesk

Hi @jouky.d, was tanner.p's or benjamin.w2's answer helpful? If so, please click the red "Accept" button on one of their answers. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes