question

Sachin N avatar image
0 Likes"
Sachin N asked Steven Hamoen commented

Batch child tokens

I have a process where child/sibling tokens are created and then needs to be combined into the parent token for further processing. Each child must be combined with the original parent, I am not sure if this can be done through Group By option or through a label on the create token activity

FlexSim 19.1.1
parent tokenparent child hierarchytoken join split batch parent childchild token references
· 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.

Sachin N avatar image Sachin N commented ·

This is the logic I have so far

child-batch-logic.fsm

0 Likes 0 ·

1 Answer

·
Joseph Gillespie avatar image
0 Likes"
Joseph Gillespie answered Steven Hamoen commented
@Sachin N

Here's a simple Process Flow that I think does what you are looking for:

In this Process Flow, the "Create Tokens" produces a child token in "Do Stuff". Then, the parent token waits in the "Wait for Event" activity until the child token exits "Do Stuff" and they are both batched together in the Batch activity. The parent token is also given a label "Child" that has a reference to the child token so that it can wait for the token that matches token.Child to exit "Do Stuff":

Here's a working model with this Process Flow: childbatchlogicanswer.fsm


capture.png (22.6 KiB)
capture2.png (11.4 KiB)
· 7
5 |100000

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

Sachin N avatar image Sachin N commented ·

Thank you! This is what I was looking for!

1 Like 1 ·
Sachin N avatar image Sachin N commented ·

Is there a generic label for any child token created? I tried to use token.children.ToArray[] and token.children.length to batch specific child tokens to the parent when there are multiple sources sharing a resource and that didnt seem to work

0 Likes 0 ·
Joseph Gillespie avatar image Joseph Gillespie Sachin N commented ·

@Sachin N

To access any child token, use token.children[Index] where "Index" is the which token in the child array you want to access. In my example, since I labeled all of the children as "token.Child", I can do the same thing (token.Child[Index]).

0 Likes 0 ·
Sachin N avatar image Sachin N commented ·

Instead of using a specific label such as token.Child, what is the method to reference child tokens specific to a Create Tokens object? I have multiple Create Token objects generating child tokens all mixed in a process. I would like to batch specific child tokens from the parent Create Token object that generated them. I know it is possible to create a separate label on each Create Token object such as Child1, Child2 and so on, but then the batching will not be possible with one object. Is there a way to use the builtin token.children.ToArray logic to do this batching process?

0 Likes 0 ·
Joseph Gillespie avatar image Joseph Gillespie Sachin N commented ·

@Sachin N

The way to reference the child tokens of a specific token is by using token.children. This will give you an array of the child tokens of the specified token. If you want to access a specific child token, you just have to do token.children[Index]. For example if you wanted the second child token of a specific token, you can use token.children[2].

Correct me if I misunderstood, but it sounds like you want to batch a parent token with all of its children. I think what you are looking for is something like this:

I've modified the last model I gave you to give each parent token a label called "Group".

This label references the parent token. Then, in the "Create Tokens" activity, I gave each of the children of the parent token the same label:

That way, the parent token and the child tokens all reference the same token: the parent token.

Then I set the "Batch" activity to group the tokens by the "Group" label:

The result of all this is that the parent token and all of its children will get batched together at the "Batch" activity as long as the parent token + the number of children is the same as the batch quantity.

Here the working model: childbatchlogicanswer2.fsm

0 Likes 0 ·
capture.png (17.9 KiB)
capture2.png (8.8 KiB)
capture3.png (15.4 KiB)
capture4.png (9.1 KiB)
Sachin N avatar image Sachin N commented ·

I tried to use your logic to build multiple sources, but it still required as many Batch objects as the number of sources. I have a lot of sources generating Child tokens which needs to be batched after a shared process. This makes it unmanageable without accessing the token.children parameter used by flexsim rather than token.xxxx labels created for every source in the model. I would like to have just one Batch object that distinguishes parent/child no matter the source.

childbatchlogic3.fsm

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen Sachin N commented ·

Hi @Sachin N

You can simply change it back to 1 label called (for instance) Group. Then you need only 1 Label and it doesn't matter from which source it comes. I attached the model. if you let it run you will see it creates all different batches, 1 batch for each token that was originally generated from a source.childbatchlogic-talumis.fsm

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.