Phase 1. Creating assets
In the first phase we will create a new model and populate it
with buildings that will be subject to bombing.
a new model
We shall start designing our model with creating a new population of
agents that will represent 10 facilities.
- Click the New
toolbar button. The New
Model dialog box will be displayed.
- Define the parameters of the new model:
- Specify the name of the model in the Model name field.
Type Air Defense System.
- Set the new model location if necessary by clicking the
Browse button and selecting the required
- Set Model time units to seconds.
Click Finish to create a new model.
Create new population of agents
have created a population of agents and defined animation shape for
- Drag the Agent
element from the Agent
the Main diagram. The
dialog box will open.
- Click Population of agents. You will be
taken to the next step of the New agent wizard.
Type Building in the Agent
type name field. The Agent population name
will be automatically filled.
Click Next to proceed to step 3.
- Leave the Choose animation parameter
set to 3D mode and choose the House
animation shape in the Buildings section.
Click Next to proceed to step 4.
- We will not set any agent parameters, you may
click Next to proceed to Step 5.
- Set the Create population with
parameter to 10.
Click Next to proceed to step 6.
- Leave the Space type parameter set to Continuous
and select the Apply random layout option.
- Click Finish to save the changes and
Adjust the scale of the model
- Click the Scale element on the Main diagram to open its Properties.
Set the Ruler length corresponds to
parameter to 100. The scale on the ruler will
We modified the scale of the model, as a result the
building shape changed its size.
We have completed setting up the population of agents and may now run
model for the first time to observe the model behavior.
Run the model
Now we will create 3D animation for our model. First
of all we need to add 3D
window to our Main diagram.
role of a placeholder for 3D animation. It defines the area on
presentation diagram where 3D animation will be shown at runtime.
- Click the Run
The model window will appear.
Click Run to launch the model. You
will see the 10 building shapes randomly distributed
in a 500 by 500 pixel space. This is the space size set by default. We
do not need to change it as we will customize the location of
Now we will run the model and switch between the 2D
and 3D views in the model window.
Window element from
the 3D section
of the Presentation
editor. Place the window below the model window
to the Properties view of the 3D window
and set its Width and Height
parameters to 1000 and 600
Compare 2d and 3d
- Click Run in
the toolbar to open the model window.
- When you create a 3D window, AnyLogic adds a view area
that allows you to easily navigate to the 3D view at runtime. To switch
to this 3D view while the model is running, open the developer panel by clicking the Developer panel control in the right corner of the control panel. In the developer panel, expand the select view area to navigate list and select [window3d] from the list.
The view mode will change to 3D.
- Drag a Rectangle shape from the Presentation
palette onto the editor
of Main, place its
top left corner at (0,0).
- Navigate to the Position and size
section of the rectangle's Properties and set its Width
and Height parameters to 1000
and 600 respectively, hence the area size is
- Now set the Z and Z-Height
parameters to -1 and 1 respectively.
Now run the model and observe the new layout both in 2D and 3D modes.
In the Appearance section of
the rectangle's Properties set
the Line color option to No color.
- Now we will define the texture of the rectangle area. Click
the Fill color control and select Textures
to open a dialog box with available textures.
Click Earth texture to set it
as the fill color for the rectangle shape.
Click OK to close the dialog box. The
rectangle shape will change it appearance.
order to make buildings visible in the 2D view we must reorder
shapes in the design.
- Run the model. You will observe the
model in the 2D view.
As you can see, we have the new layout here but no buildings can be
Switch to 3D animation scene. You can observe buildings in 3D view.
Now the model should have correct visualization in both 2D and 3D view.
Prior to running the model to check if everything works like it should,
we will lock the Rectangle
shape and add camera.
- Right-click the rectangle shape to open its context menu.
Then click the Order menu item and select Sent
to Back sub-item from the list of available orders.
The 2D building shape will now be visible.
Lock the rectangle
- In the Properties view select the Lock
option to lock
This will prevent occasional selection of the rectangle while working
with other elements on the diagram.
It is time to run the model and adjust the camera position to the
desired one. We will save that position afterwards to have the camera
always located at the set position.
the Camera element
section of the Presentation
palette onto the
graphical editor. You will see the camera icon in
- Direct the camera at the buildings presentation
shapes (the positioning is described in details in the Camera
Adjust the camera position
You may stop the simulation now. We have set up our camera and
copied its position, now we need to apply the new camera position.
- Run the model and switch to 3D mode.
- Right-click the 3D model presentation to open a pop-up
menu. Navigate to the Camera menu item and
select camera sub-item.
You will switch to the camera view.
- Position the camera to have the best possible picture while
observing the model in the runtime (for more details on navigating the
3D scene refer here).
- When done, right-click the 3D model presentation
and click Copy camera's location.
Apply new camera position
In the last step of this phase we will create a protected area,
within which the buildings will be placed. The area will further be
equipped with the air defense system, eliminating the air attacks on
- Click the Camera element to open its Properties
- Click the Paste coordinates from clipboard
button in the Properties view. The
rotation parameters will change.
Define protected area
We have created a new area, now we need to locate our facilities within
- Double-click the Polygonal Node element
in the Process Modeling Library palette to activate
- Click on top of the rectangle to start
drawing the protected area.
- Finish drawing with a double-click on the last node.
Navigate to the element's Properties,
name it protectedArea and set its Visible
parameter to no.
Relocate the facilities
- Click the buildings
population on the Main
to open the Properties view.
- Navigate to the Initial location
section and set the Place agent(s)
parameter to in the node. The Node
parameter will appear below.
- Click the set by default None value for
the Node parameter and select protectedArea
from the drop-down list of available nodes.
- Now open the properties of Main and navigate to the Space
and network section.
- Set the Layout type to User-defined.
Finally, we may run the model. The buildings will be located
within the area defined by the polygonal node
Well done, we have completed the first phase of the
Air defense system
tutorial. Proceed to Phase 2.
defense system model
2. Adding bombers