PDA

View Full Version : Recorder Histogram Problem


Bennett Foster
07-16-2008, 10:44 AM
When using the recorder to generate a histogram, the value on the Y-axis (number or "hits" recorded for the tallest bar in the histogram) was way too large. Discussing this with Alex Christensen, he confirmed that there's a problem - there's a histogram entry every time there's an event in the model!

Alex supplied a work-around (which I haven't had time to implement yet).

Alex Christensen
07-17-2008, 12:30 PM
My solution was to use a global table to keep track of the histogram data, then when I want to add a hit to the histogram, I just increment the proper row with something like this (from the OnExit trigger in the sink):/**Custom Code*/
treenode item = parnode(1);
treenode current = ownerobject(c);
int port = parval(2);

double throughtime=time()-getcreationtime(item);
double bucketsize=15;//this is manually adjusted to fit the data
int row=2+throughtime/bucketsize;//2 because 0 should go in the first bucket, which is row 2 because row 1 is underflow
inc(gettablecell("myhistogram",min(row,12),1),1);//12 because there are 10 buckets plus underflow and overflow
. Then, I used a modified VisualTool from this post (http://www.flexsim.com/community/forum/showthread.php?t=509) to display the table if there are nonzero values in it. I clear the global table onReset (Checkbox in global table editor).

Brandon Peterson
07-18-2008, 08:40 AM
Bennet,

Can you post the model you were having problems with? It may be something more simple than a bug.

Brandon