FAQ -> How To...

This document lists questions that were frequently asked by our customers along with solutions.

If you have searched for the solution of your problem and found that it is still neither mentioned in AnyLogic Help, and in this F.A.Q., feel free to contact our technical support group using the  Get Support toolbar button.

AnyLogic Support Team will gladly help you to solve all your problems, either technical (e.g. my model does not compile successfully, throwing out an error) and modeling ones (e.g. what modeling approach to use to solve my problem?)



Process Modeling Library

System Dynamics


Charts and datasets

Statecharts and events

Execution control



Pedestrian Library

         Road Traffic Library


How do statecharts differ from action charts and flowcharts?

In AnyLogic we use diagrams that look similar (have boxes connected with arrows), but have different meaning, or semantics. For instance: statecharts, action charts, process flowcharts, and stock and flow diagrams. It is worth considering the difference between these diagrams:

Statecharts define internal states, reactions to external events, and the corresponding state transitions of a particular object: a person, a physical device, an organization, a project, etc. The (simple) states of the statechart are alternative: at any given moment in time the statechart is in exactly one simple state.

Action charts are a graphical way to define algorithms or calculations. The arrows define the control flow for a calculation. The action chart does not persist in time: it executes logically instantaneously from start to end, and it does not have a notion of state. Action chart can be considered as a graphical form of a Java function.

Process flowcharts (composed of the Process Modeling Library objects) define sequences of operations performed over entities. During the simulation there may be multiple entities in different places of a flowchart, so the “state” of the flowchart is actually spread across the whole diagram.

Stock and flow diagrams are a fundamental part of system dynamics models. Stocks are accumulations and the state of the system is defined by the values of all stocks. Compared to statecharts, all stocks and all flows are simultaneously active.

How to change the size of the model window?

By default, model window has size 1000*600 pixels. However, you can adjust it as required by resizing the frame.

How to set up model parameters from the simulation page before launching the model? 

You can add controls onto presentation of your experiment and bind them to the parameters you want to modify. 

How-To video: Setting up parameters from the experiment page

 To add controls modifying model parameters onto simulation experiment's presentation

  1. Let's study this by the example of our "Wandering Elephants" example model. You can see that this model has the parameter NumberOfElephants, defining the number of elephants.  Let enable users to set up this parameter interactively from the simulation presentation page.
  2. First, we need to add a variable and bind it to the parameter we want to adjust.
  3. Open the diagram of the Simulation experiment.
  4. Add elephants variable of type int. Specify the variable's Initial value50.
    Since this variable is added for binding purposes only, we recommend to place it beyond the bounds of the model frame.
  5. Add a  slider to vary number of elephants. Specify elephants as the slider's Default value. Specify the Action of the slider:
    elephants = (int)value;
  6. On the General properties page of the experiment, specify elephants as the actual value of the parameter NumberOfElephants
  7. Run the experiment and play with the slider. You will see that the model gets the parameter value you have specified on the experiment presentation page. 

How to get current model time value? 

You can get current model (logical) time using the function time()

My model stops after simulating 100 time units. How can I set another stop time?

Simulation stop time is specified on the Model time page of the experiment you are currently working with. 

By default, model simulates 100 model time units and then stops. 

How can I find an element on the diagram?

If for some reason you cannot find some element on the graphical diagram, use the Projects view. Expand the corresponding branch of the agent type or experiment in the Projects view tree and find the required element in the tree branch. Then double-click it: this selects the element in the diagram and centers the diagram, so the element appears in its center. 

How to know the current mouse coordinates in the graphical editor?

The current mouse coordinates in the graphical editor are displayed in AnyLogic statusbar:

Why some palette elements have  icon? What does it mean?

The pencil icon  drawn near a palette element means that this element supports drawing mode. Drawing mode is the additional way of adding elements onto the diagram in addition to common drag'n'dropping.

When you drag an element onto the diagram, you always get the shape of the predefined size and form. But sometimes you may want to draw a shape of the required form at once. In this case you should use the drawing mode.

To activate the drawing mode, double-click the element in the Palette. The element icon should turn to :

Now you can draw a shape in the graphical editor using some common set of actions. However, these actions slightly differ for different elements:

State, Rectangle, Rounded Rectangle, Oval, Line

Drag to the graphical editor where you want to draw the shape. Stop dragging when you've got the shape of the required form and size.

Connector, Transition, Polyline, Curve, Path, GIS Route, Railway Track, Road, Bulk Conveyor Belt, Pipe, Wall

Successively draw points of a shape by clicking at the required points on the diagram. Double-click to place the end point and finish.

How can I refer to the top-level agent?

Each agent, living in top level agent-environment, has a link to it. You may find the visual non-removable link on the agent diagram, above the X-axis.

If the top-level agent type name is Main, the name of the link is main.

In this case you are able to refer to the top level agent by name of this link, i.e. main

How can I pass a certain value to the standalone application as a command line argument?

To pass command line arguments to your standalone application you should simply specify the space-separated list of argument values (in the case of Windows, you type it in the application's .bat file, after the enumeration of all required JAR files), e.g.:

25 107.8 "useful text"

Or, in the case you are the author of this standalone application, you can specify these values in the advanced Command-line arguments property of the experiment.

To capture these values in the model, please use the function getCommandLineArguments() of an experiment.

This function returns an array of Command-line Arguments passed to the standalone application. To get, say, the first argument from the list, you can call getCommandLineArguments()[0], to get the second one - getCommandLineArguments()[1], etc.

Please note that the function will return the values of type String. You may parse numbers from String using these functions: Integer.parseInt(), Double.parseDouble()

This "capturing code" can be placed in e.g. experiment's Initial experiment setup property.

How can I distribute my models among other people in a standalone way without need to install AnyLogic?

Since AnyLogic model is a Java application itself, it could be used as standalone application. For this purpose, AnyLogic Professional has a special feature allowing a user to export a model as a java application. To export a model, select it in the Projects view, choose Export from the File menu, then follow the instructions of the wizard. 

In AnyLogic PLE and AnyLogic University Researcher, this option is not available and stand-alone model usage is prohibited by the License Agreement. 

Is it possible to open some external application (e.g. Notepad) from AnyLogic model? How?

Yes, you can open external application. The code below opens file.txt text file in Notepad application:

try {
    String link = "file.txt";
    Runtime rt = Runtime.getRuntime();
    Process pr = rt.exec("c:\\Windows\\notepad.exe"+" "+link);

catch (java.io.IOException e) {

Can I add sound effects into my model?

Yes, you can use some third-party Java library. The following model demonstrates how to do it (to properly add a library's JAR file refer to the Adding External Java Classes article). The sound is played when the user clicks the button at the model runtime. Please note that Java code that plays the sound is invoked in a separate Java thread. This enables doing simulation and playing the sound simultaneously.

Demo model: Model with Sound Effect

Is it possible to open a presentation of some agent on clicking the button on Simulation presentation?

Yes, to implement this, you need to add a button and type the following Java code in the Action of this button: 


Here top-level agent is named Main. Main contains agent named company. Click on the button will open the presentation of company, not the presentation of Main.

How can I implement Student t-distribution in AnyLogic?

Student's t-distribution can be synthesized using normal and chi-square distributions. Both of them are implemented in AnyLogic.

Is it possible to rotate icons of agents?

Some block based simulation platforms have block-flip and block-rotation features, in order to get more realistic simulation diagrams. Is there some way to rotate icons in AnyLogic?

There is no way to rotate icons of agents in AnyLogic. If you want to improve your model appearance, please use bent connectors (this approach is widely used in our demo models).

Where should I place comments so that they will get into my library's Javadoc?

I am currently developing a library in AnyLogic. Since I noticed that Javadoc documentation could be generated, I decided to integrate it within the library. Where exactly would I specify the Javadoc comments?

If you want to add some comments for library element so that they will get into the library's Javadoc, you should type the required text on the Description property page of this particular element.

I cannot find Numeric Methods settings in the experiment properties.

Numerical Methods settings moved to the model properties.


How to draw triangles and polygons?

You can draw triangles and polygons with the polyline shape. Select the popyline's Closed property, and optionally change its Fill color.

How can I add a shape on the presentation at runtime?

Shape myShape can be dynamically added onto presentation of some agent by calling the function presentation.add(myShape)

My shape rotates dynamically around its upper left corner, but I want it to be rotated around its centre. Can I implement this?

When you rotate a shape, it rotates around its origin of coordinates. So, if you want your shape to be rotated around its centre, you should anyhow make the centre of the shape the origin point. This can be done using a group

First, you should add your shape to a new group (right-click (Mac OS: Ctrl+click) the shape and choose Grouping|Create a group). This creates a group at the centre of your shape and adds your shape to this group. 

Then you should go to the Dynamic properties of this group and type your dynamic expression for rotation in the Rotation field. Now all contents of this group will be rotated around its origin point.

And finally you should remove the expression from the dynamic field Rotation of your shape since now the rotation is defined in the group properties.

Can I dynamically change shape's position in stacking order at model runtime?

For the time being, it seems to be impossible. But you can play with visibility of the shapes to create the required dynamic presentation.

How to get the coordinates of the mouse click on the model presentation?

Please have a look at the given demo model. This model catches (and displays) the mouse coordinates when the user clicks on the presentation at the model runtime. 

The implementation is the following: a rectangle is drawn on the diagram. When the user clicks on the rectangle, the code of its On click dynamic parameter is executed. The mouse coordinates are available there as clickx and clicky

Demo model: Getting Mouse Coordinates

How to add a clickable URL onto the model presentation?

You can create a button on the animation, and then add the following code to its Action:


If you press that button, your default browser starts and opens the specified website (in this example it opens The AnyLogic Company website).

Can I add a scrollbar on my presentation?

Please look at the noted demo model. It demonstrates one of possible implementations of scrollable presentation area. 

Demo model: Scrollable Presentation

You can see a set of navigation buttons and the function named scrolling on the presentation of Main. When the user clicks some navigation button, the presentation area is scrolled in the corresponding direction. The navigation buttons stay on the same positions regarding the left corner of the presentation area. 

To understand the mechanism, take a look at On click dynamic property of any navigation button - you'll see a call of scrolling function there. Please refer to the code of scrolling function for implementation. This function takes two arguments - values of scrolling offsets. The first line of code moves the group of navigation buttons so that they look staying on the same position. The second one moves the content of the model window aside according to the given scrolling offsets.

Process Modeling Library

How can I count agents passed through the Process Modeling Library object?

You should use the function count(). For example, if you have source object and want to know how many agents left its output port, type source.count() 

How to add some custom attributes to the agent?

Create new agent type and add the required parameters, and variables on the graphical diagram of the agent type.

How to control the process of agent creation? I want to create agents in some particular moments of time.

Source object has a set of different agent generation modes. If you want to control moments of agent generations, choose Manual (call inject() function) one. 

To generate some agents in this mode, you will need just to call the function source.inject(some_value);

where some_value is the number of agents you want to generate at the current moment.

You can call this function e.g. in actions of events, transitions, etc. whenever you need.

How can I measure agent's "time in system" or "length of stay"?

Process Modeling Library contains a pair of objects (TimeMeasureStart and TimeMeasureEnd) measuring the time the agents spend between two points in the flowchart, such as "time in system", "length of stay", etc.

Demo model: Measuring Length of Stay

I need resources that work according a timetable: start working at 09:00 and finish at 18:00.

To implement this, you should define the schedule. Then you should choose By schedule in the Capacity defined parameter of your ResourcePool object and specify the name of this schedule in the Schedule field below.

Please refer to the given demonstration model for the implementation.

Demo model: Implementing Work Shifts for Resources

Can I change my agent shape when it is in some particular block of Process Modeling library?

Please have a look at the Changing Agent Shape model. The model demonstrates how to change agent's animation shape  when it is in some particular flowchart block.

Here we have agent type Box. It contains two different animation shapes placed in the same place (centered at the the axis origin piint): boxOpened, and boxClosed.

By default boxClosed is visible, while for boxOpened we set Visible: no.

So, agents entering the first conveyor are displayed as closed boxes. Entering the second conveyor, the downstreamConveyor On enter code action is executed.

There we make the shape boxClosed invisible: agent.closedBox.setVisible(false);

And vice versa make the shape openedBox visible: agent.openedBox.setVisible(true);

To be able to access Box attributes in a simple way, specify Box as the source's New agent.

Demo model: Changing Agent Shape

How to get agents that are currently being stored in some Process Modeling Library block?

You can create a collection, add agents into this collection when they enter this particular Process Modeling Library block and remove them from there when they exit the block. Thus, you will always have actual list of agents currently being stored in the object.

How to connect Process Modeling Library objects dynamically?

You can connect / disconnect ports of AnyLogic library blocks (e.g. Process Modeling Library blocks) dynamically by calling connect() / disconnect() functions of block ports. 

The following demo model illustrates how to connect Process Modeling Library objects dynamically. It has two separate parts of a flowchart that are connected by clicking on the button placed between them. Please have a look at the button's Action to understand the approach.

Demo model: Connecting Library Objects Dynamically

Please note, that you can connect the out port of object A and the in port of object B only if no agent has been yet in the object A.

You also cannot disconnect the ports if some agent(s) have already passed through this connection.

Can I change a value of some flowchart object's parameter at model runtime?

Yes, all parameters can be modified dynamically at the model runtime. 

To change a value of some parameter, you should call the automatically generated function set_parameterCodeName(), passing the value you want to assign as a function parameter.

For example, to change the Capacity of queue object to 50, you should call queue.set_capacity(50);

You may ask - how can I know the correct Java name of the parameter, I can see only labels like Arrival rate in the Properties view. To know the programmatic name of some parameter, we recommend you to refer to Process Modeling Library Reference Guide. There you can find the full description of object parameters. For example, to find the code name for Source's Arrival rate, open the help document on Source object and search for Arrival rate section. Here you can find the required name in the Syntax row:

 Please note that here we talk about static parameters, not dynamic ones. Dynamic parameters are evaluated each time they are needed, e.g. each time the delay time, the speed or other property of an agent needs to be obtained, so they do not have any persistent value, and it is meaningless to speak about changing values of dynamic parameters.

Is it possible to implement a conveyor with dynamically changing speed?

Yes, you can do this using the function conveyor.set_speed() of the Conveyor object.

Demo model: Conveyor with Dynamic Speed

Can I implement a resource that releases itself on timeout expiry?

I would like to add a time factor to the resource so that the resource seized would release by itself after a specified time, e.g. 60s. That means a resource is released either "normally" by Release module before 60s or by itself at exactly 60s after seize. Is there any simple method to do that?

Demo model: Releasing Resource on Timeout

Please take a look at the given demonstration model. The functionality you are describing can be implemented in AnyLogic, however it requires using some more objects. The general idea is the following: as it is not possible to "interrupt" the normal process flow exactly after 60 sec to release the agent and then resume the process, we need to create a separate auxiliary "sibling" agent for each original agent that will actually seize the resource unit, wait for exactly 60 seconds and then release it. If by chance the original agent wants to release the resource earlier, it will tell its sibling to stop waiting for 60 seconds and release the resource immediately. To identify the sibling we are remembering the original agent hash code in the sibling's id field. Please see the On exit code of delayArbitrary to find out how to extract the sibling. 

If the pattern you are describing is met frequently in your model, we would recommend to create a new agent and put there all objects inside the dashed line so that you do not have to create them all the time. The only drawback of this approach is that the resource unit is formally seized not by the original agent but by its sibling.

Is there any way to get the batch size from Unbatch?

Yes, it is accessible as batch.contents.size() from On enter parameter of Unbatch.

Is it possible to switch between different resource pools, choosing some particular resource to work with current agent depending on some parameter?

In some cases it is required to switch between several resource pools. Let's say we should simulate the work of two support teams. Some requests are performed by the first one and some by the second one. We want to manually switch the team working with current agent depending on some parameter.

Yes, it is possible, but you cannot directly connect replicated ResourcePool to your Service, or Seize & Release objects. If you setup more than one as Replication parameter of ResourcePool object and ResourcePool is graphically connected to your flowchart object (Service, or Seize & Release), you will have the following error on launching your model: 'java.lang.RuntimeException: root.webServer.Process.seize: access: This object can only be connected to one ResourcePool object'.

The legal use case is the following. You should specify some expression evaluating the team to use in the ResourcePool Object parameter of your flowchart object, e.g. agent.vip = 1 ? supportTeams.get(0) : supportTeams.get(1). So an ability to have replicated resource pools allows you to organize flexible resource pools switching.

How to implement custom selection policy for resource units? I need to choose the closest resource unit.

The problem is ResourcePool always selects the longest idle unit to assign, but I need to select the closest unit idle.

The attached model demonstrates how to implement any custom selections (not just closest, but also longest waiting, longest utilized, closest and red, closest and blue, etc.). The starting point is to migrate from ResourcePool to regular agents representing resources. Transporters become agents and Enterprise Library blocks can be used to send these special agents to customers, move within the network etc. And let's solve the closest issue first and then go to dynamic quantity. In the attached example there are two flows of agents both requiring Transporters and being processed in two different locations (therefore there is always a chose in selecting closest). When an agent arrives a special function selects a closest Transporter agent (if there are any, otherwise the agent waits). Then the transporter is sent to the agent location, both are matched and then processed. Finally the transporter is returned to a storage of idle transporters.

Demo model: Choosing Closest Resource

System Dynamics

Is it possible to import models in AnyLogic from other System Dynamics tools?

Yes, currently AnyLogic supports import of Vensim® models. Now you can simply open Vensim® model (File|Import|From Vensim menu item) and it will be converted into AnyLogic model analogous to the original Vensim® model so you can easily continue developing it in AnyLogic.

How can I access the automatically created datasets for dynamic variables?

The datasets automatically created for dynamic variables (when the corresponding option is chosen in the Advanced tab of the agent type's properties) have names composed in the following way: 




For scalar variables
DataSet _ds_variable This is a single data set that was generated by AnyLogic for the variable variable

For arrays
DataSet[] _ds_array This is a flat array with a dataset for each element of this array variable array

These datasets are intended primarily for internal use: they are displayed in inspect windows (yellow popup callouts) when you click on a variable at runtime and switch to chart view. However, you can obviously use them as you like.

Is it possible to change the value of a flow or a dynamic variable from outside? How?

To allow assigning some values from somewhere to a flow or to a dynamic variable, please make it a constant (by selecting the Constant checkbox in its properties). 


How many agents can I efficiently simulate?

AnyLogic can efficiently simulate up to several millions of agents. This certainly depends on software and hardware you use. To test the performance of an agent based model on your computer, please run the Bass Diffusion Agent Based example model - it is a good test of a model simulating 1 million of agents.

However, the agents in this model have rather simple internal structure. More parameters, states in their statecharts, etc. agents have, more memory is needed for calculations and handling the model.

 But probably you should not raise a question in this way - much more interesting question is “How many agents do I need to simulate?” For example, if one needs to model the population of a country (like 100,000,000 people), does he need 100 million agents? The answer is: in most cases not necessarily! There are several techniques of reducing the number of agents to make the simulation computationally efficient yet giving the correct results. For example, if all regions in the country have the same conditions, you may model only one region with, say, population of 5,000,000 and then extrapolate the obtained results on the whole country.

How to dynamically add agents into a population?

We recommend you to create an agent and set its replication to zero. So you will be able to add the instance of this agent type and define its parameters in runtime by using the following function:

Assume you have population named patients: . The initial size of the populaton is 0. We want to add all agents in a population dynamically at model runtime.

To add an agent in a population at model runtine, call the auto-generated function add_agentPopulationName() In our case the name of the agent population is patients, so you should call the function add_patients().

And our agent Patient has two parameters: BMI and age. To set the values of the parameters for a just created agent, specify the parameter values using the arguments of the add_patients() function. Specify the values for all the parameters of this agent inside the function parentheses, separated by commas. Please note that the parameter values must be specified exactly in the same order as they appear on the properties page of the agent population (patients):

So, to create a new agent in a patients population and assign the value of 20 to its BMI parameter, and 80 to age, you should call the function: add_patients(20, 80);

To know how to reorder parameters of agent population, please refer here.

Another example: please look at the given demo model. Agents are created there using the event newAgent. You can see the function add_people() called in the event's action. This function creates new agents. It is named so because the replicated object that models the agent population is named people in this model.

Demo model: Event Generating New Agents

How to delete all agents from a population?

Please try the following code (here we assume your agent population is named people):

while( people.size() > 0 ) {
        remove_peoplepeople(0) );

How can I reorder agent parameters (on agent's properties page)?

Please open the properties of the agent type (and not the agent population) and open the Parameters preview section of properties. There you will be able to reorder the parameters using the "arrow" buttons on the right side of the view.

Is it possible to make agent move along a given path?

Agent has function moveTo(x, y, path) that initiates movement to a target (x,y) along a given polyline (path).    

Demo model: Agent Moving Along Path

Can I move an agent from one environment to another?

Direct migration of agents between environments is not supported in AnyLogic.

Generally, two solutions are possible. 

First one is to use the only environment and additional variables to organize agents into logical groups. Algorithms of establishing connections between agents can also depend on those variables. 

If, for some reason, having several environments is required, the second solution is offered: 

  1. remove the agent from first environment; 
  2. create a new agent with same parameter values; 
  3. assign it to the second environment. 

Some recalculations will probably be required depending on environment type and connection establishing logic.

There are several transitions leading to the same state. How can I know how many agents entered this state by taking this or that transition?

You can create variables in your agent - one for a transition, e.g. numTransitionA, numTransitionB, etc. Each variable will count agents that took some particular transition. To increase value of a counter on taking a transition, type code like numTransitionA++; in the Action property of this transition.

Or you may create several simple states inside the state you want to investigate. Each transition will lead to some particular simple state and you can create standard statistics functions to calculate number of agents that are currently inside this or that active state.

Charts and datasets

How to display model date and time in time axis labels of charts with history?

All charts with history (time plot, time stack chart and time color chart) can display model date and time in time (x-) axis labels. 

You can find more information here.

Can I add a Gantt chart into my model?

AnyLogic does not support Gantt charts but you can create a similar chart by customizing AnyLogic time color chart, see the demo model below.

Demo model: Gantt Chart

How can I gather statistics from multiple replication runs?

You should add Statistics element onto your experiment diagram and use Before/After Simulation run advanced properties of the experiment you will be able to fill this statistics object with data from the model. So when the experiment finishes, you will be able to analyze it or export somewhere.

Is it possible to adjust the Time Window of some chart dynamically at runtime?

Unfortunately, this property of charts cannot be changed at runtime. But you can create several similar charts with different time windows and play with their visibility, choosing this or that chart to be visible at the moment according to the current parameter values.

Statecharts and events

How can I know whether some particular state of a statechart is currently active or not?

Use the getState() function of the statatechart or the inState() function of the agent. Please refer to this article for more details.

How to obtain the remaining time before the transition is scheduled?

If you have a transition named transitionA, you may use transitionA.getRest() to get the remaining time.

How to obtain the remaining time before the event is scheduled?

If you have an event named myEvent, you may use myEvent.getRest() to get the remaining time. 

Please note that the function getRest() is not available if the event is triggered by condition.

Execution control

Is there a way to bypass the experiment presentation on model startup and get directly to the model without pressing the button?

Please write the following code in the advanced property Initial experiment setup of the simulation. The code is bellow:

getExperimentHost().setPresentable( getEngine().getRoot() ); 

How to run a model cyclically?

Just add an event with the following action:

new Thread() {
    public void run() {
        // stops the model
        try {
            // delay
        } catch(Exception e) {};
        // runs it again
        ((Simulation) getExperiment()).button.action();


How to set the Source block to generate agents according to timestamps read from DB?

The detailed description of this scenario is provided in this section.

How to set the Source block to generate agents with parameters read from DB?

The detailed description of this scenario is provided here.

How to connect to MySQL Server from AnyLogic?

At first, please add Database component to your model and then follow the instructions below to connect AnyLogic model to the MySQL database:
  1. Download the required driver (zip archive) from: http://dev.mysql.com/downloads/connector/j/5.1.html 
  2. Copy all driver files to the model's folder. 
  3. Open the model in AnyLogic, select it in the Projects view and import driver JAR file on Dependencies tab. 
  4. Go to the advanced properties of Main and type the following line in Import sectionimport com.mysql.jdbc.Driver; 
  5. Select database and type com.mysql.jdbc.Driver in JDBC driver property. 
  6. Connection URL should look like the following: jdbc:mysql://host:port
    host - is the ip address of the database, e.g.
    port - the default value is 3306 
  7. Specify login and password for the database.

How to improve performance of a model with the logging being turned on?

If the simulation takes significantly more time with the logging being turned on, you can disable data collection for some logs that you do not need.

 To turn off data collection for a log

  1. After you simulated your model at least once and got the logs collected, expand the Database branch in the Projects view.
  2. Expand the  Log item's branch in the tree. You will see the list of logs in the Log branch. 
  3. In the Projects tree, select the log you do not need, and select the I do not need this type of log checkbox in the properties.


Can I turn off the GUI to speed up execution?

AnyLogic Professional includes the runFast() function which is added for this case.

In AnyLogic PLE and AnyLogic University Researcher you can use the Parameter Variation experiment with a single iteration. It runs the model with the runFast() function without efforts on animation at all.

Pedestrian Library

How to know the coordinates of a pedestrian?

You can get pedestrian's coordinates by using ped.getX()ped.getY() and ped.getZ() code lines. You're able to access these functions of pedestrians from Pedestrian Library blocks when pedestrian enters block, exits block, etc.

How to simulate pedestrian evacuation?

Pedestrian Library has a built-in mechanism for handling evacuation cases. Nearly all Pedestrian Library flowchart blocks have the cancel(ped) and cancelAll() special functions. Use these functions in the case of evacuation. The first function interrupts the current command for the specified ped and causes it to exit the object via ccl port. The second one does the same for all pedestrians that are currently in the object.

The ccl port is usually located on the lower border of the object's icon (the figure below shows it on PedWait example). 

To define some custom behavior for evacuating pedestrians, you will need to define some alternative flowchart for that case and connect ccl ports of your flowchart objects with the input port of PedEnter object that starts that alternative flowchart.

Moreover, when you call cancel(ped) and cancelAll() functions, the code specified in the object's On cancel property is executed, so you can perform some additional actions with evacuating pedestrians, e.g. change color of their shapes.

Can I change the shape of a pedestrian? I want to use a custom shape, not just circles.

Yes, you can animate pedestrians with any shapes and images. You can find more information here.

How to simulate turnstiles?

You should draw the turnstiles graphically on top of your layout plan with the Service with Lines space markup shape. This element models services of one of two types: Delay and pass through, or Just delay. Use the first one if you need to model turnstiles. Delay and pass through service is defined by a line, along which pedestrians should move, and this meets the case of turnstiles.

Then you should add the Pedestrian Library PedService block into your pedestrian process flowchart to simulate how the pedestrians go through the turnstiles.

I want one pedestrian to move towards another one. How can I implement this?

You can get x and y position of any ped while simulating. Then you could force the chasing pedestrian to go to the position of another pedestrian constantly (creating some kind of loop that includes the pedGoto object and cancels it repeatedly when on cancel port leads again to the same block) while doing that you should update the position of the target that this PedGoto block leads to (put the x and y pos. of the followed pedestrian). If you want these pedestrians to move together after meeting, you may add them to a pedestrian group while the position will be close enough. 

I want to implement some sensors to trigger events if pedestrians got within a certain range.

To implement this, follow these steps:

Create an event with the cyclic mode. 

In the Action field of the event calculate the distance between ped and other object of interest using sqrt((x2-x1)^2-(y2-y1)^2)

For multiple pedestrians you will need to put them into a list while injecting and inside the event use "for" loop calculating this distance for any of them. 

While the result will be lower than the required value call the desired action.

Road Traffic Library

How can I create cars of different colors and types?

You can use the technique described in the following video.

How-To video: Creating cars of different colors

Modeling warehouses

Can I use AnyLogic for simulating warehouse logistics?

Yes, AnyLogic is capable of detailed simulation modeling of warehouses based on physical dimensions of buildings, fork-lift-trucks, shelves, products and pallets, aimed at finding the optimal management policy.

Demo model: Distribution Center

There is a specific space markup element Pallet rack for drawing pallet racks graphically, and Process Modeling Library contains a set of three blocks (RackSystemRackStore and RackPick) designed to simplify modeling of storages with multiple locations and regular structure, such as warehouse storages.

Demo model: Wholesale Warehouse

Is it possible to have a storage with some initial stock?

Yes, you can do this using the approach shown in the given demo model:

Demo model: Storage with Initial Stock