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
|
|||
|
|||
Problem in sorting products by jobnum
Hi everyone!
I have 2 processors connected to 6 racks with a max content of 35 each. I want to send my products to the racks according to their jobnumbers, which are stored on an itemlabel called "jobnum". Each rack may only have one job in it at a time. The product quantity of each job changes. On both processors I chose the picklist option "matching itemtypes" in the flow tab and changed it, so that it looks for "jobnum" and not for "itemtype". It seemed to work at first side, but sometimes if , for example, processor1 has a time delay between two products of the same jobnumber (e.g. job 3) and processor 2 has products to send (e.g. job 6), the according rack of processor1 with content 12 of current job (job 3) is filled up to content 35 with job 6 of processor2 and the rest of job 3 is send to the next rack with content 0. Here is the code I use in the two processors: treenodeitem = parnode(1); treenode current = ownerobject(c); /**Matching Itemtypes*/ /** \nSend flowitem to the output port connected to an object that contains flowitems whose itemtype matches the itemtype of the involved flowitem.*/ double curjob = getlabelnum(item,"jobnum"); int outportindex; int flowitemindex; int nrofoutports = nrop(current); int nrofflowitems; treenode tempoutobject; for(outportindex = 1; outportindex <= nrofoutports; outportindex++) { tempoutobject = outobject(current, outportindex ); nrofflowitems = getlabelnum(rank(tempoutobject,1),"Quantity"); for(flowitemindex = 1; flowitemindex <= nrofflowitems; flowitemindex++) if(curjob == getlabelnum(rank(tempoutobject, 1),"jobnum")) return outportindex; } for (outportindex = 1; outportindex <=nrofoutports; outportindex++) { tempoutobject = outobject(current,outportindex); if (content(tempoutobject) == 0) return outportindex; } return 0; I do not see my mistake. Somehow I think I need to save the current port in the processors, but do not know how to solve this... Hope you understand the problem and have any help? Thanks a lot, Claudia |
#2
|
||||
|
||||
Claudia,
here you find my modified code with the two changes I made: treenodeitem = parnode(1); treenode current = ownerobject(c); /**Matching Itemtypes*/ /** \nSend flowitem to the output port connected to an object that contains flowitems whose itemtype matches the itemtype of the involved flowitem.*/ double curjob = getlabelnum(item,"jobnum"); int outportindex; int flowitemindex; int nrofoutports = nrop(current); int nrofflowitems; treenode tempoutobject; for(outportindex = 1; outportindex <= nrofoutports; outportindex++) { tempoutobject = outobject(current, outportindex ); nrofflowitems = content(tempoutobject); // HERE YOU NEED TO GET THE NUMBER OF FLOWITEMS IN THE TEMP RACK for(flowitemindex = 1; flowitemindex <= nrofflowitems; flowitemindex++) if(curjob == getlabelnum(rank(tempoutobject, flowitemindex),"jobnum")) // HERE YOU HAVE TO LOOK AT THE flowitemindex RANKED ITEM NOT THE FIRST return outportindex; } for (outportindex = 1; outportindex <=nrofoutports; outportindex++) { tempoutobject = outobject(current,outportindex); if (content(tempoutobject) == 0) return outportindex; } return 0; This seems to do the job as far as I understood it was supposed to be done. If not please come back to me or send me your model by email. Best regards Ralf aka ralle Flexsim Germany |
The Following 2 Users Say Thank You to RalfGruber For This Useful Post: | ||
Tom David (03-11-2010) |
#4
|
|||
|
|||
I realized that I already tried it that way, but it is not working.
My model is very big, thus didnt upload. I'll try to build a sample model, that will show the problem. So it will be easier to understand, I suppose. Already found a solition, but it doesnt fit the situation exactly. Will upload a sample of it, too. Give me a moment... |
#5
|
|||
|
|||
Well, this is my solution of the problem.
I put a controlqueue between proc1, proc2 and the racks. This queue controls, which rack is empty and not filled with the current job. The problem is, that in my original model the mounting_1 process has a process time of 1800 (much longer than in the sample). Therefore the items in proc2 have to wait a very long time, before the job in mounting_1 is finished and the controlqueue releases the job. In reality, while mounting_1 is still processing a job, proc2 can release its current job to a rack, if ready. Tried to put 2 controlqueue in between. But then the original problem comes back... |
#6
|
|||
|
|||
Ok. Now I'm all confused.
Tried to build a sample model of my original problem, but now Ralf's solution works! So, here is the solution and not the problem. |
#7
|
|||
|
|||
Just had a look at the model where I tried Ralf's solution earlier.
Guess what... I "just" forgot the "jobnum" in the if-statement if(curjob == getlabelnum(...,"jobnum") Aaargh! 2 weeks gone... |
#8
|
||||
|
||||
Hello,
in the first model you shared, is in the OnEntry trigger still some code of the idea you got it from Probably this gives some mistakes!?
__________________
Hemmi |
#9
|
||||
|
||||
Ok I found my fault, the "batchsize" variable is used correct I think. This means no mistake this way. Sorry, just an little too bussy the last time. Will try to proof my statements before I give some the next time
__________________
Hemmi |
Thread | Thread Starter | Forum | Replies | Last Post |
Sorting and Stacking multi products | Simon Zaw | Q&A | 5 | 08-05-2014 01:16 AM |
Sorting a list of nodes in the tree | Ben Wilson | Tips and Tricks | 3 | 02-27-2013 07:10 AM |
Pulling from a Queue vs Sorting the Queue | Brandon Peterson | Tips and Tricks | 3 | 03-03-2010 01:27 AM |
Vitor - warehouse operations for long steel products | vgeorge | Pre-sales Questions | 2 | 07-12-2008 09:52 AM |
Queue Sorting | Jeff Nordgren | Q&A | 12 | 05-22-2008 03:21 PM |