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 03-16-2015
Herwina Richelle Andres Herwina Richelle Andres is offline
Flexsim User
 
Join Date: Aug 2014
Location: Philippines
Posts: 13
Downloads: 8
Uploads: 0
Thanks: 9
Thanked 3 Times in 1 Post
Rep Power: 70
Herwina Richelle Andres is on a distinguished road
Default 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
Attached Files
File Type: fsm OE Simulator.4.fsm (167.9 KB, 386 views)
  #2  
Old 03-16-2015
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default 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  
Old 03-16-2015
Herwina Richelle Andres Herwina Richelle Andres is offline
Flexsim User
 
Join Date: Aug 2014
Location: Philippines
Posts: 13
Downloads: 8
Uploads: 0
Thanks: 9
Thanked 3 Times in 1 Post
Rep Power: 70
Herwina Richelle Andres is on a distinguished road
Default

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
Attached Files
File Type: fsm Send to Port By Percentage.fsm (17.0 KB, 353 views)
  #4  
Old 03-16-2015
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 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);
}
The flow function Send To Port has got as the return value the result of dempirical-distribution referrenced to the local table in the label.
Code:
double value = dempirical(label(current,"Flowtable"),1);
return value;
Jörg
Attached Files
File Type: fsm DempiricalPartOfGlobaltableByCopyToLabel.fsm (39.1 KB, 369 views)
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


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.