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 08-28-2008
Vic Li Vic Li is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 6
Thanked 1 Time in 1 Post
Rep Power: 150
Vic Li is on a distinguished road
Default 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  
Old 08-29-2008
Martijn van Oostenbrugge's Avatar
Martijn van Oostenbrugge Martijn van Oostenbrugge is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Posts: 71
Downloads: 12
Uploads: 0
Thanks: 44
Thanked 44 Times in 24 Posts
Rep Power: 268
Martijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to allMartijn van Oostenbrugge is a name known to all
Default

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  
Old 08-29-2008
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

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, y-bar is the mean staytime.
Click image for larger version
Name:	formula.png
Views:	278
Size:	3.4 KB
ID:	417
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 (n-1)
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 = (throughput-1)*lastvariance/throughput 
              + meanchangesqr + sqr(staytime - newstaytimeavg)/throughput;
     setlabelnum(current, "staytimevariance", newvariance);
}

Last edited by Anthony Johnson; 08-29-2008 at 11:25 AM.
The Following 4 Users Say Thank You to Anthony Johnson For This Useful Post:
Vic Li (09-02-2008)
  #4  
Old 09-02-2008
Vic Li Vic Li is offline
Flexsim User
 
Join Date: Mar 2008
Posts: 39
Downloads: 0
Uploads: 0
Thanks: 6
Thanked 1 Time in 1 Post
Rep Power: 150
Vic Li is on a distinguished road
Default

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; 09-02-2008 at 02:38 AM.
  #5  
Old 09-02-2008
Jon Fournier Jon Fournier is offline
Flexsim User
 
Join Date: Apr 2008
Posts: 10
Downloads: 0
Uploads: 0
Thanks: 3
Thanked 40 Times in 7 Posts
Rep Power: 171
Jon Fournier will become famous soon enoughJon Fournier will become famous soon enough
Default

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 i-1, 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  
Old 09-02-2008
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

Hi Jon,

Try to use the trigger End of warmup period.
You will find the trigger under Experimenter - Advanced.

Lars-Olof
  #7  
Old 11-04-2010
Congshi Wang Congshi Wang is offline
Student
 
Join Date: May 2010
Location: Germany
Posts: 58
Downloads: 2
Uploads: 0
Thanks: 48
Thanked 0 Times in 0 Posts
Rep Power: 124
Congshi Wang is on a distinguished road
Default

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  
Old 12-19-2010
Congshi Wang Congshi Wang is offline
Student
 
Join Date: May 2010
Location: Germany
Posts: 58
Downloads: 2
Uploads: 0
Thanks: 48
Thanked 0 Times in 0 Posts
Rep Power: 124
Congshi Wang is on a distinguished road
Default

Hi,

could you please provide a similar formula, just for the content variance?

Thanks

Last edited by Congshi Wang; 12-19-2010 at 04:36 AM.
  #9  
Old 12-22-2010
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

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 (12-23-2010)


Thread Thread Starter Forum Replies Last Post
How to turn on stats history in Vista to use Record object syseo Q&A 1 09-22-2007 01:45 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.