View on GitHub

im_sample_algorithm

MITRE's Interval Management Sample Algorithm. An implementation of RTCA DO-361A Appendix C.

Entry Points

Back to Landing Page

Note: this code will not compile as-provided. If you’re trying to call it, we’ll assume you’ve modified it to make it compile.

From a state-machine perspective, the code follows a simple process path.

Like this:

state_sequence

Initialize the Algorithm

You’ll need a concrete IMAlgorithm class for this step and that choice is based on what you are trying to do. (Unsure? Consider this.) But, in general, you’ll probably want to instantiate an IMTimeBasedAchieve or IMDistBasedAchieve algorithm. Once that is built, you need to initialize the internal states. You’ll find this declared in the parent class, IMKinematicAchieve.h.

virtual void Initialize(const KineticTrajectoryPredictor &ownship_kinetic_trajectory_predictor,
                        const KineticTrajectoryPredictor &target_kinetic_trajectory_predictor,
                        std::shared_ptr<TangentPlaneSequence> tangent_plane_sequence,
                        AircraftIntent &target_aircraft_intent,
                        const IMClearance &im_clearance,
                        const std::string &achieve_by_point,
                        WeatherPrediction &weather_prediction);

Call the Algorithm

The code provides a virtual declaration for the Update method in IMAlgorithm.h.

virtual Guidance Update(const Guidance &prevguidance,
                        const DynamicsState &dynamicsstate,
                        const AircraftState &owntruthstate,
                        const AircraftState &targettruthstate,
                        const vector<AircraftState> &targethistory);

Each time this method is called, it is assumed that the simulation clock has advanced and new data is being provided to the algorithm. You should be providing:

The return is a Guidance object which contains a new IM Speed in the m_ias_command class member.

Data Returned by the Algorithm

Each time this method is called, it returns a Guidance object. That object has many class members, but it operates as a struct by holding the latest value of any given member; most members are public. :unamused: There are only two output members of importance (from an IM Algorithm perspective) in the Guidance object:

The only members of the Guidance class that you should pay attention to are these two members. All others are unused by the IMAlgorithm classes.

This output can also be accessed via a simple getter exposed by IMAlgorithm:

   virtual const Units::Speed GetImSpeedCommandIas() const;

We’ve noticed that the Units::Speed object sometimes truncates bits when converting from meters-per-second to knots. The result is that the above call to GetImSpeedCommandIas() can sometimes give a value very near to an integer IAS value, but not quite (e.g. 269.9999999 rather than 270.0). This can look odd on a human-interface display. There are multiple work-arounds to this problem, but ours has been to also provide an integer accessor for the IM Speed. It’s in the Guidance object and looks like this:

int GetIasCommandIntegerKnots() const;

This call is implemented such that it is guaranteed to return a clean value appropriate for human-interface displays.