SlideShare a Scribd company logo
1 of 16
How to create and access
variables
Become an AnyLogic Expert Step by Step
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.
Learning subjects
khoi.tran@simbean.com 3
In this example you can learn,
• How to create different kinds of plain variable.
• Normal plain variable
• Static plain variable
• Constant plain variable
• Collection variables
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.
Create different plain variables
khoi.tran@simbean.com 4
Drag & drop all the
variables and rename
them
Create an active object called “PlainVarAO“ and insert the plain variables.
Properties of normal plain variable
khoi.tran@simbean.com 5
The name of the plain
variable can be changed, first
character should be lower-
case as Java convension
Like the variable in Java, access
modes are “public“,
“protected“ and “private“.
With “default“ the variable
can be access everywhere in
the model
A variable can be
static or constant
Some simple variable types are
listed as options, but you can
define the plain variable with
arbitrarily object type.For a double type, inital value can be e.g.
1.5, but for a String type, the initial value
must be in quota e.g. „initial value“
Access and assign value for an normal
plain variable
khoi.tran@simbean.com 6
Create embedded
object on “main“
active object
Assign and access the variable
of active object “plainVarAO“
in startup code of “main“
active object
Properties of static plain variable
khoi.tran@simbean.com 7
Change the name of the plain
variable
Define this plain
variable as a static
plain variable
Access and assign value for an static
plain variable
khoi.tran@simbean.com 8
Asign and access the variable
of active object “plainVarAO“
in startup code of “main“
active object
As Java convension, you will get a
warning, if character “p“ of
“plainVarAO“ is lower case.
Character “P“ must be upper case.
As Java convension, you will get a
warning, if character “p“ of
“plainVarAO“ is lower-case.
Character “P“ must be upper-case.
“//“ is marked as comment, if
you want to see the effect of
this line of code, please
uncomment it by removing the
“//“
Properties of constant plain variable
khoi.tran@simbean.com 9
Define this plain
variable as a constant
plain variable
Change the name of the plain
variable, as Java convension, all
the characters are upper-case
Access and assign value for an constant
plain variable
khoi.tran@simbean.com 10
As a constant plain variable, you can
access its value, but you are not able to
assign any value to it
Create different collection variables
khoi.tran@simbean.com 11
Drag & drop all the
collection variables
and rename them
Create an active object called “CollectionVarAO“ and insert the collection variables.
Create different collection variables
khoi.tran@simbean.com 12
Choose
„java.util.LinkedList“
for both variable
Element class is
“String“
Choose “Static“
for definition of a
static collection
Access and assign collection variables
khoi.tran@simbean.com 13
In each active object
there is a collection and
value can be added
In each active object
there is a collection and
value can be added
Using the for loop for
printing out all the values
in the collection
Access and assign static collection variables
khoi.tran@simbean.com 14
For static collection the name
of the class is used, that‘s
why the first character is
upper-case
Run the model
khoi.tran@simbean.com
Click on the run button and
choose the simulation
15
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. Add more values to the collection variable.
2. On slide 12, you can try it with different collection classes.
3. You need to restart the model to see the effects
Thank You
khoi.tran@simbean.com 16
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.

More Related Content

Viewers also liked (16)

La ruta de la sal 2013
La ruta de la sal 2013La ruta de la sal 2013
La ruta de la sal 2013
 
V este 1 web
V este 1 webV este 1 web
V este 1 web
 
Cd digi pack cover completed
Cd digi pack cover completedCd digi pack cover completed
Cd digi pack cover completed
 
Presentation2
Presentation2Presentation2
Presentation2
 
Ancient greece project
Ancient greece projectAncient greece project
Ancient greece project
 
La tardor
La tardorLa tardor
La tardor
 
Re:new
Re:newRe:new
Re:new
 
Ricky ppt
Ricky pptRicky ppt
Ricky ppt
 
Operations Department Budget
Operations Department BudgetOperations Department Budget
Operations Department Budget
 
Hokkaido.pm
Hokkaido.pmHokkaido.pm
Hokkaido.pm
 
Lecture
LectureLecture
Lecture
 
Measure or Die
Measure or DieMeasure or Die
Measure or Die
 
Liquid pres
Liquid presLiquid pres
Liquid pres
 
Bombers book pt
Bombers book ptBombers book pt
Bombers book pt
 
Współpraca polsko – ukraińska
Współpraca polsko – ukraińskaWspółpraca polsko – ukraińska
Współpraca polsko – ukraińska
 
Pierwszy dzień przeglądu filmów
Pierwszy dzień przeglądu filmówPierwszy dzień przeglądu filmów
Pierwszy dzień przeglądu filmów
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

AnyLogic - Free AnyLogic basic lessions - Learning AnyLogic by examples - Demo variable

  • 1. How to create and access variables 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 kinds of plain variable. • Normal plain variable • Static plain variable • Constant plain variable • Collection variables 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 different plain variables khoi.tran@simbean.com 4 Drag & drop all the variables and rename them Create an active object called “PlainVarAO“ and insert the plain variables.
  • 5. Properties of normal plain variable khoi.tran@simbean.com 5 The name of the plain variable can be changed, first character should be lower- case as Java convension Like the variable in Java, access modes are “public“, “protected“ and “private“. With “default“ the variable can be access everywhere in the model A variable can be static or constant Some simple variable types are listed as options, but you can define the plain variable with arbitrarily object type.For a double type, inital value can be e.g. 1.5, but for a String type, the initial value must be in quota e.g. „initial value“
  • 6. Access and assign value for an normal plain variable khoi.tran@simbean.com 6 Create embedded object on “main“ active object Assign and access the variable of active object “plainVarAO“ in startup code of “main“ active object
  • 7. Properties of static plain variable khoi.tran@simbean.com 7 Change the name of the plain variable Define this plain variable as a static plain variable
  • 8. Access and assign value for an static plain variable khoi.tran@simbean.com 8 Asign and access the variable of active object “plainVarAO“ in startup code of “main“ active object As Java convension, you will get a warning, if character “p“ of “plainVarAO“ is lower case. Character “P“ must be upper case. As Java convension, you will get a warning, if character “p“ of “plainVarAO“ is lower-case. Character “P“ must be upper-case. “//“ is marked as comment, if you want to see the effect of this line of code, please uncomment it by removing the “//“
  • 9. Properties of constant plain variable khoi.tran@simbean.com 9 Define this plain variable as a constant plain variable Change the name of the plain variable, as Java convension, all the characters are upper-case
  • 10. Access and assign value for an constant plain variable khoi.tran@simbean.com 10 As a constant plain variable, you can access its value, but you are not able to assign any value to it
  • 11. Create different collection variables khoi.tran@simbean.com 11 Drag & drop all the collection variables and rename them Create an active object called “CollectionVarAO“ and insert the collection variables.
  • 12. Create different collection variables khoi.tran@simbean.com 12 Choose „java.util.LinkedList“ for both variable Element class is “String“ Choose “Static“ for definition of a static collection
  • 13. Access and assign collection variables khoi.tran@simbean.com 13 In each active object there is a collection and value can be added In each active object there is a collection and value can be added Using the for loop for printing out all the values in the collection
  • 14. Access and assign static collection variables khoi.tran@simbean.com 14 For static collection the name of the class is used, that‘s why the first character is upper-case
  • 15. Run the model khoi.tran@simbean.com Click on the run button and choose the simulation 15 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. Add more values to the collection variable. 2. On slide 12, you can try it with different collection classes. 3. You need to restart the model to see the effects
  • 16. Thank You khoi.tran@simbean.com 16 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.