Mohammad Hasan N.
Mohammad Hasan N.

Reputation: 224

Anylogic dynamic Location of arrival for carSource

Is there any idea how to set location of arrival of a car dynamically and during code. For example imagine that we have 20 parking lots and I don't want to draw 20 carSources for each one. Only one carSource and determining the location dynamically is my goal. How is it possible?

Thanks in advance

Upvotes: 0

Views: 211

Answers (2)

Benjamin
Benjamin

Reputation: 12660

Re making this a function, I suggest this:

  1. create a collection of type ArrayList that stores ParkingLots. Manually add all your parking lots as below: enter image description here
  2. create the function getRandomParkingLot that returns a ParkingLot. Set the code so it pulls a random object from the collection as below: enter image description here

Upvotes: 2

Benjamin
Benjamin

Reputation: 12660

This is simple: just use the dynamic property of the CarSource initial location as below. You need to click on the little "=" symbol left of the normal selection object and type code as below: enter image description here

Upvotes: 0

Related Questions