Sie sind auf Seite 1von 24

Ilya Grigoryev

AnyLogic 6
in Three Days
A quick course in simulation modeling

Firstedition

AnyLogic North America


2012

AnyLogic6inThreeDays7

Modelingandsimulationmodeling
This chapter is from "The Big Book of
Simulation Modeling: Featuring AnyLogic"
being currently written by Dr. Andrei
Borshchev and partially available on
AnyLogicwebsite.
Modelingisoneofthewaystosolverealworldproblems.Inmanycases,wecant
afford to find the right solutions by experimenting with real objects: building,
destroying,makingchangesmaybetooexpensive,dangerous,orjustimpossible.
Ifthisisso,weleavetherealworldandgototheworldofmodelsasshowninthe
figurebelow.Webuildamodelofarealsystem:itsrepresentationinamodeling
language. This process assumes abstraction: we omit the details we think are
irrelevant and we keep those we think are important. The model is always less
complexthantheoriginalsystem.

Themodel

Thesolution
atthemodellevel

Theworldofmodels
[THERISKFREEWORLD]
Therealworld

Theproblem

Thesolution

8AnyLogic6inThreeDays

Modeling
Themodelbuildingphasesmappingtherealworldtotheworldofmodels,
choosingtheabstractionlevel,andchoosingthemodelinglanguageareless
formalized than the process of using models to solve problems. This is still
moreanartthanascience.
Afterwehavebuiltthemodelandsometimesevenaswebuildthemodelwe
starttoexploreandunderstandtheoriginalsystem'sstructureandbehavior,test
how the system will behave under a variety of conditions, play and compare
scenarios,andoptimize.Afterwefindoursolution,wethencanmapittothereal
world.
Thewholemodelingthingisactuallyaboutfindingthewayfromtheproblem
to its solution through a riskfree world where we are allowed to make
mistakes,undothings,gobackintime,andstartoveragain.

Typesofmodels
There are many types of models, including the mental models we each use to
understand how things work in the real world: friends, family, colleagues, car
drivers, town where you live, things that you buy, economy, sports, politics, or
your own body. Decisions such as what to say to your child, what to eat for
breakfast,whotovotefor,orwheretotakeyourgirlfriendareallbasedonmental
models.
Computersareextensivelyusedformodeling,andtheyprovideuswithaflexible
virtualworldwherewecaneasilycreateanythingimaginable.Ofcourse,thereare
manydifferenttypesofcomputermodels,fromspreadsheetsthatallowanyoneto
model expenses to simulation modeling tools that help users explore dynamic
systemssuchasconsumermarketsandbattlefields.

Analyticalvs.simulationmodeling
If you could ask a major organizations strategic planning, sales forecasting,
logistics, marketing, or project management teams about their preferred
modeling tools and technologies, you'd quickly find Microsoft Excel is the most
popularmodelingsoftware.Excelhasobviousadvantages:youcanfinditonany
officecomputeranditisveryeasytouse.Itsalsoextensible:youcanaddscripts
toyourformulasasthespreadsheetlogicbecomesmoresophisticated.

AnyLogic6inThreeDays9

Calculate!
Inputs

Outputs

X1

Y1

X2

Y2

X3

Y3

X4

Y4

Analyticalmodel(Excelspreadsheet)
The technology behind spreadsheetbased modeling is simple: you enter the
model inputs in some cells and you view the outputs in others. The input and
output values linked by chains of formulas and in more complex models
scripts.Variousaddonsallowyoutoperformparametervariation,MonteCarlo,
oroptimizationexperiments.
However, there's also a large class of problems where the analytic (formula
based)solutiondoesntexistoritisveryhardtofind.Thisclassincludesdynamic
systemsthatfeature:

Nonlinearbehavior

"Memory"

Nonintuitiveinfluencesbetweenvariables

Timeandcausaldependencies

Allabovecombinedwithuncertaintyandlargenumberofparameters

Inmostcases,itsimpossibletoobtaintherightformulas,muchlessputtogether
amentalmodelofsuchasystem.
As an example, consider a problem that requires you to optimize a rail or truck
fleet.Factorssuchastravelschedules,loadingandunloadingtimes,deliverytime
restrictions, and terminal point capacities make it difficult to approach with a
spreadsheet.Avehiclesavailabilityataparticularlocationonaparticulardateat
aparticulartimedependsonasequenceofprecedingeventsandansweringthe
questionofwheretosendthevehiclewhenitisidlerequiresustoanalyzefuture
eventsequences.

10AnyLogic6inThreeDays

Formulasthataregoodforexpressingstaticdependenciesbetweenvariables
typicallydon'tdowellindescribingsystemswithdynamicbehavior.Itswhy
we use another modeling technology simulation modeling to analyze
dynamicsystems.
Simulation model is always an executable model: you can run it and it will build
youatrajectoryofthesystem'sstatechanges.Thinkofasimulationmodelasaset
ofrulesthattellyouhowtomovefromthesystemscurrentstatetothefollowing
state.Therulescantakemanyforms,includingdifferentialequations,statecharts,
process flowcharts, and schedules. The model's outputs are produced and
observedasthemodelruns.

Run!

Trajectory of the
systemintime

Inputs
X1
X2

Outputs
Y1

time

X3
X4

Y2
Y3
Y4

Simulationmodel
Simulation modeling is done with special software tools that use simulation
specific languages, both graphic and textual. While it typically requires some
training,yourtimeandeffortpaysoffwhenyoucreateahighqualityanalysisofa
dynamicsystem.
People especially those who count themselves as Excel professionals and have
some programming background often still try to build spreadsheet models of
dynamic systems. As they try to capture more and more detail, they inevitably
start reproducing the functionality of simulators in Excel. The resulting models
areslowandunmanageable,andtheyareusuallyquicklythrownaway.
Virtually any of those details are impossible to capture in an analytic solution.
Eveniftherewereformulastoguideyourconfiguration,asmallprocesschange
couldvoidthem,andyou'dneedaprofessionalmathematiciantofixthem.

AnyLogic6inThreeDays15

InstallingandActivatingAnyLogic
AnyLogic 6 Professionals wizarddriven installation process is simple and
straightforward.DownloadAnyLogic6fromwww.anylogic.com,andthenusethe
followingstepstoinstallit:
1.

Start AnyLogic. If it is not activated with a personal unlock key yet, the
AnyLogic Activation Wizardwillbedisplayedautomatically.

2.

Onthe Activate AnyLogicpage,select Request a time-limited Evaluation Key.


The key will be sent to you by e-mail.,andthenclickNext.

16AnyLogic6inThreeDays

3.

On the AnyLogic License Request page, provide your personal information


andthenclickNext.

You'llreceiveaconfirmationshortlyafteryousendyourrequest,andyou'll
receiveyourevaluationkeyinaseparateemail.

AnyLogic6inThreeDays17

4.

After you receive your activation key, open the AnyLogic activation wizard,
select Enter the Evaluation Key that you received by emailonthefirstpage,
andthenclickNext.

18AnyLogic6inThreeDays

5.

Copythereceivedactivationkeyfromtheemailmessageyoureceived,paste
itintothePlease paste the key herefield,andthenclickNext.

AnyLogic6inThreeDays27

the
Enterprise Library
paletteopen
You'll

see

Add Source objecttogenerateentities.Whilethe Source objectusuallyactsasthe


processmodelsstartingpoint,ourmodelwilluseittogeneratewashingmachine
bodies.
7. Drag the Source element from the Enterprise Library palette on to the
graphicaldiagram.Youllfindthistobetheeasiestandmostcommonwayto
addanelementtoadiagram.

28AnyLogic6inThreeDays

8. Afteryoudraganelementontothegraphicaleditor,you'llseetheelement's
nameisselectedintheinplaceeditor.

Here,youcanentertheobjectsnewname:sourceBodies.
Namemodelelementsaswedohereyou'lllaterrefertotheseelementsby
theirnames.
If you exit the inplace editor, doubleclick the object's name on the diagram
canvastoreturntoeditingmode.

AnyLogic6inThreeDays29

ContinueconstructingtheflowchartbyaddingmoreEnterpriseLibraryobjects:
9. Add a Queue object on to the diagram, and then use the inplace editor to
nameitbodies .
TheQueue objectmodelsaqueue(abuffer)ofentities
waiting to be
acceptedbytheprocessflow'snextobjectorastorageoftheentities.Weadd
a queue to store the washing machine bodies until they can be placed on a
conveyor.

10. AddaConveyorobject,andthennameitconveyorBodies .
The Conveyor object movesentitiesalongapathatagivenspeed,anditalso
ensures a minimum space separates them. In our model, the object
representsaconveyorthattransportswashingmachinebodies.

10

11. Add Sink.A Sink objectdisposesentities,anditusuallyactsasaflowchart's


endpoint.

11

AnyLogic6inThreeDays41

Enterprise Library objects don't have builtin animations, so you should tell the
object bodies that the rectangle shapeBodyStorage should be used as the shape
animatingthestoragezoneforwashingmachinebodies.Whilewashingmachine
bodies will be in the storage zone, their animations will appear inside this
rectangle.

13
14

15

17
16

13. Selectbodies .

Don't forget to select the object first to display its properties in the Properties
view.
14. EnlargethePropertiesviewbydraggingitsborderup.
15. Selectthe Maximum capacitycheckboxtomakethequeue'scapacityaslarge
aspossible.

42AnyLogic6inThreeDays

16. SelectBagasAnimation type.


17. Specify shapeBodyStorage as Animation guide shape. Typefirstlettersand
press Ctrl+Space (Mac OS:Alt+space) toactivate code completion assistant.
SelectshapeBodyStorage fromthelist.

Codecompletionassistant

Use code completion assistant to avoid typing full names of variables and
functions. To open the assistant, click the desired position in theedit box, and
thenpressCtrl+space(Alt+spaceonMacOS).Thepopupwindowliststhemodel
elements available in the given context, such as: model variables,
parameters,functions,etc.Scrolltothenameoftheelementyouwanttoaddor
typetheelement'sfirstlettersuntilitappearsinthelist,andthenpressEnterto
insertthenameintheeditbox.

Now let's define the animation shape for our conveyor. We want to see how
entities(ourwashingmachinebodies)movealongtheconveyor.Theconveyoris
drawnontheanimationwiththepolylineshapeConveyorBodies ,so:
conveyorBodies on the diagram and specify our polyline
shapeConveyorBodies asitsAnimation guide shape.

18. Select

AnyLogic6inThreeDays43

18

AnimationtypesofEnterpriseLibraryobjects
Objectthatperformssomeoperationoverentities(orresources)cananimateits
activitybyanimatingentitiesthisobjecthandles.AnyLogicallowsyoutodothis
easily by drawing a shape on the graphical diagramsay, a polyline or a
rectangleand specifying this shape as objects Animation guide shape. The
objectthenusesitasaguidelinetoanimatetheentities.Thereareseveralwaysof
animatingentitiescalledanimationtypes:
Arranged

Animations of entities are displayed arranged in 2D


arraythatfitsthegivenrectangle.

Bag

Animations are displayed at random positions in the


specifiedrectangle.

Path

Animations are displayed moving along the polyline in


thesamepositiontheyarepositionedintheobject.

Single

The single entity animation is displayed at the shape's


baseposition.

Set

Animations of entities are displayed at the positions of


pointsofthespecifiedpolyline.

44AnyLogic6inThreeDays

19. Runthemodelandwatchitsanimation.
If you see the following error message, you've forgotten to choose Bag as the
Animation typefortheobjectbodies :

20. Look at the model animation, and you'll see washing machine bodies are
storeduntiltheconveyortransportsthem.

21

20

21. Adjustthemodel'sexecutionspeedbyclickingthe Slow downand Speed up


toolbarbuttons.

58AnyLogic6inThreeDays

Phase4.Modelingpackagingoperation
Let's continue developing our model by adding logical details. We want to
simulatenextoperationsfollowingtheassembly:

Letsaddalinetopackmanufacturedproductsintoboxes.Ourpackaging
lineincludestheupstreamconveyorandthepackagingzone.

Packed products will be placed in the loading zone, and workers will
batchtheboxesingroupsof10forshipment.
2
1

Draw five new shapes to represent the packaging zone, the packaging zone's
conveyor,andtheloadingzone.
1. Drawthe shapeMoveToPackagingpolylinefromlefttoright.Itwillrepresent
anupstreamconveyortopackagingzone.
2. Draw a rectangle to represent the workers' location, and then name it
shapeWorkers .
3. DrawacircleshapePrePackage toanimatethequeuetopackagingzone.
4. DrawarectangleshapePackage todefinethepackaginglocation.
5. DrawarectangleshapeLoadingtodefinetheloadingzone.

76AnyLogic6inThreeDays

The approach that involves drawing a transportation network for entities and
resources on a layout of simulated physical space is network or layoutbased
modeling.
Network based modeling is successfully used in complex service, logistics, and
healthcaresystemswherelayoutisimportantandthereisanetworkoflocations
andpathsbetweenthemwhichentitiesuseasroutes(androutelengthsmatter).
Another example of a networkbased model is a transportation network in a
logistics model. Here, the entities are trains that transfer the cargo, network
nodesstandforterminals,andrailwaysaredefinedwithnetworksegments.

Networkbasedmodelofaterminalnetwork

AnyLogic6inThreeDays77

RetailerModel
Letsbuildamodelofaretailerwarehouse.Forsimplicity,we'llassumethisstore
sellsjustoneproduct.
Theretailerworksasfollows:

The retailer orders a number of products. When the retailer receives


them,theystoretheproductsintheirwarehouse.

Products are regularly sold by the store. When a new request for a
product arrives, a product is removed from storage and sold to the
customer.

When the number of stored products reaches a set level, the retailer
ordersadditionalproductstoincreasetheinventory.

78AnyLogic6inThreeDays

WarehouseOperationsandLayoutOptimization

HighBayWarehousemodel
Constructing and fitting out a modern warehouse with all its required
equipment and tools is an expensive undertaking. The planning and design
stagesarekey,andmistakescanreducewarehouseutilityandperformanceand
increase operational costs. You should also pay careful attention to operational
optimization; increased loads can affect the performance of a warehouse which
onceoperatedeffectively.
Simulationmodelingisthemoderntoolthatmakesiteasiertodesign,layout,and
optimize warehouse operations. Simulating a warehouse implies developing a
computer model and testing it by executing computational experiments with
combinations of parameters based on that model these experiments provide a
lowcost and low risk method to determine the optimal parameter set for a
warehouseunderdevelopmentorredesign.

AnyLogic6inThreeDays79

Thefirststepincreatingamodelistodetailthewarehousesstructure:theexact
location of major zones and transportation routes. Afterward, well specify the
business processes the warehouse uses to operate: the who, what, and when of
resources(staffandequipment)associatedwithvariousprocedures.Weconsider
materialarrivalschedules,includingvariablessuchasparts,volume,andtiming.
During model operation, we typically collect detailed warehouse operations
statistics such as resource utilization rates, activity durations, and completion
times.
Warehouse modeling deliverables often include items such as a detailed report
that describes the warehouses design, suggested changes to lay out a stone
optimization results, software caught allowing the customer to reach these
determinations himself, or an ongoing software decision support system.
Whateverthedeliverable,mostwarehousesimulationsolutionsaddress:

the required quantity and type of transportation and material handling


equipment

stafflevelrequirements

floorspacerequirementsandlayout

ultimatescenariosofequipmentlayoutanarrangement

calculatingperformancemetricssuchasexecutiontime

resourceutilizationrates,inventorylevels,etc.

calculatingandoptimizingwarehouseoperationalexpenses

determiningtheoptimalnumberofloadingandunloadinggates

developingmoreeffectivefreighttrafficflows

optimizingoperationaltimetables

106AnyLogic6inThreeDays

16

16. Modifythechartproperties:

IntheTime Windowbox,changethechartstimewindowtooneweek.

IntheVerticalscalebox,click Fixed scalewithamaximumYaxisvalue


of60 .

Inthe Recurrence timebox,type hour()toupdaterecurrencetimetoone


hour.

IntheDisplay up tobox,changethenumberofsamplesthechartdisplays
atonetimeto200 .

17. IntheTime axis formatlist,clickModel date (date only).

17

Chartswithhistory(timeplot,timestackchartandtimecolorchart)candisplay
modeldatesintime(x)axislabels.Selectthesuggestedformatthatbestfitsyour
needsintheTime axis formatoptionontheAppearancepropertiespage.

AnyLogic6inThreeDays107

Addtwosliderstovarys andS parametersinteractivelyduringthesimulation.


18. AddSliderfromtheControlspaletteontothediagram.

18

19. Modify the sliders properties by selecting the Link to checkbox and then
typingthenameofparameteryouwanttovaryintheeditboxtotheright: S .
SettheMaximum valueequalto60 .

20

19

20. Add labels that display the sliders minimum, current, and maximum values
byclickingAdd labels.
21. Create acopy of this slider and set it up to vary s parameter. Use Ctrl+drag
(MacOS:Cmd+drag)tocopy.
22. Addlabelsforthisslideralso.

118AnyLogic6inThreeDays
21. Drawasecondpolylineovertheremainingpartofthewall.
22. Selectbothpolylinesandset:

OntheGeneralpage:

Line color: Textures.. | brickRed

Line width:3pt

OntheAdvancedpage:

Z-Height:30

Try It Now

23. Runthemodel.

23

We've completed the warehouse model. Though our model represents a small
warehouse,you'llbepleasedtoknowthemodelscomplexityisntdirectlyrelated
tothewarehouse'ssize.Infact,itislargelyafunctionofthedetaillevelyouselect
andthecomplexityoftherelatedbusinessprocesses.
Tomakethismodelmorerealistic,youcanadddispatchprocess,pickingprocess,
additionalzones:unloadingzone,receptionzone,placementzone,dispatchzone,
controlzone,temporarystoragearea,moretypesofstaff:acceptors,controllers,
differenttypeofvehiclesetc.

Das könnte Ihnen auch gefallen