**4.1 Structure-defined mathematical model of the aircraft speed in a flight simulator**

The input values are represented by a change of an aircraft elevator control stick angle and a throttle control stick of engine. The values are adjusted as required and

*Simulation of a Mathematical Model of an Aircraft Using Parallel Techniques (MPI and GPU) DOI: http://dx.doi.org/10.5772/intechopen.105538*

forwarded to the input of the structured mathematical model of aircraft motionspeed. The aircraft speed displacement equation Δ*V*(*s*) defines a change in fuel supply and the change in the aircraft elevator angle [14]:

$$
\Delta V(\mathfrak{s}) = -G\_{V/\delta \mathcal{M}}(\mathfrak{s}) \Delta \delta\_{\mathcal{M}}(\mathfrak{s}) - G\_{V/\delta V}(\mathfrak{s}) \Delta \delta\_{V}(\mathfrak{s}), \tag{17}
$$

where *GV/*δ*<sup>M</sup>* (*s*) defines a mathematical model of speed—transfer function for fuel supply, *Δδ<sup>M</sup>* (*s*) is an input function for fuel supply in Laplace transform, *GV/*δ*<sup>V</sup>* (*s*) is a mathematical model of speed—transfer function for an aircraft lift, and *Δδ<sup>V</sup>* (*s*) means the input function of an aircraft pitch angle in the Laplace transform. Derivation of equations of a structured mathematical model of speed increment is a suitable description of the problem. Information about mathematical solution of these equations is known [13]. The expression *A* ¼ *s* <sup>4</sup> <sup>þ</sup> <sup>1</sup>*:*134*<sup>s</sup>* <sup>3</sup> <sup>þ</sup> <sup>62</sup>*:*798*<sup>s</sup>* <sup>2</sup> <sup>þ</sup> <sup>28</sup>*:*659*<sup>s</sup>* <sup>þ</sup> <sup>4</sup>*:*093, is the same in all equations. The items for *l12*(*x*) defined by the Eq. (16) are as follows:

$$A\_{11} = 5 \frac{s^3 + 1.12s^2 + 62.782s + 25.32}{A}, \\ \varkappa\_1 = \Delta \delta\_M(s). \tag{18}$$

$$A\_{12} = \frac{-0.11 \cdot (9.81\text{s} + 620.97\text{3}) - 0.42 \cdot (-9.81\text{s} - 10.006)}{A}, \text{x}\_2 = \Delta\delta\_V(\text{s}). \tag{19}$$

In Eq. (17), *GV/<sup>δ</sup><sup>M</sup>* (*s*) is the mathematical model of aircraft speed (a transfer function) depending on the fuel supply, *δM(s)* is the fuel supply, *GV/<sup>δ</sup><sup>V</sup>* (*s*) is a mathematical model of aircraft speed depending on the elevator angle, *δV*(*s*) is the aircraft elevator angle. The mathematical model of aircraft speed in the longitudinal direction, the fuel supply, and angle of attack can be determined, see [14]:

$$\mathbf{G}\_{V/\delta\mathbb{M}}(\mathbf{s}) = -a\_{\mathbf{x}}^{\delta\mathbb{M}} \frac{\Delta\_{\mathbf{1}\mathbf{1}}}{\Delta}, \mathbf{G}\_{V/\delta V}(\mathbf{s}) = -a\_{\mathbf{y}}^{\delta V} \frac{\Delta\_{\mathbf{2}\mathbf{1}}}{\Delta} - a\_{mx}^{\delta V} \frac{\Delta\_{\mathbf{3}\mathbf{1}}}{\Delta}, \tag{20}$$

where *aδ<sup>M</sup> <sup>x</sup>* is a speed coefficient with respect to the fuel supply, *aδ<sup>V</sup> <sup>y</sup>* is a pitch coefficient with respect to the elevator angle, *aδ<sup>V</sup> mz* is the coefficient of the speed angle with respect to the elevator angle, *Δ*(*s*)—a determinant of the transfer function, Δ11(*s*), Δ21(*s*), Δ31(*s*)—algebraic additions to the determinant Δ(*s*), see paragraph (Eq. (9)). The fuel supply transfer function (Eq. (17)) can be calculated using the following equation:

$$\begin{split} \Delta V\_{V/\delta \mathcal{M}}(\mathbf{s}) &= \quad G\_{V/\delta \mathcal{M}}(\mathbf{s}) \* \Delta \delta\_{\mathcal{M}}(\mathbf{s}) \\ &= \quad 5 \frac{\mathbf{s}^3 + \mathbf{1.12s^2} + 62.782\mathbf{s} + 25.32}{\mathbf{s}^4 + \mathbf{1.1338s^3} + 62.7975\mathbf{s}^2 + 28.6585\mathbf{s} + 4.09291} \Delta \delta\_{\mathcal{M}}(\mathbf{s}). \end{split} \tag{21}$$

The transfer function of the elevator (Eq. (17)) is given by:

$$\begin{split} \Delta V\_{V/\delta V}(\mathbf{s}) &= \mathbf{G}\_{V/\delta V}(\mathbf{s}) \* \Delta \delta\_{V}(\mathbf{s}) \\ &= \frac{-\mathbf{0}.1\mathbf{1} \cdot (9.81\mathbf{s} + 620.97\mathbf{3}) - \mathbf{0}.4\mathbf{2} \cdot (-9.81\mathbf{s} - 10.0062)}{\mathbf{s}^4 + \mathbf{1.1338s^3} + 62.7975\mathbf{s}^2 + 28.6585\mathbf{s} + 4.09291} \Delta \delta\_{V}(\mathbf{s}). \end{split} \tag{22}$$

#### **4.2 Structure-defined mathematical model of the angle of aircraft attack in a flight simulator**

From description angle of aircraft attack Δ*α*(*s*), we can derive that the equation of angle of aircraft attack displacement defines a change aircraft throttle control (of fuel supply) and a change in the angle of aircraft elevator [10]:

$$
\Delta a(\mathbf{s}) = -G\_{a/\delta \mathcal{M}}(\mathbf{s}) \Delta \delta\_{\mathcal{M}}(\mathbf{s}) - G\_{a/\delta V}(\mathbf{s}) \Delta \delta\_{V}(\mathbf{s}), \tag{23}
$$

where stability determined by zeroes of a characteristic equation is used as a numerator in the structured mathematical model of aircraft motion; see [2]. Next, we define permutation and transformation with regard to (Eq. (16)) and have coefficients for *l21*(*x*):

$$A\_{21} = 5 \frac{0.002s^2 - 0.252s - 0.1}{A}, \mathbf{x}\_1 = \Delta \delta\_M(s). \tag{24}$$

$$A\_{21} = -0.11 \cdot (-s^3 + 0.886s^2 + 0.0124s - 2.453) - 0.42 \cdot (-s^2 - 0.414s - 0.025)$$

$$A\_{22} = \frac{-0.11 \cdot (-s^3 + 0.886s^2 + 0.0124s - 2.453) - 0.42 \cdot (-s^2 - 0.414s - 0.025)}{A},\tag{25}$$
  $\infty\_2 = \Delta \delta\_V(s).$ 

The equations Eq. (18) and Eq. (24) will use a step change of throttle control stick (fuel supply) in Laplace transformation Δ*δ<sup>M</sup>* (*s*) = *1*/*s*. Eqs. (19) and (25) will use a step change of aircraft elevator control (angle of attack) in Laplace transform Δ*δ<sup>V</sup>* (*s*) = 1/*s*. The problem statement of a mathematical model of motion in a flying simulator is conditioned by identification of its stability. The roots of the characteristic equation, the denominator equation (Eq. (18)), (Eq. (19)), (Eq. (24)) and equation (Eq. (25)), see [1].

In Eq. (17), *Gα/δ<sup>V</sup>* (*s*) is the calculated mathematical model angle of aircraft attack (a transfer function) depending on the fuel supply, *δM*(*s*) is the fuel supply, *Gα/δ<sup>V</sup>* (*s*) is the calculated mathematical model angle of aircraft attack depending on the angle of the elevator, *δV*(*s*) is the angle of the elevator. A mathematical model of an angle of aircraft attack in the longitudinal direction, fuel supply, and the angle of attack can be determined; see [14]:

$$\mathbf{G}\_{a/\delta\mathcal{M}}(\mathbf{s}) = -a\_{\mathbf{x}}^{\delta\mathcal{M}} \frac{\Delta\_{12}}{\Delta}, \mathbf{G}\_{a/\delta V}(\mathbf{s}) = -a\_{\mathbf{y}}^{\delta V} \frac{\Delta\_{22}}{\Delta} - a\_{mx}^{\delta V} \frac{\Delta\_{32}}{\Delta}. \tag{26}$$

The transfer function of fuel supply (Eq. (23)) can be calculated using the following equation:

$$\begin{split} \Delta a\_{a/\delta \mathcal{M}}(\mathbf{s}) &= \mathcal{G}\_{a/\delta \mathcal{M}}(\mathbf{s}) \ast \Delta \delta\_{\mathcal{M}}(\mathbf{s}) \\ &= \mathbf{5} \frac{0.002 \mathbf{s}^2 - 0.25 \mathbf{18} \mathbf{s} - \mathbf{0}. \mathbf{1}}{\mathbf{s}^4 + 1.1338 \mathbf{s}^3 + 62.797 \mathbf{5} \mathbf{5}^2 + 28.658 \mathbf{5} \mathbf{s} + 4.0929 \mathbf{1}} \Delta \delta\_{\mathcal{M}}(\mathbf{s}). \end{split} \tag{27}$$

$$\begin{aligned} \Delta a\_{a/\delta V}(s) &= G\_{a/\delta V}(s) \ast \Delta \delta\_V(s) \\ &= \frac{-0.11 \cdot (-s^3 + 0.886s^2 + 0.0124s - 2.453) - 0.42 \cdot (-s^2 - 0.414s - 0.025)}{s^4 + 1.1338s^3 + 62.7975s^2 + 28.6585s + 4.09291} \Delta \delta\_V(s) . \end{aligned} \tag{28}$$

#### **5. Visualization of results of parallel simulation of mathematical models**

Initial or limiting restricting conditions in the given flight phase affect the form of equations of the system depending on which phase of aircraft motion they are calculated [17]. Visualization of results has an impact on quality simulation and simulation *Simulation of a Mathematical Model of an Aircraft Using Parallel Techniques (MPI and GPU) DOI: http://dx.doi.org/10.5772/intechopen.105538*

tries to obtain the information about the properties of a real system by means of an experiment, the so-called simulation model [18]. "Computer simulation of flying simulator is employed as enlargement or replacement of a structured mathematical model of aircraft motion for which an analytical solution is difficult of even impossible. [19]".

The sequential program of the mathematical model program is characterized by the equations of simulation of aircraft motion in a single computer time in equidistant moments. The disadvantage of this method is the limitation of the power of the processor, which calculates mathematical models of aircraft motion [20]. For presentation of more accurate simulation results, we need a higher-quality simulation system and a visualization generator providing artificial surrounding of required quality; this surrounding is a three-dimensional scene, see **Figure 3**.

The first term according to Eq. (17) or Eq. (23) represents the transfer function (structured mathematical model of aircraft motion) of speed displacement shift depending on the fuel supply of the aircraft and transfer function (structured mathematical model of aircraft motion) of the angle of attack depending on the aircraft fuel supply. In the polynomial expression of the transfer function, we derive the following form for the transfer function of increase in speed calculated from the change in fuel supply in meters per second and calculated displacement angle of attack shift depending on fuel supply in radians:

$$-G\_{V/\text{\\$M}}(\text{s})\Delta\delta\_{\text{M}}(\text{s}) = -5 \frac{\text{s}^3 + 1.12\text{s}^2 + 62.782\text{s} + 25.32}{A} \frac{M}{\text{s}}.\tag{29}$$

$$-G\_{a/\delta M}(s)\Delta\delta\_{\mathcal{M}}(s) = -5\frac{0.002s^2 - 0.252s - 0.1}{A}\frac{M}{s}.\tag{30}$$

If displacement of the speed is considered in Eqs. (29) and (30) and this is conditioned by the step of change in fuel supply (unit step).

**Figure 3.** *Principle of a pilot's activity and its visualization in a projection system.*

The second member according to Eq. (17) or Eq. (23) represents the transfer function of the speed increment depending on the angle of the aircraft elevator and represents the transfer function of the angle of attack depending on the angle of the aircraft elevator. In polynomial expression of the transfer function, we derive the following form for the transfer function of the increase in speed calculated from the change of aircraft elevator in meters per second and of calculated displacement of angle of attack from the aircraft elevator in radians:

$$-G\_{V/\delta V}(\mathbf{s})\Delta\delta\_V(\mathbf{s}) = -\frac{-0.1\mathbf{1}\cdot(9.81\mathbf{s} + 620.973) - 0.42\cdot(-9.81\mathbf{s} - 10.006)}{A} \frac{V}{\text{s}}.\tag{31}$$

$$-G\_{a/\delta V}(\mathbf{s})\Delta\delta\_V(\mathbf{s}) = $$

$$-\frac{-0.1\mathbf{1}\cdot(-\mathbf{s}^3 + 0.886\mathbf{s}^2 + 0.0124\mathbf{s} - 2.453) - 0.42\cdot(-\mathbf{s}^2 - 0.414\mathbf{s} - 0.025)}{A} \frac{V}{\text{s}}.\tag{32}$$

The displacement of the elevation is considered in the Eq. (31) or Eq. (32) respectively, and this is conditioned by the step of elevator angle (unit step). The design and compilation of processes of a structured mathematical model of aircraft motion movement in the fuel supply to aircraft engines and angle of the aircraft elevator must be accurate. The simulation in our solution takes 30 s, and the intermediate data is sent in periodical time to the processor's core or node processing recorded simulated data and creating a graphical form of calculated results after the end of simulation.

## **5.1 Parallel simulation of a structure-defined mathematical model of an aircraft using MPI**

The sequential program of a mathematical model program is characterized by the calculation of equations in a single computer time. The code operations are performed sequentially in that order. The disadvantage of this method is the energy consumption of the processor that counts the models [20]. The state of the art of parallel system based on the standard MPI can be introduced as the first one.

#### *5.1.1 Principle of parallel message passing interface*

The simulation parallel program computers in distributed computer systems are referred to as node computers [21]. They usually consist of a primary message input queue, one or more equivalent processors, and necessary equipment for communicate over the interconnectors. The threads operate in either serial or parallel modes.

The MPI facilitates this approach by providing many ways to call open-source industrial MPI implementations such as MPICH and LAM-MPI. The send/receive commands are implemented to change messages in the source code application and are added to run on nodes. We use two basic functions to send and receive messages [22]:


*Simulation of a Mathematical Model of an Aircraft Using Parallel Techniques (MPI and GPU) DOI: http://dx.doi.org/10.5772/intechopen.105538*

#### *5.1.2 The program application created using MPI*

There are *n* nodes, which consist of the processor *Pi* and the local memory *Mj*. The nodes communicate with each other using lines and an interconnection network. When executing a given program, the program is divided into concurrent processes, each of which is executed in a separate processor. This simultaneous execution of the same task on multiple processors is used to obtain results faster.

Distributed architecture was realized as connection of five nodes: one is a central computer, and the others are computing nodes (**Figure 4**). One node (*N1*) is designed as a central computer, and the others are computational nodes, and each of them computes only one mathematical model. The MPI provides alternative methods for communication and movement of data among multiprocessors. There is no global memory, it is necessary to move data from one local memory to another by means of message passing [23].

Where the *MPI\_Send()* function on a side of the sender is responsible for sending messages. The corresponding *MPI\_Recv()* function is inserted into a target process to receive messages. The simulation takes 30 seconds, and the intermediate data are sent in periodical time to the node that presents the received data in a graphical form.

#### *5.1.3 The distributed modeling*

The implementation MPICH2 is a portable, high-performance implementation of the entire MPI-2 standard and consists of a library of routines that can be called from the program. The TOOLKIT is an integrated set of tools that supports measurement, analysis, assignment, and presentation of application performance for sequential and parallel programs [24].

As follows from the expression, the structured mathematical model of aircraft defined by Eq. (18) *A11* \* *x1* is simulated by the computer *N2* on the second node, (Eq. (19)) *A12* \* *x2* is simulated by the computer *N3* on the third node, structured mathematical model of aircraft defined by Eq. (24) *A21* \* *x1* is simulated by the computer *N4* on the fourth node, and Eq. (25) *A22* \* *x2* is simulated by the computer *N5* on the fifth node.

From the graphical output of the central node, we get **Figure 5** as a result of the simulation. The simulation of a structured mathematical model of aircraft motion using a flight simulator cluster technology is done according to Eqs. (18) and (19) or Eqs. (24) and (25).

**Figure 4.**

*Message passing interface – architecture, Ni – node-computer, Pi – processor, Mi – local memory.*

#### *5.1.4 Simulation results from MPI*

The simulation results are in **Figure 5**, the upper left figure shows a graphical presentation of the aircraft speed increase depending on the fuel supply, and it is equal to 31.0192 [m/s], it is identical to the figure in **Figure 6**. The figure on the top right shows the aircraft speed increment depending on from the elevator, and it is equal to 15.6142 [m/s]. The figure at the bottom left shows a graphical representation of the increment angle of the aircraft attack depending on the fuel supply and is equal to 0.1237 [rad], it is identical to the presentation in **Figure 7**. The figure at the bottom right shows the increment angle of the pitch depending on the rudder and is equal to 0.0714 [rad]. The simulation time is set depending on the value of the integration error, which is less than 0.002 with these distributed simulation methods.

Modeling of the parallel aspect of the decomposed flight simulator subsystems in the form of mathematical notation was performed in accordance with Eqs. (18) and (19) or Eqs. (24) and (25). The strengths of this model are the combination of both the advantages: efficiency (memory savings) and ease of programming of a sharedmemory method and scalability of a distributed-memory method.

#### **5.2 Parallel simulation of a structure-defined mathematical model of an aircraft using GPU**

Computer simulation a structured mathematical model of aircraft motion is used for modeling of aircraft characteristics in such cases [25]. The numerical integration

#### **Figure 5.**

*Simulation results of (Eq. (18)) – upper left, (Eq. (19)) – upper right, (Eq. (24)) – bottom left, (Eq. (25)) – bottom right.*

*Simulation of a Mathematical Model of an Aircraft Using Parallel Techniques (MPI and GPU) DOI: http://dx.doi.org/10.5772/intechopen.105538*

**Figure 6.**

*A block diagram of simulation of a mathematical model of aircraft motion on the GPU computation.*

#### **Figure 7.**

*GeForce 560 GPU block scheme of Streaming Multiprocessors (SM), Load (LD), Store (ST), Special Function Unit (SFU).*

must be available in real time, in single computer time in equidistant moments. The above, two-parameter control of a block structured mathematical model of motion is performed by controlling the throttle lever of the engine and throttle rudder, which cause a change in the movement of the aircraft and the angle of attack of the aircraft. Parallel codes running on GPU hardware can yield results equivalent to the performance of dozens of traditional CPUs.

*Input of block mathematical model* represents control values of block structured mathematical model of aircraft motion—the fuel supply or the elevator angle. *Output of block mathematical model* represents simulated values of block structured mathematical model of aircraft motion—the speed or the attack angle. A given system can simulate multiple computers or processors. When several processors of a simulator system are connected (*Block1*, *Block2*, ..., *Blockn*), they communicate with each other via SMS; see **Figure 8**.

#### *Aeronautics - New Advances*

```
Figure 8.
Outline of a revised host code ComputeFlightGPU ()
```
Control values of block structured mathematical models of aircraft motion—fuel supply and an aircraft elevator angle represent an input in a block diagram and an output in a block diagram, next figure.
