question

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

Push items from queue to two different sinks

Hi everyone

I recently joined this forum in an attempt to learn more about FlexSim. I started building my own production planning model [time unit = hours | planning horizon = 6 months] and already encountered my first problem. As I cannot seem to find the solution by using the options from the pick list, I suppose there is some custom coding necessary. I personally don't think it is really complex, but as I have little experience in doing this, I am counting on some help.

I am trying to push items from a queue to 2 separate sinks (see below). This has to happen at predefined times, more specifically after every month (= 720 hours). I already defined a global integer variable for Time (initial value set to 0) as I suppose this will be needed to specify the delay between two months. In other words, inventory accumulates throughout the month, and a certain quantity is released at the end of every month to fulfill that period's total demand (= fixed + random). Then, inventory is increased again by the next month's production, in order to fulfill the next period's demand as well as possible backorders from previous periods. Backorders (=unfulfilled orders) thus have to be automatically added to the next period's demand.

Items should be pushed to the first sinks based on a global lookup table which contains 6 values, each column corresponding to a certain month's fixed demand. The monthly number of items pushed to the second sink on the other hand, should be random and based on a normal probability function with specified mean and standard deviation (e.g. mean = 25 | st dev = 2). The priority rule regarding which sink's demand to fulfill first could be random.

2 seperate sinks

However, perhaps it is easier to combine these 2 sinks (see below). The number of items to be pushed to the sink at the end of each month should then be equal to the fixed number from the global lookup table, augmented with a random number based on the normal distribution with known parameters.1 combined sink

I personally think the second option is easier in order to count the backorders and add them to the next month's demand.

Final remark:

It would also be great if I could use the same random numbers that were generated for the random demand (based on the normal distribution with known parameters) as the monthly release quantity of a 'source' somewhere else in my FlexSim model. I suppose it is possible to write these 6 generated random numbers to a table and access them from there, but don't know exactly how to do this.

Thank you in advance for all your time and support. I strongly appreciate it!

Kindest regards

Pieter

FlexSim 16.0.6
sinkrandom streampush
jhzud.png (4.6 KiB)
vowka.png (5.2 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.

1 Answer

Adrian Haws avatar image
1 Like"
Adrian Haws answered Adrian Haws commented

Pieter,

First, thank you for describing your model clearly. Process Flow is a great tool for executing custom logic in one place without the need for custom code. I've created a sample model using Process Flow that performs what you've described. Items are created in the queue, then pushed to a list. There is then a separate source that creates one token which loops through every 720 seconds. Labels are created on that token to set the demand based on fixed demand, random demand, and backorders. Backorders are defined as demand - items pulled from list. I've also included another source with quantity defined from a global table.

Let me know if you need any clarification. Model is attached.


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

Pieter Cecat avatar image Pieter Cecat commented ·

Dear @Adrian Haws

Wonderful! This forum, and more importantly its user's help, is truly amazing.

As I am not familiar with "process flow", it took me a while to understand what it is you exactly did. Having gone through the entire model, I would like to start by thanking you for your time and effort. The model indeed describes exactly what I wanted to achieve. I do however have some minor questions related to this "process flow technique" before implementing it in my simulation model.

Firstly: I was wondering if there is any need to "physically" connect items in your model when using "process flow". Your model obviously suggests there isn't.

Secondly: Is it possible to only partially model a simulation using "process flow"? As I already have a processor in place which fills the queue, I suppose there is no need for me to create the new order source you added in the top box. This would thus mean I can push the items arriving at the queue directly to the list - and drop the three other actions - if I am not mistaken. How exactly would this be done?

Thirdly: I was looking into backorders - which should indeed be defined as you did - but was wondering if there is any way of copying those values for each month to a (separate) table as well. Moreover, if I set fixed demand very high - too high to be fully satisfied - I still get a value of only 1 when checking the token, even though the correct number of backorders is taken into account when calculating next period's demand.

Lastly: My ultimate goal would be to have the random numbers created at the start of each period, as this would allow me to use these values to define the arrival schedule at another source in my model. In other words, the other source I am talking about has to know these numbers -which are randomly generated at the end of each month - already at the start of each period. Is there any way of making sure the numbers are generated and copied to the table at the start of each period?

Thanks again for your assistance. Wishing you a blessed New Year!

Greetings from Belgium

Pieter

0 Likes 0 ·
Adrian Haws avatar image Adrian Haws Pieter Cecat commented ·

@Pieter Cecat Happy new year to you as well!

You are correct in assuming that physical connections aren't always needed when using Process Flow. Setting up the logic in Process Flow means that you can control the steps of your model in a highly visual, simplified way. For example, instead of using a processor's default logic with custom code in the triggers, you can send an item to a fixed resource in Process Flow, then define each step in a different activity-like process time, setting labels, etc. As for partially defining a model using Process Flow, that is very common. The updated model I am attaching shows what you described. I created a global list, which the queue pushes to as its "flow" option. The list activity in Process Flow then references the same global list. Another useful feature is "Event-triggered source" and "Wait for event" activities to sync your Process Flow with the 3d model.

I'm not sure how you would be getting a value of 1 for backorders when there should be more. I'm seeing the correct values set on that label. To write those values to a table, it would be similar to how I wrote the random demand values to the "Monthly Demand" table.

To write the random demand values at the start of each period, you can just set move the "demand" and "Write to Table" activities before the delay.

I hope this helps!

1 Like 1 ·