ATTENTIONThis FlexSim Community Forum is readonly. 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, mobilefriendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threadedconversationstyle forum like the one below, so be sure to read our Answers Best Practices. 
flexsim.com 

FAQ  Downloads  Calendar  Search  Mark Forums Read 
Q&A Using Flexsim and building models 

Thread Tools  Display Modes 
#1




Record object variance staytime
statistics>experimenter>performance measures, there are no command can record variance.
I want to record the performance measures  "variance",so I want to create a new user command, some thing like "stats_staytimevar". The flexsim can record the object average staytime, so I think my problem can easy to recover.But I don't know how to write down the code. please give me a hand,I will appreciate your help. 
#2




The experimenter does that for you. For the performance measures you give in it determines for each scenario the mean of the replications, the variance and shows you confindence intervals. After you've run the experimenter you can view the results at performance measures tab. There you can Generate the PFM report.
Martijn 
#3




I think what you mean is you want the variance of an object's staytime for one replication, instead of getting the variance of a staytime performance measure across multiple replications. To calculate this incrementally as you run your model, I got a cool formula from Dimitris Pachakis at Moffatt and Nichol. Here's the formula, where s^2 is the sample variance, n is the throughput of an object, y is the staytime of a flowitem that just exited, ybar is the mean staytime.
Here's some code that implements it. This should be implemented in the exit trigger of the object whose staytime variance you want to record. Code:
double throughput = getoutput(current);// the throughput before exit (n1) double staytime = time()  get(stats_lastmovetime(item)); double oldstaytimeavg = get(stats_staytimeavg(current)); double staytimetotal = oldstaytimeavg * throughput; double newstaytimeavg = (staytimetotal + staytime) / (throughput+1.0); if(throughput >= 1) { double meanchangesqr = sqr(newstaytimeavg  oldstaytimeavg); double lastvariance = getlabelnum(current, "staytimevariance"); double newvariance = (throughput1)*lastvariance/throughput + meanchangesqr + sqr(staytime  newstaytimeavg)/throughput; setlabelnum(current, "staytimevariance", newvariance); } Last edited by Anthony Johnson; 08292008 at 11:25 AM. 
The Following 4 Users Say Thank You to Anthony Johnson For This Useful Post:  
Congshi Wang (12192010), LarsOlof Leven (08292008), Pablo Concha (09012008), Vic Li (09022008) 
#4




Hi,Anthony Johnson
you get my point and thanks for the cool formula.you explain clear. Would you can provide other codes for me ? 1.recode the variance of content in one replication experiment? 2.the original code of these commands: stats_staytimeavg , stats_contentavg, stats_staytimemax. I am beginner for the flexsim and want to acquire mastery of flexsim, so I want to see more details in the flexsim. thank you very much Last edited by Vic Li; 09022008 at 02:38 AM. 
#5




Is there a way to find out whether or not the simulation time is passed the specified warmup period in a run? Only because if I wanted to collect variance data on part stay times I would want to make sure I'm only collecting the data after the warmup time has elapsed...
I learned that the staytimes of parts in a simulation model are usually not independent, identically distributied (IID) and so can't be validly analyzed within a single run. The reasoning was that the staytime of part i is usually affected by the staytime of part i1, and so part i is dependent on part i  1. Then I was told that pretty much all stat tools used for analyzing simulation data variance had to assume the observations were IID, and so we couldn't use staytime variance for a part type in a single run, unless you can prove that the observations are IID. Otherwise we just make multiple runs where we can assume the runs are IID. You can see a discussion of this in Averill Law's simulation textbook, 4th edition, chapter 4, example 4.17 (pg. 224). Or you can look at the Banks, Carson, Nelson & Nicol 3rd Edition of Discrete Event System Simulation, section 11.5.2 (pg.426) 
#6




Hi Jon,
Try to use the trigger End of warmup period. You will find the trigger under Experimenter  Advanced. LarsOlof 
#7




Hi Anthony,
is it possible to apply this formula to a group of objects to get the throughput time variance of that group? Thanks! Congshi 
#8




Hi,
could you please provide a similar formula, just for the content variance? Thanks Last edited by Congshi Wang; 12192010 at 04:36 AM. 
#9




Sorry, I don't really know of a great formula for that. Tracking variance on the content seems like a weird thing to track, though, because each sample is not independent of other samples, and I don't know how you'd figure weighting into the equation, i.e. staying at one content sample for longer results in a higher weight for that sample.

The Following User Says Thank You to Anthony Johnson For This Useful Post:  
Congshi Wang (12232010) 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to turn on stats history in Vista to use Record object  syseo  Q&A  1  09222007 01:45 AM 