Unmanned aerial vehicle dynamic simulation in SimInTech

The paper considers the simulation results of the flight monitoring system of an unmanned aerial vehicle (UAV) of the octocopter type in SimInTech dynamic simulation environment, where the developed mathematical model was exported. The paper also proposes a monitoring system based on a proportional-integral-derivative (PID) controller. The simulation of the octocopter monitoring system was completed by the export of the monitoring system developed in Simulink environment. The described approach to simulation allows evaluating the copter monitoring system and reproducing the flight dynamics of a real physical object. Here, the modeling of precession effects is omitted, it is assumed that the torque reaction of each engine-propeller combination (EPC) equals zero, namely: each EPC has two motors and rotors rotating at the same speed in opposite directions. The issue of simulating equipment failures is also omitted and it is assumed that the object is only in the air (in normal flight mode). The given model does not imply landing and take-off modes, emergency situations, load grip system and unloading, as well as does not consider the issues of detailed modeling of sensors, filtering of signals and noises, bending of the frame of the copter and/or rotors, operation at out-of-limit loads, writing drivers to particular equipment. The technical result of the algorithm is the design and parametric implementation of the model of the object dynamics in the general form and in the volume sufficient for the design of the flight controller and the ground control panel of the copter.


Introduction
At present, unmanned aerial vehicles have turned from the means of entertainment to complex mechanisms that help people in various activities. Thus, quadcopters are actively used for cadastral aerial photography, allow searching for people and monitoring fires in remote forest areas, searching and recording wild animals, delivering goods at short distances, and are also used for amateur and professional photo and video photography [1].
A copter is a highly maneuverable aircraft that has poor stability, since its dynamics is highly susceptible to external wind disturbances due to its fairly small weight. The copter control system must fundamentally solve the problems of angular and spatial stabilization, ensure that the copter reaches the given altitude (take-off), and facilitate landing, hovering and flight along the given trajectory. In general, the copter control system is subject to fairly high requirements for accuracy and speed, taking into account the specified limitations.

Problem Statement
Data: an object with a weight of about 10-25 kg, with 4, 6 or 8 paired coaxial engine-propeller combinations (EPC) located according to the traditional quadro-, hexa-or octocopter scheme on a rigid frame with 8, 12 or 16 engines of the T-motors Antigravity 6007 KV320 type or similar and corresponding rotors (based on the EPC carrying capacity of about 2 kg per 50% gas). Let us assume 2 that the design of the device is not fully defined. It is required to design and implement the model of object dynamics parametrically in a form and in volume sufficient for design of flight controller and copter ground control panel [2,5].
Various data sources provide quite a few models of quadcopter, some models of hexa-and octocopters are mentioned, while the following assumptions and simplifications may be distinguished in the task being implemented.

Engine simulation
The engine is modeled as an inertial link (aperiodic link) of the first order supplied with a specified angular speed to its input, and current (measured) value of angular rotation speed is supplied to its output. By integrating the rotation speed it is also possible to get the current turning angle. The thrust force of the EPC develops proportional to the square of angular velocity (as well as the torque reaction of each engine, but in our case it will be 0), it is represented using formulas (1, 2): where CT = 2.02268⋅10 −4 H⋅s2 (for a chosen EPC according to its characteristic); MM ≈ 0 Н⋅m⋅s 2engine torque reaction; ω(t) -current angular velocity, rad/s.

Multi-rotor drone modeling
The multi-rotor drone is modeled as a solid body and represents a rigid (non-deformable) constantmass frame, which is symmetric along three main axes, with EPC attached to it in the same plane, in which the drone mass center is located. Besides, EPC are located on eight beams (4 of them have one length and other 4 may be of another length) and are rigidly fixed relative to the frame. Thus, it can be said that the radius-vectors of the EPC centers and the thrust ports of each EPC are geometric constants in the coordinate system connected with the copter. In other words, the value FM(t) [H] calculated in the EPC model is a modulus of a force vector always applied in a certain direction and at a certain copter point. During the flight, this direction will change, but with respect to the frame of the copter and the coordinate system associated with it, it remains almost unchanged [3].

Coordinate systems
Two coordinate systems are used: a) fixed inertial related to the Earth and b) mobile related to the copter. The coordinate systems are indicated by letters I and B (from the English words inertial and body). In this case, the axes of the systems are directed as follows: xI -to the right, yI -to the observer, zI -down, xB -to the right along the beam of the first EPC, yB -to the observer along the beam of the third EPC, zB -from top to bottom under the normal orientation of the copter, as shown in Figure 1. Thus, if l1 -beam length of the 1, 3, 4 and 5 th EPC, and l2 -beam length of the 2, 4, 6 and 8 th EPC, then in the coordinate system B, the vectors of the EPC centers will be equal: In order for the copter to be controlled on the course, in our case with the absence of the torque reaction of engines, the thrust force vectors of each EPC must be slightly deviated from the vertical direction, i.e. rotated around each beam at a small angle of about 1-5 degrees, and in different directions: even -in one, and odd -in the other. If we denote this angle as γ, unit vectors may be obtained as follows: " Based on these geometric constants, which are only such in the coordinate system B associated with the copter, let us construct a further skeleton of the model. In general, there may be a different number of engine-propeller combinations and they may be directed in other directions, as well as be located in other places of the copter.

Relevant forces
The following forces act on the copter: • Gravity -always directed down along the axis of the inertial system of coordinates zI. Gravity is a constant value and depends only on the weight of the copter. The weight of the copter is taken constant and does not change, but it can be assumed that during the simulation it may be changed simulating an additional payload on the copter.
• EPC thrust forces -there are only 8 of them, they are directed along their directions, the force modulus is calculated depending on the angular rotation speed of the corresponding EPC.
• Air force (wind) -simulated as consisting of two components. Air resistance is directly proportional to air density, square of the linear velocity of an object in the air and the characteristic cross-sectional area in the chosen direction (shape factor). Wind force is an external perturbing force and is set arbitrarily or using an additional "wind model". This paper does not address this issue.
• External force or disturbance -arbitrary external influence. In the model, such an opportunity is laid down as an easy way to further check the regulators for stability in each direction.

Considered moments
When the copter moves, the following moments occur: • Torque reaction of EPC engines -in the considered model it equals zero due to the parity of engines and rotors in each EPC. In general, it should be taken into account, in some devices this moment is also used for heading control.
• Precession phenomenon -in the considered model it equals zero. In general, it requires separate calculations.
• Air resistance modulus -similar to the air resistance force, directly proportional to air density, the square of the angular velocity of the copter and the shape factor.
• Stalling torque from wind load -expressed by algebraic value of projection of the acting forces on axis.
• External disturbing moment -calculated mathematically and used to adjust regulators.
• Moments from the EPC thrust forces -in the considered model the following assumption is possible: since the rotors are not located in the mass center of the copter, each of them will create its own turning moment. They are probably the main factor that controls the orientation of the copter in space.

Implementing dynamic equations in the structural modeling environment
This paper suggests one method of dynamic equations using SimInTech dynamic simulation environment. In general, they are expressed by dependencies (3, 4): 1 2 ⃗ + 4 ⃗ + 5 ⃗ 6 + 78 9: " 9 ⃗; − : ⃗ × < : ⃗ , In the coordinate system B, two vector differential equations are obtained, which, when moving to projections and scalar equations, give 6 nonlinear first-order differential equations with respect to 6 variables: three velocities and three angular velocities, which is called the Six Degrees of Freedom (6DoF). At first glance, since the copter has 6 degrees of freedom, then there should be 6 state variables (they are also differential variables). However, in addition to velocities, we also need coordinates -three linear and three position angles in space, for which we should integrate the velocities again. Thus, in total, the copter has 12 degrees of freedom. But if we take into account the fact that the right parts of differential equations are the acceleration of the copter along the axes, then we can say that 18 degrees of freedom are obtained. Therefore, in the future, to build a regulator, we To solve the differential equation by structural modeling in SimInTech dynamic simulation environment, either typical links of the first and second orders are used (if the differential equation is linear and fits one of the types), or an Integrator block is used, the input of which is the right part of the equation, and the output will be the desired integral quantity. Figure 2 shows the "basis" of the dynamic part of the octocopter model, which is formed by 6+3+3 blocks of the Integrator type. The first six blocks, receiving the right parts of the differential equations at the input (copter accelerations along the axes aBx, aBy, aBz, ωBx, ωBy, ωBz) are engaged in integrating and calculating copter velocities along the same axes.
The following three integrators receive linear velocities in the coordinate system I obtained algebraically from velocities in system B by applying a rotation matrix, and by integrating them, we obtain the coordinates of the copter mass center in the inertial coordinate system. Besides, three Integrator blocks are engaged in calculating the orientation angles of the copter, integrating their derivatives (angular velocities) in system I obtained from angular velocities of the copter in system B using a WBI matrix. The calculation of the necessary trigonometric functions from the rotation angles is also implemented. The large number of blocks "in memory" and "out of memory" is caused by the repeated use of the obtained values in other parts of the model, for example, Figure 1 clearly shows that trigonometric functions from orientation angles are used repeatedly, and they should be optimally calculated in one place of the circuit for use as needed.

Results and Discussion
If we had a simpler situation, i.e. one differential equation of the second order (classical Newton second law: a = A 1 ), for example, in the projection on the x axis, then its solution in the above way was implemented in Figure 4. In case of a copter, the same approach is used, i.e. if there is some value at the output from the integrator, then a derivative of the same value is necessarily applied to its left part. Thus, in our case, differential equations are written and solved using the structural modeling method, or the built-in programming language SimInTech is used.

Conclusion
In conclusion it should be noted that in this paper the authors considered the simulation results of the flight monitoring system of an unmanned aerial vehicle (UAV) of the octocopter type in SimInTech dynamic simulation environment. It was demonstrated that with correctly selected empirical parameters, the algorithm is able to implement dynamics equations in the structural modeling environment.