This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.

Go Back   FlexSim Community Forum > FlexSim Software > Q&A

Q&A Using Flexsim and building models

Old 08-28-2015
Nathan Moriarty
Posts: n/a
Downloads: 0
Uploads: 0
Default Pull when empty

I'm having some trouble setting up the pull logic for my most recent simulation. I have a queue feeding into a combiner, and that queue needs to draw the flowitems from one queue, wait until the combiner uses all of said items, and THEN draw the next set of flowitems from the next queue in line. I've tried everything I can think of, but my experience is limited. Help?
I'm using Flexsim 5.0.
Attached Thumbnails
Click image for larger version
Name:	Untitled.png
Views:	695
Size:	232.1 KB
ID:	3012  
Attached Files
File Type: fsm Draw from queues.fsm (395.7 KB, 571 views)
Old 08-31-2015
Ben Wilson's Avatar
Ben Wilson Ben Wilson is offline
Flexsim Consultant, Super Moderator
Join Date: Jul 2007
Posts: 82
Downloads: 352
Uploads: 6
Thanks: 30
Thanked 159 Times in 43 Posts
Rep Power: 256
Ben Wilson is a glorious beacon of lightBen Wilson is a glorious beacon of lightBen Wilson is a glorious beacon of lightBen Wilson is a glorious beacon of lightBen Wilson is a glorious beacon of light

Not sure about version 5.0, but in the current version 7.5.4, you can view the Event List (Main Menu>Debug>Event List). Open your model, then open the Event List, then hit reset. You'll see all the events that are scheduled for time 0.

Every event can spawn new events. Try hitting the Step button once. After one step, several things have happened:

- the first source created its first flowitem
- the first flowitem flowed from Source8 to the FeederQueue, where the CombinerQueue pulled it and sent it on to the Combiner
- the CombinerQueue's Exit trigger made it into the condition where it was empty, so it incremented its inputport label
- the CombinerQueue will now pull from input port 2
- the first source made the rest of its flowitems from the first row of its schedule

We need to account for all of these things happening at time 0 - we don't want CombinerQueue to pull from the 2nd FeederQueue after just one flowitem pulled from the first FeederQueue. If I understand the problem correctly, you want the following events to occur in order:

1) Sources create all their flowitems and populate their feeder queues
2) CombinerQueue pulls all the items from the top feeder queue
3) CombinerQueue feeds the combiner until CombinerQueue is empty
4) CombinerQueue pulls all the items from the next feeder queue
5) repeat steps 3 and 4 until there are no more feeder queues

What we need to do is keep #2 from happening at all until #1 is totally complete. And we need to keep flowitems from flowing through the CombinerQueue to the Combiner until CombinerQueue has pulled all flowitems from the FeederQueue.

In the attached model I've made the following changes:
- CombinerQueue onReset trigger: added closeinput, closeoutput, plus delayed messages after 0.000001 time elapsed to open output then input
- CombinerQueue onMessage trigger: added cases that will open and close input and output on demand
- CombinerQueue onExit trigger: added delayed messages if the queue is emptying. Messages will close outputs then inputs, then open input (reevaluates the pull requirement, allows queue to fill), before opening output
- CombinerQueue Pull Strategy - changed to pull from any port. The problem with specifying a port here is that its hard to change later. Once the queue has requested something from a particular port and it is waiting for a flowitem on that port, it is stuck there until a flowitem actually arrives over that port. Best to just pull from any port and put the logic into...
- CombinerQueue Pull Requirement - since this can be reevaluated on openinput(), we put the specific port requirement (based on label value) here

This model was built in FlexSim 7.5.4. You can install 7.5 in its own directory - it won't overwrite anything from 7.3 or older installations. If you don't have a license, no worries. Version 7.5.4 will install in the feature-limited Express mode, which will still allow you to view and run this sample model.

Reply back if I misunderstood the problem and the attached model isn't what you were looking for.


PS - Version 5.0 was released in May 2010. Any chance of upgrading to the latest version?
Attached Files
File Type: fsm DrawFromQueues_fs01.fsm (18.0 KB, 509 views)
The Following 5 Users Say Thank You to Ben Wilson For This Useful Post:
syseo (09-01-2015)

Thread Thread Starter Forum Replies Last Post
Send message from a queue when it is empty hendry teo Flexsim Student Forum 7 05-09-2015 10:51 PM
Script windows empty if MTBR tablename contains only digits Jens Mühlheimer Gripes and Goodies 2 03-27-2012 11:31 PM
Empty level in rack Manoj Kumar Q&A 3 02-01-2012 05:27 AM
Empty & Idle Warehouse at the end of the day Labro Eleni Q&A 3 08-08-2011 04:08 AM
IDLE and EMPTY Lydia Franck Q&A 2 08-05-2010 03:03 AM

All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.