SlideShare ist ein Scribd-Unternehmen logo
1 von 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.

Weitere ähnliche Inhalte

Andere mochten auch

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
 

Andere mochten auch (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
 

Kürzlich hochgeladen

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
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
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
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
 

Kürzlich hochgeladen (20)

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
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!
 
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!
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
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
 

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.