Otwarty dostęp

Optimal Tuning of Digital PID Controllers for Commercial BLDC Motors Using the Nelder–Mead Method

, ,  oraz   
29 lip 2025

Zacytuj
Pobierz okładkę

Introduction

The adoption of brushless DC (BLDC) motors has grown rapidly across a wide range of industries, including electric vehicles (EVs), industrial automation and home appliances. This growth can be attributed to their enhanced efficiency, durability and minimal maintenance requirements compared with traditional brushed DC motors. BLDC motors are particularly notable for their impressive energy efficiency, which optimises power usage, cuts down on energy consumption and helps reduce operating expenses. These advantages make them a top choice for applications that emphasise sustainability and long-term energy savings (Lee et al., 2016; Mohanraj et al., 2022).

In household appliances, BLDC motors offer quieter operation and improved efficiency in devices such as water pumps (Khan and Miah, 2020) and washing machines (Ho et al., 2012). Within the automotive sector, they enhance the performance, power density and torque of EVs, contributing to both higher performance and greater sustainability (Shao, 2006). Their lightweight design and reduced heat generation make them ideal for modern EV propulsion systems (Chau et al., 2007). Beyond consumer products, BLDC motors are extensively used in robotics (De et al., 2019) due to their precise motion control and high-speed capabilities. As technological advancements continue, developments in motor control, power electronics and battery technology are boosting both the efficiency and cost-effectiveness of BLDC motors, reinforcing their crucial role in the future of electrical and mechanical systems.

Since PID controller tuning methods based on the Ziegler–Nichols approach may not provide optimal performance for complex, non-linear systems like BLDC motors, several advanced techniques for optimal PID tuning have been proposed to address these limitations. The Ziegler–Nichols method, while effective for many linear control systems, often struggles with highly dynamic and non-linear characteristics, such as those exhibited by BLDC motors (Bazanella et al., 2017). These limitations can lead to suboptimal transient response, overshoot and steady-state error, which negatively impact the overall performance and stability of the motor drive system. To overcome these challenges, more sophisticated and adaptive tuning approaches are required to ensure optimal performance across a wide range of operating conditions (Basilio and Matos, 2002; Huba et al., 2024).

Advanced PID controller tuning methods such as genetic algorithms (GA) (Chen and Perng, 2017), particle swarm optimisation (PSO) (Alberto et al., 2009), fuzzy logic (FL) (Gopan and Shree, 2022; Raja and Rathinakumar, 2023), Tabu search algorithm (Pakdeeto et al., 2023), artificial neural networks (ANN) (Owusu et al., 2023; Rubaai and Young, 2015) and model predictive control (MPC) (Ubare and Sonawane, 2022) have been proposed to enhance the performance of PID controllers in BLDC motor applications. These intelligent tuning techniques provide adaptive and self-optimising capabilities that allow the controller to dynamically adjust PID parameters in real time. As a result, they offer improved resilience and performance under varying operating conditions, such as fluctuating motor loads, changes in supply voltage, nonlinearities and system disturbances. By leveraging these methods, control systems can achieve faster response times, reduced steady-state error and better overall stability, which are critical for high-performance motor drive applications. Especially, swarm optimisation algorithms such as PSO have been proved to be powerful and versatile techniques for solving complex, high-dimensional and non-linear problems. They are also good at global search with local optima evasion at the conference of larger search space by their stochasticity, population-based and parallel nature.

One of the main challenges in BLDC motor drives is the presence of cogging torque causing undesirable vibrations, noise and fluctuations in speed, affecting the precision and smoothness of motor operation. Various strategies have been employed to mitigate cogging torque, one of which is DC-link voltage pulse amplitude modulation (PAM) (Huang et al., 2022). This technique effectively smooths the motor’s torque output by modulating the voltage amplitude supplied to the motor drive, thereby reducing torque ripple and enhancing overall performance.

The development of sensorless control schemes for BLDC motors involves detecting an open-loop rotor position without physical position sensors such as Hall-effect sensors or encoders. Such a method allows cost reduction and system reliability enhancement and is also useful when sensors cannot be used. Sensorless control does away with physical sensors and estimates rotor position using methods like back-electromagnetic force (back-EMF) sensing, which works well at medium to high speeds but poorly at low speeds (Damodharan and Vasudevan, 2010); sliding mode observer (SMO) (Chen et al., 2000), which is robust but complex; extended Kalman filter (EKF) (Aishwarya and Jayanand, 2016), which is very accurate but computationally intensive; and flux linkage-based methods, which work well at low speeds (Gabriel and Nesimi, 2016). Furthermore, pulse-width modulation (PWM) strategies, including sine PWM (SPWM) with lower harmonics and space vector PWM (SVPWM) with higher efficiency, are also applied to control voltage and current (Gujjar and Kumar, 2017). The control method selection is application dependent; for basic applications, six-step commutation can be employed; for high-performance applications, field-oriented control (FOC)/direct torque control (DTC) could be chosen; and for cost-oriented solutions, sensorless control would be preferred (Bosso et al., 2021; Ozturk and Toliyat, 2011).

The Nelder–Mead optimisation method (Nelder and Mead, 1965) is one of the more effective alternatives to GAs and PSO for low-dimensional, smooth optimisation problems. One of its main advantages is the fast convergence without the use of gradients, therefore applicable to gradient-free optimisation problems. In addition, the Nelder–Mead use does not involve complicated stochastic processes like GA and PSO, as it uses a single simplex and fewer tuning parameters. This simplicity leads to less computational cost and more uniform and reproducible results. Therefore, it is common to use the Nelder–Mead method if the problem is unimodal and of low dimension and if fast and good local optimisation is required. The Nelder–Mead method, therefore, can be easily applied to tune the gains of a PID controller by minimising a chosen performance index. The method evolves a simplex of parameter sets by testing the control performance at every loop and adjusting PID parameters to be optimal expected behaviour without gradient information (Sinlapakun and Assawinchaichote, 2015).

Due to the substantial superiority of the Nelder–Mead method in comparison with other optimisation methods, this study proposes a systematic and precise algorithm for designing a digital PID controller for commercial sensorless BLDC motor drives. A PID parameter tuning using the Nelder–Mead optimisation algorithm is performed to minimise the weighted sum of a chosen performance index for obtaining better transient and steady-state responses of the BLDC motor drive. To verify and enhance the robustness of the Nelder–Mead optimisation algorithm for tuning PID controllers of BLDC motors, this study establishes a comprehensive and well-instrumented experimental platform. The hardware system is centred around a commercially available outer-rotor brushless DC (BLDC) motor, chosen for its widespread use in industrial and consumer applications due to its high efficiency and compact design. Motor control is achieved using a commercial sensorless BLDC motor converter, which eliminates the need for physical position sensors by estimating rotor position through back-EMF, thereby reducing hardware complexity and cost.

The remaining parts of this paper are organised as follows: Section 2 explains the digital PID controller. The key steps of using the Nelder–Mead optimisation method for tuning PID controllers are presented in Section 3. Simulink-based simulation of two common control methods for BLDC motor drives, the trapezoidal control and FOC methods, is described in Section 4. The experimental setting and results are carefully mentioned in Section 5. Finally, Section 6 summarises the paper and future work is discussed.

The Digital PID Controller

The PID controller belongs to fundamental feedback control systems extensively utilised in automation, robotics and industrial process control. It dynamically determines the error by measuring the deviation between the target setpoint and the actual process variable. To minimise this error, the controller applies a calculated corrective response based on three key components as follows:

Proportional (P): Responds to the present error. A larger proportional gain leads to a more responsive system.

Integral (I): Addresses the cumulative past errors. Although it helps eliminate steady-state errors, it may cause overshoot.

Derivative (D): Responds to the rate of change of error. It anticipates future errors, helping to minimise overshoot and oscillations.

The output of a PID controller is calculated as follows: ut=Kpet+Kietdt+Kddetdt u\left( t \right) = {K_p}e\left( t \right) + {K_i}\int {e\left( t \right)\;dt} + {K_d}{{de\left( t \right)} \over {dt}} Where:

u (t) is the control output,

e(t) is the error (setpoint-actual value),

Kp is the proportional gain,

Ki is the integral gain,

Kd is the derivative gain.

Taking the Laplace transform of Eq. (1) gives: Us=KpEs+KisEs+KdsEs U\left( s \right) = {K_p}E\left( s \right) + {{{K_i}} \over s}E\left( s \right) + {K_d}sE\left( s \right) In Eq. (2), s is called the Laplace operator. Taking the z-transform of Eq. (2) results in: Uz=KpEz+KizTz1Ez+Kdz1zTEz U\left( z \right) = {K_p}E\left( z \right) + {K_i}{{zT} \over {z - 1}}E\left( z \right) + {K_d}{{z - 1} \over {zT}}E\left( z \right) Where T is the sampling time. Eq. (3) is equivalent to the following expression: Uz=aEz+b11z1Ez+c1z11Ez U\left( z \right) = aE\left( z \right) + b{1 \over {1 - {z^{ - 1}}}}E\left( z \right) + c{{1 - {z^{ - 1}}} \over 1}E\left( z \right) In which a = Kp, b = KiT and c=KdT c = {{{K_d}} \over T} . Eq. (4) can be shorted as follows: Uz=aEz+Pz+Qz U\left( z \right) = aE\left( z \right) + P\left( z \right) + Q\left( z \right) Where: Pz=b11z1Ez P\left( z \right) = b{1 \over {1 - {z^{ - 1}}}}E\left( z \right) Qz=c1z1Ez Q\left( z \right) = c\left( {1 - {z^{ - 1}}} \right)E\left( z \right)

Eq. (6) can be rewritten as follows: Pz=Pzz1+bEz P\left( z \right) = P\left( z \right){z^{ - 1}} + bE\left( z \right) To deploy digital PID controllers using digital hardware, the equations of the controller must be expressed in discrete-time forms as follows:

1) Calculate the error at the k-th sampling instant: ek=rkyk {e_k} = {r_k} - {y_k} Where rk is the setpoint and yk is the output variable at the k-th sampling instant.

2) Calculate the integral term: pk=pk1+bek {p_k} = {p_{k - 1}} + b{e_k}

3) Calculate the derivative term: qk=cekek1 {q_k} = c\left( {{e_k} - {e_{k - 1}}} \right) Where ek and ek−1 are the error at the k and (k − 1)-th sampling intervals, respectively.

4) Calculate the control output: uk=aek+pk+qk {u_k} = a{e_k} + {p_k} + {q_k}

Tuning PID Controllers Using the Nelder–Mead Method

The Nelder–Mead method is a gradient-free optimisation method used to find the minimum of an objective function in a multi-dimensional space. It is particularly useful when derivatives of the objective function are unavailable or difficult to compute. This method is also known as the downhill simplex method. The deployment of the Nelder–Mead method includes the following steps:

1) Initialise the simplex:

Choose n + 1 points in the search space. These points form a simplex, which is a geometric shape with n + 1 vertices in an n-dimensional space.

2) Evaluate objective function:

Compute the function value at each simplex vertex.

3) Order the simplex:

Rank the points from best f (x1) to worst f (xn+1) based on function values.

4) Apply transformations:

Update the worst point using one of the following transformations:

Reflection: Reflect the worst point across the centroid of the remaining points.

Expansion: If reflection improves the function significantly, expand further.

Contraction: If reflection does not work well, try contracting towards the centroid.

Shrink: If contraction fails, reduce the simplex size.

5) Repeat until convergence:

Continue iterating until a termination condition is met, such as:

Function values have small differences.

The simplex size becomes small.

A maximum number of iterations is reached.

The details of mathematical operations in the Nelder–Mead method can be described as follows:

Let:

x1, x2, …, xn+1 be the vertices of the simplex.

xc is the centroid of the best n points xc=1ni=1nxi {x_c} = {1 \over n}\sum\limits_{i = 1}^n {{x_i}}

Transformations:

1) Reflection: xr=xc+αxcxn+1 {x_r} = {x_c} + \alpha \left( {{x_c} - {x_{n + 1}}} \right)

2) Expansion: xe=xc+γxrxc {x_e} = {x_c} + \gamma \left( {{x_r} - {x_c}} \right) If f (xe) is better than f (xr), accept xe.

3) Contraction:

Outside contraction: xco=xc+βxr xc {x_{co}} = {x_c} + \beta \left( {{x_r}\; - {x_c}} \right)

Inside contraction: xci=xcβxn+1xc {x_{ci}} = {x_c} - \beta \left( {{x_{n + 1}} - {x_c}} \right)

Shrink: xi=x1+δxix1,i=2,,n+1 {x_i} = {x_1} + \delta \left( {{x_i} - {x_1}} \right),\;\;\;i = 2, \ldots ,n + 1

If none of the above works, shrink all the points towards the best.

Typical values of α, γ, β and δ can be set as follows: α = 1; γ = 2; β = 0.5 and δ = 0.5.

The Nelder–Mead optimisation method can be used to optimally tune the PID controller’s parameters, including Kp, Ki and Kd. This process is carried out with the following steps:

1) Define the objective function:

The goal is to minimise an integral of time-weighted absolute error (ITAE) as follows: J=tetdt J = \int {t\left| {e\left( t \right)} \right|dt}

2) Initialise the simplex:

Choose initial guesses for Kp, Ki and Kd.

Create a simplex with 3 + 1 (i.e., 4) sets of parameters.

3) Simulate the PID response:

Apply the PID gains to the system using a step response.

Compute the objective function.

4) Apply Nelder–Mead transformations:

Adjust Kp, Ki and Kd using reflection, expansion, contraction or shrinking.

5) Repeat until convergence:

Stop when a specified number of iterations is reached.

Control Simulation of BLDC Motors
Mathematical model of BLDC motors

A BLDC motor has three individual phase windings and a permanent magnet rotor. The three-phase voltage equations for windings are as follows: vavbvc=Rs000Rs000Rsiaibic+LsM000LsM000LsMddtiaibic+eaebec \left[ {\matrix{ {{v_a}} \cr {{v_b}} \cr {{v_c}} \cr } } \right] = \left[ {\matrix{ {{R_s}} & 0 & 0 \cr 0 & {{R_s}} & 0 \cr 0 & 0 & {{R_s}} \cr } } \right]\left[ {\matrix{ {{i_a}} \cr {{i_b}} \cr {{i_c}} \cr } } \right] + \left[ {\matrix{ {{L_s} - M} & 0 & 0 \cr 0 & {{L_s} - M} & 0 \cr 0 & 0 & {{L_s} - M} \cr } } \right]{d \over {dt}}\left[ {\matrix{ {{i_a}} \cr {{i_b}} \cr {{i_c}} \cr } } \right] + \left[ {\matrix{ {{e_a}} \cr {{e_b}} \cr {{e_c}} \cr } } \right] In which va, vb and vc are the phase voltages of the motor. Rs is the stator resistance and Ls is the stator self inductance. M is the mutual inductance between any two phases. ia, ib and ic are the stator currents. Finally, va, vb and vc are back-EMF of the motor. The torque equation is given by: Te=eaia+ebib+ecicωm {T_e} = {{{e_a}{i_a} + {e_b}{i_b} + {e_c}{i_c}} \over {{\omega _m}}} Here, ωm is the angular velocity of the motor and Te is the electromagnetic torque. Since the back-EMF of the motor is trapezoidal, it can be obtained as follows: eaebec=ωmλmfasθrfbsθrfcsθr \left[ {\matrix{ {{e_a}} \cr {{e_b}} \cr {{e_c}} \cr } } \right] = {\omega _m}{\lambda _m}\left[ {\matrix{ {{f_{as}}\left( {{\theta _r}} \right)} \cr {{f_{bs}}\left( {{\theta _r}} \right)} \cr {{f_{cs}}\left( {{\theta _r}} \right)} \cr } } \right] Where λm is the flux leakage of the motor. fas (θr), fbs (θr) and fcs (θr) represent the functions of back-EMF for various magnitude instants. The motion equation of the motor is given by: TeTL=Jdωmdt+Fωm {T_e} - {T_L} = J{{d{\omega _m}} \over {dt}} + F{\omega _m} Here TL is the load torque, J is the moment of inertia and F is the damping constant. Figure 1 shows the block diagram of a typical BLDC motor drive consisting of a three-phase voltage-source inverter and a BLDC motor.

Figure 1.

Block diagram of a BLDC motor drive. BLDC, brushless DC.

BLDC motor control methods can be broadly categorised into sensor-based and sensorless techniques, each offering distinct advantages based on application requirements. Sensor-based control utilises Hall sensors or rotary encoders to accurately detect the rotor position, ensuring precise commutation and smooth motor operation. Among the most common sensor-based methods, trapezoidal control (six-step control) is widely used due to its simplicity and cost-effectiveness. FOC, on the other hand, employs mathematical transformations to regulate torque and flux independently, delivering smooth operation and high efficiency but requiring complex computations. The sensorless control of BLDC motors eliminates the need for physical sensors by leveraging back-EMF detection or advanced estimation algorithms, reducing cost and increasing reliability, though it may be less effective at low speeds. The selection of a suitable control method depends on factors such as cost, precision, efficiency and the operational conditions of the motor. This section presents simulations for controlling the speed of a BLDC motor using two common methods: the trapezoidal control method and the FOC method. The parameters of the BLDC motor are as follows:

Stator phase resistance: Rs = 0.5(Ω)

Stator phase inductance: Ls = 0.375 ×10−3 (H)

Flux leakage of the motor: λm = 0.0080667 (V · s)

Moment of inertia of the rotor: J = 3.989 × 10−3 (kg · m2)

Damping constant: F = 0.001 (N · m · s)

Pole pairs: p = 3

Trapezoidal control method

Figure 2 shows the Simulink diagram of trapezoidal control for BLDC motors. Based on Hall-effect sensors locating a fixed point within the motor housing to monitor the rotor position, this control method has been extensively applied in practical cases. The sensor signals give feedback and allow the motor phases to be energised at angles that are synchronised and accurate. This timed switching, or commutation, is an essential element to achieving the desired direction of rotation and for effective torque production.

Figure 2.

Simulink diagram of the trapezoidal control of BLDC motors. BLDC, brushless DC; EMF, electromotive force; PWM, pulse-width modulation.

To adjust the motor speed, a PWM on the DC input voltage is utilised. A change in the duty ratio of the PWM will change the effective voltage applied to the motor, and the motor speed can be dynamically controlled in this way. Such a power modulation technique gives more freedom and energy efficiency to the controller in case of load variations and reference input variations. To show the control performance, the actual motor speed is compared with its commanded reference speed in Figure 3. The response indicates that the proposed controller effectively attenuates the tracking error, and the motor speed accurately tracks the reference value. The figure also plots the stator current waveform with a faster switching trapezoidal waveform.

Figure 3.

Motor speed and stator current of the BLDC motor with the trapezoidal control method. BLDC, Brushless DC.

Trapezoidal control of BLDC motors, while simple and cost-effective, has several disadvantages that limit their suitability for high-performance applications. One of the main issues is torque ripple, which leads to vibrations and audible noise due to the abrupt switching of motor phases. This results in reduced smoothness and precision, making it less ideal for applications requiring fine motion control. Additionally, efficiency drops at low speeds, especially in sensorless configurations where back-EMF detection becomes unreliable. The control method also makes suboptimal use of the motor’s magnetic field, leading to lower overall energy efficiency compared to more advanced techniques like FOC. These drawbacks make trapezoidal control less suitable for applications that demand quiet operation, high efficiency, or precise control.

FOC method

The Simulink model of the FOC applied to BLDC motors is illustrated in Figure 4. Unlike trapezoidal control, which requires Hall sensors for rotor position sensing, this is no longer necessary with the use of advanced mathematical transforms like Clarke and Park introduced by FOC. These transformations then decouple torque and flux components and allow for their independent and accurate control. FOC control can be seen as the most efficient current vector control and directs the current stator vector into the direction of the rotor magnetic field as a current vector, whereby a maximum torque is produced. This feature not only results in quieter, more efficient motor operation but also provides much more responsive system performance. The control system dynamically regulates the current of the motor in a real-time manner, which can adjust to the load demand requirement, together with the torque ripple, with better transient performance.

Figure 4.

Simulink diagram of the FOC method of BLDC motors. BLDC, Brushless DC; FOC, field-oriented control; SVPWM, space vector PWM.

The superior dynamic response of FOC makes it especially well-suited for high-performance, high-precision applications. These applications include areas such as robotics, which depend on precise positioning and smooth motion; industrial automation systems, whose success is tied to reliability and precision of control; and, in the world of electric and hybrid vehicles, where high efficiency and responsive torque control result in improved mileage as well as improved performance. The speed response of the FOC-based system is evident in Figure 5, where it closely follows the reference speed command. As can be seen in the graph, the real speed of the motor approximates the desired speed. This highly precise tracking result ensures the robustness and accuracy of the FOC algorithm for achieving the desired operating conditions when the load or speed commands change. The small error between these reference speed and actual speed profile graphs shows the high fidelity of the system in real time as well.

Figure 5.

Motor speed and stator current of the BLDC motor with the FOC method. BLDC, brushless DC; FOC, field-oriented control.

In conclusion, the choice between trapezoidal control and FOC for BLDC motors depends on the specific application requirements. Trapezoidal control offers a simpler and more cost-effective solution suitable for low-performance or budget-conscious systems, despite its limitations in torque smoothness and efficiency. On the other hand, FOC provides superior performance, efficiency and smooth operation across a wide speed range, making it the preferred option for demanding and high-performance applications, albeit at the cost of increased complexity and hardware demands.

Experiment

This section provides a detailed procedure for deploying a digital PID controller for a commercial sensorless BLDC motor drive. The gains of the PID controller, Kp, Ki and Kd, are determined using the Nelder–Mead optimisation method. The transfer function of the BLDC motor drive was first obtained to get appropriate initial values for the controller gains.

Hardware setup

Figure 6 presents the detailed hardware setup designed for precise motor control applications. At the core of the system is a 12V brushless BLDC motor from Nidec (Japan), which functions as the main actuator, delivering accurate rotational motion. The motor is powered by a reliable 12 V power supply that ensures consistent performance. To facilitate real-time speed measurement and enable feedback-based control, a rotary encoder is coupled with the motor shaft. Instead of using Hall effect sensors, the system employs a commercial sensorless BLDC motor driver that relies on a three-phase inverter configuration to estimate the rotor’s position electronically. This reduces hardware complexity and enhances durability. The overall control and coordination of the system are handled by an Arduino Nano, a compact microcontroller built around the ATmega328P. The Arduino Nano offers a balanced of processing power, memory and input/output interfaces, making it ideal for embedded applications where space is limited but precise control is essential.

Figure 6.

The hardware. BLDC, brushless DC.

System identification

To identify the transfer function of a system comprising both the motor and its driver, a procedure based on the step response of the motor speed is employed. First, a 5 V step voltage is applied to the driver, which powers the motor and acts as an excitation signal to reveal the system’s dynamic behaviour. Next, the motor’s speed response is measured over time using an encoder, with data sampled and stored at a sufficient rate to capture the dynamics accurately. Finally, the recorded speed data is imported into MATLAB (Mathworks), where the System Identification Toolbox is used to estimate the system’s transfer function. Various model structures, such as first-order or second-order transfer functions, are explored to determine the best fit for representing the combined motor and driver dynamics. By following this approach, an accurate mathematical model of the motor-driver system is obtained, which can be used for further analysis, control system design and performance optimisation. Figure 7 shows the response of the motor speed to a step voltage of 5 V applied to the control input of the BLDC motor driver.

Figure 7.

Response of the real motor speed to a step voltage of 5 V.

The step input voltage and the motor speed response were used to identify the transfer function of the system, which includes both the motor and the driver, using the MATLAB System Identification Toolbox. The motor speed response was recorded with a sampling interval of 0.1 s. The transfer function of the entire system is modelled as a second-order system, as follows: Gms=810.8s2+2.366s+2.76 {G_m}\left( s \right) = {{810.8} \over {{s^2} + 2.366s + 2.76}}

The PID controller design

The design of an optimal PID controller for the system was conducted in a two-step process to ensure precise control, stability and optimal performance. The steps are detailed as follows:

1) Obtaining initial gains for the PID controller: The initial gains of the PID controller can be determined using the transfer function identified above with the following MATLAB script:

num = 810.8;

den = [1 2.366 2.76];

Gm = tf(num,den);

C1 = pidtune(Gm,‘pid’);

Kp1 = C1.Kp;

Ki1 = C1.Ki;

Kd1 = C1.Kd;

Running the MATLAB script results in the following PID controller gains: Kp=0.0073,Ki=0.0082andKd=0.0013 {K_p} = 0.0073,\;{K_i} = 0.0082\;{\rm{and}}\;{K_d} = 0.0013

2) Tuning the PID controller gains using the Nelder–Mead method:

Defining an objective function: The objective function is an ITAE that depends on the system transfer function and the PID controller gains and can be defined in MATLAB as follows:

function S = objectiveFcn(x)

s = tf(‘s’);

Gm = 810.8/(s^2 + 2.366*s + 2.76);

Kp = x(1);

Ki = x(2);

Kd = x(3);

Gc = pid(Kp,Ki,Kd);

T = 0.01;

t = 0:T:10;

e = 1 − step(feedback(Gc*Gm,1),t);

S = sum(t’.*abs(e));

3) Tuning PID controller gains using the Nelder–Mead method: The PID controller gains can be optimally obtained using the following MATLAB script:

num = 810.8;

den = [1 2.366 2.76];

Gm = tf(num,den);

C1 = pidtune(Gm,‘pid’);

Kp1 = C1.Kp;

Ki1 = C1.Ki;

Kd1 = C1.Kd;

optimInput = [Kp1 Ki1 Kd1];

options = optimset(‘Display’,‘iter’,‘PlotFcns’,@optimplotfval,‘MaxIter’,30);

[a, fval] = fminsearch(@objectiveFcn,optimInput,options);

Kp2 = a(1);

Ki2 = a(2);

Kd2 = a(3);

The optimal values of the PID controller gains are given by: Kp=0.0165,Ki=0.0189andKd=0.0073 {K_p} = 0.0165,\;{K_i} = 0.0189\;{\rm{and}}\;{K_d} = 0.0073

As the sampling period, T, is 0.1 s, then: a=0.0165b=KiT=0.0189×0.1=0.0019c=KdT=0.00730.1=0.073 \matrix{ {a = 0.0165} \hfill \cr {b = {K_i}T = 0.0189 \times 0.1 = 0.0019} \hfill \cr {c = {{{K_d}} \over T} = {{0.0073} \over {0.1}} = 0.073} \hfill \cr }

Deployment of the digital PID controller on a microcontroller

The digital PID controller can be conveniently deployed on the Arduino Nano board by using a C script as follows:

volatile long temp, counter;

int Ts = 100;

volatile long encoderValue = 0;

long previousMillis = 0;

long currentMillis = 0;

void setup(){

  Serial.begin (9600);

  pinMode(2, INPUT_PULLUP);

  pinMode(3, INPUT_PULLUP);

  attachInterrupt(0, ai0, RISING);

  attachInterrupt(1, ai1, RISING);

}

void ai0(){

  if (digitalRead(3) == LOW) counter++;

  else counter--;

}

void ai1(){

  if (digitalRead(2) == LOW) counter--;

  else counter++;

}

float a = 0.0165;

float b = 0.0019;

float c = 0.073;

float rk = 800;

float yk = 0;

float uk = 0;

float ek = 0;

float ek_1 = 0;

float pk = 0;

float pk_1 = 0;

float qk = 0;

void loop() {

  currentMillis = millis();

  if (currentMillis − previousMillis >= Ts){

    previousMillis = currentMillis;

    yk = (float)counter*3/4;

    Serial.println(yk);

    ek = rk − yk;

    pk = pk_1 + b * ek;

    qk = c * (ek − ek_1);

    uk = a * ek + pk + qk;

    if (uk >= 255){

      uk = 255;

    }

    if (uk <= 0){

      uk = 0;

    }

    ek_1 = ek;

    pk_1 = pk;

    analogWrite(5, uk);

    counter = 0;

  }

}

Experimental results

Figure 8a–c illustrate the motor speeds corresponding to reference speeds of 500 rpm, 700 rpm and 900 rpm, respectively. These graphs highlight the system’s dynamic behaviour and provide a comparative analysis of two PID control strategies. The first strategy utilises the initial PID controller gains, while the second applies the Nelder–Mead optimised PID controller gains. Based on the comparisons between the initial and optimised PID controllers, as shown in Tables 1–3, it is evident that the Nelder–Mead optimised PID controller achieves a shorter settling time, which refers to the time required for the motor speed to stabilise and reach the reference speeds. This marks a significant improvement over the initial PID controller, which takes longer to reach the desired speeds. The reduced settling time demonstrates the optimised controller’s superior performance, allowing the system to respond more quickly and efficiently to changes in input or reference speed. This enhancement in response time is critical for applications requiring rapid and precise motor control, further validating the effectiveness of the Nelder–Mead optimisation method in tuning PID controller gains for improved system performance.

Figure 8.

Motor speed responses for reference speeds of 500 rpm (a), 700 rpm (b) and 900 rpm (c).

Performance comparison between the initial and optimised PID controllers at a speed of 500 rpm.

Controller Rise time (s) Settling time (s) Overshoot (%)
Initial PID controller 3.5867 6.8628 0.0899
Optimised PID controller 1.6477 2.8985 0.6736

Performance comparison between the initial and optimised PID controllers at a speed of 700 rpm.

Controller Rise time (s) Settling time (s) Overshoot (%)
Initial PID controller 3.7983 6.5593 0.4619
Optimised PID controller 1.6200 3.8898 0.2130

Performance comparison between the initial and optimised PID controllers at a speed of 900 rpm.

Controller Rise time (s) Settling time (s) Overshoot (%)
Initial PID controller 3.5867 6.3841 0.1332
Optimised PID controller 1.3312 2.4900 0.2745
Conclusions

This study presents a comprehensive and methodical framework for the design of an optimised digital PID controller specifically tailored for commercial sensorless BLDC motor drives. The proposed optimisation approach leverages the Nelder–Mead simplex algorithm, a derivative-free technique well-suited for non-linear, multidimensional optimisation problems where the objective function may be discontinuous, noisy or lacking an easily computable gradient. Unlike traditional gradient-based methods, which rely on explicit derivative calculations and may struggle with non-convex or irregular search spaces, the Nelder–Mead algorithm uses a simplex of points that iteratively adapts through operations such as reflection, expansion, contraction and shrinkage. This enables efficient exploration of the parameter space, resulting in fine-tuned PID gains that enhance dynamic response characteristics such as reduced overshoot and faster settling time. One of the core strengths of the Nelder–Mead method lies in its ease of implementation and adaptability to a wide range of real-world engineering problems, making it particularly attractive for embedded systems and digital control applications where computational resources may be limited. While this study validates the effectiveness of Nelder–Mead optimisation in tuning PID controllers for BLDC motor drives, it also lays the groundwork for future investigations aimed at comparative performance analysis. Subsequent research will focus on evaluating the relative strengths and limitations of the Nelder–Mead algorithm against other popular direct search-based optimisation techniques, such as GA and PSO. These algorithms are well-established in control system optimisation and have demonstrated significant potential in various motor control applications due to their global search capabilities and adaptability to complex optimisation landscapes.

Język:
Angielski
Częstotliwość wydawania:
1 razy w roku
Dziedziny czasopisma:
Informatyka, Sztuczna inteligencja, Inżynieria, Elektrotechnika, Elektronika