First, we will create a simple model where we will simulate how to manufacture the electrodes, cover them with special paste, and collect them into batches.
Create a new model
Click the New toolbar button. The New Model dialog box is displayed.
Specify the name of the model. In the
edit box, type
Lead Acid Battery Production.
Specify the location where you want to store your model files. Browse for the existing folder using the Browse button or type the name of the folder you want to create in the Location edit box.
selected as the
Model time units.
Click Finish to complete the process.
New model is created. It already has one agent type called Main and one experiment called Simulation. Agents are the main building blocks of AnyLogic model. In our case the Main agent will serve as the place where will define all the logic of the model: here we will draw the production line and define the battery manufacturing process using a flowchart.
In the center of the workspace you will see the graphical editor. It shows the diagram of the
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 currently opened in the workspace. The workspace tree provides easy navigation throughout the models. The Palette view contains all graphical elements, which you can add onto the graphical editor of your agent just by drag'n'drop. Model elements are grouped by categories in a number of palettes.
On the right side of the workspace you can see the Properties view. The Properties view is used to view and modify the properties of a currently selected model element(s). When you select something – e.g., in the Projects view or in the graphical editor – the Properties view displays the properties of the selected item.
Now we can start developing the model.
We will use the following layout:
Save the layout image to your computer
Place the layout on the canvas
Alternatively, you can drag the image directly from the folder and drop in on the graphical editor.
Make sure that the upper left corner of the image matches the axis origin.
Our next step is to draw the conveyor, which transfers electrodes from the point of their generation to the pasting machine and after that - to the storage location, using the space markup elements.
Material Handling Library markup is not only a set of instruments to define the layout of the model. Such elements as
also serve to define the logic of the model: the speed of material item movement, use of resources, etc.
Draw the conveyor
Congratulations! We have finished drawing the first element of our production line. Now, let's build the flowchart to define the model logic behind this step.
This flowchart will be composed from the Process Modeling Library and Material Handling Library blocks. Each block will define an operation performed on the electrodes in the course of production.
In AnyLogic you can create flowcharts by adding the blocks from the library palette to the graphical diagram, connecting the blocks to each other in the necessary order and tuning their parameters according to your modeling needs.
Create the model flowchart
Place the block at some distance below the layout, since the flowchart will expand with each step of the tutorial not only vertically but also horizontally, and you want to leave enough space to fit all the blocks.
a. In the
Arrivals defined by
b. In the Interarrival time box type 1.5 and select hours from the time units drop-down list.
c. In the First arrival occurs parameter select At model start.
d. Select the Multiple agents per arrival check box.
e. In the Agents per arrival box type 200.
f. In the Advanced section of the properties deselect Forced pushing check box.
g. In the Agents that can't exit parameter select wait in this block from the drop-down list.
To model the transfer of the electrodes by the conveyor, drag the Convey element from the Material Handling Library palette to the Main graphical diagram and place it next to the source block so that they are automatically connected as displayed in the image below:
is the single block of the Material Handling Library that controls the
movement of the material items in the conveyor network. By default, it
selects the shortest route from the starting point to the destination,
but you can also specify the precise sequence of conveyors which should
make up the route or use Avoid conveyors
options to customize it.
In the convey block's Properties specify the Source conveyor: conveyor and Target conveyor: conveyor.There are two ways to refer to model elements from the block's parameters:
We have finished building a simple flowchart and now can run the model and see how the electrodes move along the conveyor.
Start the model
Click the Run toolbar button and choose the experiment you want to run from the drop-down list. Your simulation experiment is called Lead Acid Battery Production / Simulation.
In our case this model is the only one opened in the workspace at the moment, as a result you will be prompted to run this particular experiment. Later, on pressing this button you will start the previously launched experiment. To run any other experiment, right-click (Mac OS: Ctrl click) the experiment in the Projects view and choose Run from the context menu.On starting the model, you will see the presentation of your top-level agent type (by default it's Main). The model will launch immediately. Observe the process dynamics. You will see how electrodes move along the conveyor in 2D animation, over the layout image.
If needed, adjust the execution speed to your needs using slow down and speed up controls.
You must have observed that the electrodes on the conveyor that we have just modeled didn't look much like real electrodes. To correct this, we will create a new agent that will represent them in our flowchart.Create a new material item type
AnyLogic will automatically open the graphical diagram of the new agent type.
view is context-sensitive: it always displays the properties of the
currently selected item. You can select the item by clicking on it
either in the model tree (in the Projects
view) or in the graphical editor.
Add the pasting station
b. Process time: 1 second
c: Offset from conveyor start: 80
d: Length: 0.5 meter.
After going through the pasting machine, the electrodes change color. To define this change during the animation, we will introduce a variable.
b. Initial value: white
Note, that white here is the name of a Java constant used to define the color.
a. Click the
static property icon next to the
field. After the icon changes to the
dynamic property, a box will appear next to it.
b. Type color in this box to link this property to the previously created variable of the same name.
With the help of this code we address each electrode (agent) that goes through the station and assign a new value (peru) to its
parameter at the moment when the station has just finished processing this agent (On process finished). When we run the model, we'll see how the electrodes change their color after passing through the pasting machine.
You can use the
Code Completion Master
to simplify and streamline your work. Place the cursor where you want
to enter the line of code, type the first letter of the word and press Ctrl Space. The wizard
listing all the model variables and available functions will appear,
and all the elements that begin with the letter you've typed will be
listed at the top.
Double-click the necessary entry and the wizard will complete it for you.
Add the batch storage location
b. Visible: no
c. Location layout: arranged.
a. Specify the
100. The block will accumulate 100 agents of
type before releasing them as a single batch.
b. In the Agent location parameter select the platesBuffer node.
c. In the Location of batch parameter select Network/GIS node from the drop-down list.
d. In the Node parameter select the platesBuffer node.
Now, create a new material item type which will represent the electrode batches.
Specify its Name: PlatesBatch.
Step 2. Agent animation, leave the
option selected, expand the
Warehouse and Container Terminals
section and select the
b. Width: 1.2 meter
b. Width: 100
c. Height: 100
d. Z-Height: 30
Now that logic of the first phase is complete, let's enhance our model with 3D animation.The first step is placing the 3D window on the diagram of the agent type. 3D window plays the role of a placeholder for the 3D animation. It defines the area on the presentation where the 3D animation will be displayed at runtime.
Add 3D window
Now you can run your model and observe simple 3D animation.
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.
Navigate through the 3D scene using the commands described below:
In order to
Use the mouse like described here
Move the scene
1. Press the left mouse button in the 3D view and hold the mouse button pressed.
Rotate the scene
key (Mac OS:
key) and hold it pressed.
Zoom in/out the scene
|1. Scroll the mouse wheel in the 3D window away from / towards you.|
you run the model now, you will see that the conveyor, electrodes, and
batches are animated in 3D, but the pasting machine and the walls are
absent. Let's fix that!
we have changed the default scale of the model, the scale of the 3D
objects added from the palette should be adjusted accordingly to look
natural on runtime.
Draw the walls
In the layout there are several segments
of identical size. Instead of drawing them one by one, you can copy
them. To do this, draw a single segment and then Ctrl
drag it to the intended place. Repeat the action as many times as neccessary.
To adjust the placement of a segment, select it and use the Shift arrow keys combination.
Note that there are several reference models available that represent the milestones of the editing. You can use them if you experience any difficulties creating a model and you would like to compare your model with the reference file. Below you can see the link opening the reference model corresponding to this phase.
Reference model: Lead Acid Battery Production - Phase 1
Lead Acid Battery Production TutorialPhase 2. Modeling the free space transporters