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
|
|||
|
|||
Using Separator for split Flowitem
Hi,
I am wanting to do the following things. From source 8 flowitem will go to the processor .Each flowitems processtime is different. and they have a specific platenumber. I also want to split them into specific parts using separator (which i was able to do using label). Now the thing i want is to give specific properties from my excel file to the new split items. Can u suggest me what i should do within the separator ? Last edited by jasonjj; 06-01-2012 at 08:09 AM. |
#3
|
||||
|
||||
You should use Separator after using Combiner.
You can use Separator after using Combiner that assembled flow items.
Separator is used for disassembling the flow items combined. You must combine the number of parts in the previous operation using Combiner. Your flow item created is only one item not combined though using label 'partsnumber'. Label is only a name. |
The Following User Says Thank You to syseo For This Useful Post: | ||
jasonjj (06-01-2012) |
#4
|
|||
|
|||
It means i have to get equal number of parts from source directly into the combiners , which will combine into a specific plate , then separate will separate again them , right?
in that case, i should put all the properties of the parts as label in the source or use global table? which command i should use to combine , for example 101 parts into specific 1 plate , and 14 parts into another 1 plate? |
#5
|
||||
|
||||
Quote:
Jasonjj, you are asking questions so fundamental to using the software that you should probably take a training class to learn how to use Flexsim. If you received training on how to use the software, you would find these tasks much easier. It would be easier to teach you these basic principles through a class rather than through forum posts. For more information about training courses, see: http://www.flexsim.com/calendar/ You can read your table of data from Excel into a Global Table and then access that data in the triggers of your objects. |
The Following 2 Users Say Thank You to Phil BoBo For This Useful Post: | ||
syseo (06-01-2012) |
#7
|
|||
|
|||
Dear phil
its just a course assignment i am trying to do which i have to finish within 2 weeks.. so you know right now i just have to get it finish by learning as much as possible and taking help from others... so training is not possible now ! |
#8
|
||||
|
||||
Read in the excel file in Flexsim into a global table (Using the excel single table import)
On the exit trigger use the command "addlabel" to add labels to all the items you produce with data from the table. I have no idea what your link is between de product being produced and the row in the table where your data is but if it is a matter of simply running throug the table you can use "getoutput" on the exit trigger of the seperator and use commands like "gettablenum" or "gettablestr" to read the data from the table and put it on the label. So an example would be: addlabel( item,"section", gettablestr( "input_data", getoutput(current), 2); |
The Following 2 Users Say Thank You to Steven Hamoen For This Useful Post: | ||
jasonjj (06-04-2012) |
#9
|
|||
|
|||
The thing i am trying to link is that , The Flowitem before split have a specific platenumber in their label, for example One item has plateNr 135319 ,, when this plate will be split into specific pieces, from global table they should take the properties by matching plateNr 135319 .
|
#10
|
||||
|
||||
Then you have to make some kind of hatch table that makes the connection between plateNr 135319 and the row in the table, or have a for loop (or while loop ) that runs through the table and find the matching row. In this case I would do the loop when you create the flowitem, not only put the platenr on it but also the matching row. In that case you only have to do the lookup once when you create the item.
|
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
jasonjj (06-04-2012) |
#11
|
|||
|
|||
Does your Import data change or will the data from the Excel sheet be always like this?
And should this be a continuous simulation? Will you only simulate the 8 items that are currently in the model or will they reappear? If not I would sort the data by platenumber and make it the first column in the Excel sheet. Then import the data into a GlobalTable to Flexsim. Then use the PlatNr. Label on your FlowItems to find the first row with that PlateNr in the GlobalTable, write all the information to labels and delete that row out of the GlobalTable, so you make sure no sub-part information is used twice. Put that code in the Seperator's OnExit or Queue's OnEntry trigger. I also saw that you set the itemtype and color in the source's OnExit-Trigger. Maybe you just want to set the color and not the itemtype there. You did that already by creating the FlowItems with your source. Generally I didn't really get the application of the model. Maybe you could write a few words what you specifically want to model in reality Hope I could help a little bit so far. |
The Following User Says Thank You to Jens Mühlheimer For This Useful Post: | ||
jasonjj (06-04-2012) |
#12
|
|||
|
|||
that 8 iteam will be continuous , I think i have to write some code using Steven's suggestion in the Separator's exit trigger which will search in the global table and look for specific platenum first and then assign other properties from others columns,
Next step (which is not added yet in the model ) will be done by a crane , checking the workchain number from the global table and send them to different processor (more 3 processor will be added to it ) .. but the thing is which code i should use to search the global table that will match the flowitem type or platenum and then take the properties .. |
#13
|
|||
|
|||
Hi Jason,
start by looking into the user manual. Chapter Flexsim Coding > Writing Logic in Flexsim is what you look for. I remember that all the manual coding was really complicated when I was new to Flexsim, but there is no way around putting a lot of time into studying the user manual till the last bit and searching through old forum posts, because your model requirements will always be unique at some point and you have to find your own solution. But to get you started: One way to look through a GlobalTable is with a For-Loop: Code:
string tablename = "YourTable"; for (int row = 1;row <= gettablerows(tablename);row++) // Look through table { if (gettablenum(tablename,row,1) == getlabelnum(item,"platenumber")) // If correct row was found { your code; } } Look through the codes you can find in the picklists and see what you can apply to your problems. That will bring you further |
The Following 2 Users Say Thank You to Jens Mühlheimer For This Useful Post: | ||
Steven Hamoen (06-04-2012) |
#14
|
|||
|
|||
You should also read the article about the Step Debugger in User Helpfile -> Modeling Tools -> Flexscript Step Debugging
That'll help you figure out little bugs in your code. |
#15
|
|||
|
|||
Updated model
Here is new model that i am still trying to build. Thanks jens for the hints.
I still finding hard to use suitable code which will add new label in the item properties ( order number , section, Flatrack ID, ...etc as global table) and put the value matching PlateNr . from global table. I used addlabel command in the separator Onexit trigger. but i see it dont add any label in the item properties. for example for adding label "section " and getting its value from Global table , i used addlabel( item,"section", gettablenum( "parts", row, 2)); but nothing happen.. any suggestion. Last edited by jasonjj; 06-05-2012 at 08:12 AM. |
#16
|
|||
|
|||
First, the section data is in string format and not in numerical format (you can see that on the missing decimal point") and also in the 7th column in your GlobalTable, so
Code:
gettablestr(tablename,row,7) Code:
getlabelstr(item,"PlateNr") You need all this to modify your If-condition. It should look like Code:
if (comparetext(string1,string2) == 1) { bla bla; } In the second step you can add labels. It's better to add a label with addlabel(item,"name") and then set the value with setlabelnum() or setlabelstr(), depending on whether you want to assign numer or string data. |
The Following 2 Users Say Thank You to Jens Mühlheimer For This Useful Post: | ||
Steven Hamoen (06-05-2012) |
#17
|
|||
|
|||
The PlateNr from col 7 is numerical value , why i should use str to compare?
Quote:
|
#18
|
||||
|
||||
Sorry but your PlateNr is interpreted by Flexsim as a string an not as a number. You can see that if you look in the table because it is outlined to the left and not the right and it doesn't have a decimal point (just as Jens already told you) Also if you double click on a product and look at the labels you can clearly see the different between a string and a number. So you are probably right that "if (gettablenum(tablename,row,7) == getlabelnum(item,"PlateNr"))" doesn't work!
If I look at the Excel file you can also see that it is interpreted as a string and not as number. If you can get it a number in Excel, Flexsim will also see it as a number. |
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
jasonjj (06-05-2012) |
#19
|
|||
|
|||
Fixed num
Thanks,, i have fixed those values to numerical, it can compare now but i see the value for labels like section.. order.. is always fixed for every items of specific plate.
how i can define that it should take the values of these Labels (section..orderNr... etc) from specific row during searching and finding specific plateNr. Last edited by jasonjj; 06-05-2012 at 08:12 AM. |
#20
|
||||
|
||||
I don't understand. You have a lot of rows with the same PlateNr. Currently your code (the for loop in the OnExit of the separator) always takes the first row with the right PlateNr (Because although the loop runs further, the addlabel command doesn't overwrite a label when it already exists)
So if you want that all products that come out have different properties you have to define in your for loop what the other selection criteria are. I guess when looking at your table that the partnumber is also a unique criteria. You know how many parts there are in a platenr so you could make a lable on the Separator, call it CurrentPart and on entrytrigger set this label to getlabelnum (item, "numparts") And change your for loop into something like: Code:
int Counter = 0; for (int row = 1; row <= gettablerows(tablename);row++) // Look through table { if (gettablenum(tablename,row,7) == getlabelnum(item,"PlateNr")) // If correct row was found { //Increase the counter Counter++; //If the counter equals the current part that we are producing set all the labels corrent if( Counter == getlabelnum( current, "CurrentPart") ) { addlabel( item,"OrderNR", gettablenum( "Parts", row, 1)); addlabel( item,"section", gettablestr( "Parts", row, 2)); addlabel( item,"Flatrack ID", gettablestr( "Parts", row, 3)); //And make the CurrentPart 1 smaller inc( label( current, "CurrentPart") , -1 ); //breaks leaves the for loop break; } } } |
The Following 2 Users Say Thank You to Steven Hamoen For This Useful Post: | ||
Jens Mühlheimer (06-05-2012) |
Thread | Thread Starter | Forum | Replies | Last Post |
how to get the last item in separator? | oliver xie | Q&A | 6 | 10-28-2011 08:20 AM |
Simple Separator Question | Anthony Timmiss | Q&A | 1 | 01-25-2010 08:22 AM |
o(Separator, current).v_unpack | Dane Lee | Q&A | 2 | 08-05-2009 02:29 PM |
Problem about Separator | wutian | Q&A | 8 | 06-18-2008 11:58 PM |
[Suggestion] multi tasking combiner/ separator | KelvinHo | Gripes and Goodies | 0 | 05-20-2008 06:48 PM |