Object parameters: static, dynamic and code

Parameters of all AnyLogic library objects (Process Modeling Library, Pedestrian Library, Rail Library and Road Traffic Library) are of three types:

Examples

Parameter type

Object

Parameter

Valid value

  Static

Queue

Capacity

15

Delay

Agent location pathDelay

Dynamic

SelectOutput

Condition

agent.type==1

PedServices

Delay time

2.5 + uniform( 2, agent.complexity * 60 )

Code

Sink

On enter

dataset.add( time() - agent.timestamp );
serviced++;

TrainSource

Car setup if( carindex == 0 ) {
    car.setShape( locomotive );
}
else {
    car.setShape( boxCar );
}

How to distinguish parameters of different types

That's the way you can distinguish them.

Small triangle indicates that you can switch between different controls and an edit field.

In Library Reference Guides both dynamic have [dynamic] label, and code parameters have [code] label. The code parameters have void type (see the Syntax: line in the parameter description) and commonly their names start with On....

Local variables

Either in expressions of dynamic parameters and in code of code parameters you can use local variables. For example, in Process Modeling Library the most common one is agent. It refers to the current agent for which the expression/code is evaluated. The analogous local variable ped in Pedestrian Library refers to the current ped, in Rail Library you can see variables train, track, etc.

You can see the list of available local variables by clicking in the field and hovering the mouse over the bulb icon in the top left corner of the property field.