Ajay Bhesaniya avatar image
Ajay Bhesaniya asked JUanGarcia commented

Pull Strategy for Sink using Global Table for Demand

I am new to Simulation Modeling using FlexSim and I am trying to build a simple model to assess the feasibility of creating a Pull Strategy referencing a Global Demand table.

I created a Global Demand table with the columns representing the number of items (4 in this e.g.) and the rows as time periods. Each row represents an hour and the table values represent the demand for each product, every hour. I have 4 Queues connected to the Sink and each Queue holds only one itemtype. I have set the Pull Strategy to "Using Global Lookup Table (Demand)" in the Flow tab of the Sink and tried running the model. The Sink pulls only Itemtype 1 form Queue1 and completely ignores the other queues. Also, the Sink pulls the entire quantity of itemtype 1 arriving at Queue 1 and does not reference the demand table for pulling.

I am sure there is additional logic required to execute the 'Pull Strategy at the Sink' successfully. Any guidance here will be highly appreciated.

FlexSim 16.0.1
global tablepull strategy
· 4
5 |100000

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

Sam Stubbs avatar image Sam Stubbs ♦ commented ·

Ajay, could you post a sample model for us to look at?

1 Like 1 ·
Ajay Bhesaniya avatar image Ajay Bhesaniya commented ·


Hi Sam,

I have attached the Sample Model. Thanks for offering to review it.

I am eager to get your feedback.

1 Like 1 ·
extrastorage.fsm (32.4 KiB)
JUanGarcia avatar image JUanGarcia commented ·

In our model the ItemCounts doesn´t counts. For that reason in the second 0 the sink takes all at once.

0 Likes 0 ·
JUanGarcia avatar image JUanGarcia JUanGarcia commented ·
0 Likes 0 ·
ddmrp-question.fsm (71.4 KiB)
Sam Stubbs avatar image
Sam Stubbs answered Ben Wilson commented

Hey Ajay, so we took a look at it. This is what we came up with: First we introduced a Global Variable: "CurrentHour" to track which hour in the table the model was on. Then we created a Label Table on the Sink "Terminal" called ItemCounts that tracks how many of each item type the sink is receiving. We added a line of code to say that the sink will receive up to a certain amount of that item type within the set hour based on your table. Finally we created a global User Event "TrackCurrentHour" that increments the CurrentHour variable, and reopens the ports to receive the next amount on the table for the given hour. I'm including our modifications as a model attachment. I hope this has helped! demandtableexample.fsm

· 3
5 |100000

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

Ajay Bhesaniya avatar image Ajay Bhesaniya commented ·

Sam, I am amazed to have this level of support. I had spent several days trying to implement this strategy and I am glad I reached out to you guys.

I spent some time running the model and had few follow-up questions;

1. After running the model, I saw the "ItemCounts" label not incrementing in value but stays at 0.00.Is there a way to build separate labels for each "itemtype" and thus get a count of each? which I can use to verify if the sink is pulling based on the demand table.

2. I see the model keeps running indefinitely (I had to stop it at 5000 time units). One of my goals was to setup the Sink to Pull based on the demand table and then Stop (24 time units in this example since the demand table has 24 rows). Beyond that, the Queues start filling until they are maxed out and then the Source gets blocked. What additional logic needs to be added to make this happen?

3. Also, is there a way to read the demand table values as daily or weekly demand instead of hourly?

Thus, the source continues to produce at hourly rates and the Sink consumes on a daily rate or weekly rate?

4. The End goal of this modeling effort is to find the Optimal Queue capacity for each product that would satisfy a rate of demand fed through the demand table. Is there a way to quickly get to that number?

I could not contain my excitement after I got your last response and I hope I am not overwhelming you with this additional questions.I have spent a lot of time going through the video tutorials and reading the Applied Simulation Text but have not yet found complete answers for my questions.

Thanks in advance!

0 Likes 0 ·
Sam Stubbs avatar image Sam Stubbs ♦ Ajay Bhesaniya commented ·

Hello Ajay, just as a heads up, as we are using this new answers forum format, we are trying to keep each question isolated to its own post on the board. So I've broken up these four questions into posts on the board as a whole for the community and especially support to all look at and help with. (As a reference you can go here to see "Best Practices" for using this forum.)

Question 1 is posted here. Question 2 is posted here. Question 3 is posted here. And Question 4 is posted here.

Thank you for your questions. I posted an answer to some of the questions already, let us know if you still need help.

0 Likes 0 ·
Ajay Bhesaniya avatar image Ajay Bhesaniya commented ·

Sam, Thanks a lot. I will check the Best Practices section for future queries.

0 Likes 0 ·
Helen avatar image
Helen answered Sam Stubbs commented

Thank you for this thread, it's being really helpful. Nevertheless, I have additional questions on it @Sam Stubbs. In this code, you compare the parts that have been shipped (I guess that the value is reset every hour but don't see how) with the items that should be shipped hourly. The second part of the equation is clear, it seeks for row Current hour and column item type for the column in the table demand. But it's not clear for me what does the first part do.

gettablenum(label(current, "ItemCounts"),getitemtype(item),1) >= gettablenum("demand",CurrentHour,getitemtype(item))

Thanks a lot!


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

Felix Möhlmann avatar image Felix Möhlmann commented ·

The sink possesses a label called "ItemCounts". This label contains a table that tracks how many items of each type the sink has received by incrementing the respective value whenever an item enters the sink (first function in the On Entry trigger).
The first part of the condition reads the value for the current item's type from that table label which then gets compared to the target value from the global table.

You can see the table view of the label by rightclicking on it and choosing "Explore -> As Table".



The reset of the values happens in the User Event "Track Current Hour".


3 Likes 3 ·
1673852924025.png (5.3 KiB)
1673852932955.png (6.5 KiB)
1673853013532.png (8.5 KiB)
Helen avatar image Helen commented ·

Thank you @Felix Möhlmann

0 Likes 0 ·

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.