Abstract
This paper presents the simulation and controller optimization of a quadrotor Unmanned Aerial Vehicle (UAV) system. The quadrotor model is derived adopting the Newton-Euler approach, and is intended to be constituted by four three-phase Permanent Magnet Synchronous Motors (PMSM) controlled with a velocity control loop-based Field Oriented Control (FOC) technique. The Particle Swarm Optimization (PSO) algorithm is used to tune the parameters of the PID controllers of quadrotor height, quadrotor attitude angles, and PMSMs’ rotational speeds, which represent the eight critical parameters of the PMSM-quadrotor UAV system. The PSO algorithm is designed to optimize eight Square Error (SE) cost functions which quantify the error dynamics of the controlled variables. For each stabilization task, the PID tuning is divided in two phases. Firstly, the PSO optimizes the error dynamics of altitude and attitude angles of the quadrotor UAV. Secondly, the desired steady-state rotational speeds of the PMSMs are derived, and the PSO is used to optimize the motors’ dynamics. Finally, the complete PMSM-Quadrotor UAV system is simulated for stabilization during the target task. The study is carried out by means of simulations in MATLAB/Simulink®.
1. Introduction
Urban Air Mobility (UAM) represents a promising innovation in the field of urban transportation, and nowadays is seen as a potential revolution in the context of smart cities. In particular, Unmanned Aerial Vehicles (UAVs), as a key element of UAM, are suitable for a variety of applications and missions spanning from surveillance to passenger transportation [1]. For instance, in the delivery sector, UAVs can reduce delivery times and costs while minimizing the environmental impact with respect to the traditional truck-based delivery [2,3,4,5,6,7].
Quadrotors are widely recognized as the most promising configuration among all the types of UAVs, mainly for their maneuverability, relatively low cost, and capability to perform almost any type of task [8]. Quadrotor UAVs are flying mechatronic systems equipped with propellers, motors, electronic speed controllers, and different kinds of payloads (sensors, battery, CPU, etc.) integrated into their cross-shaped structure. Among brushless motors, Permanent Magnet Synchronous Motors (PMSMs) are remarkably dependable and efficient. Without compromising the torque generation capability, PMSMs can help reduce the size of the platform thanks to their power-to-size ratio [9]. PMSMs enhance UAV control by generating high thrust, thus improving maneuverability.
This paper investigates the performance of a quadrotor equipped with four PMSMs, focusing on its dynamics during hovering and maneuvering. Controlling UAVs with PMSMs involves controlling the motors’ speed to control the drone’s direction, this is typically achieved with a series of decentralized Proportional-Integral-Derivative (PID) controllers. To further optimize the performance of the closed-loop system, a Particle Swarm Optimization (PSO) algorithm is designed to tune the parameters of each PID controller. Several works can be found in the literature about the tuning of PID controllers of quadrotors with PSO algorithms for attitude control and trajectory tracking [10,11,12,13,14,15], but the inclusion of the motor dynamics in the loop is unseen (a part from simplifications with first order motor’s dynamics) even though it is crucial for the development of the drone digital twin [16]. By exploiting the PSO algorithm for the optimal tuning of all the PID controllers of the system, it is possible to comprehensively simulate the PMSM-Quadrotor UAV system and optimize the performances.
2. Methodology
This section presents the methodology adopted for the development of this work, which is composed by (i) the model of the quadrotor UAV based on the Newton-Euler formalism, (ii) the model of the PMSMs, (iii) the control model of the PMSM-Quadrotor UAV system by means of PID control, and (iv) the PSO algorithm for the optimal tuning of the PID parameters. The simulation settings are also presented for the sake of repeatability of the results.
2.1. System Model
Figure 1 shows a schematic representation of the two systems simulated in this work, i.e., the quadrotor platform and the PMSM.
Figure 1.
(a) Schematic representation of the quadrotor platform, taken from [17]. (b)Schematic representation of the PMSM system and its control unit.
2.1.1. Quadrotor UAV Model
The nonlinear dynamical model of the quadrotor UAV adopted in this work is based on the Newton-Euler formalism. Such model, as reported in Equation (1), is the same model developed in one of our previous works [17]. Refer to [17] for the complete terminology as well as the assumptions.
2.1.2. PMSM Model
A Permanent Magnet Synchronous Motor (PMSM) operates with a rotor made of permanent magnets and a stator with three-phase windings, synchronizing its speed with the AC power frequency. A Voltage Source Inverter (VSI) provides the necessary AC power, while a control unit adjusts the motor’s stator currents for optimal performance. The motor operates in constant torque mode up to its rated speed, and switches to flux weakening mode for higher speeds by reducing the d-axis current, allowing for extended speed ranges while maintaining efficiency. The d-q model is developed in the rotor reference frame, where at any time , the rotor d-axis (rotating at the same speed of the rotor) forms an angle with the fixed stator phase axis. The voltage equations are reported in Equation (2).
is the stator resistance, is rotor angular velocity, and are dq-axes inductances, is flux linkage, and are d-axis and q-axis currents, respectively, and ρ is the derivative operator. The mechanical torque is defined follows:
with being the developed torque, the load torque, the viscous friction coefficient, the rotor inertia. The rotor mechanical speed is reported in Equation (4).
where is the rotor electrical speed, is the rotor mechanical speed, and is the number of poles.
The dynamic d-q modeling technique is utilized to analyze motors under transient and steady-state conditions by transforming three-phase voltages and currents into dq0 variables using the Park transformation. This conversion of to in the rotor reference frame is expressed by the following equation:
The control of PMSMs mirrors the one of DC motors through Field-Oriented Control (FOC), also known as vector control. This technique decouples torque and flux components of current by modulating the stator excitation. The vector control strategy is derived from the dynamic model of PMSM, utilizing currents as inputs to evaluate the three-phase currents as reported in Equation (6).
where is the angle between the rotor field and stator current phasor, and is the magnitude of the supply current in d-q reference frame. Stator currents are converted to the rotor reference frame using the Park transformation at rotor speed . In this frame, q- and d- axes currents are constant for a given load torque and considering the angle . The q-axis current acts like the armature current in a DC machine, while the d-axis current represents the field current, partially supplied by the permanent magnet field. Thus, the q-axis current is the torque-producing component, and the d-axis current is the flux-producing component. Manipulation of Equation (6) and Equation (5) yields to:
Finally, the electromagnetic torque is expressed as follows:
2.2. System Control Model
2.2.1. Quadrotor UAV Control Model
The PID controllers of quadrotor attitude and altitude are defined as:
with , and to be optimized by the PSO algorithm. In particular, and .
2.2.2. PMSM Control Model
The classical formulation of PID control reported in (9) is applied also to the PMSM speed control system, with the controller being inserted in the speed control loop and computing the reference torque (thus, the reference current) for the motor, as follows:
with . denotes the motor angular velocity, denotes the reference angular velocity, and is meant to be optimized by the PSO algorithm.
2.3. PSO Algorithm
The Particle Swarm Optimization (PSO) algorithm is based on a swarm of particles learning from each other’s best performances, emphasizing cooperation and competition [18]. Analogous to birds searching for food, each particle adjusts its direction and velocity based on its position and collective insights, iteratively refining their movement until the optimal solution is found.
A swarm consists of multiple particles, each representing a potential solution to an optimization problem. For parameters, a particle’s position is and the swarm of particles is . Each particle updates its position and velocity iteratively. The velocity update equation is defined as follows:
where is the inertia weight, is the cognitive weight, is the social weight, is the best position of particle (cognitive component), and is global best position of the swarm (social component). Therefore, the new position is defined as follows:
This process continues until convergence, balancing exploration (searching new areas of the search space) and exploitation (refining known good areas). The inertia, cognitive, and social components ensure diverse search behavior, with typically used to balance their influence. The fundamentals of the PSO algorithm and how it is applied to the decoupled systems considered in this work are shown in Figure 2.
Figure 2.
(a) Flow chart of the PSO algorithm based on [19]; (b) Process of searching for a new position in the PSO methodology; (c) Schematic representation of how the PSO framework is used for optimizing the PID parameters of both quadrotor and PMSMs’ controllers.
2.4. Implementing the PSO Approach
The PSO algorithm is utilized to derive the optimal values of the parameters of the PID controller, with the objective of minimizing the discrepancy between desired and simulated dynamics derived from MATLAB/Simulink simulations. The algorithm’s parameters values are specified in Table 1. Leveraging the swarm initialization and the predefined parameter ranges outlined in Table 1, the fitness function is computed to evaluate the performance of each particle. As depicted in Figure 2a, the PSO process starts with the initialization of PSO parameters, including random initialization of particle positions and velocities. Subsequently, the error between the desired and simulated results is evaluated (process represented in Figure 2c. The particles’ velocities and positions are then updated based on Equations (11) and (12). Figure 2b provides a schematic representation of how particles adjust their positions according to individual and global best values. This iterative process of fitness evaluation, velocity adjustment, and position update continues for a predefined number of iterations or until a convergence criteria are met, such as achieving minimal changes in the global best value . As shown in Figure 2c, this process ensures the determination of optimal parameters for both quadrotor and PMSMs’ PID controllers.
Table 1.
Initial parameter for PSO algorithm.
2.5. Simulation Settings
Both the PMSM-Quadrotor UAV system and the PSO algorithm are implemented in MATLAB/Simulink. The parameters of the quadrotor model are the same as the ones reported in our previous work in [17]. The characteristics of the PMSM model are defined in Table 2.
Table 2.
Characteristics of the PMSM model.
3. Simulation Results
In this section the simulation results are presented. The optimization of the PID parameters’ values is decoupled in two stages: (i) the quadrotor altitude and attitude PID controllers are optimized for a stabilization task with the aim to minimize the SE cost function of the error signals’ dynamics, (ii) the reference steady-state rotational speed of each PMSM () is computed for that task by means of , as in Equation (1), and the PSO is used to optimize the PID speed controllers with the aim to minimize the motors’ error dynamics. The complete PMSM-Quadrotor UAV system is then simulated during hovering and maneuvering tasks, with all the eight PID controllers being optimized by the PSO approach. Figure 3 shows the comparison of the system’s dynamics during stabilization for 2 tasks: hovering and maneuvering, with different random initial conditions. The PMSM-Quadrotor UAV is simulated with the PID controllers of the motor being optimized by the PSO, and the PID controllers of the quadrotor being both optimized (Figure 3a,c) and non-optimized (Figure 3b,d). Reduction of oscillations and superior fastness of response in the attitude and altitude signals are observed for the optimized system.
Figure 3.
Comparing (a) optimized and (b) non-optimized PMSM-Quadrotor UAV system’s performances for a hovering stabilization task. Comparing (c) optimized and (d) non-optimized PMSM-Quadrotor UAV system’s performances for a maneuvering stabilization task. Simulations performed with a set of random initial conditions.
In Table 3 the cost function values, computed in the simulations shown in Figure 3, referring to the sum of the attitude angles’ SE cost function () are presented, highlighting the significant reduction of the SE when the PID controllers are tuned by the PSO algorithm.
Table 3.
Comparison of the SE cost function values () with optimized and non-optimized PID parameters. Simulations performed with 5 random initial conditions for both Hovering (H) and Maneuvering (M) stabilization tasks.
Figure 4a,b show the optimized dynamics of one motor during one of the maneuvering stabilization tasks of Figure 3. Figure 4c,d show the comparison of the performance of one motor for different reference velocity signals in case of optimized and non-optimized controller. Again, faster dynamics and oscillations reduction are observed due to the PSO optimization of the speed controllers.
Figure 4.
(a,b) Optimized dynamics of one motor during the maneuvering stabilization tasks, simulations refer to the same set of Figure 3c. Comparing (c) optimized and (d) non-optimized dynamics of one motor for different reference velocities (i.e., different maneuvers).
4. Conclusions
This paper presents a simulative study of a PMSM-Quadrotor UAV system with decentralized PID controllers of quadrotor attitude and altitude, and motors’ rotational speed. A PSO algorithm is implemented to optimize the performances in terms of squared error cost functions of the controlled variables’ error dynamics. Simulation results with different initial conditions for both hovering and maneuvering stabilization tasks corroborate the validity of the approach. This work shows how to develop the set of system engineering tools for further advancing the drone digital twins. Future works will be focused on the comparison of the performances obtained by implementing other optimization approaches for tuning the controllers as well as the development of comprehensive simulative studies with different types of quadrotors and motors.
Author Contributions
Conceptualization, M.R.; methodology, M.R.; software, M.M.; validation, M.M., M.R. and S.P.; formal analysis, M.M. and M.R.; investigation, M.M. and M.R.; resources, M.M.; data curation, M.M.; writing—original draft preparation, M.M. and M.R.; writing—review and editing, S.P. and G.G.; visualization, M.M.; supervision, G.G.; project administration, G.G.; funding acquisition, G.G. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The data used in the current study are available from the corresponding author upon reasonable request.
Acknowledgments
The authors wish to thank the Piedmont Aerospace Cluster for supporting the activity of Marco Rinaldi.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Panov, I.; Ul Haq, A. A Critical Review of Information Provision for U-Space Traffic Autonomous Guidance. Aerospace 2024, 11, 471. [Google Scholar] [CrossRef]
- Rinaldi, M.; Primatesta, S.; Guglieri, G.; Rizzo, A. Auction-based Task Allocation for Safe and Energy Efficient UAS Parcel Transportation. Transp. Res. Procedia 2022, 65, 60–69. [Google Scholar] [CrossRef]
- Rinaldi, M.; Primatesta, S. Comprehensive Task Optimization Architecture for Urban UAV-Based Intelligent Transportation System. Drones 2024, 8, 473. [Google Scholar] [CrossRef]
- Rinaldi, M.; Primatesta, S.; Guglieri, G.; Rizzo, A. Multi-Auctioneer Market-based Task Scheduling for Persistent Drone Delivery. In Proceedings of the 2023 International Conference on Unmanned Aircraft Systems (ICUAS), Warsaw, PL, USA, 6–9 June 2023. [Google Scholar]
- Rinaldi, M.; Primatesta, S.; Bugaj, M.; Rostáš, J.; Guglieri, G. Development of Heuristic Approaches for Last-Mile Delivery TSP with a Truck and Multiple Drones. Drones 2023, 7, 407. [Google Scholar] [CrossRef]
- Tomasicchio, G.; Cedrone, A.; Fiorini, F.; Esposito, L.; Scardapane, G.; Filipponi, F.; Rinaldi, M.; Primatesta, S. Resilient Drone Mission Management and Route Optimization in Drone Delivery Context. In Proceedings of the 28th Ka and Broadband Communications Conference (Ka), Bradford, UK, 23–26 October 2023. [Google Scholar]
- Rinaldi, M.; Primatesta, S.; Bugaj, M.; Rostáš, J.; Guglieri, G. Urban Air Logistics with Unmanned Aerial Vehicles (UAVs): Double-Chromosome Genetic Task Scheduling with Safe Route Planning. Smart Cities 2024, 7, 2842–2860. [Google Scholar] [CrossRef]
- Idrissi, M.; Salami, M.R.; Annaz, F. A Review of Quadrotor Unmanned Aerial Vehicles: Applications, Architectural Design and Control Algorithms. J. Intell. Robot. Syst. 2022, 104, 22. [Google Scholar] [CrossRef]
- Özçiflikçi, O.E.; Koç, M.; Bahçeci, S.; Emiroğlu, S. Overview of PMSM control strategies in electric vehicles: A review. Int. J. Dyn. Control 2024, 12, 2093–2107. [Google Scholar] [CrossRef]
- Rodriguez, E.X.; Lu, Q. Tuning PID Controller for Quadrotor Using Particle Swarm Optimization. In Proceedings of the 2024 21st International Conference on Ubiquitous Robots (UR), New York, NY, USA, 24–27 June 2024. [Google Scholar]
- Jing, X.; Wang, X. PSO algorithm tuning PI_ PID controller parameters of quad-rotor UAV. J. Phys. Conf. Ser. 2022, 2228, 012017. [Google Scholar] [CrossRef]
- El Gmili, N.; Mjahed, M.; El Kari, A.; Ayad, H. Particle Swarm Optimization and Cuckoo Search-Based Approaches for Quadrotor Control and Trajectory Tracking. Appl. Sci. 2019, 9, 1719. [Google Scholar] [CrossRef]
- Lu, X.; Zhang, X.; Jia, S.; Shan, J. Design of Quadrotor Hovering Controller Based on Improved Particle Swarm Optimization. In Proceedings of the 2017 10th International Symposium on Computational Intelligence and Design (ISCID), Hangzhou, China, 9–10 December 2017. [Google Scholar]
- Noordin, A.; Basri, M.A.; Mohamed, Z.; Abidin, A.F. Modelling and PSO fine-tuned PID control of quadrotor UAV. Int. J. Adv. Sci. Eng. Inf. Technol. 2017, 7, 1367–1373. [Google Scholar] [CrossRef]
- Gmili, N.E.; Mjahed, M.; Kari, A.E.; Ayad, H. Intelligent PSO-based PDs/PIDs controllers for an unmanned quadrotor. Int. J. Intell. Eng. Inform. 2018, 6, 548–568. [Google Scholar] [CrossRef]
- Abro, G.E.M.; Abdallah, A.M. Digital Twins and Control Theory: A Critical Review on Revolutionizing Quadrotor UAVs. IEEE Access 2024, 12, 43291–43307. [Google Scholar] [CrossRef]
- Rinaldi, M.; Primatesta, S.; Guglieri, G. A Comparative Study for Control of Quadrotor UAVs. Appl. Sci. 2023, 13, 3464. [Google Scholar] [CrossRef]
- Gad, A.G. Particle Swarm Optimization Algorithm and Its Applications: A Systematic Review. Arch. Comput. Methods Eng. 2022, 29, 2531–2561. [Google Scholar] [CrossRef]
- Umar, R.; Mohammed, F.; Deriche, M.; Sheikh, A.U. Hybrid cooperative energy detection techniques in cognitive radio networks. In Handbook of Research on Software-Defined and Cognitive Radio Technologies for Dynamic Spectrum Management; IGI Global: Hershey, PA, USA, 2015; pp. 1–37. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).