Skip to content

FerrySpeedCalculator refactoring #2526

Open

Description

@easbar
  • remove handling of missing estimated_distance. It will never be missing and if it is it's not our fault.
  • use precise distance, not some estimate, because we can (since Create edge flags per edge instead of per way #2457)
  • remove maxSpeed capping (should be done elsewhere)
  • remove speedFactor (should be done elsewhere)
  • why do we round the result in some of the (too many) cases?
  • clean up logic (do not set durationInHours=0 for control flow etc.)

Activity

  1. easbar commented on Mar 1, 2022

    @easbar
    MemberAuthor

    remove handling of missing estimated_distance. It will never be missing and if it is it's not our fault.

    Or what was the reasoning behind this?

    use precise distance, not some estimate, because we can

    Currently we use the distance between the tower nodes. At some point we used the distance between the first and last way point. I'm not sure if this was ever considered, but what if the way went beyond the map borders? It could happen that a way is only included partially, so the distance would be changed, but e.g. the duration tag would remain the same which could lead to wrong speeds.

    Also why do we sometimes return speedFactor/2 and sometimes unknownSpeed depending on distance <= 300?

    // no duration -> speed depends on distance
    checkSpeed(c, null, 100.0, speedFactor / 2);
    checkSpeed(c, "0", 100.0, speedFactor / 2);
    checkSpeed(c, null, 1000.0, unknownSpeed);
    checkSpeed(c, "0", 1000.0, unknownSpeed);

    // suspicious slow speed (still depends on distance)
    checkSpeed(c, "180000", 100.0, speedFactor / 2);
    checkSpeed(c, "1800000", 1000.0, unknownSpeed);

  2. easbar commented on Mar 8, 2022

    @easbar
    MemberAuthor

    Currently we use the distance between the tower nodes. At some point we used the distance between the first and last way point. I'm not sure if this was ever considered, but what if the way went beyond the map borders? It could happen that a way is only included partially, so the distance would be changed, but e.g. the duration tag would remain the same which could lead to wrong speeds.

    This is a problem actually. First of all, the duration tag refers to the entire way, but in some cases ferry ways are split into several edges (e.g. when different ferry ways share the same nodes, which happens sometimes close to a harbor). Using the duration tag to calculate the speed of each edge is incorrect in this case.

    The case of a missing estimated_distance occurred when the first/last node of a ferry way was missing: #2528 (comment)

    Also why do we sometimes return speedFactor/2 and sometimes unknownSpeed depending on distance <= 300?

    The intention here was probably to make short ferries (like those that just cross a river) as slow as possible to (somewhat) account for the waiting time that might be much longer than the (short) ferry actually takes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions