1. How to create events
Become an AnyLogic Expert Step by Step
2. About me
khoi.tran@simbean.com 2
My name is Khoi Tran and I’m living in beautiful Stuttgart, Germany.
As a 12-years expert in the software industry and 6-years expert in
simulation with AnyLogic, I would like to share my experiences
with you on a simple and fast path.
3. Learning subjects
khoi.tran@simbean.com 3
In this example you can learn,
• How to create different kind of Events.
• Static Events
• Dynamic Events
You can see the demo in action first
http://simbean.com/en/knowhow/become-an-anylogic-expert.html
If you like to know, how I built this model, this presentation may help you.
4. create_MyDynamicEvent01(15);
static event and dynamic event
khoi.tran@simbean.com 4
0
10 15
timeevent.restart(15);
1. Static event exists for the whole time, during the model run. When time is over,
you can restart the static event by calling its restart method.
2. Many dynamic event objects can be created in parallel. When time is over, you
need to create new dynamic event.
15
0
10
time
Static event
Dynamic event
Action executed
Start to schedule
create_MyDynamicEvent01(10);
5. Create a static event
khoi.tran@simbean.com 5
Drag & drop one event
onto the graghical
editor
6. Set properties for static event
khoi.tran@simbean.com 6
• Method “Traceln” prints the message on the console of AnyLogic
• Absolute time of a running model is exactly the time, which is counted from the
begin of the running model
Show the message,
when this event is
triggered
Set Trigger type:
“Timeout”
Set Mode: “Occurs
once”
Set absolute time for
event trigger
7. Create a dynamic event
khoi.tran@simbean.com 7
Drag & drop a dynamic
event onto the
graghical editor
Drag & drop a plain
variable onto the
graghical editor
8. Set properties for dynamic event
khoi.tran@simbean.com 8
Method traceln(“...“) shows the
message on the console, as the
definition of the action in this
dynamic event
9. Set properties for plain variable
khoi.tran@simbean.com 9
Set the plain variable on type
“DynamicEvent“
10. Set startup code for active object which has a
dynamic event
khoi.tran@simbean.com 10
Create dynamic events,
Value 10 is the trigger time
11. Run the model
khoi.tran@simbean.com
Click on the run button and
choose the simulation
11
1. You can run the model and see the result
2. Try to change or set properties to see some small effects e.g.
1. Set the absolute time for the static and dynamic events.
3. You need to restart the model to see the effects
13. The result
khoi.tran@simbean.com 13
Two dynamic events are
created. Time value can be
seen at the plain variables
The time is counting down
for the static event
Two dynamic events are
created. Time value can be
seen at the plain variables
14. Thank You
khoi.tran@simbean.com 14
IF YOU HAVE ANY QUESTION, IDEA, FEEDBACK or FIND ANY MISTAKE,
PLEASE SEND ME an EMAIL
khoi.tran@simbean.com
BECAUSE I WOULD LIKE to IMPROVE this SLIDE CONTINUOUSLY.
I APPRECIATE a lot YOUR TIME.