Skip to content

TCL.constantSpeedLevel fails when stepClimb=True #32

Description

@guibuzi

Description

When calling TCL.constantSpeedLevel with stepClimb=True, an exception is raised:

Exception: Undefined Heading value combination

After inspecting the source code, the issue appears to be caused by both HDGMagnetic[-1] and HDGTrue[-1] being non-None when passed into constantSpeedRating.

In constantSpeedLevel, the following branch is taken when Lat, Lon, and magneticHeading evaluate to True:

initialHeading={
    "magnetic": HDGMagnetic[-1],
    "true": HDGTrue[-1],
    "constantHeading": constantHeading,
}

However, inside constantSpeedRating, the heading validation logic only allows exactly one of trueHeading or magneticHeading to be defined:

if trueHeading is not None and magneticHeading is None:
    ...
elif magneticHeading is not None and trueHeading is None:
    ...
else:
    raise Exception("Undefined Heading value combination")

As a result, providing both values triggers the exception.

Questions for maintainers

Should constantSpeedLevel ensure that only one of HDGTrue or HDGMagnetic is passed to constantSpeedRating?

Or is constantSpeedRating expected to handle the case where both are provided ?

What is the intended heading-handling logic when stepClimb=True?

I would appreciate guidance on the correct behavior or a recommended fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions