Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
AnyLogic - Free AnyLogic basic lessions - Learning AnyLogic by examples - Demo function
1. How to create functions
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 function
• Without arguments
• With arguments
• How to create table function
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.
5. Create a function and specify it
khoi.tran@simbean.com 5
The return type of the
function “calculate“
must be double
Specify the function
code
6. Create an event for a function call
khoi.tran@simbean.com 6
After 2 seconds the
function call is executed
and its result is assigned to
the plain variable ”sum”
Set properties for the
event
You can create a function call like this line of code e.g. in
and event’s action or at another places for inserting
code in the model.
7. Create a function with argument input
khoi.tran@simbean.com 7
Similar to the first
function, there are two
summand arguments
defined for this
function
In the property “Code“ the result of
the calculation for two summand
arguments is returned
8. Set properties for event
khoi.tran@simbean.com 8
The method call must have
arguments . Here they are two
simple double values. Plain
variables are possible for these
arguments , too. E.g. Sum1 =
calculateWithParameter( a, b);
9. Create a table function
khoi.tran@simbean.com 9
Interpolation type
Argument-value-list defines
the function as the figure
If the value is not in the
range, the function
returns an error
Argument-value-list defines
the function as the figure
10. Table function definitions
khoi.tran@simbean.com 10
There is no
interpolation, the
function is explixitely
defined only for these
input argument
values on the list
Figure of step
interpolation
Figure of the step
interpolation
11. Table function definitions
khoi.tran@simbean.com 11
“Out of range“ can
be also defined with
a custom value
“Out of range“ can
be also defined with
a custom value. The
function always
returns a valid
value, not an error
anymore
“Out of range“ is
defined with
“nearest“ and the
figure is redrawn
“Out of range“ is
defined with
“nearest“ and the
figure is redrawn
13. Run the model
khoi.tran@simbean.com
Click on the run button and
choose the simulation
13
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. Test the functions with different values
2. Also with some out-of-range-values
3. You need to restart the model to see the effects
15. Thank You
khoi.tran@simbean.com 15
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.