Click or drag to resize

Code Sample

The following code samples illustrate the various pieces required to setup, configure, and numerically propagate an aircraft through multiple maneuver segments. The propagation sequence has the aircraft hold a constant heading, pull up to a desired rate of climb, reach an altitude at which to begin leveling off, push over to zero rate of climb, and turn left at a constant rate of change in heading.

Note Note

The functionality described in this topic requires a license for the Aircraft Propagation Library and the Segment Propagation Library.

Height Reference

Some of the objects used in the Aircraft Propagation Library require a height reference surface, which defaults to EarthCentralBody.MeanSeaLevel (get / set), which is the Mean Sea Level (MSL) surface of the Earth. This surface is initially undefined and must be configured before using the library. See the Terrain topic for more information on obtaining and loading MSL data. Alternatively, an EllipsoidTerrainProvider can be assigned to the MeanSeaLevel (get / set) property to use the Earth ellipsoidal shape as an inaccurate approximation of the mean sea level surface, without additional data files.

Atmosphere, Wind, and Performance Models

Next, we define the atmosphere and wind models to be used. USStandardAtmosphere1976 is used as the atmospheric model in this example. For wind, we use a ConstantWindModel and define the local horizontal wind speed and direction (from North) and up/down draft. It is important to note that the wind direction indicates where the wind is coming from, as would the arrowhead of a weather vane.

Java
USStandardAtmosphere1976 atmosphere = new USStandardAtmosphere1976();

ConstantWindModel winds = new ConstantWindModel();
winds.setCentralBody(earth);
winds.setHorizontalWindSpeed(10.0); // meters per second
winds.setWindDirection(Trig.degreesToRadians(90.0)); // convert to radians, winds are coming from the East

We also configure the set of performance models corresponding to the various flight phases. These performance models govern the aircraft's motion during the maneuvers. The load limits are specified as G's with the EarthSurfaceGravity used to represent standard gravity for conversion to accelerations.

Java
// Construct a cruise performance model which varies with height relative to mean sea level.
BandedCruisePerformanceModel cruise = new BandedCruisePerformanceModel(earth.getMeanSeaLevel());
cruise.addBand(10000.0, new CruiseCommandedValues(150.0, 0.0755987));
cruise.addBand(11000.0, new CruiseCommandedValues(175.0, 0.0755987));

SimpleAccelerationPerformanceModel accelerationModel = new SimpleAccelerationPerformanceModel();
accelerationModel.setLongitudinalLoadLimits(new Bounds(-0.5, 0.5));  // Deceleration and acceleration in G's
accelerationModel.setLateralLoadLimits(new Bounds(-1.1547, 1.1547)); // Left and right turn acceleration in G's
accelerationModel.setVerticalLoadLimits(new Bounds(0.75, 1.1547));   // Push over and pull up acceleration in G's
accelerationModel.setGravitationalAcceleration(Constants.EarthSurfaceGravity);

SimpleClimbPerformanceModel climbModel = new SimpleClimbPerformanceModel(92.6, 10.16, 0.0629989);
SimpleDescentPerformanceModel descentModel = new SimpleDescentPerformanceModel(92.6, -10.16, 0.0629989);

PerformanceModels performance = new PerformanceModels();
performance.setAcceleration(accelerationModel);
performance.setCruise(cruise);
performance.setClimb(climbModel);
performance.setDescent(descentModel);

Defining the First Segment

We define the initial position, velocity, and mass of the aircraft. Also, we configure a numerical integrator for use in propagating the state.

Java
double longitude = Trig.degreesToRadians(0.0); // convert to radians
double latitude = Trig.degreesToRadians(0.0); // convert to radians
double height = 10000.0; // meters

double initialMass = 1500.0; // kilograms

AircraftReferenceState initialState = new AircraftReferenceState(epoch);
initialState.setHeightReferenceSurface(earth.getMeanSeaLevel());         // This is the default, but we'll set it here for clarity.
initialState.setPosition(new Cartographic(longitude, latitude, height)); // Then, this initial height is altitude with respect to mean sea level.
initialState.setVelocityReferenceAxes(ManeuverReferenceAxes.MOVING_ATMOSPHERE);                   // The velocity is relative to the moving atmosphere,
initialState.setVelocity(new AzimuthHorizontalVertical(Trig.degreesToRadians(45.0), 150.0, 0.0)); // so these values are true heading and true airspeed.

NumericalIntegrator integrator = new RungeKutta4Integrator();
integrator.setInitialStepSize(1.0);

Our first maneuver will hold a constant angle and speed using a MaintainCourseOrHeadingBehavior as its horizontal behavior and a MaintainHorizontalAndVerticalSpeedsBehavior as its vertical behavior. The ManeuverReferenceAxes is set to the moving atmosphere, so the true heading of the aircraft is the angle that is maintained. If the ManeuverReferenceAxes were set to the static atmosphere, then the true course of the aircraft would be the angle that is maintained.

Java
CompositeManeuver flyStraight = new CompositeManeuver();
flyStraight.setPerformanceModels(performance);
flyStraight.setWindModel(winds);
flyStraight.setHorizontalBehavior(new MaintainCourseOrHeadingBehavior(ManeuverReferenceAxes.MOVING_ATMOSPHERE));           // Maintain true heading.
flyStraight.setVerticalBehavior(new MaintainHorizontalAndVerticalSpeedsBehavior(ManeuverReferenceAxes.MOVING_ATMOSPHERE)); // Maintain true air velocities.

Next, some configuration is needed to set up the propagator. The state elements to be propagated are the aircraft's Cartesian motion and mass. Each are configured with an initial value and an identifier for use later in recovering the results of the propagation. The aircraft motion element's mass property is set to the mass state element's integrated value so that the correct value is used during numerical integration.

The propagator definition is configured with the numerical integration method and the aircraft motion element and mass state element are added to the list of elements to be integrated. The applyManeuver method creates the state element which will be the source of the derivatives for the motion element during numerical integration.

The getFuelFlowRateScalar helper function provides the scalar derivative for the rate of change of mass. The details of this function will be discussed next, after we cover the final details of setting up the first propagation segment.

Java
// Define the mass state element for the propagator definition.
String massID = "MyAircraftMass";
PropagationScalar massStateElement = new PropagationScalar();
massStateElement.setIdentification(massID);
massStateElement.setInitialState(new Motion1<>(initialMass));
massStateElement.setIncludeHighestDerivativeInOutput(true); // Include the mass flow rate information.

// Define the position state element for the propagator definition.
String positionID = "MyAircraftPosition";
AircraftMotionElement aircraftMotion = new AircraftMotionElement(positionID, initialState, winds);
aircraftMotion.setMass(massStateElement.getIntegrationValue());

// Configure the propagator definition with the state elements.
NumericalPropagatorDefinition firstPropagatorDefinition = new NumericalPropagatorDefinition();
firstPropagatorDefinition.setEpoch(epoch);
firstPropagatorDefinition.setIntegrator(integrator);
firstPropagatorDefinition.getIntegrationElements().add(aircraftMotion.applyManeuver(flyStraight));
firstPropagatorDefinition.getIntegrationElements().add(massStateElement);

// Define the derivative function for the mass state element.
massStateElement.setScalarDerivative(getFuelFlowRateScalar(atmosphere, winds, aircraftMotion));

The first segment is configured with the propagator definition and a stopping condition which is triggered once the aircraft has flown for 5 minutes.

Java
NumericalPropagatorSegment flyStraightFor5Minutes = new NumericalPropagatorSegment();
flyStraightFor5Minutes.setName("FlyStraightFor5Minutes");
flyStraightFor5Minutes.setPropagatorDefinition(firstPropagatorDefinition);

DurationStoppingCondition flyStraightFor5MinutesStoppingCondition = new DurationStoppingCondition(new Duration(0, 5.0 * TimeConstants.SecondsPerMinute));
flyStraightFor5MinutesStoppingCondition.setName("StopIn5Minutes");
flyStraightFor5Minutes.getStoppingConditions().add(flyStraightFor5MinutesStoppingCondition);

Fuel Flow Rate

We now return to the mass flow rate mentioned above. In this example, the mass flow rate is derived from a simple propeller propulsion model. In order to determine the fuel flow rate, the applied thrust must be determined, which in turn means that the propulsion and aerodynamic forces acting on the aircraft must be computed, which requires that the orientation of the aircraft body axes must be assessed. Fortunately, the SimpleFixedWingCoordinatedFlight type can be used to facilitate these computations.

The getFuelFlowRateScalar helper function configures the aerodynamic model to be used with the required parameters and a ScalarDynamicPressure. The SimpleFixedWingCoordinatedFlight instance uses the aerodynamic model to determine the orientation of the aircraft (bank angle and angle of attack) and aerodynamic and propulsion forces required to follow the motion prescribed by the maneuver. The required thrust determined by the coordinated flight condition is used to configure the propulsion model so that the corresponding fuel flow rate can be determined. The scalar which can produce this fuel flow rate is returned from the getFuelFlowRateScalar helper function for use as the derivative of the mass state element.

Java
private Scalar getFuelFlowRateScalar(USStandardAtmosphere1976 atmosphere, WindModel winds, AircraftMotionElement element) {
    // The relative velocity vector accounts for the local winds at the desired location.
    // The dynamic pressure is needed to compute the aerodynamic forces.
    ScalarDynamicPressure dynamicPressure = new ScalarDynamicPressure(atmosphere.getDensity(), winds.getRelativeVelocityVector());

    SimpleFixedWingForwardFlightAerodynamics fixedWingAerodynamics = new SimpleFixedWingForwardFlightAerodynamics();
    fixedWingAerodynamics.setReferenceArea(ValueDefinition.toValueDefinition(5.0));
    fixedWingAerodynamics.setAspectRatio(ValueDefinition.toValueDefinition(4.0));
    fixedWingAerodynamics.setLiftCoefficientAtZeroAngleOfAttack(ValueDefinition.toValueDefinition(0.0));
    fixedWingAerodynamics.setLiftCoefficientSlope(ValueDefinition.toValueDefinition(0.065 * Constants.DegreesPerRadian));
    fixedWingAerodynamics.setOswaldEfficiencyFactor(ValueDefinition.toValueDefinition(0.8));
    fixedWingAerodynamics.setDragCoefficientAtMinimum(ValueDefinition.toValueDefinition(0.02));
    fixedWingAerodynamics.setDragIndex(ValueDefinition.toValueDefinition(0.0));
    fixedWingAerodynamics.setDynamicPressure(dynamicPressure.applyServiceProvider(element.getIntegrationPoint()));

    SimpleFixedWingCoordinatedFlight flightCondition = new SimpleFixedWingCoordinatedFlight(element.getIntegrationPoint(), winds, fixedWingAerodynamics,
                                                                                            element.getMass(), Scalar.toScalar(Constants.EarthSurfaceGravity));

    SimpleForwardFlightPropellerPropulsion propulsionModel = new SimpleForwardFlightPropellerPropulsion();
    propulsionModel.setDensity(atmosphere.getDensity());
    propulsionModel.setDensityRatio(atmosphere.getDensityRatio());
    propulsionModel.setFuelFlowRateLimits(new Bounds(0.022167, 0.22167));
    propulsionModel.setPowerAvailableLimits(new Bounds(0.0, 1.70064e+006));
    propulsionModel.setPowerDropOffParameter(ValueDefinition.toValueDefinition(0.117));
    propulsionModel.setPropellerCount(1);
    propulsionModel.setPropellerRadius(ValueDefinition.toValueDefinition(3.048));
    propulsionModel.setReferencePoint(element.getIntegrationPoint());
    propulsionModel.setRelativeVelocity(winds.getRelativeVelocityVector());
    propulsionModel.setThrustRequired(flightCondition.getThrustRequired());

    return propulsionModel.getFuelFlowRate();
}

Defining the Remaining Segments

Returning to the propagation set-up, the second segment is configured similarly to the first. This segment performs a pull-up maneuver while holding a constant heading. The segment stops once the rate of climb is 50 meters per second.

Java
PushOverOrPullUpBehavior pullUpVerticalBehavior = new PushOverOrPullUpBehavior();
pullUpVerticalBehavior.setTransverseLoadFactor(ValueDefinition.toValueDefinition(1.15)); // This is a pull-up since the load factor is greater than 1 G.
pullUpVerticalBehavior.setLongitudinalLoadFactor(ValueDefinition.toValueDefinition(0.0)); // The velocity does not increase during the pull-up.
pullUpVerticalBehavior.setGravitationalAcceleration(Constants.EarthSurfaceGravity);

CompositeManeuver pullUp = new CompositeManeuver();
pullUp.setPerformanceModels(performance);
pullUp.setWindModel(winds);
pullUp.setHorizontalBehavior(new MaintainCourseOrHeadingBehavior(ManeuverReferenceAxes.MOVING_ATMOSPHERE)); // Maintain true heading.
pullUp.setVerticalBehavior(pullUpVerticalBehavior);

NumericalPropagatorDefinition secondPropagatorDefinition = new NumericalPropagatorDefinition();
secondPropagatorDefinition.setEpoch(epoch);
secondPropagatorDefinition.setIntegrator(integrator);
secondPropagatorDefinition.getIntegrationElements().add(aircraftMotion.applyManeuver(pullUp));
secondPropagatorDefinition.getIntegrationElements().add(massStateElement);

NumericalPropagatorSegment pullUpTo50MpsClimb = new NumericalPropagatorSegment();
pullUpTo50MpsClimb.setName("PullUpTo50MpsClimb");
pullUpTo50MpsClimb.setPropagatorDefinition(secondPropagatorDefinition);

ScalarStoppingCondition pullUpTo50MpsClimbStoppingCondition = new ScalarStoppingCondition();
pullUpTo50MpsClimbStoppingCondition.setName("StopAt50MpsClimb");
pullUpTo50MpsClimbStoppingCondition.setScalar(
        new ScalarDerivative(new ScalarCartographicElement(earth, aircraftMotion.getIntegrationPoint(), CartographicElement.HEIGHT), 1));
pullUpTo50MpsClimbStoppingCondition.setThreshold(ValueDefinition.toValueDefinition(50.0));
pullUpTo50MpsClimbStoppingCondition.setTypeOfStoppingCondition(StopType.ANY_THRESHOLD);
pullUpTo50MpsClimbStoppingCondition.setFunctionTolerance(0.001);
pullUpTo50MpsClimb.getStoppingConditions().add(pullUpTo50MpsClimbStoppingCondition);

A constant rate of climb is held for the third segment until the aircraft reaches an altitude of 11000 meters.

Java
CompositeManeuver climb = new CompositeManeuver();
climb.setPerformanceModels(performance);
climb.setWindModel(winds);
climb.setHorizontalBehavior(new MaintainCourseOrHeadingBehavior(ManeuverReferenceAxes.MOVING_ATMOSPHERE));           // Maintain true heading.
climb.setVerticalBehavior(new MaintainHorizontalAndVerticalSpeedsBehavior(ManeuverReferenceAxes.MOVING_ATMOSPHERE)); // Maintain true air velocities.

NumericalPropagatorDefinition thirdPropagatorDefinition = new NumericalPropagatorDefinition();
thirdPropagatorDefinition.setEpoch(epoch);
thirdPropagatorDefinition.setIntegrator(integrator);
thirdPropagatorDefinition.getIntegrationElements().add(aircraftMotion.applyManeuver(climb));
thirdPropagatorDefinition.getIntegrationElements().add(massStateElement);

NumericalPropagatorSegment climbTo11KmAltitude = new NumericalPropagatorSegment();
climbTo11KmAltitude.setName("ClimbTo11KmAltitude");
climbTo11KmAltitude.setPropagatorDefinition(thirdPropagatorDefinition);

ScalarStoppingCondition climbTo11KmAltitudeStoppingCondition = new ScalarStoppingCondition();
climbTo11KmAltitudeStoppingCondition.setName("StopAt11KmAltitude");
climbTo11KmAltitudeStoppingCondition.setScalar(
        new ScalarCartographicElement(earth, aircraftMotion.getIntegrationPoint(), CartographicElement.HEIGHT));
climbTo11KmAltitudeStoppingCondition.setThreshold(ValueDefinition.toValueDefinition(11000.0));
climbTo11KmAltitudeStoppingCondition.setTypeOfStoppingCondition(StopType.ANY_THRESHOLD);
climbTo11KmAltitudeStoppingCondition.setFunctionTolerance(0.001);
climbTo11KmAltitude.getStoppingConditions().add(climbTo11KmAltitudeStoppingCondition);

The aircraft then performs a push-over maneuver until a zero rate of climb is attained.

Java
PushOverOrPullUpBehavior pushOverVerticalBehavior = new PushOverOrPullUpBehavior();
pushOverVerticalBehavior.setTransverseLoadFactor(ValueDefinition.toValueDefinition(0.75)); // This is a push-over since the load factor is less than 1 G.
pushOverVerticalBehavior.setLongitudinalLoadFactor(ValueDefinition.toValueDefinition(0.0)); // The velocity does not increase during the push-over.
pushOverVerticalBehavior.setGravitationalAcceleration(Constants.EarthSurfaceGravity);

CompositeManeuver pushOver = new CompositeManeuver();
pushOver.setPerformanceModels(performance);
pushOver.setWindModel(winds);
pushOver.setHorizontalBehavior(new MaintainCourseOrHeadingBehavior(ManeuverReferenceAxes.MOVING_ATMOSPHERE)); // Maintain true heading.
pushOver.setVerticalBehavior(pushOverVerticalBehavior);

NumericalPropagatorDefinition fourthPropagatorDefinition = new NumericalPropagatorDefinition();
fourthPropagatorDefinition.setEpoch(epoch);
fourthPropagatorDefinition.setIntegrator(integrator);
fourthPropagatorDefinition.getIntegrationElements().add(aircraftMotion.applyManeuver(pushOver));
fourthPropagatorDefinition.getIntegrationElements().add(massStateElement);

NumericalPropagatorSegment pushOverTo0MpsClimb = new NumericalPropagatorSegment();
pushOverTo0MpsClimb.setName("PushOverTo0MpsClimb");
pushOverTo0MpsClimb.setPropagatorDefinition(fourthPropagatorDefinition);

ScalarStoppingCondition pushOverTo0MpsClimbStoppingCondition = new ScalarStoppingCondition();
pushOverTo0MpsClimbStoppingCondition.setName("StopAt0MpsClimb");
pushOverTo0MpsClimbStoppingCondition.setScalar(
        new ScalarDerivative(new ScalarCartographicElement(earth, aircraftMotion.getIntegrationPoint(), CartographicElement.HEIGHT), 1));
pushOverTo0MpsClimbStoppingCondition.setThreshold(ValueDefinition.toValueDefinition(0.0));
pushOverTo0MpsClimbStoppingCondition.setTypeOfStoppingCondition(StopType.ANY_THRESHOLD);
pushOverTo0MpsClimbStoppingCondition.setFunctionTolerance(0.001);
pushOverTo0MpsClimb.getStoppingConditions().add(pushOverTo0MpsClimbStoppingCondition);

Finally, the aircraft enters a left turn where the heading changes by 1 degree per second. This turn is maintained for 5 minutes.

Java
TurnAtConstantRateBehavior turnLeftHorizontalBehavior = new TurnAtConstantRateBehavior();
turnLeftHorizontalBehavior.setManeuverReferenceAxes(ManeuverReferenceAxes.MOVING_ATMOSPHERE);           // The true heading will change at the constant rate.
turnLeftHorizontalBehavior.setTurnRate(ValueDefinition.toValueDefinition(-Trig.degreesToRadians(1.0))); // Left turn since the rate is negative.

CruiseBehavior turnLeftVerticalBehavior = new CruiseBehavior();
turnLeftVerticalBehavior.setHeightReferenceSurface(earth.getMeanSeaLevel());                           // This is the default, but we'll set it here for clarity.
turnLeftVerticalBehavior.setTimeConstant(ValueDefinition.toValueDefinition(1.0));
turnLeftVerticalBehavior.setAltitude(ValueDefinition.toValueDefinition(11000.0));                      // Then, this cruise height is altitude with respect to mean sea level.
turnLeftVerticalBehavior.setLevelOffAltitudeBandAboveCruise(ValueDefinition.toValueDefinition(100.0)); // Above this band the descent performance model is used.
turnLeftVerticalBehavior.setLevelOffAltitudeBandBelowCruise(ValueDefinition.toValueDefinition(100.0)); // Below this band the climb performance model is used.

CompositeManeuver turnLeft = new CompositeManeuver();
turnLeft.setPerformanceModels(performance);
turnLeft.setWindModel(winds);
turnLeft.setHorizontalBehavior(turnLeftHorizontalBehavior);
turnLeft.setVerticalBehavior(turnLeftVerticalBehavior);

NumericalPropagatorDefinition fifthPropagatorDefinition = new NumericalPropagatorDefinition();
fifthPropagatorDefinition.setEpoch(epoch);
fifthPropagatorDefinition.setIntegrator(integrator);
fifthPropagatorDefinition.getIntegrationElements().add(aircraftMotion.applyManeuver(turnLeft));
fifthPropagatorDefinition.getIntegrationElements().add(massStateElement);

NumericalPropagatorSegment turnLeftFor5Minutes = new NumericalPropagatorSegment();
turnLeftFor5Minutes.setName("TurnLeftFor5Minutes");
turnLeftFor5Minutes.setPropagatorDefinition(fifthPropagatorDefinition);

DurationStoppingCondition turnLeftFor5MinutesStoppingCondition = new DurationStoppingCondition(new Duration(0, 5.0 * TimeConstants.SecondsPerMinute));
turnLeftFor5MinutesStoppingCondition.setName("StopIn5Minutes");
turnLeftFor5Minutes.getStoppingConditions().add(turnLeftFor5MinutesStoppingCondition);

Propagating

All five segments are added to a SegmentList and the sequence is propagated.

The position element identifier is used to retrieve the aircraft's motion from the propagation results. Propagation of the maneuver segments produces ephemeris for the aircraft, which defines its position, velocity, and acceleration at discrete times. In order to provide information at an arbitrary time over the propagation, the motion must be interpolated. The code below uses 5th-order Hermite interpolation.

Java
SegmentList segmentList = new SegmentList();
segmentList.setName("StraightThenClimbThenTurn");

segmentList.getSegments().add(flyStraightFor5Minutes);
segmentList.getSegments().add(pullUpTo50MpsClimb);
segmentList.getSegments().add(climbTo11KmAltitude);
segmentList.getSegments().add(pushOverTo0MpsClimb);
segmentList.getSegments().add(turnLeftFor5Minutes);

SegmentListResults results = segmentList.getSegmentListPropagator().propagateSegmentList();

// Recover the position, velocity, and acceleration.
DateMotionCollection1<Cartesian> ephemeris = results.getDateMotionCollectionOfOverallTrajectory(positionID);

// Recover the mass and flow rate.
DateMotionCollection1<Double> mass = results.getDateMotionCollectionOfOverallTrajectory(massID);

Some additional scalars are defined from the interpolated point in order to compute the aircraft's altitude, true airspeed, heading, and course.

Java
EvaluatorGroup group = new EvaluatorGroup();
PointInterpolator location = new PointInterpolator(earth.getFixedFrame(), new HermitePolynomialApproximation(), 5, ephemeris);

// The fixed velocity vector is needed to compute the true course of the aircraft.
Vector fixedVelocity = new VectorVelocity(location, earth.getFixedFrame());

// The relative velocity vector accounts for the local winds at the desired location.
// It will be used to compute the true heading and true airspeed.
Vector relativeVelocity = winds.getRelativeVelocityVector().applyServiceProvider(location);

MotionEvaluator1<Cartographic> cartographicEvaluator = earth.observeCartographicPoint(location, group);

Axes eastNorthUpAxes = new AxesEastNorthUp(earth, location);

ScalarEvaluator trueAirspeedEvaluator = new ScalarVectorElement(relativeVelocity, CartesianElement.MAGNITUDE, eastNorthUpAxes).getEvaluator(group);
ScalarEvaluator trueHeadingEvaluator = new ScalarInverseTangent(new ScalarVectorElement(relativeVelocity, CartesianElement.X, eastNorthUpAxes),
                                                                new ScalarVectorElement(relativeVelocity, CartesianElement.Y, eastNorthUpAxes)).getEvaluator(group);

ScalarEvaluator trueCourseEvaluator = new ScalarInverseTangent(new ScalarVectorElement(fixedVelocity, CartesianElement.X, eastNorthUpAxes),
                                                               new ScalarVectorElement(fixedVelocity, CartesianElement.Y, eastNorthUpAxes)).getEvaluator(group);

ScalarInterpolator interpolatedMass = new ScalarInterpolator(new HermitePolynomialApproximation(), 1, mass);

ScalarEvaluator massEvaluator = interpolatedMass.getEvaluator(group);

With some assumptions about how the aircraft is configured and flown, its orientation can be determined. Specifically, assuming that the thrust acts along the longitudinal axis (x-axis) of the vehicle and that there is no slip angle (and correspondingly, no aerodynamic side force), the bank angle and angle of attack can be determined from an aerodynamic force model.

In the following code sample, a SimpleFixedWingForwardFlightAerodynamics model is applied to define the orientation of the body axes of the aircraft. The force model is configured with a ScalarDynamicPressure derived from a density and velocity relative to the moving atmosphere.

Java
// The dynamic pressure is needed to compute the aerodynamic forces.
ScalarDynamicPressure q = new ScalarDynamicPressure(atmosphere.getDensity(), VectorDependentOnServiceProvider.toVectorDependentOnServiceProvider(relativeVelocity));

SimpleFixedWingForwardFlightAerodynamics aerodynamics = new SimpleFixedWingForwardFlightAerodynamics();
aerodynamics.setReferenceArea(ValueDefinition.toValueDefinition(5.0));
aerodynamics.setAspectRatio(ValueDefinition.toValueDefinition(4.0));
aerodynamics.setLiftCoefficientAtZeroAngleOfAttack(ValueDefinition.toValueDefinition(0.0));
aerodynamics.setLiftCoefficientSlope(ValueDefinition.toValueDefinition(0.065 * Constants.DegreesPerRadian));
aerodynamics.setOswaldEfficiencyFactor(ValueDefinition.toValueDefinition(0.8));
aerodynamics.setDragCoefficientAtMinimum(ValueDefinition.toValueDefinition(0.02));
aerodynamics.setDragIndex(ValueDefinition.toValueDefinition(0.0));
aerodynamics.setDynamicPressure(q.applyServiceProvider(location));

SimpleFixedWingCoordinatedFlight coordinatedFlight = new SimpleFixedWingCoordinatedFlight(location, winds, aerodynamics, interpolatedMass, Scalar.toScalar(Constants.EarthSurfaceGravity));

Axes bodyAxes = coordinatedFlight.getBodyAxes();