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
|
|||
|
|||
Send to Port by Percentage - Writing Values
Hi everyone,
Good day! I am building a model with 500+ objects and I wish to write to each queue of the probabilities for send to port. Is there a way to write the percentage values in one global table and use that as a reference for all? I have tried using dempirical but it requires to create one global table per queue as there should be a total of 100 per column. See attached model. Thank you for your help! Best, Herwina Richelle Andres |
#2
|
||||
|
||||
Using a label to point to a global table row
The way I normally do it is using one global table with a row for each object and several columns for the information. A label on the object is used to point to the row where the label is just the row number. The effort is once to define the label on each object, which is manual work, but you can use a script windows with some code to define the label and set the row number.
If the objects are in the right order in the tree, what they always should, you can use code like the follwing in a script window // SELECT ALL QUEUES AND SET LABEL ROW NUMBER TO COUNTER int iCounter = 0; forobjecttreeunder(model()) { if(comparetext("Queue", getname(first(classes(a))))) { iCounter = iCounter + 1; addlabel(a,"RowNumber",iCounter); } } Now you can use this label information to point to the global table. gettablenum("GlobalTable",getlabelnum(current,"RowNumber"),1) I hope you got the idea. Good success with your model.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
#3
|
|||
|
|||
Hi Tom,
Thank you for helping me out on this one. Unfortunately, the objects I need to label on are not arranged consequentially on the Tree. Therefore, I have labeled the objects manually and applied your suggested format for the global table but it did not work. Best, Herwina Richelle |
#4
|
||||
|
||||
If you still interested in an emprical-distribution, you find an attached model.
I have written the source code to the OnReset-trigger of the involved objects. You can place the code in an user command, too. The Method copies a part of your globaltable to a local table in your object, which is stored in a label. This empirical-distribution uses this local table. Perhaps you have read about the empirical distributions in the manual. The variant dempirical suits best to distribute flowitems. The reset code creates the label, place a table of defined size and copies the values from the global table: Code:
/**Custom Code - copy part of a global table to a label*/ treenode current = ownerobject(c); treenode involved = current; string labelname = "Flowtable"; treenode emp_table=assertlabel(involved,labelname,DATATYPE_NUMBER); int startrow = 0; // previous row in the global table of sub matrix int rel_endrow = 3; // relative last row from the global table settablesize(emp_table,rel_endrow,2,DATATYPE_NUMBER); // creates a table in the label node // copying value to the local table for (int row = 1; row <= rel_endrow; row++) { int base_row =row+startrow; double columnvalue1=gettablenum("GlobalTable1",base_row,1); settablenum(emp_table,row,1,columnvalue1); double columnvalue2=gettablenum("GlobalTable1",base_row,2); settablenum(emp_table,row,2,columnvalue2); } Code:
double value = dempirical(label(current,"Flowtable"),1); return value; |
The Following User Says Thank You to Jörg Vogel For This Useful Post: | ||
sagar bolisetti (03-16-2015) |
Tags |
david chan |
Thread | Thread Starter | Forum | Replies | Last Post |
Send to Port By Percentage | Herwina Richelle Andres | Flexsim Student Forum | 6 | 03-17-2015 09:58 PM |
Send flowitems to different ports by percentage! | DilAmaya | Container Terminal (CT) Library | 7 | 12-26-2013 05:13 AM |
FlexTips: Send To Port By Label | Markus Cueva | FlexSim Media | 0 | 09-09-2013 03:19 PM |
FlexTips: Send To Port By Expression | Markus Cueva | FlexSim Media | 0 | 09-05-2013 10:02 AM |
Send To Port | Liang Wen Yin | Q&A | 2 | 08-11-2012 03:20 AM |