0% found this document useful (0 votes)
20 views82 pages

Factory Model

The document outlines a training presentation for creating a factory model using AnyLogic, specifically focusing on the assembly of washing machines. It details the process flow, from parts entering the factory to the final packaging of the product, and includes steps for modeling the factory layout and defining parameters for various components. The training is structured in phases, guiding users through building a simple discrete event model and enhancing it with animations and parameters.

Uploaded by

prd.sim1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views82 pages

Factory Model

The document outlines a training presentation for creating a factory model using AnyLogic, specifically focusing on the assembly of washing machines. It details the process flow, from parts entering the factory to the final packaging of the product, and includes steps for modeling the factory layout and defining parameters for various components. The training is structured in phases, guiding users through building a simple discrete event model and enhancing it with animations and parameters.

Uploaded by

prd.sim1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

The Factory

Model
This presentation is a part of
AnyLogic Standard Training Program

© The AnyLogic Company | www.anylogic.com


The Factory Model
We will create a model of a factory shop.
The factory produces washing machines. This particular floor
performs the final stage of manufacturing – assembling a
finished machine from two parts – a body and a door.
The floor works as follows:
• Parts enter the shop and are transported by conveyors to the assembly
station.
• Assembly robot assembles a washing machine from a body and a door.
• Finished machine is transported by a conveyor to the packaging line,
where it is packed into a box by workers.
• Each 10 finished products compose a batch that is taken away from the
factory by a truck.

© The AnyLogic Company | www.anylogic.com 52


The Factory Model

Washing machine
bodies storage Conveyor to the assembly station
Packaging zone

Assembly station

Loading zone

Conveyor to the packaging zone


Washing machine doors storage

© The AnyLogic Company | www.anylogic.com 53


Factory. Phase 1
• We will start with a very simple model that will model how washing
machine bodies enter the factory floor and are transported by a
conveyor to the place where the assembly will be performed.

© The AnyLogic Company | www.anylogic.com 54


Factory. Phase 1. Step 1

AnyLogic Welcome Page


Start AnyLogic

Click Create a model

© The AnyLogic Company | www.anylogic.com 55


After you start AnyLogic, you will see the Welcome page

Welcome page
• The purpose of the Welcome page is to introduce you to the product. The welcome
page provides access to the example models, tutorials, books and other resources
helpful to learn simulation modeling and AnyLogic.

Whenever you need, you can


open the list of Example
Models via AnyLogic menu:
Help > Example Models

© The AnyLogic Company | www.anylogic.com 56


Factory. Phase 1. Step 2

Type Factory here

Set the model time units

Click Finish

© The AnyLogic Company | www.anylogic.com 57


You will see the New Model wizard appear.
Enter the name of a new model: Factory. The Factory model will
act as a component of a global supply chain model later.
Choose minutes as the model time units.
Click Finish to start creating new model from scratch.

Another way to create a new model is to click the New button located
on the toolbar:

© The AnyLogic Company | www.anylogic.com 58


Factory. Phase 1. Step 3

Graphical editor

Properties view

Projects + Palette views

© The AnyLogic Company | www.anylogic.com 59


AnyLogic Graphical User Interface
Graphical editor
• The place to graphically edit the diagram of the agent type.

Projects view
• Provides access to AnyLogic models currently opened in the workspace. The workspace tree
provides easy navigation throughout the models.

Palette view
• Provides the list of model elements grouped by categories in a number of stencils (palettes).

Properties view
• Allows to view and modify the properties of currently selected model item(s).

Problems view
• Displays errors found during model development and compilation.

© The AnyLogic Company | www.anylogic.com 60


Factory. Phase 1. Step 4

You will see the


Process Modeling Library
palette opened

To open a palette, click its


icon on the vertical tab

© The AnyLogic Company | www.anylogic.com 61


We will model our factory using AnyLogic Process Modeling Library.

AnyLogic Process Modeling Library


• Process Modeling Library is the standard AnyLogic library for discrete-event, or,
to be more precise, process-centric modeling. Using the Process Modeling
Library objects you can model real-world systems in terms of agents
(transactions, customers, products, parts, vehicles, etc.), processes (sequences
of operations typically involving queues, delays, resource utilization), and
resources.
• The processes are specified in the form of flowcharts - a widely adopted
graphical representation used in many areas: manufacturing, call centers,
business processes, logistics, healthcare, etc. Flowcharts are constructed from
Process Modeling Library objects.

The Process Modeling Library palette opens by default. The palette


contains library objects. Now we can add library objects from this
palette onto the graphical diagram of the Main agent type.

© The AnyLogic Company | www.anylogic.com 62


Factory. Phase 1. Step 5

Name the object sourceBodies

Drag Source onto the diagram

© The AnyLogic Company | www.anylogic.com 63


Add Source object. In our model it will generate washing machine
bodies.
Source
• Source object generates agents. It usually acts as a starting point in the process model.

Drag the Source element from the Palette onto the graphical
diagram. Drag’n’drop is the common way of adding palette
elements onto your diagram.
Right after dragging an element onto the graphical editor, you can
see that its name is selected in the in-place editor.

Type here a new name of this object: sourceBodies.


Name model elements exactly as we do since later on you will refer
to these elements by their names.
© The AnyLogic Company | www.anylogic.com 64
Factory. Phase 1. Step 6

Sink

Add Queue object here Conveyor

© The AnyLogic Company | www.anylogic.com 65


Continue constructing the flowchart by adding more Process
Modeling Library objects. When adding flowchart blocks, you will
see that the closest ports get automatically connected
Add Queue object. Name it bodiesStorage. We add a queue to
store the arrived bodies until they can be taken on the conveyor.
Add Conveyor object. Name it conveyorBodies. In our model it will
represent a conveyor transporting washing machine bodies.
Add Sink.

• Queue object models a queue (a buffer) of agents waiting to be accepted by the next
object(s) in the process flow, or a storage of the agents.

• Conveyor moves the agents along a path at a given speed preserving a minimum space
between them.

• Sink object disposes agents. It is usually an end point in a flowchart.

© The AnyLogic Company | www.anylogic.com 66


Factory. Phase 1. Step 7

Save your model

© The AnyLogic Company | www.anylogic.com 67


Finally your flowchart blocks should get connected as shown on the slide.

Defining a route for agent flow


• You define a route for agents by connecting the ports of flowchart blocks. You may
notice that right port is connected to the left port of the successor block. The reason
is that Process Modeling Library blocks have input and output ports. Input ports are
located on the left side of the icon, while outputs are on the right. You may only
connect output ports to input ports.
• By connecting the flowchart objects you define the path for agents passing through
this flowchart. Once having entered the Source object, the agent is passed on to the
flowchart object connected to Source’s output port and so on.

You may notice an asterisk near the model item in the Projects tree:

It means that you have unsaved changes in this model. Save your model
by clicking the Save toolbar button.

© The AnyLogic Company | www.anylogic.com 68


Factory. Phase 1. Step 8

Click Run button

Choose Factory / Simulation

Click the button


Presentation
window

© The AnyLogic Company | www.anylogic.com 69


Now we have finished building this very simple model. Run
the model and observe its behavior.
- There can be several models opened in the
workspace, each one having a number of experiments. So
you need to tell AnyLogic, what particular experiment you
want to run.
Having started the model, you will see the presentation
window. It displays the presentation of the launched
experiment (Simulation).
By default the experiment’s presentation contains the
button Run. Clicking this button starts running the model
and opens the presentation of the top-level agent Main.

© The AnyLogic Company | www.anylogic.com 70


Factory. Phase 1. Step 9

You will see the animated flowchart

Click the block.


You will see its inspect
window opened.

Move the window


by dragging its title

© The AnyLogic Company | www.anylogic.com 71


Examine the current states of flowchart objects using the
animated flowchart and AnyLogic inspect windows

Animated flowchart Number of agents currently


being transported

Number of agents
passed through Conveyor is currently
transporting an agent

Inspect windows

Object parameters

Information on Statistics
agents currently
being in the object

© The AnyLogic Company | www.anylogic.com 72


Factory. Phase 1. Step 10

Control the
model simulation
using Run, Step
and Pause buttons Close the window by
clicking the “cross” button

Click Stop button to


stop model simulation

© The AnyLogic Company | www.anylogic.com 73


Controlling the model execution
You can control the model execution using the toolbar, displayed at the top of AnyLogic
presentation window.

Run from the current state


Runs the simulation. Starts the execution, or if the simulation was
paused, resumes the simulation from the current state.

Step
Makes the step.

Pause
Pauses the simulation. You can resume the paused simulation anytime.

Terminate execution
Terminates the current model execution.

© The AnyLogic Company | www.anylogic.com 74


Factory. Phase 1. Questions
1. How can you access AnyLogic example models?
2. What is the difference between left and right ports of Process
Modeling Library objects?

© The AnyLogic Company | www.anylogic.com 75


Factory. Phase 2
• We have created the simplest discrete event model in the first
phase.
• In this phase we will define the units of time and length in the
objects of our process flowchart.
• Also, we will add some simple animation of a conveyor and bodies
storage zone

© The AnyLogic Company | www.anylogic.com 76


Factory. Phase 2. Step 1

Drag Image onto the diagram

Open the
Presentation palette

© The AnyLogic Company | www.anylogic.com 77


Start drawing the model animation with adding a factory
layout. We will use a layout from an existing image file.
The dialog window that helps you to
browse to the file opens automatically
when you drop the Image element on
the diagram.
Choose the image file to be displayed by this
Image shape: factory_layout.png from
Models\Factory folder located on your USB
disk.

Presentation palette
• The Presentation palette contains a set
of geometric shapes, used for drawing
model presentations (rectangle, line,
oval, polyline, curve, etc.)

© The AnyLogic Company | www.anylogic.com 78


Factory. Phase 2. Step 2

Open the Space


Markup palette

Draw a Rectangular Node to


fit into the BODY STORAGE zone

© The AnyLogic Company | www.anylogic.com 79


- Draw a rectangular node to represent an area where the washing
machine bodies are stored. You may name it shapeBodyStorage.

Double-clicking on the Rectangular Node element in the Palette you


activate its drawing mode.

Drawing mode
• Some elements (marked in the Palette with icons) support drawing mode - additional way of
adding these elements onto the diagram in addition to common drag’n’dropping.
• In the drawing mode you can draw shapes of the required form at once, e.g. you can draw an oval or a
rectangle of the required size or draw a polyline point by point, putting points where you need.
• To activate the drawing mode, double-click the element in the Palette. The element icon should turn
to :

To make drawing easier, you can hold the Alt key while drawing or turn off the grid button in the
toolbar:

© The AnyLogic Company | www.anylogic.com 80


Factory. Phase 2. Step 3

Double-click Path

Draw path points by


clicking on animation

End path with a double click

Rename this path and


modify its appearance

© The AnyLogic Company | www.anylogic.com 81


Draw a path to represent a conveyor.
Double-clicking on the Path element in the Palette you activate its
drawing mode.
- Draw a path from left to right as shown on the slide.
Name the path shapeConveyorBodies.

Animating Process Modeling Library blocks


• Flowchart block that performs some operation over agents (resources, transporters) can
animate its activity by animating agents that are being handled by this block. AnyLogic
suggests an easy way of doing this: you draw a space markup shape on the graphical
diagram—say, a node or a path—and specify this shape as object’s Agent location. The
object then uses it as a guideline to animate the agents.
• Inside nodes, agents may appear at random positions, or arranged in 2D array that fits the
given node. You can also define the exact positions using the attractors.

© The AnyLogic Company | www.anylogic.com 82


Factory. Phase 2. Step 4

Select
sourceBodies

Change Arrival rate:


1 per minute

© The AnyLogic Company | www.anylogic.com 83


Define the parameters of these library objects we have added to
the agent’s diagram.
Select the object sourceBodies to change its parameters in the
Properties panel.
Let one washing machine body arrive per one minute.

© The AnyLogic Company | www.anylogic.com 84


Factory. Phase 2. Step 5

Select the
bodiesStorage

Select the checkbox for


Maximum capacity

Choose the node you have


drawn earlier as the Agent location

© The AnyLogic Company | www.anylogic.com 85


Select the bodiesStorage object in the graphical editor.
Remove any restrictions to the number of bodies in the queue by
selecting a checkbox next to the option Maximum capacity.
Define the Agent location for this queue.

Properties view
• The Properties view is a context-sensitive view that
displays the properties of the currently selected
model element(s).
• To modify properties of some element, first select it
(by clicking it in the graphical editor or in the
Projects view) and then modify the required
properties in the Properties view.
• The name and the type of the currently selected
element are shown at the top of the view.
• The Properties view contains several sections. To
expand/collapse a section, just click on its name.

© The AnyLogic Company | www.anylogic.com 86


Factory. Phase 2. Step 6

Select
conveyorBodies

Define conveyor’s
speed here

Select new
Agent length

© The AnyLogic Company | www.anylogic.com 87


Now change the parameters of conveyorBodies to match the
parameters of the preceding objects of the flowchart.
Select the conveyorBodies object in the graphical editor and go to
its properties.
The conveyor parameter Speed supports several units that you can
use to define the speed. We will define the conveyor speed in the
standard units here: meters per second.
Enter new Speed parameter value: 0.02 meters per second.
Let us also change the Agent length to 1 meter. The Conveyor
object will use this value when placing bodies on the conveyor
animation which we will define in the next step.

© The AnyLogic Company | www.anylogic.com 88


Factory. Phase 2. Step 7
Set the animation shape
for the conveyor

Set the length to be


defined by path

You will see only the shapes of the compatible


types highlighted. Select the shape by clicking it Click the button
in the graphical editor.

© The AnyLogic Company | www.anylogic.com 89


Tell the conveyorBodies object that the just drawn path should be used
to animate agents currently being transported by this conveyor.

To make a reference to a graphical object (such as a path, a node, an


area) in a logical object (such as queue or delay) you simply click the
object in the editor ( ) after you click the selection button ( ).

Let us also define the conveyor length by path – its animation that we
have drawn with a space markup element. Its actual length will be
defined by the layout of the factory floor. You can find the element Scale
above the X-axis on every agent diagram. It defines the meters to pixels
scale for the presentation figures that this agent contains.

© The AnyLogic Company | www.anylogic.com 90


Factory. Phase 2. Step 8

Speed up the
model execution

Run the model

You can see bodies waiting


at the storage and being
transported by our conveyor

© The AnyLogic Company | www.anylogic.com 91


Run the model and observe its animation.
Adjust the model execution speed by clicking Slow down and Speed
up toolbar buttons.

Adjusting the model execution speed


• AnyLogic model can be run either in real time or virtual time mode.
• In real time mode, the mapping of AnyLogic model time to the real time is made, i.e. you
specify how many model time units one second takes. It is frequently needed when you
want your animation to appear life-like.
• In virtual time mode, the model runs at its maximum speed and no mapping is made
between model time units and seconds of astronomical time. This time mode is useful
when you need to simulate your model for a long period of time.
• In real time mode, you can increase or decrease model simulation speed by changing the
model simulation speed scale. x2 means that model is run twice as fast as the specified
model speed, etc.
• Control the model execution speed using the Time scale toolbar:

Slow down Toggle real/virtual time mode

Scale of model time to real time Speed up


© The AnyLogic Company | www.anylogic.com 92
Factory. Phase 2. Questions
1. Which element you may use to draw the place for animation of agents
being inside a Process Modeling Library block?
(a) Rectangle
(b) Rectangular Node
(c) Rectangular Area
2. Which space markup shape would you use to draw animation for:
1. Cinema hall (a) Rectangular node, Arranged locations
layout
2. ATM (b) Rectangular node, Attractors
3. Bar with seats around
the tables (c) Point node
3. In 1:1 real time execution mode, what time will it take to simulate 100
model time units?
(a) 100 (b) 1 (c) 100 or more

© The AnyLogic Company | www.anylogic.com 93


Factory. Phase 3
• In this phase we will continue developing the model. We will:
• Add a source of washing machine doors and downstream
conveyor leading to an assembly robot.
• Add the assembly robot. The robot finishes washing machine
production by attaching a door to a body.
• Modify the model animation by drawing pictures to display
washing machine parts.
• Configure the flowchart objects with actual parameter values:
define the conveyor’s length, speed, space between parts, etc.

© The AnyLogic Company | www.anylogic.com 94


Factory. Phase 3. Step 1

Point Node
Name: pointQ1

Name: pointDelay
Rectangular Node
Name: shapeDoorStorage
Name: pointQ2

© The AnyLogic Company | www.anylogic.com 95


Draw a rectangular node to represent an area where the washing
machine doors are stored when entering the shop floor. Resize it to
fit into DOOR STORAGE zone. Name it shapeDoorStorage.
Draw a point node (pointQ1) to represent the zone of the assembly
robot where washing machine bodies are placed.
Draw one more point node (pointDelay) to represent robot area
where doors are placed.
The third point node (pointQ2) will define the robot area where
finished washing machines are placed.

© The AnyLogic Company | www.anylogic.com 96


Factory. Phase 3. Step 2

Create a new Agent Type

Name the agent type Body


and click Next

There is no washing
machine body among the
animation templates, so On the next page of the wizard
Choose animation: None you can define agent attributes. We
do not need any, so just click Finish.

© The AnyLogic Company | www.anylogic.com 97


Currently, the parts of washing machines are drawn on the animation as
little circles. It is the default animation used for agents in AnyLogic. We
want to draw some particular image for each part so we could
distinguish them. Let’s draw pictures of washing machine parts: body,
door and assembled washing machine.
To assign some other animation for agents in your model, you need to
create custom agent types.

Custom agent types


• The default agent type allows minimum customization (for example, you can change the
color of its default animation). If you need to customize your agents further (e.g. to add
properties, functions, or to collect custom statistics), you need to create a custom agent.
• New agent type creation wizard allows you to set animation for the agent and add
parameters of various types and set their default values.
© The AnyLogic Company | www.anylogic.com 98
Factory. Phase 3. Step 3

You will see the diagram of


the created agent type Body

Draw a rectangle 10*10 pixels and place it


exactly in the axis origin ( point (0,0) )

Choose Body as the agent


generated by the Source block

© The AnyLogic Company | www.anylogic.com 99


Run the model. You will
see the parts animated
with custom shapes.

© The AnyLogic Company | www.anylogic.com 100


Factory. Phase 3. Step 4

Create two more agent


types: Door and Product

For the Door, draw


a circle with the
Radius: 3

For the Product,


copy the shapes
from Door and Body

© The AnyLogic Company | www.anylogic.com 101


You can copy and paste model’s elements across the
diagrams of different agent types using conventional
Ctrl+C/Ctrl+V or the context menu options Copy/Paste.
AnyLogic also allows copying different model elements from
one model to another. This way, you can copy whole agent
types together with their internal elements.

© The AnyLogic Company | www.anylogic.com 102


Factory. Phase 3. Step 5
Add new Source and Queue objects
using Ctrl+drag (Mac OS: Cmd+drag)

New agent: Door

© The AnyLogic Company | www.anylogic.com 103


Add two more blocks into our flowchart:
▪ Source block to model generation of washing machine doors
▪ Queue block to model a storage of doors
Name just created Source block sourceDoors. Choose Door as the
type of agents generated by this block.
Name this Queue block doorsStorage and set its Agent location.

Selecting multiple elements


There are two ways of selecting several elements simultaneously:
• Drag the selection rectangle around the shapes.
• Successively Ctrl-click the shapes you want to select. (Ctrl-clicking the already selected
shape removes it from the selection).
Cloning elements
• Ctrl+dragging (Mac OS: Cmd+dragging) selected elements (either in the graphical editor
and or in the Projects view) creates copies of these elements.
• Cloned elements have the same properties as the original elements except for the name
that is made unique.

© The AnyLogic Company | www.anylogic.com 104


Factory. Phase 3. Step 6

Assembler
New agent: Product
You can add and remove the Delay time: 1 min.
editing points on a connector Animation
with a double-click Agent location (delay): pointDelay
Agent location (queue1): pointQ1
Agent location (queue2): pointQ2

© The AnyLogic Company | www.anylogic.com 105


Add Assembler block and connect it to other blocks as shown on
the slide.
Tell the block that it assembles Product agents.
Resources are not needed to perform the operation at the moment.
Set the assembly time to be equal to one minute.
Setup animation shapes for bodies queue (queue 1), doors queue
(queue 2) and assembly operation (delay).

Assembler
• Assembler block assembles one agent from several ones arriving into its input ports.
The number of agents required to perform an assembly is specified individually for each
port via object parameters Quantity 1, Quantity 2, etc. The block waits until each input
port has got the required number of agents, then produces a new agent and outputs it.
• The assembly operation takes specified delay time.
• Optionally assembly may be performed using resources (they will be covered later.)

© The AnyLogic Company | www.anylogic.com 106


Factory. Phase 3. Step 7

Run the model

You will see the assembly


process animated

© The AnyLogic Company | www.anylogic.com 107


Factory. Phase 4
• Now we want to develop our model further.
• Let’s add a packaging line where manufactured products will be
packed into boxes. Packaging line comprises upstream conveyor
and the packaging zone itself.
• Packed products will be placed into the loading zone. Each 10 boxes
will be batched together and shipped from the factory.

© The AnyLogic Company | www.anylogic.com 108


Factory. Phase 4. Step 1

Draw one more


shapeWorkers shapeLoading
conveyor and several nodes

shapeMoveToPackaging

shapePrePackage shapePackage

© The AnyLogic Company | www.anylogic.com 109


Start from updating the model animation.
Draw five more space markup elements to represent a conveyor
going to the packaging zone, the packaging zone itself and the
loading zone. Name them as shown on the slide.

© The AnyLogic Company | www.anylogic.com 110


Factory. Phase 4. Step 2
Ctrl+drag (Mac OS:
Cmd+drag) conveyorBodies here

© The AnyLogic Company | www.anylogic.com 111


Now let’s model an upstream conveyor leading to the packaging zone.
Add a conveyor by cloning conveyorBodies block. We recommend that
you clone the conveyor drawn earlier since it already has some
parameters adjusted the way we need.
Specify the shape that will be used as a path for agent animations

Run the model and watch products


moving along the conveyor

© The AnyLogic Company | www.anylogic.com 112


Factory. Phase 4. Step 3

From the Projects view,


open Product agent diagram

Drag the Box from the Pictures


palette. Place and resize it as
shown here, set Visible: no.

© The AnyLogic Company | www.anylogic.com 113


Draw a picture of a box containing our washing machine.
To simplify drawing small pictures, zoom the diagram to 400%. Resize
the picture to occupy approximately one grid cell.

Zooming the graphical diagram


• AnyLogic allows zooming graphical diagram in and out as you like. Set up the diagram
scale using the AnyLogic Zoom toolbar:

Zoom to 100% Zoom In

Zoom Out Zoom


• Set the required zoom using the Zoom combo box or Zoom Out/Zoom In buttons.
• To return to the default zoom click the Zoom to 100% button.

© The AnyLogic Company | www.anylogic.com 114


Factory. Phase 4. Step 4

Batch
Agent location: shapeLoading
Service
Queue capacity: 1
Delay time: triangular( 0.5, 1, 1.5 ) minutes
Agent location (queue): shapePrePackage
Agent location (delay): shapePackage
Actions
On exit: agent.box.setVisible(true);

© The AnyLogic Company | www.anylogic.com 115


This Service block models packaging a washing machine into a box. At this
time we will not use resources – they will be added in the next phase.
• Time needed to pack a machine into a box: triangular( 0.5, 1, 1.5 ) minutes
• Set the capacity of the queue equal to 1. We assume that one washing
machine may wait for packaging in a prepackage zone.
• In the On exit action code we make our box shape visible for the agents
that exit this Service block (i.e. machines packed in boxes).
This Batch block models loading a batch of boxes onto a truck (saying in terms
of the object, it creates a batch (truck) from a set of original agents (boxes)).
• Check that the Permanent batch checkbox is deselected since we want to
create a temporary batch (later on we will unbatch it to a number of boxes
again).

• Service block seizes a given number of resources to perform some operation over agent,
delays the agent (this models the operation itself), and releases the seized resources.
• Batch block converts a number of agents into one agent (batch) by either discarding the
original agents and creating a new one - permanent batch, or by adding the original agents
to the contents of the new agent - temporary batch that can later on be unbatched by
Unbatch block.

© The AnyLogic Company | www.anylogic.com 116


Factory. Phase 4. Step 5

Run the model

You will see how products are


packed into boxes and batches of boxes
are shipped away from factory

© The AnyLogic Company | www.anylogic.com 117


Factory. Phase 5
• In fact assembly and packaging operations need resources –
assembly robot and packagers correspondingly.
• Let’s add two types of resources into the model:
• one robot to perform an assembly
• two workers to perform packaging
• Collect utilization statistics for the resources and display it using bar
charts.
• Introduce assembly robot downtime.

© The AnyLogic Company | www.anylogic.com 118


Factory. Phase 5. Step 1

Drag the Clock from


the Pictures palette

© The AnyLogic Company | www.anylogic.com 119


A set of standard pictures

• The Pictures palette contains a set of pictures of


frequently modeled objects: person, truck, lorry, forklift
truck, warehouse, factory, etc.

• You can simply add a standard picture from the


Pictures palette and continue developing your model,
wasting no time on drawing.

© The AnyLogic Company | www.anylogic.com 120


Factory. Phase 5. Step 2

Set schedule to define


Add Schedule rates and define time
pattern as shown here

© The AnyLogic Company | www.anylogic.com 121


Schedule
• Schedule is a special element allowing you to define how some value changes in time
according to a defined cyclic pattern. Schedule is frequently used to define:
• Agent generation times, or cyclic pattern of agent arrival rate in source objects.
• Timetable for a pool of resources defined with ResourcePool.

• Schedule works in one of two modes: it can either define intervals, or time moments.
• Intervals mode is used when you need to define how some value continuously
changes in time (usually according to some cyclic pattern). Intervals are used to
define work timetables for worker shifts, cyclic pattern of agent arrival rate, etc.
• Moments mode is used when you need to define a sequence of key time moments
and some values corresponding to this particular moments (or perform some
actions. The example - train arrival schedule.
• You can define a schedule in one of three alternative views:
• Week - Use this view in case your schedule has weekly recurrence, e.g. if you need to
define a weekly schedule for office men.
• Days/Weeks - Use it when you need to define a schedule as a sequence of calendar
dates and times with non-weekly recurrence, e.g. a shift schedule 24 hours on, 48
hours off.
• Custom (no calendar mapping) - There is no mapping to calendar dates. Schedule
intervals/moments are defined simply as number of time units (milliseconds,
seconds, minutes, hours, days, or weeks) passed from the model start. Define
schedule in this view when only interval durations are important, not the exact
calendar times.

© The AnyLogic Company | www.anylogic.com 122


Factory. Phase 5. Step 3

Make both Source


blocks generate parts of
washing machines
according to the schedule

© The AnyLogic Company | www.anylogic.com 123


Arrival modes of source objects
• All currently present AnyLogic libraries contain objects that generate library agents. In
Process Modeling Library, Source supports several agent arrival modes:

Arrival mode Description


Rate Agents are created at the specified arrival rate (which is equivalent to exponentially
distributed interarrival time with mean = 1/rate).
Interarrival time The time between two subsequent arrivals is defined by the specified value/expression.
Rate schedule Agents are generated using rate schedule - a schedule defining how the arrival rate
changes with time.
Arrival schedule Agents are generated at exact times defined in the arrival schedule.
Calls of inject() Agents are not generated automatically and are only generated on calls of inject()
function method.

© The AnyLogic Company | www.anylogic.com 124


Factory. Phase 5. Step 4

Resource sets: robot

Resource sets (alternatives):


workers

ResourcePool
Name: robot
Resource type: Static ResourcePool
Name: workers
Capacity: 2
Home location (nodes): shapeWorkers

© The AnyLogic Company | www.anylogic.com 125


Add a resource to simulate the assembly robot. Name it robot and
change the Resource type to Static in its properties.
Add another ResourcePool object to simulate two workers that
perform packaging of the product.
• Name the object workers.
• Set the Capacity parameter to 2.
• Choose the shapeWorkers markup object as the home location of the
resources.
- Tell assembler block that now it needs one resource to perform
the operation, and the object packaging will use workers resources.

ResourcePool
• ResourcePoolobject defines a set of resources. Resources are objects that are needed by
agents to perform operations. Resources are seized and released by agents using Seize,
Release, Service and Assembler objects.

© The AnyLogic Company | www.anylogic.com 126


Factory. Phase 5. Step 5

ResourcePool
Shifts, breaks, failures,
maintenance…
Failures / repairs:

Choose minutes

© The AnyLogic Company | www.anylogic.com 127


Select the robot objects and go to its Properties. Expand the section
Shifts, breaks, failures, maintenance…
Choose the option Failures / repairs. You will see several new
parameters that you can use to define these events for your
resources.
We know that an assembly robot might fail and will require
some repair work, but we do not know when exactly. In this case
we will use the distribution functions to define these time intervals.

© The AnyLogic Company | www.anylogic.com 128


Factory. Phase 5. Step 6

Add a Bar Chart from


the Analysis palette

Define the
recurrence time

Click this button in the Data


section, then change the data
element’s properties

Resize the chart in the graphical


editor and change its bars direction in
the Appearance section

© The AnyLogic Company | www.anylogic.com 129


Add a bar chart to display the utilization statistics of the workers.
The Analysis palette contains the elements that you can use to
collect and analyze the simulation results (data set, statistics … )
and charts (bar chart, stack chart, time plot, histogram … ) that
help you visualize that collected data.
Type Workers utilization in the Title field of the data element.
Define Value that this bar chart will display: workers.utilization().
workers here is the name of the ResourcePool object, and
utilization() is the function that collects the utilization statistics of
the resources.
- Set the Recurrence time to 1 minute, then go to the
Appearance section and change the Bar direction property.

© The AnyLogic Company | www.anylogic.com 130


Factory. Phase 5. Step 7
Now we have finished creating our first model of a factory. You can analyze the impact
of equipment downtime and maintenance period on the factory performance

Resources
utilization statistics

Workers’ animation

© The AnyLogic Company | www.anylogic.com 131


Factory. Phase 5. Questions
1. If you model a truck with boxes going from one warehouse to
another would you use a permanent batch or non-permanent?
2. How can you change the number of available resources of
some specific type?
3. Workers are animated with circles now. How can you set
2D worker shapes for them?

© The AnyLogic Company | www.anylogic.com 132

You might also like