Shariff Ghanem
Shariff Ghanem

Reputation: 75

How do I create monte carlo results on a graph using parameter variation experiment on anylogic?

I am working on the evacuation time of pedestrians by running 100 runs using monte carlo. I have trouble creating the graphs and am very confused in the steps. Something is missing and I am not sure what it is.

I have created a parameter variation experiment page and included a Histogram2D data and a graph from analysis but I don't know how to read the data I want from the main.

Below image is the data I am trying to acquire from the timeMeasureEnd which isn't linked yet. enter image description here

I use the code root.timeEnd but get this error as shown below enter image description here

Upvotes: 0

Views: 417

Answers (1)

Florian
Florian

Reputation: 972

You can directly access the timeMeasureEnd's internal dataset: timeMeasureEnd.dataset. See the AnyLogic example model Measuring Length of Stay, referenced in the documentation.

As for your error, your statement gets interpreted as a variable declaration. As soon as you put some useful code in there it works, eg. a simple assignment to a local dataset in your Experiment class:

dataset = root.timeMeasureEnd.dataset;

Experiment Dataset

To save the longest measured time after each run:

  • add a dataset, deactivate update automatically
  • add a integer variable iteration to save the current iteration index
  • use the following in After Simulation run code:
iteration++;
dataset.add(iteration,root.timeMeasureEnd.dataset.getYMax());

enter image description here

Upvotes: 1

Related Questions