ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > User Development
Downloads

User Development User developed add-ons to Flexsim

  #1  
Old 08-21-2011
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default 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.
Attached Files
File Type: zip MultiBatchingQueue library.zip (4.5 KB, 200 views)
File Type: fsm MultiBatchinQueue test v5.12.fsm (32.3 KB, 219 views)
The Following 5 Users Say Thank You to Kris Geisberger For This Useful Post:
Sung Kim (08-25-2011)
  #2  
Old 08-22-2011
Chieng Kai Seng Chieng Kai Seng is offline
Flexsim User
 
Join Date: Jul 2011
Location: Malaysia
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 109
Chieng Kai Seng is on a distinguished road
Default 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  
Old 08-22-2011
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default

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  
Old 08-24-2011
Chieng Kai Seng Chieng Kai Seng is offline
Flexsim User
 
Join Date: Jul 2011
Location: Malaysia
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 109
Chieng Kai Seng is on a distinguished road
Default

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  
Old 08-25-2011
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default 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:
What's batchlistmanager? the label "nextbatchlist" on multiple batching queue is empty. Whyyyy???
It's not empty. Look at the nextbatchlist label of the queue in the tree view while the model is running. On this node I collect references to each item and organize them into batches. This is why I don't have to re-rank the items themselves until a batch is released.

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


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.