Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

imit_model / AnyLogic / UsersManual(AnyLogic)

.pdf
Скачиваний:
141
Добавлен:
06.06.2015
Размер:
4.28 Mб
Скачать

AnyLogic V User’s Manual

Note that while items in the Project window are classes, items in the Model Explorer are instances.

Figure 135. Model Explorer

To open the Model Explorer of the root object

1.Click the Model Root Object toolbar button, or Choose View|Model Root Object from the main menu.

If you select an item in the Model Explorer, the Properties window displays the inspect window of the item. The inspect window shows the item’s inspect string obtained from the model. In addition, if the selected item is an active object, the Properties window displays the log window.

You can open more explorers having different objects at roots of their trees. The new Model Explorer displays the subtree of the object the explorer is opened on. This is a way of shifting the Model Explorer base along the object hierarchy. There is also a backward

© 1992-2004 XJ Technologies http://www.xjtek.com

267

Chapter 11. Running and observing a model

operation: the Model Explorer can go up through the object hierarchy until the root object is met.

To explore an active object in a new Model Explorer

1.Right-click the active object in an existing Model Explorer and choose Explore from the popup menu.

To shift the Model Explorer up one level

1.Right-click the Model Explorer and choose Up from the popup menu.

The Model Explorer can show a large set of items: active objects, ports, variables, parameters, statecharts, datasets, threads, chart timers, chart events. Sometimes it is desirable to hide some of them. AnyLogic allows the user to choose what to show and what to hide.

To show/hide items

1.Right-click the Model Explorer and choose the corresponding item from the Hide Items item of the popup menu, e.g. choose Hide Items|Parameters to show/hide parameters.

To show/hide behavior items (statecharts, threads, events, and timers)

1.Right-click the Model Explorer and choose Hide Items|Behavior Items from the popup menu.

To show/hide structure items (objects, ports, variables, parameters, and datasets)

1.Right-click the Model Explorer and choose Hide Items|Structure Items from the popup menu.

To show/hide all items except objects

1.Right-click the Model Explorer and choose Hide Items|All Except Obejcts from the popup menu.

268

© 1992-2004 XJ Technologies http://www.xjtek.com

AnyLogic V User’s Manual

Every item in the Model Explorer has a set of actions associated with it, accessible through the item’s popup menu. For example, an encapsulated object can be explored in a new Model Explorer, its structure diagram, log, and inspect windows can be opened, and a breakpoint can be set on it.

11.2.1.1 Modifying variables and parameters

You can modify parameters and variables of active objects from the Model Explorer.

To modify a variable/parameter

1.Double-click the variable/parameter, or

Right-click the variable/parameter and choose Modify from the popup menu. The Modify dialog box is displayed.

2.Type a new value in the Enter new value edit box.

3.Click OK.

11.2.1.2 Color highlighting of model items

Objects displayed in the Model Explorer (active objects, ports, threads, timers, etc.) may be involved in steps executed by the simulation engine. For example, an event step may be associated with a timer expiry. Such shapes are highlighted in the Model Explorer to help you to locate the current activity within the model.

The default highlight colors and their meanings are given in the table below. You can change the default color scheme using the Colors page of the Options dialog box.

Item

Color

Status

 

(default)

 

 

 

 

Timer

Red

Chosen. Will expire at this step.

 

 

 

Thread

Red

Chosen. Will advance at this step.

 

 

 

Statechart

Red

Chosen. One of the statechart’s transitions is

 

 

chosen.

 

 

 

© 1992-2004 XJ Technologies http://www.xjtek.com

269

Chapter 11. Running and observing a model

Table 17.

Please note that an active object is highlighted only if an activity takes place exactly at its own statecharts, timers, or threads. The activity of an encapsulated object does not affect highlighting of its parent objects.

11.2.2Animated structure diagram

The animated structure diagram window, see Figure 136, visualizes the structure diagram of an active object. It looks like the structure diagram editor, but editing is not allowed and color animation, breakpoints, and other viewer features are enabled.

While the structure diagram editor window corresponds to an active object class, the animated structure diagram window corresponds to an instance of an active object class.

Figure 136. Animated structure diagram window

The animated structure diagram displays chart timers only, whereas the Model Explorer displays all currently existing timers: chart timers as well as static and dynamic timers.

270

© 1992-2004 XJ Technologies http://www.xjtek.com

AnyLogic V User’s Manual

You can open the animated structure diagram from the Model Explorer, or from another animated structure diagram.

To open the animated structure diagram of an active object from the Model Explorer

1.Double-click the active object in the Model Explorer, or

Right-click the active object in the Model Explorer and choose Structure from the popup menu.

To open the animated structure diagram of an encapsulated object from the animated structure diagram of a parent object

1.Double-click the encapsulated object, or

Right-click the encapsulated object and choose Structure from the popup menu.

To open the animated structure diagram of a parent object from the animated structure diagram of an encapsulated object

1.Right-click the empty area of the animated structure diagram and choose Up to Parent from the popup menu.

You can get the image of the animated structure diagram (including color highlighting) on the Clipboard:

To copy the image of the animated structure diagram on the Clipboard

1.Click on the diagram, and choose Draw|Copy Image from the main menu, or Right-click the empty area of the diagram and choose Copy Image from the popup menu.

Every shape on the animated structure diagram has a set of actions associated with it, accessible through the shape’s popup menu. For example, an encapsulated object can be explored in the Model Explorer, its structure diagram, log, and inspect windows can be opened, and a breakpoint can be set on it.

To explore an active object in the Model Explorer

1.Right-click the active object and choose Explore from the popup menu.

© 1992-2004 XJ Technologies http://www.xjtek.com

271

Chapter 11. Running and observing a model

11.2.2.1 Modifying variables and parameters

You can modify parameters and variables of active objects from the animated structure diagram.

To modify a variable/parameter

1.Double-click the variable/parameter, or

Right-click the variable/parameter and choose Modify from the popup menu. The Modify dialog box is displayed.

2.Type a new value in the Enter new value edit box.

3.Click OK.

11.2.2.2 Color highlighting of model items

Objects, involved in steps executed by the simulation engine are highlighted in animated diagrams. The default highlight colors and their meanings are given in the table below.

Item

Color

 

Status

 

(default)

 

 

 

 

 

 

Active object

Red

 

Chosen. One of the statecharts or timers of this

 

 

 

active object is chosen.

 

 

 

 

Chart timer

Red

 

Chosen. Will expire at this step.

 

 

 

 

Statechart icon

Red

 

Chosen. One of the statechart’s transitions is

 

 

 

chosen.

 

 

 

 

 

 

Table 18.

Please note that an active object is highlighted only if an activity takes place exactly at its own statecharts, timers, or threads. The activity of an encapsulated object does not affect highlighting of its parent objects.

272

© 1992-2004 XJ Technologies http://www.xjtek.com

AnyLogic V User’s Manual

11.2.2.3 Animating active objects

If you have developed some icon for an active object (see section 1.5.3, “Active object icon”), each time an instance of this object appears as an encapsulated object on an animated structure diagram, this icon is displayed. Since you can link properties of the shapes your icon is constructed from to active object data, you can animate active objects on the animated structure diagram.

11.2.3Animated statechart diagram

The animated statechart diagram window, see Figure 137, visualizes a statechart running in the model. It looks similar to the statechart diagram editor, but editing is not allowed and color animation, breakpoints, and other viewer features are enabled.

Figure 137. Animated statechart diagram

You can open the animated statechart diagram from the Model Explorer or from the animated structure diagram.

To open the animated statechart diagram of a statechart

1.Double-click the statechart, or

Right-click the statechart and choose Statechart from the popup menu.

© 1992-2004 XJ Technologies http://www.xjtek.com

273

Chapter 11. Running and observing a model

To open the animated structure diagram of a parent object from the animated statechart diagram

1.Right-click the empty area of the animated statechart diagram and choose Up to Parent from the popup menu.

You can get the image of the animated statechart diagram (including color highlighting) on the Clipboard:

To copy the image of the animated statechart diagram on the Clipboard

1.Click on the diagram, and choose Draw|Copy Image from the main menu, or Right-click the empty area of the diagram and choose Copy Image from the popup menu.

Using the animated statechart diagram window you can set breakpoints on states and transitions of statecharts.

11.2.3.1 Color highlighting of model items

Objects involved in steps executed by the simulation engine are highlighted in the animated statechart diagram. The default highlight colors and their meanings are given in the table below.

 

Item

Color

Status

 

 

(default)

 

 

 

 

 

 

State

Red

Active. The control is at this state. If this is a

 

 

 

composite state, the exact location of control is

 

 

 

in one of the inner simple states.

 

 

 

 

 

Transition

Red

Chosen. Will be taken at this step.

 

 

 

 

 

Transition

Blue

Enabled. Could be taken at this step, but some

 

 

 

other event has been chosen. This can be

 

 

 

changed using the events window, see section

 

 

 

14.2, “Viewing and modifying AnyLogic

 

 

 

events”.

 

 

 

 

274

 

© 1992-2004 XJ Technologies http://www.xjtek.com

AnyLogic V User’s Manual

Table 19.

11.2.4Inspect window

You can display the information about the current state of a model element in the element’s inspect window. More precisely, the inspect window displays the inspect string associated with the object. Some objects (datasets, variables) have hard coded inspect, see Figure 138. Inspect strings for active objects, statecharts and ports can be set manually.

Figure 138. Inspect window of a dataset

The inspect window appears in the Properties window when you select a model item. Also, a standalone inspect window can be opened from the popup menu of an item.

To open the inspect window of a model item

1.Right-click the item in the Model Explorer or on the animated structure diagram and choose Inspect from the popup menu.

11.2.4.1 Defining custom inspect

You can define custom inspect strings for an active object, a port and a statechart. This is done using the following API (for more information, please consult AnyLogic Class Reference):

© 1992-2004 XJ Technologies http://www.xjtek.com

275

Chapter 11. Running and observing a model

Related method of ActiveObject

void setInspect( java.lang.String value ) – sets the inspect string for the active object.

Related method of Port

void setPortInspect( java.lang.String s ) – sets the inspect string for the port.

Related method of Statechart

void setThreadInspect( java.lang.String value ) – sets the inspect string for the statechart.

11.2.5Log window

The log window, see Figure 139, displays textual output of a model (global log) or of an individual active object. The log is displayed as read-only text which can be copied onto the Clipboard. The log window of an active object appears in the Properties window when you select an active object. Also a standalone log window can be opened from the popup menu of an active object.

276

© 1992-2004 XJ Technologies http://www.xjtek.com

Соседние файлы в папке AnyLogic