question

Lambert avatar image
0 Likes"
Lambert asked Julie Weller commented

Help modeling probability distribution for number of consecutive totes

Hi, I am trying to model the induction of totes into a conveyor based on a forecasted probability (weight).

So far I am using the following empirical distribution:

1651748862748.png

Now, I would like to add in variability in terms of the number of consecutive totes for the same arc that go into the conveyor.

In other words, I would like to have parameters that increase/decrease the probability of having more/less consecutive totes for the same arc:

for example:

1-4-6-1-3-1-6 vs 1-1-1-4-6-6-3

does anyone have any ideas on how to model this?

In my head the expected behavior would be something like this:

1651749431440.png

Thank you in advance,

Lambert


FlexSim 22.1.1
probability distribution
1651748862748.png (10.9 KiB)
1651749431440.png (41.2 KiB)
5 |100000

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

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Julie Weller commented
The weight give the increased chance of having two consecutive totes on the same arc if you're sampling for each tote.


If you're sampling for a each slug of totes going to an arc, then you can do that in a seperate lookup but then sample less frequently from the the empirical distribution. That then mean the empirical should represent the spread of consecutave totes and not the total spread of totes, meaning you data should be changed to reflect that (if it's the spread of totes currently).

· 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.

Lambert avatar image Lambert commented ·

Thanks Jason

"The weight give the increased chance of having two consecutive totes on the same arc if you're sampling for each tote. "

This makes sense.


How can I then add some variability to the weights defined in the empirical distribution attached to the source of totes?

for example, for arc 1, 15 plus/minus a random probability distribution

1651755185684.png




0 Likes 0 ·
1651755185684.png (25.0 KiB)
Lambert avatar image Lambert Lambert commented ·
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Lambert commented ·

Sorry we missed this.

If you comment and then accept an answer as was the case here - it can disappear from our tracking system. While you require follow-up please do not accept the answer after a follow-up question.

0 Likes 0 ·
Julie Weller avatar image Julie Weller Lambert commented ·

Are you still struggling with this follow up question? If so would you want to post it as a new question? Thanks in advance!

0 Likes 0 ·
Lambert avatar image
0 Likes"
Lambert answered Felix Möhlmann commented

Hi good morning,

could anyone tell me how to add some variability to a Empirical Distribution?

I'd like that with each replication of the simulation it takes different values.

For example, for Arc 1, instead of a fixed 15 weight, i'd like to use Normal (15, 2) that varies with each replication

1652075124174.png


Thank you in advance,

Lambert


1652075124174.png (34.3 KiB)
· 8
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 Felix Möhlmann commented ·

You could set the distribution weights in the model reset trigger and use a global table to store the respective distributions (make sure to 'Assign FlexScript Data' to the table cells).

1652080276185.png

// Reference to distribution table and source table
treenode distributionBundle = Model.find("Tools/EmpiricalDistributions/EmpiricalDistribution1>variables/data");
Table weightsTable = Table("EmpDistWeights");

// Create array of weights based on table
Array weights = Array(weightsTable.numRows);
double sum = 0;
for(int index = 1; index <= weights.length; index++)
{
    weights[index] = weightsTable[index][1];
    sum += weights[index];
}

// Scale to 100% and assign to distribution
for(int index = 1; index <= weights.length; index++)
{
    weights[index] = weights[index]/sum*100;
    setbundlevalue(distributionBundle, index-1, 1, weights[index]);
}

This will of course only yield different results, if the 'Repeat Random Streams' option is inactive or for different replications of the experimenter.

Variable_EmpDistribution_fm.fsm

Please consider posting a new question the next time, if it doesn't directly relate to the topic of the previous one.

0 Likes 0 ·
Lambert avatar image Lambert Felix Möhlmann commented ·

@Felix Möhlmann

Thank you Felix, it seems to work fine except for some totes that do not get anything assigned (arc remains blank)

1652095848826.png

do you know what can be the reason?

updated: seems to be related with the decimal points.

now when I click in generate samples, i get the following error:

1652096621116.png

exception: FlexScript exception: Invalid row identifier forVIEW:/active/EmpiricalDistributionProperties2700133680/GenerateSamples/popup2699292528/BarChart>variables/dumpData at VIEW:/active/EmpiricalDistributionProperties2700133680/GenerateSamples/popup2699292528/BarChart>eventfunctions/getData c: VIEW:/active/EmpiricalDistributionProperties2700133680/GenerateSamples/popup2699292528/BarChart


thank you

0 Likes 0 ·
1652095848826.png (1.0 MiB)
1652096621116.png (41.8 KiB)
Felix Möhlmann avatar image Felix Möhlmann Lambert commented ·

Looks like a bug. I get the same with a fresh model/distribution when changing the data type around a lot.

It seems like the Variant returned by Empirical().get() is not always interpreted as the correct type when assigning it to the bundle that holds the sample data.

1652115770578.png

If I run the same code but cast the Variant as the respective type (...as(double)) it works consistently.

For now I can only offer the workaround to test the distribution 'manually' by writing sample data to a global table, link that to a calculated table and plot it in a dashboard chart.

0 Likes 0 ·
1652115770578.png (95.3 KiB)
Show more comments