Become an AnyLogic Expert Step by Step How to access a root active object
About me firstname.lastname@example.org 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 email@example.com 3 In this example you can learn,
how to access the root object from another active object.
You can see the demo in action first http://simbean.com/en/knowhow/become-an-anylogic-expert.html If you like to know, how we built this model, this slide may help you.
Create a new model firstname.lastname@example.org 4 Write the name of the model e.g. „DemoRootAccessControl“ Choose menu item „Model“ Right mouse click on the Project area, e.g. At the the point of this pointer Create a new model
Create an active object email@example.com 5
Write „SpeedControl“ instead of „MyClass“ Create an active object called “SpeedControl” in the model project
Insert a control object to an active object firstname.lastname@example.org 6 Choose Control tab on the palette on the right side Drag and drop the Slider on the Graphical editor of the active object Drag & drop the slider onto the graghical editor
Set properties for control object „slider“ email@example.com 7 Enable the “icon” checkbox Set Maximum value to 300
Create Object from Enterprise Library and its connections firstname.lastname@example.org 8 Drag & drop elements from Enterprise Library Drag & drop elements from Enterprise Library Drag & drop elements from Enterprise Library Drag & drop elements from the Enterprise Library
Set properties for „source“ email@example.com 12 Write “groupCar” for the entity animation shape Set the unique shape for each entity
Create embedded active object firstname.lastname@example.org Drag & drop the “SpeedControl” active object onto the graphical editor of the “Main” active object 13
Code for changing the conveyor behaviour in „Main“ or so called „Root“ active object email@example.com 14 Write this two lines of code in “Action” property Click on the “SpeedControl” active object to get back to the graphical editor Put the two lines of code Main main = ((Main)getEngine().getRoot()); main.conveyor.set_speed(value);
Run the model firstname.lastname@example.org Click on the run button and choose the simulation 15 You can run the model and see the result Try to change or set properties to see some small effect e.g. Where the property is put on “false”, you can turn it on with “true”. Set and unset the checkboxes. You need to restart the model to see the effects
Thank You email@example.com 16 IF YOU HAVE ANY QUESTION, IDEA, FEEDBACK or FIND ANY MISTAKE, PLEASE SEND ME an EMAIL firstname.lastname@example.org BECAUSE I WOULD LIKE to IMPROVE this SLIDE CONTINUOUSLY. I APPRECIATE a lot YOUR TIME.