ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. 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. |
flexsim.com |
#1
|
|||
|
|||
Multi Batching Queue
This is an enhancement to a standard Queue such that it will collect simultaneous batches of flowitems based on a custom condition, like batches of like itemtypes or same labels. The user library will install 3 user commands when loaded which contain comments on how to use them.
custombatchcondition() customtargetbatchsize() custommaxwaittime() The MultiBatchingQueue has labels for TargetBatchSize and MaxWaitTime which can be used to apply to all batch types, or if set to -1 the user commands will be used instead of these label values. With the commands you could define a batch size and max wait time per batch type. Currently the batches are re-sorted in the sequence that they are released with items in chronological order within each batch. This took under 2hrs to make, and is not novel, but I think it could be helpful to some users. It is also a good example of using releaseitem(), and tree node structures to book-keep references. Note that it is not built for speed, I would probably try to reduce the creation and destruction of nodes to make it more lean. |
The Following 5 Users Say Thank You to Kris Geisberger For This Useful Post: | ||
Sung Kim (08-25-2011) |
#2
|
|||
|
|||
criteria
Some questions. How do you batch the items? By itemtypes? I can't find the code for the criteria for batching. I'm interested in batching by similar labels on items.
After thinking about it, I think there isn't much use for a multiple batching queue if there's only one criterion for batching - it'll work pretty much like a normal queue. A multiple batching queue will only come in handy when there're multiple criteria to be considered. As for my case in Batching, max wait time, the first criterion would be to arrange by CR, and then the second criterion - batch by same labelname. Just some thoughts. Cheers, Chieng |
#3
|
|||
|
|||
When a new item is received, the custombatchcondition user command is executed to compare this new item with the first item in each of the unique batches (one-by-one) that are currently being collected. If the command returns a 0 it means that the new item does NOT belong with the current batch, so the next batch will be checked for compatibility. A return of 1 will tell the queue that the new item belongs to the current batch and will then stop the search. If there are no matches found, then the new item will start a new batch for future items to join.
So you can have as many criteria as you like, I have given you a reference to the newly arrived item (itemA) and the first item in the batch (itemB) in the custombatchcondition user command. In hindsight I guess I should have called it custombatchcriteria. |
#4
|
|||
|
|||
Kris,
What if I want to include a sorting code(by Critical ratio) before the codes you've written for onEntry? my part of the code will look like this. { //************* PickOption Start *************\\ /**Sort by Labelnum*/ int ascending = 1; int descending = 2; /** \nSort Order: */ int order = /**/ascending/**list:ascending~descending*/; /** \nLabel: */ string labelname = /**/"CR"/**/; /** \n\nSort entering flowitems in the given order according to the label*/ /**\n\n*/ double curitemtype = getlabelnum(item, labelname); int maxrank = 1; for(int i = 1; i <= content(current); i++) { double compare = getlabelnum(rank(current, i), labelname); if(order == ascending) { if(compare > curitemtype) break; } else if(compare < curitemtype) break; maxrank++; } setrank(item,min(maxrank, content(current))); } //******* PickOption End *******\\ It's a template code. Will the ranking of item mix everything up? Your code seems really cool but I don't really understand them. lol. What's batchlistmanager? the label "nextbatchlist" on multiple batching queue is empty. Whyyyy??? |
#5
|
|||
|
|||
batchlistmanager
What do you want to accomplish by sorting the items by the CR label on entry? If you are batching by CR label then just use the custombatchcondition user command found under the Tools menu. If you just want to change the appearance of the items in the queue then go ahead, BUT if a batch is released and the downstream object is busy... then you will have troubles when a new item enters. So, no I don't recommend it.
Quote:
I suggest you lookup all the commands I used in the OnEntry and OnMessage that you don't recognize. |
The Following User Says Thank You to Kris Geisberger For This Useful Post: | ||
Chieng Kai Seng (08-25-2011) |
Thread | Thread Starter | Forum | Replies | Last Post |
Batching, max wait time | Chieng Kai Seng | Q&A | 27 | 08-29-2011 10:12 PM |
Pulling from a Queue vs Sorting the Queue | Brandon Peterson | Tips and Tricks | 3 | 03-03-2010 01:27 AM |
Multi Core Processor | Alistair Smitheman | Gripes and Goodies | 1 | 04-28-2009 07:43 AM |
batching problem | KelvinHo | Q&A | 9 | 06-25-2008 08:17 PM |
Multi-Processor Help | Davie Stomp | Q&A | 3 | 01-27-2008 02:23 PM |