question

lorislang avatar image
0 Likes"
lorislang asked lorislang commented

Dynamic target quantity for combiner?

dynamic_compiler_problem.fsmHi there,

I’m relatively new to FlexSim and have encountered an issue with my combiners.

In my supply chain, pallets containing up to 25 items, with three different item types, are used. These pallets travel to three different stations via a transporter. At each station, the pallet enters a separator where it is divided. The pallet is sent directly into the combiner, while the three types of items are placed into a separate queue. This queue has a conditional port that sends a specific type of box to its corresponding sink, while the remaining items (types 2 and 3) are directed to another queue. The items from this second queue are then moved to the combiner.

Once the combiner processes the items, the finished product — consisting of the pallet and combined items — is placed in a queue, ready to be picked up by the transporter.

The issue I’m facing is with the target quantity for the combiner. Since the number of type 2 and type 3 boxes per pallet varies in multiple runs, the combiner’s target quantity needs to be adjusted accordingly. I can't simply set a fixed low target because I need to ensure that no boxes are left behind. I’ve solved this issue before using process flows, but due to my license restrictions, I’m unable to use them along with the transporter. Any suggestions for a code solution or triggers would be greatly appreciated! :))

Btw Im using version 22.0.5 but I cannot select that one.

FlexSim 22.0.16
target quantity
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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered lorislang commented

First, you need to know how many items will be placed on the pallet, so you can set the target quantity of the combiner accordingly. I would suggest to count the number of items where the Route label is not equal to "C" in the separator's On Entry trigger and write that number to a label on the pallet.

  1. int batchCount = 0;
  2. for(int i = 1; i <= item.subnodes.length; i++) {
  3.     if(item.subnodes[i].Route != "C") {
  4.         batchCount++;
  5.     }
  6. }
  7. item.BatchCount = batchCount;

The "Update Combiner Component List" option available in the combiner's On Entry trigger contains the necessary code to update the target quantity. The option is build to read values from a global table where the column is determined by a label on the pallet. You can greatly simplify the code as there is only one input port for items and the target quantity is given directly through the label on the pallet in your case.

  1. if(port == 1)
  2. {
  3.     Table thelist = getvarnode(current, "componentlist");
  4.     treenode thesum = getvarnode(current, "targetcomponentsum");
  5.     thelist[1][1] = item.BatchCount;
  6.     thesum.value = item.BatchCount;
  7. }
· 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.