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 > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 12-18-2012
Manoj Kumar Manoj Kumar is offline
Flexsim User
 
Join Date: Jan 2012
Location: India
Posts: 77
Downloads: 71
Uploads: 0
Thanks: 35
Thanked 0 Times in 0 Posts
Rep Power: 106
Manoj Kumar is on a distinguished road
Default pull from rack using table

Dear Friends,

I have made a model for picking items from rack. I have used pull function and global table. The model works but it does not follow the global table sequence.
Please find the model attached with this.


Regards,
Manoj.
Attached Files
File Type: fsm Pull using table.fsm (38.3 KB, 170 views)
  #2  
Old 12-18-2012
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

Hello,

The Pull Requirement tests over all released items in the pulled objects.
You should specify the exact item you want to pull. The loop is done from the flexsim engine.

Pull Requirement
Code:
// test label nextorderrow of existance
treenode nextorderrow = label(current,"nextorderrow");
if(!objectexists(nextorderrow))    
    {
        addlabel(current,"nextorderrow",1);
        nextorderrow = label(current,"nextorderrow");
    }
if((getinput(current)==0) && (getvarnum(current,"nroftransportsin")== 0)) setlabelnum(current,"nextorderrow",1); // initialize number label > equal to OnReset-Trigger on reset
//for (int row = 1; row <= gettablerows("order");row++)
int row = getlabelnum(current,"nextorderrow");
int bay = gettablenum("order",row,1);
int level = gettablenum("order",row,2);
treenode itemtorelease = rackgetitembybaylevel(inobject(current,1),bay,level,1);
    // possibly pull item
    if(item == itemtorelease)
    {
        inc(nextorderrow,1); // set next order row
        return 1;
    }
return 0;
Joerg

Last edited by Jörg Vogel; 12-18-2012 at 09:30 AM. Reason: error in condition initialize label nextorderrow
The Following 2 Users Say Thank You to Jörg Vogel For This Useful Post:
Manoj Kumar (12-18-2012)
  #3  
Old 07-24-2013
Kurt Ehlers Kurt Ehlers is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 9
Downloads: 0
Uploads: 0
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 0
Kurt Ehlers is on a distinguished road
Default Similar Problem

I have a model that has 60 different itemtypes going into racks like an ASRS system. I'm trying to pull a group of items by their item type and label so that when an "order" is complete it comes out of the racks together. The number of items of each itemtype changes and is checked with a global table. Here is the code I have written in my queue's "Pull" section. Any help would be appreciated.

/**Custom Code*/
treenodecurrent = ownerobject(c);
treenode
item = parnode(1);
int val =
1;
while (val <
61)
{
string valstr =
numtostring(val);
string trackedvar =
concat("Source", valstr, "Count");
double valcount =
gettrackedvariable(trackedvar);

int row = val;
int col =
1;
string tablename =
"ItemCount";
int itemnum =
gettablenum(tablename, row, col);

if (valcount == itemnum)
{
int
port = parval(2);
int type = val;
return
getitemtype(item) == type;
string labelname =
"WaveNumber";
return
getlabelnum(item,labelname);
}
else
{
val = val +
1;
}
}
  #4  
Old 07-25-2013
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

Hello Kurt,
Quote:
The loop is done from the flexsim engine.
This is what counts.

The Pull Requirement is a long lasting function. It is repeated over all items to be released from the inobjects of your object. That means after the first executed return-command, the function ends. Flexsim calls the Pull Requirement function again for the next item that an inobject can release. The Pull Requirement ends again and flexsim calls the Pull Requirement on the next Item that an inobject can release, and so on. The Pull Requirement tests only the items of the inobjects, which you allowed to test on in the Pull Strategy.
This loop is a single Event in Flexsim, the simulation time is the same as on the first call of the Pull Requirement.
Please try it on your own. You can write a code in the Pull Requirement, which tells you which item, which rank the item owns, from which releasing object, is currently tested:
Code:
pt(getname(item));pt("  ");
pd(getrank(item));pt(" ");
pt(getname(up(item)));
For this test the return value of the Pull Requirement is 0. The Output Console shows you the text.

The Pull Requirement tests if the tested item should be pulled or not. The return values are true or false (1 or 0).

I commented your code a bit.
Quote:
Originally Posted by Kurt Ehlers View Post
I have a model that has 60 different itemtypes going into racks like an ASRS system. I'm trying to pull a group of items by their item type and label so that when an "order" is complete it comes out of the racks together. The number of items of each itemtype changes and is checked with a global table. Here is the code I have written in my queue's "Pull" section. Any help would be appreciated.

Code:
/**Custom Code*/
treenode current = ownerobject(c);
treenode item = parnode(1);
int val = 1;
while (val < 61)
{
string valstr = numtostring(val);
string trackedvar = concat("Source", valstr, "Count");
double valcount = gettrackedvariable(trackedvar);
//int row = val; //not necessary
int col = 1;
string tablename = "ItemCount";
int itemnum = gettablenum(tablename, val, col);// here you know the counting variable act as row
if (valcount == itemnum) // here you compare double with an integer variable - might work
{
int port = parval(2);
//int type = val; // not necessary
return getitemtype(item) == val; // here you leave the block, 
                                                    //the while loop and 
                                                    // the pull requirement function 
string labelname = "WaveNumber";// code will never be executed
return getlabelnum(item,labelname);// code will never be executed
}
else
{
val = val + 1; // next loop step begins
}
}


Jörg

Last edited by Jörg Vogel; 07-25-2013 at 01:36 AM. Reason: add Pull Strategy
  #5  
Old 07-29-2013
Kurt Ehlers Kurt Ehlers is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 9
Downloads: 0
Uploads: 0
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 0
Kurt Ehlers is on a distinguished road
Default Pulling specific batch

I've gotten the queue to pull when an order is complete, but it seems that once one order is complete it pulls every order whether or not it is complete. Here's the code.
Code:

/**Custom Code*/
treenodecurrent = ownerobject(c);
treenode item = parnode(1);
double value = 0;
string labelname = "WaveAndItem";
int val = 1;
while (val < 61)
{
string valstr = numtostring(val);
string trackedvar = concat("Source", valstr, "Count");
double valcount = gettrackedvariable(trackedvar);
int col = 1;
string tablename = "ItemCount";
double itemnum = gettablenum(tablename, val, col);
if (valcount == itemnum)
{
int port = parval(2);
value = getlabelnum(item,labelname);
break;
}
else
{
val = val + 1;
}
} 
return getlabelnum(item,labelname) == value;
  #6  
Old 07-30-2013
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

Hi,

in PullFromRack_JV.fsm the Engine does the loop. If the Rack contains an amount of 3 flowitems with the same Labelvalue the queue starts to pull these items.

Jörg

Last edited by Jörg Vogel; 12-03-2014 at 03:36 AM.
  #7  
Old 07-30-2013
Kurt Ehlers Kurt Ehlers is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 9
Downloads: 0
Uploads: 0
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 0
Kurt Ehlers is on a distinguished road
Default

They don't have the same label value though. I even put breaks in the code so that when the queue should start pulling items it would stop to show the code, but it started pulling items before.
Attached Files
File Type: fsm buffer2.fsm (184.3 KB, 88 views)

Last edited by Kurt Ehlers; 07-30-2013 at 08:21 AM.
  #8  
Old 07-30-2013
Kurt Ehlers Kurt Ehlers is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 9
Downloads: 0
Uploads: 0
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 0
Kurt Ehlers is on a distinguished road
Default

So the queue will correctly pull boxes when the order is complete, so that part is ok. The problem is that only that queue will pull, so if other boxes in the order are in different racks, they won't get pulled. The new model is attached.
Attached Files
File Type: fsm buffer2.fsm (184.8 KB, 89 views)
  #9  
Old 07-31-2013
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

You can set a flag to indicate, which batch can be pulled. If you check the amount of pulled Items belonging to the batch, you can unset the flag, when the last Item is pulled. This method can you write at the beginning of your Pull Requirement.

Jörg
  #10  
Old 07-31-2013
Kurt Ehlers Kurt Ehlers is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 9
Downloads: 0
Uploads: 0
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 0
Kurt Ehlers is on a distinguished road
Default

I've been trying to figure out how to do this, but could not find much information on it. Do you know where I can learn how to do this?
  #11  
Old 07-31-2013
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

You can add second column in your global table "ItemCount"
When the batch size of an itemtype is stored over all your racks, change the value in the second column from 0 to the value of the batch size. Each time you pull an item from that batch you reduce this value by one.
In the Pull Requirement you check if the item, that is currently tested, belongs to an itemtype with a number greater than 0 in the second column in your table"ItemCount". If that is true you reduce the value in the second column and call "return 1" on that item.

Jörg
The Following User Says Thank You to Jörg Vogel For This Useful Post:
Kurt Ehlers (08-06-2013)
  #12  
Old 08-05-2013
Kurt Ehlers Kurt Ehlers is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 9
Downloads: 0
Uploads: 0
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 0
Kurt Ehlers is on a distinguished road
Default Still doesn't work

I tried what you recommended, as well as some other fruitless ideas, but it still will not work. The two attached files have slightly different pull codes in the exit queues. Any more ideas?
Attached Files
File Type: fsm testbuff.fsm (186.0 KB, 79 views)
File Type: fsm doubletestbuff.fsm (185.3 KB, 71 views)
  #13  
Old 08-05-2013
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

Search the forum for releaseitem and make a small test model to practice using releaseitem.

1. Abort the Pull Logic approach
2. On all your racks, set the SendTo to "Do No Release Item" pick option (or just return -1)
3. Create a User Command that gets called just before the return -1; in the SendTo. This command will act like a central brain for the entire ASRS. It is responsible for updating your inventory count (in a table or TVs like you have) for the item that just entered. Then it should check whether the order is complete. If the order is complete, you loop through all the appropriate racks to find the items belonging to the order and call releaseitem(<theitem>,1) on each of them (and maybe decrement your count). You might have to send a message in zero time to an object of your choice and perform the search-and-releaseitem there to be safe. That said, might as well center connect a single object to all racks so that you have easy references to them. So, if you are uncomfortable with user commands, just use the OnMessage of that central object instead (senddelayedmessage in 0 time from the SendTo before the return -1). I would use a Dispatcher just because it looks like a controller and has an OnMessage.
The Following 2 Users Say Thank You to Kris Geisberger For This Useful Post:
Kurt Ehlers (08-06-2013)
  #14  
Old 08-06-2013
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

if you still want to stay on the pull strategie, here is small model PullFromRack2_JV.fsm without a while-loop but a for-loop

Jörg

Last edited by Jörg Vogel; 12-03-2014 at 03:40 AM.
The Following User Says Thank You to Jörg Vogel For This Useful Post:
Kurt Ehlers (08-06-2013)
  #15  
Old 08-06-2013
Kurt Ehlers Kurt Ehlers is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 9
Downloads: 0
Uploads: 0
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 0
Kurt Ehlers is on a distinguished road
Default Thanks

Thanks guys, I'm pretty sure I have it working now. When I get it completely done I'll post it back so future people can use it.
  #16  
Old 08-09-2013
Kurt Ehlers Kurt Ehlers is offline
Flexsim User
 
Join Date: Jul 2013
Posts: 9
Downloads: 0
Uploads: 0
Thanks: 3
Thanked 1 Time in 1 Post
Rep Power: 0
Kurt Ehlers is on a distinguished road
Default model with ASRS Pull Logic

Here is the Pull part of my finished model.
Attached Files
File Type: fsm buffadvi.fsm (191.7 KB, 104 views)
The Following User Says Thank You to Kurt Ehlers For This Useful Post:
Manoj Kumar (08-09-2013)

Tags
pull from rack


Thread Thread Starter Forum Replies Last Post
Rack number from global table Manoj Kumar Q&A 1 05-31-2012 03:40 AM
Pull Specific Flowitems from Rack using Message Christian Norregaard Q&A 2 04-04-2012 07:28 AM
Pull rule Alan Pope Q&A 4 04-15-2010 07:46 AM
Can I make a column of a global table to type table? qin tian Q&A 0 10-01-2008 09:27 PM
Pull items out of a rack BenjaminBuecklein Q&A 1 09-22-2008 03:59 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.