0
votes

From what I can see, the cars choose their path based on shortest distance, as soon as the "carMoveTo" command occurs.

First question: How is the parameter for getting the road length called? Unlike in Paths, where you can simply call path.length(), there is nothing simple as that (obviously, inward lanes in curved paths have shorter length).

Second question: Is there a simple or hard way to change the logic of routing? I have found this article on path network https://florianhuebler.com/custom-routing-in-anylogic/ , but have no clue how to put that into road traffic.

Third question: Does the "average speed" consider average speed of current cars on road? That's not what I would really want - my preferred way of routing would be to only take the speed limit stoplines into consideration (In that sense, I guess the car's maximum speed would also need to be checked - if it drives 50 kph at max, then it will not care about 80 kph limit). Does there exist a way to do it easily?

(Side-question - what is the average speed on unused road? Road network descriptor colors it as greenest.)

1

1 Answers

0
votes

Question 1

the road is composed by segments and you can calculate the length for each segment like this, you need to transform it from pixels length to meters for example if needed.

scale.toLengthUnits(road.getSegment(0).length(), METER)//this example is for segment 0, you can replace 0 with another index that referes to the particular segment

Question 2. you can't touch the routing. The algorithm is internal and you have no control over it, but you can somewhat control something using stoplines as you can see in the following answer, but not really AnyLogic - determination of lane in road traffic Also of course you can create intermediary carMoveTo with all the conditions you need, but if your network is too big, this becomes really crazy.

Question 3. yes it's the average speed of cars on the road. But what's the relationship between this and routing... I don't understand your question, but you can't control the internal routing anyways, so there's no point even asking the question.