SlideShare une entreprise Scribd logo
1  sur  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.

Contenu connexe

En vedette

La ruta de la sal 2013
La ruta de la sal 2013La ruta de la sal 2013
La ruta de la sal 2013Anam
 
V este 1 web
V este 1 webV este 1 web
V este 1 webAnam
 
Cd digi pack cover completed
Cd digi pack cover completedCd digi pack cover completed
Cd digi pack cover completedjackthompson
 
Ancient greece project
Ancient greece projectAncient greece project
Ancient greece projectolearya
 
La tardor
La tardorLa tardor
La tardormonbove
 
Operations Department Budget
Operations Department BudgetOperations Department Budget
Operations Department Budgetstanes
 
Liquid pres
Liquid presLiquid pres
Liquid presAllosRoy
 
Współpraca polsko – ukraińska
Współpraca polsko – ukraińskaWspółpraca polsko – ukraińska
Współpraca polsko – ukraińskasknsz
 
Pierwszy dzień przeglądu filmów
Pierwszy dzień przeglądu filmówPierwszy dzień przeglądu filmów
Pierwszy dzień przeglądu filmówsknsz
 

En vedette (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
 

Dernier

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Dernier (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

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.