In this phase, we will create a model, then we will add and configure our first component - a GIS map.
New model is created. Every new model by default contains two main components: the
Main
agent type and the
Simulation
experiment.
In the center of the workspace you can see the graphical editor. By default it shows the diagram of the
Main
agent type.
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.
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.
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 automatically create agent instance(s) 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 agents of the same type.
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 where we have dropped it from the palette. The agent animation shape will be placed somewhere 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 functions.
We will use GIS space markup shapes. This way you will 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. The
model will run immediately, 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.