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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Martin B6, was Parker S's answer helpful? If so, please click the red "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 unaccept and comment back to reopen your question.

0 Likes 0 ·

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:

Table Inventory = Table("Inventory");
Table SKUs = Table("SKUTable");

for (int rowNum = 1; rowNum <= 2027; rowNum++) {
    Inventory[rowNum]["SKU"] = SKUs [duniform(1,500,1)][1];
    Inventory[rowNum]["ArrivalTime"] = duniform(0,227,1);
}


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.

Martin B6 avatar image Martin B6 commented ·

Hi @Parker S

thank you very much for your answer. Yes exactly, at each start of the simulation a list (OrderHistory) should be generated, which consists of 925 different orders of 1-7 products each. The due date of the order should be stored with a statistical distribution. The idea is that at each simulation start always different Inventory and Order lists are created. Unfortunately I do not know if this is feasible. I tried to integrate the code from you into the model and there was a problem. I always get an error message that the path cannot be found. I do not know exactly what the problem is. Could you help me again and show me how I can integrate the code into the model?

Many thanks!

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Martin B6 commented ·

@Martin B6 Normally inventory and order due date are correlated through 'material requirements planning' and 'availability to promise'.

If we generate random SKU arrivals into inventory and random order due dates independantly we might see storage levels and late orders that are not at all representative of the real system with an early order waiting for a very late SKU arrival.

It also seemed in your model so far, that you were preassigning the individual SKUs to an order, but in the completely randomly generated case would you still enforce that, or would you allow, when it arrives, the same SKU number to be reassigned to another order that needs it with an earlier due date ?

I think what you're asking, while possible, raises a lot of questions.

0 Likes 0 ·