You can observe the current state of an agent during model simulation using inspect window just like you do with variables. The only difference is that you should first enable inspecting for the agent as described below:
Enable inspecting for an agent
By default an inspect window displays the agent's name. However, you can adjust the agent to output information you need by overriding its
- Open the diagram of the agent type.
- Ensure that there is an
drawn. If the agent has no icon, draw it using some shape, say a rectangle, and make this shape a part of agent's icon by selecting the
check box in its properties.
- Enable showing inspect window for this shape on user click. Go to the
section of the shape's properties and type
field. Shapes with the
action enabled will respond to mouse clicks and show inspect windows.
Specify information you want to be shown in the inspect window
- In the
view, double-click the agent type.
- Override the
function of this agent type. Go to the
section of the agent type's properties and enter the following code in the
Additional class code:
// info = ...
Now you can run your model and inspect the state of your agent population during the model simulation.
To open inspect window for an agent population
- Click the icon of the agent population on the presentation.
- The yellow popup box will be shown. If needed, move it by dragging the window title.
- Resize it to the desired size by dragging the lower right corner of the window.
If you want to have a look at a well-engineered inspect window, inspect a block from Process Modeling Library.
Inspect window of Process Modeling Library's Service agent
You can copy the output to the Clipboard for further pasting it to some external application.
To copy the content of the inspect window to the Clipboard
You can close inspect window any time you like.
- Right-click (Mac OS: Ctrl click) in the inspect window and choose
from the context menu.
To close inspect window
Hover the mouse over the title of the inspect window and click the "cross" button
in the upper right corner of the window.