In AnyLogic you can easily create multi-level models, i.e. 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 the 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, i.e. you can add elements to it.
To rename or delete a level, you have to select it in the Projects view. The levels are listed in the Presentation group.
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 objects situated on the level will have a relative Z which is calculated from the level’s absolute Z-coordinate. If the object 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 object resides in the object’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 / network.
You can change the visibility of the level’s objects 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 grayed-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.
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.
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, etc.) 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.:
Name — The name of the level. The name is used to identify and access the level from code and Material Handling Library blocks.
Visible — Here you specify whether the level with all its elements shapes 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.
Show in — Here you can choose whether you want the level’s contents to be shown both in 2D and 3D animation, or in 2D only, or in 3D only.
You can dynamically modify the properties of the element at model runtime using the following API.
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.
Function Description Collection<Agent> getPeds() Returns an unmodifiable list of all pedestrians on this level. int pedestriansCount() Returns a total number of pedestrians which are currently located on this level.
Function Description List<Obstacle> getObstacles() Returns a list of all space markup elements on this level which are specified as obstacles.
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?