In AnyLogic, you can easily create multi-level models: for example, multi-floor buildings in pedestrian simulation or complex multi-level conveyors in material handling simulation. You can switch between different levels in design time and use space markup elements to organize and define the modeled environment on each level separately.
Each model uses at least one level, which is created automatically and is named level. At any given time only one level can be active, that is, you can add elements to it.
When you select a level, its properties become available in the Properties view.
All space markup elements, shapes, controls, charts, 3D Objects, and 3D animation tools (3D Window, Camera, Light) in the model belong to a certain level. The only exceptions are the scale element and the view area.
Every level has an absolute Z-coordinate. The elements situated on the level will have a relative Z which is calculated from the level’s absolute Z-coordinate. If the element is a part of a group (presentation shapes), or a network (paths, nodes, conveyors, etc.), the Z is calculated for the group or network.
You can change the level where the element resides in the element’s properties. It will move to the specified level retaining the same coordinates. If the object is a part of a group (presentation shapes), or a network (paths, nodes, conveyors, etc.), its level cannot be changed: you can only change the level for the whole group or network.
You can change the visibility of the level’s elements in design time, using the widget, which is located at the bottom right corner of the graphical editor.
The widget displays a list of all levels in your model. The currently active level is highlighted in grey. To switch to a different level, click on this level in the widget:
- Always show — the content of the level will be always fully displayed in design time like the currently selected level;
- Dim when inactive — if the level is not active in design time at the moment, its contents will be greyed out;
- Hide when inactive — if the level is not active in design time at the moment, its contents will be completely hidden from view.
A level (including all the elements that belong to it) can be either visible or invisible during the model run. This is specified in the Visible parameter of the level’s properties. The visibility of the level can be changed during the runtime with the help of the setVisible() function.
To rename or delete a level, you have to select it in the Projects view. The levels are listed in the Presentation group.
Material items can be transported between levels either by conveyors connected through network ports or by transporters. Transporters with path-guided navigation can move between levels along network paths connected by network ports. Transporters with free space navigation use level gates to move between levels.
The movement of pedestrians between levels is modeled with the help of target lines and the PedChangeLevel block.
To create a new level
- Click the Levels widget in the graphical editor.
- In the displayed menu select the Create a new level option.
Alternatively, you can create a new level when you add a new space markup element (shape, chart, and so on) to the graphical editor.
- Go to the properties of the added element and select the [new level] option from the Level drop-down list, e.g.:
- General
-
Name — The name of the level. The name is used to identify and access the level from code and blocks.
Visible — Here you specify whether the level with all its elements is visible on animation at model runtime, or not. Using the control, choose yes or no.
Z — Here you can define the Z-coordinate for this level.
- Advanced
-
Show in — Here you can choose whether you want the level’s contents to be shown both in 2D and 3D animation, in 2D only, or in 3D only.
You can dynamically modify the properties of the element at model runtime using the following API.
- Z-coordinate
-
Function Description double getZ() Returns the Z-coordinate of this level. - Level’s elements
-
Function Description List<AreaNode> getAreas() Returns a list of all areas on this level, including the service areas. List<BulkConveyorbelt> getBulkConveyorBelts() Returns a list of all bulk conveyor belts on this level. List<ConveyorNetwork> getConveyorNetworks() Returns a list of all conveyor networks on this level. List<Crane> getCranes() Returns a list of all cranes on this level. List<DensityMap> getDensityMaps() Returns a list of all density maps on this level. DensityMap getDensityMap(DensityMapType type) Returns the density map of a particular type from this level.
type — the type of the density map: either pedestrian or transporter.List<EscalatorGroup> getEscalators() Returns a list of all escalator groups on this level. List<LevelGate> getGates() Returns a list of all gates on this level. List<Lift> getLifts() Returns a list of all lifts on this level. List<Network> getNetworks() Returns a list of all networks on this level. List<Node> getNodes() Returns a list of all nodes on this level. List<Pathway> getPathways() Returns a list of all pathways on this level. List<PedFlowStatistics> getPedFlowStatistics() Returns a list of all elements that collect pedestrian statistics on this level. List<Pipe> getPipes() Returns a list of all pipes on this level. List<RailwayNetwork> getRailwayNetworks() Returns a list of all railway networks on this level. List<RoadNetwork> getRoadNetworks() Returns a list of all road networks on this level. List<Storage> getStorages() Returns a list of all storages on this level. List<StorageTank> getStorageTanks() Returns a list of all storage tanks on this level. List<TargetLine> getTargetLines() Returns a list of all target lines on this level. List<AbstractWall> getWalls() Returns a list of all walls on this level. - Pedestrians
-
Function Description Collection<Agent> getPeds() Returns an unmodifiable list of all pedestrians on this level. int pedestriansCount() Returns the total number of pedestrians currently located on this level. - Obstacles
-
Function Description List<Obstacle> getObstacles() Returns a list of all space markup elements on this level which are specified as obstacles. - Visibility
-
Function Description boolean isVisible() Returns true if the level is visible; returns false otherwise. void setVisible(boolean v) Sets the visibility of the level.
v — visibility. If v is true, the level is set to be visible, if it is false — the level is not visible.
-
How can we improve this article?
-