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
|
|||
|
|||
Group Capacity
This model shows how a modified Group object along with a couple of commands can be used to constrain flow based upon the collective free capacity of downstream resources that are Group members. It could be modified so that the group capacity is less than that of its members.
The two commands 'groupsendto' and 'groupreceiveitem' are used to govern the flow. groupreceiveitem: On reset the group members register that they can receive items by calling 'groupreceiveitem' and passing in the capacity (maxcontent variable). Code:
groupreceiveitem(current,getvarnum(current,"maxcontent")); Code:
groupreceiveitem(current); groupsendto: This is used to allocate items to the processor in a group and hold them back if no group capacity is available. The syntax in the sendTo trigger is Code:
return groupsendto(<groupname>,item,<port>); Example Model In the example the first conveyor has code to send the items to "Group_1" which consists of the first 6 machines on the merge sort conveyor - but they could be in any order and position in this example and even on any port due to the way the sendTo of the mergeSorter is implemented. Those six machines then send to "Group_2" which are the next six around the conveyor. Group_2 machines then send to Group_3 which is the sink and I've set the capacity of that to be 12 just so they release enough to maintain the flow. The colors of the boxes change from to red in Group 1 and to blue in Group 2 before exiting around the conveyor loop. I've used the option to place a destination label on the items by passing in a datatype as the 4th parameter. The sendTo logic is then just: Code:
return groupsendto("Group_2",item,1,DATATYPE_NUMBER) ; There's also the option to call a function on the processor when an item is allocated to it, by calling groupreceiveitem with a 3rd parameter (obj node) which is the variable or label that has the notification handler code on it. The allocated item is passed to that handler as parnode(1). Last edited by Jason Lightfoot; 10-11-2010 at 05:55 AM. Reason: Update model - added zero time delay on sink before calling groupreceiveitem. Update 2 - changed template location to /Tools |
The Following 5 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Tom David (10-09-2010) |
#2
|
|||
|
|||
if i change the reset of sink code like this :groupreceiveitem(current,2);
the system console will print : time: 252.588218exception: Exception Caught in ObjectFunction201__project_library_FlexsimObject_b ehaviour_eventfunctions_OnTimerEvent object: /MergeSort i: /MergeSort>variables/sortedtable/5 class: /MergeSort time: 276.021847exception: Exception Caught in FixedResource::frgetvar(fsnode* flowitem, int varnum) time: 276.021847exception: Exception Caught in MergeSort::OnTimerEvent(fsnode *involved, int code, char *datastr) object: /MergeSort time: 276.021847exception: Exception Caught in ObjectFunction201__project_library_FlexsimObject_b ehaviour_eventfunctions_OnTimerEvent object: /MergeSort i: /MergeSort>variables/sortedtable/16 class: /MergeSort Time: 296.004164. The label named "groupdestination" was referenced but does not exist on (null) and a strange thing will happen, you can test it |
The Following User Says Thank You to For This Useful Post: | ||
Jason Lightfoot (10-10-2010) |
#4
|
|||
|
|||
I added the user library that will 'stamp' the functionality into an already loaded model, and changed the location of the GroupTemplate to /Tools so that it isn't confused with other Groups you have in the model. You can add the library to a model after you've defined the groups or before.
For those that aren't familiar with Groups, the menu is found under View->Modelling Utilities ->Groups. Here's the help section: "The groups utility lets you create and edit different groups in your model. Press Add Group or Delete Group to add or delete a group. Enter the name and press Set Name to change the name of the group. Select object in the model using the Ctrl or Shift lasso method, then press Set or Add to set or add those objects to the group. Press Select to select the objects in the group. Press Select Only to select the objects in the group and unselect all other objects in the model." |
#5
|
|||
|
|||
Additional Example
I've added a second entry conveyor and a destructive test exit chute and attached it here. I also changed the exit/sink capacity to 4 to more clearly see the effect of constraining the system.
When there is a queue on both entry conveyors, items from each will be allowed onto the conveyor alternately. In the MergeSort sendTo trigger, 15% are sent to the Destructive Testing chute which re-registers the item's current destination as available against its group capacity (after zero time delay). |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
shafizad (10-22-2010) |
#6
|
|||
|
|||
Hi Jason,
where did you set the capacity of the first group (first six processors). With the command groupreceiveitem(current,getvarnum(current,"maxcon tent")) for group one you set the initial maxcontent of the first group with the maxcontent of an idividual processor. But this maxcontent is only one, and you want to set the maxcontent of the group. I'm a little bit confused. I just got Flexsim 4.32. There following error appears when I load your custom library: Flexscript Error MAIN:/project/userlibrary/GroupCapacity>newmodelinstall/groupreceiveitem>command/groupreceiveitem/code line 9 The function nodetomodelpath is not recognized Flexscript Error MAIN:/project/userlibrary/GroupCapacity>newmodelinstall/groupreceiveitem>command/groupreceiveitem/code line 14 The function nodetomodelpath is not recognized Flexscript Error MAIN:/project/userlibrary/GroupCapacity>newmodelinstall/groupsendto>command/groupsendto/code line 8 The function nodetomodelpath is not recognized Thanks for your help! Congshi |
#7
|
|||
|
|||
Each processor registers its own capacity against the group - it's not done in one place. So by passing maxcontent of 4 it would be registering that it is capable of processing 4 more items for the group.
Nodetomodelpath is in 5.04, but not in v4. |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Congshi Wang (11-04-2010) |
#8
|
|||
|
|||
In the case where the flowitem location is directly connected to a group member to which it is allocated, I changed the return port to correspond directly to that member. Otherwise it will return the port number as passed into groupsendto().
|
Thread | Thread Starter | Forum | Replies | Last Post |
adding a node to a group | Frank Janssen | Q&A | 2 | 02-08-2010 09:34 AM |
New LinkedIn Group | Bill Nordgren | Product Announcements | 0 | 01-21-2010 11:50 AM |
Batch from Queue and capacity of operator | Michael Pohl | Q&A | 3 | 05-18-2009 01:42 AM |
TE loads to it's capacity | qin tian | Q&A | 1 | 11-13-2008 09:35 AM |
different capacity for different flow item for a same TE | KelvinHo | Q&A | 10 | 08-28-2008 08:12 AM |