question

Pieter Cecat avatar image
0 Likes"
Pieter Cecat asked Pieter Cecat commented

Distribute (probability) items from 1 queue over several other queues

Hi fellow FlexSim-users

As usual, what seemed easy at first turned out to be rather difficult after all. Being new to FlexSim, I already learned a lot but apparently not enough to tackle the following issue:

I am trying to distribute items that arrive at the bottom queue - "graded cores inventory" - over five other queues, each of which represents a different product quality level. This should be done according to a given proportional distribution corresponding to one of five possible scenarios (see model below). In other words, I want to account for five possible scenarios that might occur, each of them having its own probability (summing to 1 of course) as well as its own unique proportion for each of the five product quality levels (e.g. see table below). This activity (of distributing the items across the five different quality levels depending on the scenario that occurred) should be repeated at the start of every month (equaling 720 hours as time unit of the model is [hours]).

Remark: In order to anticipate future problems, I would like the items in each queue - once they are distributed among all five queues - to have a different itemType (number corresponding to the quality grade of the item, thus ranging from 1 to 5) as well as box color.

I recently got introduced to Process Flow by one of this forum's users. However - even though I consider Process Flow to be a very interesting feature provided by FlexSim - I suppose there must be other ways of tackling this problem.

Any recommendations on how to proceed? All help would be appreciated.

Kindest regards

Pieter

E.g.

FlexSim 16.0.6
queuedistributionsscenarioprobability
fidug.jpeg (84.4 KiB)
x8vmv.jpeg (67.3 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.

Joerg Vogel avatar image Joerg Vogel commented ·

To all readers: mentioned question.

0 Likes 0 ·

1 Answer

·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Pieter Cecat commented

When does the scenario change? How many items are created or processed in a scenario? What you are looking for is the distributional function

dempirical(..) 

you can use it to set the itemtypes and colors for the quality depending on a scenario label in the OnCreation trigger that you change after a given simulation time or after a given amount of produced items. This changing is then depending again by the "dempirical(..)" function, that chooses or sets the value of a label. One Parameter is the name as a string to a global table which contains the probability in percent and its discrete return value.

In answers.flexsim.com, here, you type the command word "dempirical" into the search field and choose this word from the list to get the command description in the command manual. Please read the manual entry and its further comments thoroughly. The other aspect in your way to build a solution is the concept of Labels in Flexsim.

The design of ProcessFlow is the near future concept to create and control Flexsim. It is recommended to use it and to learn it. The "3D model" building is the previous or older method to build models. It depends on source code scripts, triggers and a strict event driven sequential process structure. You must have an event to change the model. And if the item flow doesn't create for you such a event you have to create a event by a delayed message or a user event.

I try to build a model later at work and attach it to a comment.

· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Pieter Cecat avatar image Pieter Cecat commented ·

Hi Jörg

Thank you for your time and help. I appreciate it!

My simulation describes a production planning model for 6 months. At the start of every month (=every 720 hours, as hours is the time unit of my model) one of the five different scenarios will occur - some of them are more likely than others - and distribute the items from the bottom queue over the five other queues according to the proportions for that scenario as specified in the table.

The number of items that arrive every month in the bottom queue (and need to be distributed) will be given and will be the same for every scenario:

E.g. Month 1: 25 / Month 2: 28 / Month 3 : 30 / Month 4: 24 / Month 5: 26 / Month 6 : 27

My ultimate goal is to - at a later stage - use the Experimenter that is built in FlexSim to change the number of items that need to be distributed over the five queues. The proportions however would remain the same for all five scenarios.

In short, I want to model/simulate the randomness associated with these five scenarios that can occur (let's refer to them as a worst case, worse, average, better and best case scenario) and see how it will impact the size of my inventory for every product quality level.

Best regards

Pieter

0 Likes 0 ·
Pieter Cecat avatar image Pieter Cecat Joerg Vogel commented ·

Hi @Jörg Vogel

I had a look at the model you created and it basically does what I want it to do, except that it averages the scenarios I think, instead of picking one every month (see first remark below). I also think I only need the top model you created (scenario_per_time) as I will use the experimenter to change the number of arrivals at the queue.

Some minor questions/remarks w.r.t. the scenario_per_time source:

1/ Items are instantly distributed over the queues when I specify the arrival schedule of the source at the start of each month. However, if I set the number of items arriving at time 0 equal to e.g. 100, I get the following distribution over the three queues:

Queue1: 31 (31%) / Queue2: 22 (22%) / Queue3: 47 (47%)

This distribution however does not correspond to any of the defined scenarios in the table. Is it possible that it averages over the 3 scenarios?

2/ Triggers -> OnReset: Why is your int NoDelay set to -1 and not 0?

3/ Triggers -> OnReset: Do the 3 parameters refer to the scenarios or the quality grades?

4/ Triggers -> OnMessage: Why is your 'num stream' set to '12' for dempirical? Is this just a random seed?

5/ Is the label 'scenario_value' set to 3 because it corresponds to 3 scenario's or because every scenario has 3 quality grades?

Thanks a lot for your insight!

Looking forward to hearing back from you.

Best regards

Pieter

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Pieter Cecat commented ·

@Pieter Cecat

1/ if you create a mass of items e.g. 10000 the distribution works fine. Therefore you have to enhance the Capacity of the queues. If you create a relative small number the distribution behaves as a randomly distribution does. There is always a deviation.

If you get always the same results while the model is running, please check if the option Repeat Random Streams inside the main menu item Statistics is activated. You use this active option to find errors in a model, but if you want get true statistical result the option should be inactive.

2/ Please read the manual. I have set the parameters in the picklist template and that is the default value for no delay, which i didn't use. If you open the template editor you will see the delay time is set to 720. If you open the the source code editor you see the picklist source code. If you want to know why it is coded this way, then please ask the development of Flexsim.

3/ The three parameters belong to the standard senddelayedmessage template or command. The senddelayedmessage funktion consists of the the obejct that receives the message, the delay time, the object which has sent the message and three numerical parameters a user can change, as he wish. You can evaluate these parameters in the OnMessage-Trigger by the command msgparam(1),msgparam(2) and msgparam(3) out of the message itself. In this model they haven't got any function at all.

4/ It is my method to show, that each random function should use a single random stream.

5/ The OnMessage source code changes randomly the label value "scenario_value" each time the trigger is evaluated by an incoming message. The message is sent with a delay from this triggers itself to get an unstopable event loop. The Label "scenario_value" is used in the OnCreation-Trigger to change the table inside the dempiricle-function.

You find in the model three tables named "SCENE1", "SCENE2" and "SCENE3". With the command concat you can concatenate a list of strings to build a single string. I build the names of the above tables out of "SCENE" and the number of the label value "scenario_value". The function numtostring converts a number to a string. I concatenate the string "SCENE" and for instance "2" to the new string "SCENE2".

The number "3" is just the start value if you open the model, but it will change while you let run the model. Though you get the quality grades of the table SCENE3 after opening the model.

1 Like 1 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.