Wolfram Computation Meets Knowledge

Formation Flight with the Wolfram System Modeler Aircraft Library

Formation Flight with the Wolfram System Modeler Aircraft Library

Explore the contents of this article with a free Wolfram System Modeler trial. The Swedish Air Force has an annual tradition of greeting the people of Sweden at the end of the year by flying their fighter jets in a formation shaped like a Christmas tree. Besides welcoming everyone, this tradition plays a role as a valuable rehearsal for the fighter pilots in formation flying and is a way to show their presence. Thus, the large amounts of fuel burned by the fighter jets, which are most certainly not known for their fuel efficiency, may be excused in this tradition.

With the release of the new Wolfram System Modeler Aircraft library, what could be a better way to celebrate? We want to wish our users all the best for 2023 with a simulated formation flight using regular general aviation aircraft. As a bonus, it would also be interesting to compare the expected fuel consumption during the flight and see how much it could be reduced by changing the aircraft structure to lighter composite materials. Nowadays, there are even fully electric aircraft, such as the Pipistrel Alpha Electro, available in that size category. Therefore, it would be interesting to find out how much cheaper the formation flight would be if it were performed with electric aircraft—or if they even have enough range and endurance for such flight missions.

With the new Aircraft library in System Modeler, the answers to these questions can be answered by modeling the aircraft variants and simulating their flights for the desired formation flight mission.

Defining the Flight Mission

First, we must define the mission of the formation flight for each aircraft. One way to explicitly define a flight trajectory is to present timetables of altitude, flight speed and track angle, which usually are also the inputs for autopilots used in aircraft.

Let us start by defining the geometry of the flight mission. In some test flights, the aircraft are flown such that they “write” or “draw” something in the sky with their flown trajectory. One example is the recent test flight for the new Airbus A321XLR, where the letters “XLR” were written in the sky over the Bay of Biscay.

Inspired by this (and the start of the new year), I created the following shape for the flight mission and wrote a Wolfram Language script. The timetables for reference altitude, track angle and flight speed commands are solved based on the given parameters shown in the following figure, including the initial and cruising flight speeds as well as initial and cruising altitudes:

Flight path for "2023"

The Aircraft library focuses on the actual flight, so it is not capable of simulating takeoffs and landings, and therefore the flight trajectory starts and ends with an altitude of 100 m (328 ft) and with a flight speed of 144 km/h (90 mph). By setting the cruise altitude to 500 m (1640 ft), cruise flight speed to 162 km/h (101 mph) and the lengths for u and r to 1100 m (3609 ft) and 900 m (2953 ft), respectively, we get these commands for defining the flight mission.

You will need to download Wolfram System Modeler and the Aircraft Modelica library, both available on the library store, to run the following inputs:




This reference trajectory can be used to steer the lead aircraft while the others will follow a path with a fixed position with respect to the leader. In this simulation, the formation flight is performed with five aircraft to form a somewhat lighter version of the Christmas tree formation used by the Swedish Air Force.

Creating an Autopilot

The Aircraft library contains autopilots, which translate the commands for reference altitude, track angle and flight speed into control actuator commands, namely the deflection angles for the elevator, ailerons and rudder as well as the throttle position. However, this is not suitable for controlling an aircraft for a formation flight, as the lateral position of the aircraft is not directly controlled in the built-in autopilots—only its track angle and velocity at a given time instance are controlled. One feature of the library allows users to add their own versions of different components, such as autopilots, so I decided to do that.

The new autopilot I created corrects the lateral position of the aircraft based on its deviation from the reference flight trajectory at any given time instance. The position of the reference trajectory through time is solved from the commands for reference flight trajectory with the built-in ReferenceTrajectory model:


The correction of the lateral position is implemented in the built-in autopilot model by enabling the optional feed-forward connector for the PID controllers that are used for controlling the flight speed and track angle. The deviation from the reference flight trajectory along the x axis is entered into the flight speed controller, whereas the deviation from the reference flight trajectory along the y axis is entered into the track angle controller:


To arrange the five aircraft into the triangle shape and enter the correct inputs into their new autopilots, I created this formation flight model, which takes the commands for reference altitude, track angle and flight speed, which are generated by the Wolfram Language script, as inputs:


Fuel Comparisons and Modeling

For modeling the fuel-powered aircraft, we can use the model of a general aviation aircraft design found in the Aircraft library. If the mass properties (mass, center of gravity and inertia tensor) of the aircraft you want to simulate are all known, these can be used in the model. However, suppose you do not know the exact mass properties. You can use the built-in weight estimation method, which derives the mass properties of the entire aircraft from the aircraft geometry and a few design variables shown here:

Adjust mass and inertia in System Modeler

Let’s start the comparison by connecting the reference flight trajectory commands into the formation flight model with general aviation aircraft built out of aluminum:

componentsGAaluminium = {"refAltitude"

The formation flight model includes an equation to solve for the variable for summing the consumed fuel mass of all the aircraft, so let’s plot that:

simGAaluminium = SystemModelSimulate

This does not seem like very much fuel for flying a fleet of five general aviation aircraft for one hour, but it must be noted again that the simulation does not include taxi, takeoff or landing. The aircraft model used is also from the small end of the size spectrum, having a maximum takeoff weight of 600 kg (1327 lb). The average simulated fuel consumption of around 6.5 L/100 km (36 mpg) agrees with the consumption of the aircraft in the same size category.

One advantage of the weight estimation method is that it’s easy to test design changes, such as switching from aluminum to composite materials, so let’s simulate the same scenario with such a change in the aircraft models:

componentsGAcomposite = {"refAltitude"

This shows only a small decrease of 1.4 kg (3.1 lb) in fuel consumption compared to the fleet consisting of the same aircraft built out of aluminium. Thus, in this case, changing materials did not really save us a lot. However, as mentioned, nowadays there are electric aircraft, such as the Pipistrel Alpha Electro, so let’s use this instead. The Alpha Electro is one of the built-in aircraft models, so it is already parametrized and ready for use:

componentsElectric = {"refAltitude"

First, this shows that the Pipistrel Alpha Electro has the range to fly the generated flight mission of 167 km (104 mi). Let’s also see how the animation of the formation flight looks in System Modeler:

Additionally, we can compare the cost of performing the formation flight with all three aircraft by using the current prices for gasoline and electricity (in the US):

priceGAaluminium = simGAaluminium

priceGAcomposite = simGAcomposite

priceElectric = simElectric

This shows that the savings in pure running costs of the fleet for this formation flight are only $1.62 when each aircraft is built out of composite materials instead of aluminum. A total of $35 is saved when changing the fleet into electric aircraft.

The savings from using the composite materials are indeed not much in this particular comparison, but one can also study in the Aircraft library how much an airline would save in a year if its fleet flies tens of thousands of kilometers daily with large passenger planes. The library can also be used to test, for example, how much more energy density is required for the battery cells to actually be able to fly longer distances with a mid-size electric passenger aircraft.

Besides wishing you all the best for 2023 with a simulated formation flight, I have shown one example of using the new System Modeler Aircraft library to test and compare the performance of aircraft designs for any arbitrary flight mission. For more information, visit the Aircraft library page. You may also download the flight path notebook used to generate the flight trajectory and the System Modeler models used for modeling and simulating the formation flight.

Check out Wolfram’s System Modeler Modelica library store or sign up for a System Modeler free trial.


Join the discussion

!Please enter your comment (at least 5 characters).

!Please enter your name.

!Please enter a valid email address.