0

I am using the AnyLogic traffic library and need to use two functions listed here: CAR API, getDistanceDriven() and getLaneIndex(). But when I invoke them I get the error: The method getDistanceDriven() is undefined for the type Vehicle, The method getLaneIndex() is undefined for the type Vehicle.

distance is a parameter in Vehicle agent:

enter image description here

I don't have much experience with AnyLogic and I don't know if I am using the function well. Inside the list there is the function called getSpeed() but this one works fine. I have the AnyLogic 8 University version thinking it was some limitation of the PLE version but I have the same problem.

Could you help me, please?

Cesar
  • 13
  • 2

1 Answers1

0

I fix it like this:

enter image description here

Go to the project browser, click on the agent "Vehicle". In its properties, under the tab Agent in flowcharts change on Use in flowcharts as: to "Car".

Cesar
  • 13
  • 2
  • This is correct, thx for posting it for future users as well. You "activate" car API functions with this setting, hence why it did not work before this. – Benjamin Apr 02 '23 at 06:52