imit_model / AnyLogic / UsersManual(AnyLogic)
.pdf
AnyLogic V User’s Manual
17.1.1Defining a dataset
Datasets are defined within active object classes. You usually define datasets graphically in the Project window.
►To add a dataset to an active object class
1.Click the New Dataset
toolbar button, or Choose Insert|New Dataset… from the main menu. The New Dataset dialog box is displayed.
Specify the name of the new dataset, choose the active object class, which will contain the dataset, and click OK.
2.Alternatively, in the Project window, right-click the active object class and choose New Dataset… from the popup menu.
The New Dataset dialog box is displayed.
Specify the name of the new dataset and click OK.
A dataset has the following properties:
Properties
Name – name of the dataset.
Tail size – [optional] maximum number of points the dataset can store.
Phase – if set, the dataset is of phase type.
Timed – if set, the dataset is of timed type. Does not apply to phase datasets.
Smooth – if set, the dataset is of smooth (averaged) type. Does not apply to phase datasets.
Window size – averaging parameter. Applies only to smooth datasets.
Regular intervals – [optional] set of regular intervals for the dataset. Every interval is specified in the form: Lower bound Upper bound Number of intervals, where Lower bound is the lower limit of the intervals, Upper bound is the upper limit of the intervals, Number of intervals is the number of intervals.
Custom intervals – [optional] set of custom intervals for the dataset. Every interval is specified in the form: Lower bound Upper bound Color, where Lower bound is the
© 1992-2004 XJ Technologies http://www.xjtek.com |
377 |
AnyLogic V User’s Manual
17.1.2.3 Smooth timed and non-timed datasets
If you wish to observe values averaged over some period of time (or over some number of samples) preceding the actual value occurrence, you should use a smooth dataset. When you add a point to a smooth dataset, its history (either continuous or discrete) is weighted taking the new point into account, and the averaged value is actually added. The weighting function is exponential, so that the older is the point the less is its weight, see Figure 165.
weight |
Total Σwi = 1 |
weight |
Total ∫wi = 1 |
|
|
|
Window size |
|
|
Window size |
|
|
Σwi = 0.95 |
|
|
∫wi = 0.95 |
|
|
current |
Sample |
|
current |
Time |
Non-timed smooth dataset |
number |
Timed smooth dataset |
|
||
|
|
||||
Figure 165. Weight function of smooth datasets
Smooth datasets have a property Window size, defining the size of history being averaged. In case of timed dataset it is the “backward” time period covering 95% of weight. In case of non-timed dataset it is the number of samples with the total weight of 95%.
The corresponding Java classes are SlidingWindowDataSetT for timed and SlidingWindowDataSet for non-timed datasets. Consult AnyLogic Class Reference for more details.
17.1.2.4 Phase dataset
A phase dataset is used when you wish to record the dependency of one value on another.
For example, you could use a simulation parameter as x-value, and some observable as y-value. Then several model replications with different parameters show how the observable depends on the parameter. A single model replication with the fixed parameter gives just one data point.
© 1992-2004 XJ Technologies http://www.xjtek.com |
379 |
AnyLogic V User’s Manual
dataset samples are not time-persistent. They occur as isolated, discrete points in time, so the mean is simply the sum of individual samples divided by number of samples.
Information calculated by the statistics block can be seen in a dataset inspect window in AnyLogic. Also, the statistics block is accessible via the following API (for more information please consult AnyLogic Class Reference):
Related methods of DataSet
int count() – returns the number of samples added to the dataset. double min() – returns minimum sample added to the dataset. double max() – returns the maximum sample added to the dataset. double mean() – returns the mean value for the dataset.
double deviation() – returns the standard deviation of the dataset.
double meanConfidence() – returns mean confidence interval for the dataset. void reset() – resets the statistical data.
double variance() – returns variance of the samples added to the statistics.
Statistics getStatistics() – returns the statistics block of the dataset.
17.2 Collecting datasets for variables
AnyLogic supports collecting data on variable during the model simulation in a dataset. Samples of variables can be collected automatically from the beginning of the simulation.
►To collect a dataset for a variable automatically
1.Select variable on the structure diagram.
2.In the Properties window, select the Auto collect dataset check box.
If auto collecting is set, whenever you add a variable to a chart window, all the collected data on a variable from the beginning of simulation is displayed. If auto collecting data is not set, data collecting starts only when and if the variable is added to a chart window. See section 11.2.6, “Chart window” for more information on chart windows.
© 1992-2004 XJ Technologies http://www.xjtek.com |
381 |
AnyLogic V User’s Manual
Figure 166. Chart window
Chart window looks as shown in Figure 166. Datasets can be added to a chart window using drag and drop or using the Chart Setup dialog box.
►To add a dataset to a chart window
1.Drag the dataset from the Model Explorer onto the chart window.
►To set up the chart
1.Right-click the chart window and choose Chart Setup… from the popup menu. The Chart Setup dialog box is displayed (see Figure 167).
2.To add a dataset to the chart, double-click the corresponding item in the Variables, parameters and datasets list.
3.To remove a dataset from the chart, double-click the corresponding item in the Axis Y list.
© 1992-2004 XJ Technologies http://www.xjtek.com |
383 |
AnyLogic V User’s Manual
►To specify options of a chart window
1.Double-click the chart window, or
Right-click the chart window and choose Chart Options from the popup menu. The Chart Options dialog box is displayed, as shown in Figure 168.
2.Modify options using the General, Axes, and Datasets pages (description of pages is given below)
3.Click OK to close the dialog box and apply changes.
General page
The General page of the Chart Options dialog box is shown in Figure 168. It is used to specify the chart type and some presentation options.
Figure 168. Chart Options dialog box. General page
Chart types are Scatter, Gantt, and Histogram.
Scatter is a conventional 2D chart with x- and y-axes.
© 1992-2004 XJ Technologies http://www.xjtek.com |
385 |

toolbar button, or Choose
button to the left of the