AnyLogic
Expand
Font size

About Cloud API

In addition to the web UI, AnyLogic Cloud offers multiple APIs that you can use to configure and run simulations programmatically within your analytical workflows, query experiment results, build fully customized web interfaces for your models, and do a lot of other things.

AnyLogic Cloud supports the following APIs:

Consider checking out the article that describes a simple way of embedding Cloud-based animations into any web pages without using the API.

AnyLogic engine and Cloud

You can adjust the look and feel of AnyLogic model animation embedded in custom web pages by using AnyLogic Java API.

The following methods of the ExperimentHost class enable and disable controls on the Control panel:

Function Description
void setRunControlEnabled(boolean runControlEnabled) Enables or disables Run, Pause, and Stop buttons on the Control panel (not the Developer panel).
void setSpeedControlEnabled(boolean speedControlEnabled) Enables or disables all controls related to simulation speed on the Control panel (not on the Developer panel).

Synchronous and asynchronous API

There are two types of API for working with AnyLogic Cloud: synchronous and asynchronous.

  • In synchronous API, methods wait for underlying operations to complete (for example, for HTTP requests or for server-based simulation runs). The advantage of synchronous API is its ease of use: as the methods complete the required action and return the actual results, you can use straightforward control flow. The disadvantage is that such methods block the thread where they are called. Therefore, it is not good to use synchronous API where responsiveness is required or where multithreading is not available.
  • In asynchronous API, methods do not wait for completion of time-consuming operations (and thus do not block the thread) and complete immediately. They return objects where you can provide callback code to be executed when the response comes and results are available, such as promise in JavaScript or CompletableFuture in Java.

AnyLogic Cloud JavaScript API is purely asynchronous, and Java API has both synchronous and asynchronous methods for your convenience.

How can we improve this article?