question

Martin B6 avatar image
0 Likes"
Martin B6 asked Jeanette F commented

How to create global tables with custom code and statistical distributions?

Hi,

in my model I have integrated a fixed inventory list and a fixed order list which is the same in every run. But since I need to use this model for future predictions and replications, I need to change my lists every time I run a simulation. This means that uncertainties and fluctuations have to be integrated into the model. Is it possible with FlexSim to create global tables like Inventory List and Order list with statistical probabilities at the start of the simulation, which change after each run. The idea would be as follows: I have approx. 500 different products (SKUs) which are stored in a statistical distribution to a total of approx. 2000 products and a statistical ArrivalTime in the rack. These products should be statistically allocated to a total of 925 orders. An order can have 1-7 products. Thus, with FlexSim, a new Inventory List with approx. 2000 entries should be created at each simulation start. Can this problem be solved with Process Flow (CustomCode) for example? How can this list with statistical distributions be generated? Maybe someone can support me with this. Enclosed I attach the model. I have already created a global list called InventoryStat.

Test-MilkRun.fsm

Thank you very much!

FlexSim 20.2.3
processflowglobal tableflexsim 20.2.3customcode
processflow.png (11.0 KiB)
test-milkrun.fsm (1.9 MiB)
· 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.

1 Answer

Parker S avatar image
0 Likes"
Parker S answered Jason Lightfoot commented

@Martin B6

Here is code you can use to populate your Inventory global table:

  1. Table Inventory = Table("Inventory");
  2. Table SKUs = Table("SKUTable");
  3.  
  4. for (int rowNum = 1; rowNum <= 2027; rowNum++) {
  5.     Inventory[rowNum]["SKU"] = SKUs [duniform(1,500,1)][1];
  6.     Inventory[rowNum]["ArrivalTime"] = duniform(0,227,1);
  7. }


Where the "SKUTable" contains a list of your 500 SKUs.

I'm still working on the OrderHistory, I think it will be a bit more tricky. I'm assuming you want to have a fixed list of 925 OrderID that need 1-7 products to be allocated to them, is that correct?

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