question

Allen Greenwood avatar image
0 Likes"
Allen Greenwood asked Michael D11 published

Value in an Empirical distribution

How to get the value of a particular row and column in an Empirical distribution table? Seems like it should be able to be referenced like a global table but that doesn't seem to work.

FlexSim 21.2.2
flexsim 21.2.2empirical distribution
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Michael D11 published

The data of an empirical distribution is saved in a treenode containing bundle data in the tree of the respective "empirical distribution" object.

Values in it can be accessed with the "getbundlevalue" command.

  1. // Get reference to the node containing the data -
  2. // replace "EmpiricalDistribution1" with the name of the distribution
  3. treenode bundle = Model.find("/Tools/EmpiricalDistributions/EmpiricalDistribution1>variables/data");
  4.  
  5. // Assign value to variable
  6. double val = getbundlevalue(bundle, <row>, <column>);

Important note: The rows ("entry") and columns ("field") of bundles are 0-indexed.

1631103050675.png


1631103050675.png (22.4 KiB)
· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Ryan Clark avatar image
0 Likes"
Ryan Clark answered Joerg Vogel commented

Hello @Allen Greenwood,

That's not quite how Empirical Distributions work. They work like using any other statistical distribution: you define the parameters of the distribution and FlexSim outputs a random value that fits the distribution every time the distribution is accessed. The Empirical Distribution works the same way, except you manually define the parameters.

Does that answer your question?

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.