question

Yue Y avatar image
0 Likes"
Yue Y asked Yue Y commented

How to create a flow item on the fly without triggering onEntry trigger

I would like create some flow items inside a basicFR on the fly (imagine a cheese cake factory which takes in milk, flour, egg and produces cheese cakes). I used the following code to create this flow item:

treenode template = model().find("Tools/FlowItemBin").subnodes[1].first; 
treenode newitem = insertcopy(template, basicfr); 
applicationcommand("trackdefaultsoncreate", newitem);

However, this code always triggers the onEntry trigger and closes the input ports. Since this flow item is produced inside the basicfr, I don't want the onEntry trigger to be fired and I don't want it to affect any input ports.

Firing onEntry trigger is not that bad. if the item is created, the port would be 0 in the onEntry trigger, I can simply check the port number.

The problem is that creation of a flow item will close all input ports. The workaround is reopen the input ports every time a flow item is created. I was wondering if there is a way to create the flow item on the fly without affecting input ports?

Any help would be appreciated!

FlexSim 19.1.1
flowitem
· 2
5 |100000

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

Joseph Gillespie avatar image Joseph Gillespie commented ·

@Yue Y

Why not just use a combiner for this? If you don't want it to look like a combiner, you can always change the 3D shape.

0 Likes 0 ·
Yue Y avatar image Yue Y Joseph Gillespie commented ·

We need to simulate what happens inside the basicfr in another program. So once the item enters the basicfr, it is destroyed. After the other program is ready to release the flow item (it is not necessary the same flow item as it was given to it), the flow item is recreated inside the basicfr and released.

0 Likes 0 ·

1 Answer

·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Yue Y commented

You must use a different command to copy your items into the model. The name tells you already what he does. He inserts a copied item. That implies the item goes through the input events. You can try instead “createcopy” or “createinstance”. But please read the command manual description, before you are going to use them.

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

Yue Y avatar image Yue Y commented ·

createcopy worked, thank you!

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.