question

Jouky D avatar image
0 Likes"
Jouky D asked Ben Wilson commented

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

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!

FlexSim 20.0.5
processflowlabelslisttokensflexsim 20.0.5
· 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.

Jeff Nordgren avatar image Jeff Nordgren commented ·

@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 0 ·
Jouky D avatar image Jouky D commented ·

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

Thank you!

0 Likes 0 ·
sdi4flexsimq.fsm (143.5 KiB)
Ben Wilson avatar image Ben Wilson ♦♦ commented ·

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 0 ·
tannerp avatar image
1 Like"
tannerp answered

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

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


5 |100000

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

Benjamin W2 avatar image
0 Likes"
Benjamin W2 answered Jeff Nordgren edited

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:

LeaveEntriesOnList.fsm


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

Jouky D avatar image Jouky D commented ·

@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 0 ·

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.