-1

I am working on an Anylogic model, and am trying to do something but am stuck. What I want to achieve is basically being able to change a variable from within the person agent with the use of the slider from the main.

My attempt to do this was linking the slider in the main to a parameter in the main, and linking the parameter to the variable in the person agent, the issue with this is that it only happens once and does not keep changing, so I added an event to solve this issue, but it is still not working.

1 Answers1

0

Depends on your model structure (assume the var is called myVar and the slider sits in Main):

  • If the Person is a single agent embedded in Main, you can call myPerson.myVar=value in the "Action" code of the slider
  • If the Person is part of an agent population embedded in Main, you can call myPersonPop.get(x).myVar=value in the "Action" code of the slider -> x is the index of the person you want

Do check this help article to understand model structure and OOP concepts, it is VERY important to get these right. Also, check more example models, many have sliders doing what you want :)

Benjamin
  • 10,603
  • 3
  • 16
  • 28