In this phase, we will create a model, then we will add and configure our first component - a tiled GIS map. We will navigate the map at both the design-time and the runtime.
New model is created. Every new model by default contains two main components: the Main agent type and the Simulation experiment. An agent can contain model objects and other agents that you create. When you run the experiment of the top-level agent, it brings all the model elements together into a model.
In the center of the workspace you can see the
graphical editor. It shows the diagram of the Main
To the left of the graphical editor you can see the Projects view and the Palette view sharing the same area. The Projects view provides access to AnyLogic models that are currently opened in the workspace. The workspace tree provides easy navigation throughout the models. The Palette view contains all graphical elements that you can add onto the graphical editor of your agent simply by drag'n'drop. Model elements are grouped by categories in a number of palettes.
The right side of the workspace contains Properties view, which allows to view and modify the properties of the currently selected model element(s). If you select an item/element (in the Projects view or in the graphical editor), you can view its properties in the Properties view.
Now we can continue developing our model that was created by the AnyLogic model creation wizard.
We will start with adding a GIS map onto the Main agent diagram, that is where all the further created agents will live.
By default the GIS map displays the world map using tiles. We will use the default configuration of the GIS Map shape in AnyLogic:
Another popular technique is to turn off panning of the model window, leaving only the map panning at the runtime.
Now we need to define the area that will be used in the model. This can be done by either setting map to display the required area at model startup or by setting the required area as the custom search bounds, which is not obligatory to be seen at model startup. The custom area can be set in the Search section of the GIS map properties. Once the area is set, the section will show the coordinates of the top right and the bottom left points of the custom area.
We will proceed with the first option, which presupposes setting the map to display the required area at startup.
Next, we will create several agents and place them on the map.
The supply chain that we model contains one distribution center, several retailers spread across the country, and a fleet of trucks that deliver the product from the distributor to retailers.
You can choose among the following three options when creating an agent: a population, a single agent, and an agent type. Each option presupposes that you will create an agent type anyway, but the population and the single agent options also represent the agent instances that are placed in some environment, which is the Main agent in our case. Unlike a single agent, a population is a collection of a certain number of indexed agents.
To make an agent type play the role of an environment for other agents, you create those agents on its diagram.
Since we model only one distribution center, let us create it as a single agent.
The agent will appear on the Main diagram there where we have dropped it from the palette. The agent animation figure will be placed in the center of the map (it is the default location for animation on the map, we will define a specific location for it later).
There are several different methods that you can use to define an agent's position on the map, from specifying the geographic coordinates of a certain point on the map to calling specific GIS methods.
We will use GIS space markup objects and the GIS search results menu. These techniques allow you to define positions on the map with a couple of mouse clicks without writing any Java code.
Since we have only one distribution center, it makes sense to place it directly on the map.
We have finished setting up the GIS Map shape on the agent's diagram. Let us run the model and check the location of the distribution center.
Navigate to the Projects palette. If you see asterisk * next to the model's name denoting unsaved changes, click the Save button in the toolbar to save the changes in the model.
You will see the model window. Click the Run button in the control panel at the bottom of the model window.
The model will run, displaying the map. You should see the distributor located at Boulogne-Billancourt. You can navigate the GIS map at runtime using the same commands as at the design-time. As we run the model and navigate the map, the tiles are being cached into the model folder. As a result the model will be running much faster next time, because it will be using this cache.
You can compare your model to the reference model that we provide for every phase here:
Reference model: Supply Chain GIS - Phase 1
In the next phase we will create retailers and place them in particular locations on the map.
Supply Chain GIS modelPhase 2. Creating retailers