question

XiomaraG avatar image
0 Likes"
XiomaraG asked Felix Möhlmann commented

Summing Product Quantities Across Multiple Orders

Hi!
I would like to ask for your help with the following process. In the attached simulation, I am generating a certain number of daily routes, and for each route, I need to prepare a number of products according to their category, which are shown in the table "CantPorRuta".

1722853759782.png


Each of these routes has 8 orders. As I have it planned, they are registered order by order according to the category, this is the case of Butter

1722853832146.png

And the orders are listed in the table "CantMantequillaPorPedido".


For the first route, for example, every 8 iterations (orders) I must complete 40 boxes of butter (as shown in the first image). However, as I have it set up now, I would have to go through each product 8 times and check if the sum is 0, 40, or 80 (which are the probable values).

I want to check in each iteration if the order is already completed, or if not:

1. If it is the last iteration, that is, the 8th order, truncate the current value to match the sum shown in "CantPorRuta", or generate a random number such that when added to the accumulated sum of the product, it matches the required amount.

2. If it is not the last order but has already completed the product sum, the remaining should be filled with zeros.

How can I do it? Is there a single pass for all the products, perhaps using global variables?

SIMULACION_autosave.fsm

FlexSim 22.2.0
iterationorder processing loops
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 Felix Möhlmann commented

I'd do this the other way around. Start with the total target quantity, then distribute that quantity across the orders.

Attached is an example model. The created token is assigned the quantities from GlobalTable1 as an array. In the "Quantity" field of the Run Sub Flow Activity I distribute the quantities into 8 sub arrays where the first seven are random (but constrained by what is available) and the last one gets whatever is left.

constraint-random-quantities.fsm


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

XiomaraG avatar image XiomaraG commented ·

Hello @Felix Möhlmann, thank you very much for your response. However, I would like to ask how I can iterate the 8 orders per route for the total number of daily routes? I have separate processes for creating the global table "CantPorRuta" and for assigning products to orders, but merging them causes issues with reading the table.

1723052248731.png

Additionally, I would like to ask how I can print the results by date, route number (45 to 55 daily routes from the first process in the picture), and order number within each route?

I would greatly appreciate your help

simulacion-autosave (1).fsm

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann XiomaraG commented ·
Maybe I misunderstood something. In your model the table "CantPorRuta" is cleared on every reset. Based on your original question I though this table was supposed to supply input data that denotes the target quantities per route.

If this is not the case, where do the quantities come from?

0 Likes 0 ·