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 10-09-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default 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"));
When an item leaves the processor, 'groupreceiveitem' is called again but without the capacity parameter the code just assumes space for 1 box has been freed - so the exit trigger is:
Code:
groupreceiveitem(current);
At the moment the function checks that a Group container is an object and automatically copies the attributes from the GroupTemplate object if needed.

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>);
where the parameters are the groupname, the flowitem, the port to send to.

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) ;
Where the datatype of the destination label can be a string, number or coupling. The added label is called 'groupdestination' by default.

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).
Attached Files
File Type: zip GroupCapacityExample.zip (75.7 KB, 288 views)
File Type: zip GroupCapacityLibrary.zip (2.4 KB, 256 views)

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  
Old 10-10-2010
LINWEIXU
Guest
 
Posts: n/a
Downloads:
Uploads:
Default

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)
  #3  
Old 10-10-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

I've updated the model to account for this. There needed to be a delay before calling groupreceivitem on the sink.
  #4  
Old 10-11-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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."
Attached Thumbnails
Click image for larger version
Name:	GroupUtility.jpg
Views:	219
Size:	9.8 KB
ID:	1161  
  #5  
Old 10-11-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default 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).
Attached Files
File Type: zip GroupCapacityExample2.zip (80.4 KB, 240 views)
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
shafizad (10-22-2010)
  #6  
Old 11-03-2010
Congshi Wang Congshi Wang is offline
Student
 
Join Date: May 2010
Location: Germany
Posts: 58
Downloads: 2
Uploads: 0
Thanks: 48
Thanked 0 Times in 0 Posts
Rep Power: 124
Congshi Wang is on a distinguished road
Default

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  
Old 11-03-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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  
Old 03-24-2011
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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().
Attached Files
File Type: zip GroupCapacity_v0.2.zip (2.5 KB, 224 views)


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


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.