anylogictraffic-simulation

CAR API Functions - AnyLogic


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?


Solution

  • 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".