Search code examples
simulationanylogic

How to change the Speed of moveTo block on run time in AnyLogic


I am using the processing modeling library's "moveTo" block for moving the AVG. Now I want to change the speed, so in the "moveTo" block property called speed, I put a variable, and I am changing the value of the variable on runtime using an editBox, but the speed doesn't change.

enter image description here

How do I resolve the issue?


Solution

  • Whenever you change that variable, you also must actively change the agent speed yourself using setSpeed(mySpeedVariable)

    Agent speed is a static property, so an agent does not constantly check for that variable to change. It is up to you to tell the agent that. (else models would be painfully slow if all agents would constantly check)