question

Henry Paipa avatar image
0 Likes"
Henry Paipa asked Jeanette F commented

Define Pallet quantities according to Global Table

Hi Community, I need to create trucks that arrive with a certain amount of pallets (defined in a Global Table) and in addition, labels will be assigned for each arrival.

In order to define which dock to take the following rule must be met:

If the Pallets content in (A+B+C+D+E) > (F+G+H+I+J), it will have to take the docks of the left group, otherwise it will do the opposite, it will take the ones on the right. But if all the springs of the left group are occupied, you can take one from the right, if necessary, or the other way around.

In the Model you will find an exercise, where the previous rule applies but with random arrivals.

I appreciate in advance all the support and help. Thank you.


answer1-jl.fsm


FlexSim 23.2.1
warehousingarrivalswarehouse optimization modeltrucksdocks
answer1-jl.fsm (55.2 KiB)
· 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Henry Paipa, was Kavika F's answer helpful? If so, please click the "Accept" button at the bottom of their answer. 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 comment back to reopen your question.

0 Likes 0 ·

1 Answer

Kavika F avatar image
0 Likes"
Kavika F answered

Hey @Henry Paipa, I made a sample model that may do what you want.

pallet-quantities.fsm

The logic is contained in a simple Process Flow with a Global Table full of pallet quantities. You can upload your own data from an excel sheet or something similar.

1698100845600.png

1698100851448.png

My arrival source spawns a token every 60 seconds. You can change that to be however frequent your arrivals are. It assigns two labels: quantities (an array full of quantities from the corresponding row in the table) and EndOfTable (to let us know if we've run out of rows to read).

Then I do some custom code logic to assign destinations. This is just the first solution that came to mind, so there may be a more optimal way to do this. Essentially, it quantifies the sum of the first and last 5 elements in each truck so it can know where to send it.

/**Custom Code*/
Object current = param(1);
treenode activity = param(2);
Token token = param(3);
treenode processFlow = ownerobject(activity);

// Calculate Sums
Array quantities = token.Quantities;
int firstSum = 0;
for (int i = 1; i <= 5; i++) {
  firstSum += quantities[i];
}

int secondSum = 0;
for (int i = 6; i <= 10; i++) {
  secondSum += quantities[i];
}

// Determine Dock Destination
Array leftDocks = Group("LeftDocks").toFlatArray();
int leftDockMax = leftDocks.length;
int leftDockCount = 0;
for (int i = 1; i <= leftDockMax; i++) {
  leftDockCount += leftDocks[i].stats.content.value;
}

Array rightDocks = Group("RightDocks").toFlatArray();
int rightDockMax = rightDocks.length;
int rightDockCount = 0;
for (int i = 1; i <= rightDockMax; i++) {
  rightDockCount += rightDocks[i].stats.content.value;
}

string destination = "";
if (firstSum >= secondSum) {
  if (leftDockCount < leftDockMax) {
    destination = "left";
  } else {
    destination = "right";
  }
} else {
  if (rightDockCount < rightDockMax) {
    destination = "right";
  } else {
    destination = "left";
  }
}

token.Destination = destination;
return 0;

Then I run some more custom code to pick which dock on that side to send the truck to.

/**Custom Code*/
Object current = param(1);
treenode activity = param(2);
Token token = param(3);
treenode processFlow = ownerobject(activity);

string destination = token.Destination;
Group docks = Group("LeftDocks"); // default to LeftDocks
if (destination == "right") {
  docks = Group("RightDocks");
}

Object dock = current; // temp initialization
int foundDock = 0;
for (int i = 1; i <= docks.length; i++) {
  dock = docks.toFlatArray()[i];
  if (dock.subnodes.length == 0) {
    foundDock = 1;
    break;
  }
}

if (!foundDock) {
  dock = Model.find("WaitingDock");
}

token.Dock = dock;

This code makes sure that you can only have 1 truck per dock. If the whole side is full, then it will send the truck to a "WaitingDock" (no logic implemented for this sample to make it circulate back into a dock). After that, I create a truck at that dock. It will wait for a certain amount of time then leave.

Hope this helps.


1698100845600.png (29.5 KiB)
1698100851448.png (11.3 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.