question

Chris Ligetti avatar image
1 Like"
Chris Ligetti asked Matthew Gillespie commented

Process Flow to trigger Source Item Creation

I have a 3D model with multiple sources to create items of different types. They need to be dependent in that the creation of one item from one source should trigger the creation of some quantity of the other items from their respective sources (repeated recursively).

I have made some attempts to do this in the 3D model logic using flexscript (messages, open/closing outputs, etc.). While I've had limited success (still working through some issues with the recursion), I get the impression that Process Flow could help me in this situation.

I have attached a very basic model createparts.fsm to demonstrate what I want to do (5 sources for 5 different part types A, B, C, D, E). The other attachment rules.jpg lists some basic static rules I want to use to generate the items (e.g., when a PartA item is created, that triggers the creation of 2 PartBs, 3 PartCs, 4 PartDs, and 5 PartEs at the same time).

I have not used Process Flow in the past, so I could use a little help in getting starting (how to create the process flow as well as how to link that to the 3D model). Any ideas?

FlexSim 17.0.0
process flow to 3d
rules.jpg (13.3 KiB)
createparts.fsm (17.5 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.

1 Answer

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Matthew Gillespie commented

Here is a sample model showing my implementation of this logic in Process Flow in your model.

First, I have one Event Triggered Source activity for each queue listening to the queue's OnEntry event. Whenever an item enters a queue, the ETS listening to the queue makes a token and runs the Create Parts subflow.

The Create Parts subflow makes new tokens corresponding to the quantities it finds in the Rules table. These new tokens then each create an item in their corresponding queues. This then causes the listening ETS activity to again create a new token.


· 19
5 |100000

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

Chris Ligetti avatar image Chris Ligetti commented ·

@Sam Stubbs

Sam, please see attached model. After each Token Creation Source, I assign labels to the token specifying the number of each of the other token types I want to create. This assigned label is random (currently am using a bunch of duniform distributions). For example, when a Part A is created, that will trigger the creation duniform(1,3) Part B (numBParts). [Matt previously modeled this recursive creation using the Rules table, but because of the randomness, I changed to using the numPartX labels].

In my Create Tokens (A-E), Quantity field, I have custom logic written to use the numPartX labels to set the quantity of that part type to create. Then 3D model objects are created and sent to product-specific queues.

What I need to make sure of is that the labels set after the Token Creation Sources are transferred to the objects when they are sent to the queues. I hope this makes sense.

4865-4860-createparts-pf2-cblchange-notable.fsm

0 Likes 0 ·
Sam Stubbs avatar image Sam Stubbs ♦ Chris Ligetti commented ·

If I'm understanding you correctly, you are looking to add labels from the tokens onto the items that are created as they enter the queues? This can be done in the Create Object activity. As the object is created there is the option to add labels to the newly created object. Simply enter the label name and have it set to token.labelname. (For example, if you wanted to transfer the "row" label from your tokens to your items, in the Create Object simply add a label called row to the object, and set its value to be token.row.)

It should be noted that if you want token labels from your sources or Create Token activities, in your Sub Flow and Create Token activities you'll need to uncheck the box called "Label Access on Parent Token only." Am I understanding your question correctly?

(As a side note, it seems like this question is more of a new independent question regarding your model, rather than a direct followup to the above posts. If that is the case, it's probably a good practice to post these kinds of questions in their own new question post, with a link back to the original question if it's needed for clarification.)

0 Likes 0 ·
addlabeltoitems.png (11.4 KiB)
Chris Ligetti avatar image Chris Ligetti Sam Stubbs ♦ commented ·

Matthew suggested that already, but that will create the same labels on every object that is created. However, I need certain labels to be created on the objects, depending on token.type (see above, where I proposed some custom logic to do this). Unfortunately, this didn't work for me, and I was looking for a better suggestion.

0 Likes 0 ·
Show more comments
Chris Ligetti avatar image Chris Ligetti commented ·

@Matthew Gillespie

Matthew, what is the easiest way to copy the token labels to the objects created in the CreateParts subflow? Specifically if I had created unique labels for the tokens coming from each of the event-triggered sources (i.e., labels created at ETS A are different than labels created at ETS B.). Thanks!

-1 Like -1 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Chris Ligetti commented ·

You would just add an Assign Labels activity after the Create Object activity. In the Assign Labels To field you would put token.item so that it's assigning labels to the item in the model. Then just add the labels you want and set their value to token.nameOfTheLabel.

0 Likes 0 ·
Chris Ligetti avatar image Chris Ligetti Matthew Gillespie ♦♦ commented ·

This will create the same labels on every object that is created. However, I need certain labels to be created on the objects, depending on token.type. For instance, if I add a label in "Set Row" under B Arrival called "labelB", then only the B objects should get this label. I thought about just writing custom code similar to below, but I am pretty sure this isn't totally correct. Any suggestions?

int type = token.productType;
switch (type)
{
case 1:
{
item.labelA = token.labelA;
}
case 2:
{
item.labelB = token.labelB;
}
case 3:
{
item.labelC = token.labelC;
}
case 4:
{
item.labelD = token.labelD;
}
case 5:
{
item.labelE = token.labelE;
}
default:
{
// nothing to set
break;
}
}

0 Likes 0 ·
Show more comments
Show more comments