1. Introduction
In robotics, particularly in systems incorporating flexible links, effective vibration management is essential for maintaining system precision and stability. Flexible links are highly valued in the field of robotics for their capacity to enhance the accuracy in the transmission of motion and forces, and for their utility in passive vibration reduction [
1]. In addition, Flexible-link robots present several advantages over their rigid counterparts, mainly due to their lightweight construction, which leads to high throughput and low power consumption [
2], although passive reduction methods are effective under certain conditions, they exhibit limitations in dynamic environments where the demands for responsiveness and adaptability intensify. In contrast, active control systems can provide superior adaptability and precision by dynamically adjusting control parameters in response to real-time environmental conditions. This is particularly relevant in advanced robotics applications where even minor deviations can lead to significant errors or system failures. Therefore, the integration of active control strategies emerges as a critical solution to overcome the limitations of purely passive isolation methods in robots with flexible components.
Active control of robots with flexible links has been a topic of significant importance in control engineering and robotics [
3]. On one hand, flexible links present an engineering challenge due to the vibrations that occur during the transitional phase of controlling the position of a robotic arm, affecting both the performance and the precision of the system [
4]. The issues arising from these vibrations range from positioning errors to component wear, and occasionally, system failures. On the other hand, studies such as [
5] investigate how micro-positioning systems, which utilize flexibility based on the elastic deformation of joints or mechanism sections, eliminate wear, noise, and friction. These characteristics are crucial when considering the automation of robots with flexible links in environments that demand high precision, such as in surgical robotics or micro-device manufacturing. The discussion includes the use of active control systems, deliberating on the design of controllers and actuators and the selection of essential materials for precision. Cases like these motivate the pursuit of better techniques that effectively address the ability to control these vibrations according to the system’s requirements.
The linear quadratic regulator (LQR) is one of the most common and effective approaches in controller design, given its ability to provide good performance based on quadratic criteria. In LQR control, the performance index is minimized with optimal weight matrices. The [Q] and [R] matrices are the most crucial parameters to keep actuator voltage within certain limits while maintaining maximum control performance. Hence, the importance in LQR control lies in determining the optimal state weighting matrix [Q] and the input weighting matrix [R] [
6].
In advanced control systems, proper design and tuning of controllers are essential to ensure the desired system performance; however, the appropriate choice of weighting matrices in LQR design is crucial and can be complex in many situations. Optimizing these matrices can be challenging, as manual selection or the use of traditional optimization techniques may not always yield the best results, especially in complex or nonlinear systems. To overcome this challenge, this study proposes the use of genetic algorithms as in [
7] to find the weights for the gain matrix K according to the controller design requirements.
In [
8], optimization deals with performance criteria such as rise time, overshoot, control energy, and a measure of robustness, among others. Optimization is achieved through the use of an elitism-based genetic algorithm (GA). Also, Ref. [
9] investigates dynamic modeling and vibration control for a large flexible space truss. The space truss is a typical periodic triangular prism structure consisting of beams and rods. Considering the transverse deformation of the entire structure, the equivalent dynamic model of the space truss is established using the principle of energy equivalence. Fourth-order governing equations of the equivalent cantilever beam model are derived and solved by adopting Hamilton’s principle and the Galerkin method to achieve its discrete dynamic model. The LQR vibration controller is designed when the space truss is subjected to periodic and impulse excitation. The control moment is applied to the large-scale finite element model of the space truss, and numerical simulations prove the effectiveness of the designed LQR vibration controller for the suppression of vibrations.
In [
10], the so-called linear quadratic regulation problem is a modern control strategy that, through the configuration of the weight matrices Q and R, takes on the tedious task traditionally performed by specialists in controller optimization, finding the control parameters that minimize unwanted deviations. However, there are no simple analytical methods that assist the designer in defining the values of these matrices, which depend on the system, the control to be achieved, and the efforts of the control variables, making deep knowledge of the process essential for the engineer. Classic approaches such as trial and error, Bryson’s method, and pole placement are tedious and do not guarantee the expected performance. This research proposed a methodology based on genetic algorithms and particle swarm optimization to define the weight matrices Q and R, achieving the design of optimal controllers in a simple, fast manner starting from basic knowledge of the system to be controlled. The controller is evaluated using MATLAB and Simulink, assessing the effectiveness of the proposed scheme in terms of tracking and robustness through three test cases.
Our research is conducted on a cantilever beam, which is attached to a DC motor, and the model representation is executed in state space. The model is compared with the actual plant (rotary flexible link) with data provided by Quanser
®, a global leader in hardware for real-time control design in education and research [
11], where the GA-LQR controller is evaluated. This work highlights the genetic algorithm used for the optimization of a LQR under specific designer conditions swiftly and effectively in robots with flexible links, aiming to minimize oscillations at the tip of the link by controlling its base.
The primary contributions of this research include the development of a GA-LQR controller that integrates classic control design criteria, such as percentage overshoot and settling time [
12], directly into the algorithm’s cost function, allowing for precise alignment of the Q and R parameters with the specific design objectives of the controller. The results of the simulations clearly confirm that the proposed control system effectively minimizes the end vibrations of the manipulator, fulfilling the requirements set out in the design of the genetic algorithm. Moreover, a general methodology has been established for enforcing specific design requirements for position control of the tip of a rotating flexible link, using genetic algorithm techniques over a LQR for the optimization of desired parameters.
The use of a reference model for the GA ensures that the resulting parameters are aligned with a known desired behavior, although it is essential that the reference model be representative enough of the real system for the optimized parameters to be effective in practice. For future work, the challenge of using the GA-LQR control in real time is proposed. One approach could consider running the GA on a slower cycle, which allows for reviewing and adjusting the LQR parameters based on the system’s recent performance, while a faster LQR controller handles real-time control. Additionally, an improvement would be to develop a faster and more efficient version of the GA that can operate in real time or near-real time. It is hoped that this proposal will contribute to the scientific and technological community by offering other perspectives to develop controllers for flexible systems. Furthermore, this approach may serve as a foundation for future research and applications in the industry.
2. Modeling of the Rotary Flexible Link System
For the evaluation of the control technique GA-LQR, modeling is conducted both theoretically and experimentally. The theoretical modeling is divided into two parts: mechanical and electrical. The Lagrange method is used to find the motion equation of the system. These equations describe the movement of the mechanism in relation to a voltage applied to the servo motor. For the modeling through system identification, data from [
13] are acquired, specifically a rotary flexible link system provided by QUANSER
®, through its software “Quanser Interactive Labs”, version 2.15, which offers academically appropriate and high-fidelity laboratory experiences through interactions with virtual hardware. The rotary flexible link (RFL) module has facilitated the evaluation of control over the developed model. The system has been designed to couple with a rotary servo. The module simulates real-world problems in flexible and lightweight structures, being essential for studying vibration control, resonance, and modeling in robots or spacecraft [
14]. The mathematical model is obtained in a state-space representation; the following is a detailed account of the model.
An usual modeling method for flexible systems is to approximatively describe the dynamics of the flexible link with finite number modes [
14]. Nevertheless, another modeling method considers entire modes of flexible structures. Dynamic models, including the infinite-dimensional governing equation and boundary conditions, are established to describe the dynamic behaviour of the flexible manipulators via Hamilton’s principle [
15].
For the analysis of the link, the Euler–Bernoulli theory is used, which considers the link as a bar subjected to lateral vibrations. To derive the model’s equations, Hamilton’s principle is applied. The bar contributes to both the kinetic and potential energy of the system, while the base contributes only to the kinetic energy.
In accordance with the literature from [
3], the robot with flexibility in a single-degree-of-freedom link consists of a flexible link that is connected to a base. On the base, a motor is present, which applies torque to the link to move it to the desired position. The motion of the link is horizontal; thus, gravitational forces are not considered. The primary objective of control is to minimize the deflection as much as possible.
Figure 1 illustrates the reference frame used to define the variables related to the robot. The length of the link is denoted by
l, the torque by
, the time variable by
t, the deflection of the link relative to the neutral axis by
, the coordinate along the neutral axis of the link by
x, and
, which is the rotation angle of the link’s axis relative to the neutral axis (rigid line).
The link is characterized as a bar subjected to external forces distributed along its entire length. The theories used in the description of the vibrations of a bar include those of Euler–Bernoulli, Rayleigh, and Timoshenko. The simplest theory of lateral vibration is that of Euler–Bernoulli [
16].
Based on the Euler–Bernoulli theory, the link is modeled. In this theory, second- and higher-degree terms in the deformation variables are neglected, and the following assumptions are considered:
The link is a bar with uniform geometric characteristics and a uniform mass distribution. This assumption implies that the deflection of a section through the link is due only to bending or deflection and not to shear. Moreover, the contribution of the rotational inertia of the link section to the total energy is negligible.
The link is flexible in the lateral direction, with only elastic deformations being present. This assumption is reinforced by the mechanical construction of an actual flexible arm.
Nonlinear deformations as well as internal friction or other external disturbances are negligible.
Applying this theory, the link is a bar of length l, the cross-sectional area of the bar is denoted by , is the mass density acting on an external force in the z direction, is the axial inertia, and E is Young’s modulus.
It is assumed that the cross section at a distance
x remains plane even after bending and has a rotation through the
y-axis given by the slope
of the elastic curve. The displacements of the bar can then be defined as:
The strain is given by . The stress is given by .
Note: In the equations, a comma on top represents differentiation with respect to x, and a dot represents differentiation with respect to time.
To apply Hamilton’s principle, both the kinetic and potential energies of the robot are required. The first is constituted by the contributions from the link and the base. The second, the potential energy, depends entirely on the link.
From
Figure 1,
is the neutral axis when the arm is rigid. The displacement of any point
P across the neutral axis at any distance from the axis (not exceeding the length of the bar) is given by the angle of the axis
and the deflection
measured from the line
. This displacement is expressed as follows:
The potential energy (due to deformation) is given by:
From
Figure 1, the absolute position of a point along the link is described by [
15]:
Since the link is fixed to the base, the following boundary geometric conditions are satisfied:
The kinetic energy is given by:
where the kinetic energy of the axis is given by:
where
is the moment of inertia of the link, and
is the disregarding axial inertia due to
, described by:
The non conservative work for the input torque
can be written as:
To obtain the equations of motion of the manipulator, Hamilton’s extended principle, described by [
17].
can be used, subject to
at
to
, where
and
are two arbitrary times (
) and
is the system’s Lagrangian.
represents the virtual work,
represents a virtual rotation and
represents a virtual elastic displacement [
18]. Using (
5), (
10) and (
11) the integral in (
12) can be written as:
where
represents the virtual work performed by the torque. The rotary inertia and shear deformation are more pronounced at high frequencies and more influential on the higher modes [
19]. Since investigations have shown that the first two modes are sufficient in modelling the manipulator, the rotary inertia and shear deformation effects can be ignored [
18].
To determine
, consider the functional:
Applying the general Euler equation, one obtains:
The deformation
is considered to be very small in comparison to the length of the link. That is,
. See the article by Cannon [
20].
By neglecting the term involving
, and grouping the terms in
, one obtains.
From the functional:
the variation
is calculated, which is given by the expression:
If integrated by parts, it results in:
Integrating again by parts, we obtain:
This expression must vanish at the extremal of the functional, that is,
By grouping the terms involving
, one obtains
With the corresponding boundary and initial conditions as:
Substituting for
from (
4) into (
22) and (
23) and simplifying yields the governing equation of motion of the manipulator in terms of
as:
with the corresponding boundary and initial conditions as:
Equation (
24) gives the fourth-order partial differential equation (PDE), which represents the dynamic equation describing the motion of the flexible manipulator [
21].
Obtaining the Laplace transform of the system (
24) and solving for the roots of the determinant of the matrix of coefficients, a series of natural vibrational modes of the system is obtained. In AMM, the link flexibility is represented by a combination of separable mode shapes and time-varying generalized coordinates. The modal series is truncated to a finite dimension because the contribution of higher modes to the overall movement is negligible, and dynamics of the system are dominantly governed by only the first few (low frequency) modes [
18]. This method is usually adopted when the global shape functions can be analytically computed, like in the case of links with simple geometries [
22].
Using the method of assumed modes [
23], the variables of the system can be expressed as:
where the admissible function,
, also called the mode shape, is purely a function of the displacement along the length of the manipulator and
is purely a function of time and includes an arbitrary, multiplicative constant. The zeroth mode is the rigid-body mode of the manipulator, characterising the so-called rigid manipulator as considered without elastic deflection [
21].
Substituting for
from (
26) into (
24) and manipulating yields two ordinary differential equations as:
where:
where
is a constant. Let two constants
and
be defined as:
where
is the mass of the manipulator.
From the properties of self-adjoint systems, the mode shapes must also satisfy the orthogonality condition:
where
. The analytical values of natural frequencies
can then be obtained using (
29).
determines the vibration frequencies of the manipulator; a small
corresponds to the manipulator with lower vibration frequencies. For a very large
, the vibration frequencies correspond to those of a cantilever beam. By considering the boundary conditions, the mode shape function
of the manipulator can thus be obtained like a fourth-order ordinary differential equation with a solution on the form:
In the absence of an external torque, (
22) describes the behaviour of the manipulator in free transverse vibration with a solution
as:
The kinetic energy
and potential energy
of the system, in terms of the natural modes, can be obtained as [
21]:
The dissipated energy
and the work
W can be obtained as:
where
is the damping ratio.
The dynamic equation of the system can now be formed using the kinetic energy, potential energy and dissipated energy in the Lagrangian of the energy expression given as [
19].
where
,
represents the time-dependent generalized coordinates,
represents the work done by the input torque at the joint in each coordinate. Substituting for
,
,
, and
W and using the orthogonality relations, an infinite set of decoupled ordinary differential equations is obtained as:
where
is the total inertia of the system,
. In this manner, due to the distributed nature of the system, there will be an infinite number of modes of vibration of the flexible manipulator that can be represented. However, in practice, it is observed that the contribution of higher modes to the overall movement is negligible. Therefore, a reduced-order model incorporating the lower (dominant) modes can be developed. modes can be assumed. This assumption is justified by the fact that the dynamics of the system are dominantly governed by a finite number of lower modes [
24]. Retaining the first
modes of interest can be written in a state-space, truncating the series of these ordinary differential equations to a lower order, retaining the first ones
n + 1, a model of equations is written in the following form:
where
In the facility, we have a minimal sensor setup that includes only a speed and position sensor at the base, along with a strain gauge to measure deformation. This configuration allows us to monitor and analyze specific mechanical properties and movements within the system. The output vector
y of these sensors is related to the state vector by:
As performed in reference [
3], one proceeds to obtain two experimental vibrational modes that were used, which are shown in
Table 1:
To develop a Lagrangian model for a flexible link, the use of a simplified single-degree-of-freedom model is justified if the deflections are small (as indicated by the relationship
), and if the higher-frequency vibration modes have a negligible contribution to the dynamic response. As shown in
Table 1, the data provided show the vibration frequencies of the system in an open loop and how these are altered with the implementation of GA-LQR control, highlighting how the controls significantly reduce the vibration frequencies to values much lower than the natural frequency of the system. This information reinforces the justification for treating the flexible link as a simple one-degree-of-freedom link in controlled contexts, since under these controls, the system effectively operates in a regime where the high-frequency responses (characteristic of the link’s flexibility) are mitigated. This indicates that the dynamic characteristics of the system are dominated by the more rigid elements (such as the motor and its control) rather than by the flexible properties of the link, allowing for simplified modeling and control that primarily consider the most significant and easily controllable response. This simplification, as mentioned, is valid within the framework of the specified conditions and is confirmed with numerical simulation to ensure that the real-world system response aligns with the model predictions.
As observed in [
25,
26], generalized coordinates are used to uniquely determine the configuration of a mechanism or mechanical system with a finite number of degrees of freedom and to obtain a closed-form dynamic model of the manipulator; the energy expressions derived are used to formulate the Lagrangian. Using the Euler–Lagrange equation [
27]. To derive the kinetic and potential energies associated with the manipulator, the procedure adopted in [
28] is performed. By substituting for links (i = 1) and for two modes (j = 1, 2).
In Equations (
39) and (
40), the position and angular velocity vectors in generalized coordinates are presented. The position vector
is defined as:
where
represents the rotation angle and
is the tip deflection angle at time
t. The angular velocity vector
is defined as:
where
and
are the angular velocities of
and
, respectively.
The Lagrangian is utilized, a scalar function from which one can obtain the temporal evolution, conservation laws, and other important properties of a dynamic system. In fact, in modern physics, it is considered the most fundamental operator that describes a physical system [
29]. The Lagrangian of the system is the difference between the total kinetic energy and the total potential energy,
and
represents the non-conservative generalized forces or moments acting on the system, and are not derived from the Lagrangian potential. These forces influence the dynamics of the system and are crucial for the complete formulation of the equations of motion.
By substituting with the generalized coordinates, we have
where:
L is the Lagrangian of the system, a scalar function that represents the difference between kinetic and potential energy.
represents a generalized force or moment acting on the system.
represents a rotational angle in mechanical systems.
represents tip deflection.
The equations of motion involving a flexible rotary link comprise modeling the rotary base and the flexible link as rigid bodies. As a simplification of the partial differential equation describing the motion of a flexible link, an approximation of a single degree of freedom is used. The derivation of the dynamic model allows for the understanding of various properties of the system, such as the rotational inertia for an RFL (rotary flexible link) [
11].
Therefore, the moment of inertia for the link is given by:
where:
is the moment of inertia of the link.
is the mass of the link.
L is the length of the link.
And the moment of inertia of a load at the tip is given by:
The total moment of inertia of the mechanical system is:
The kinetic energy of the base is given by:
where:
is the moment of inertia of the base.
is the angular velocity of the base.
And the kinetic energy of the link is given by:
Therefore, the total kinetic energy is:
On the other hand, the total potential energy of the system is given by:
where
is the stiffness constant.
is the displacement at the tip.
The stiffness of a structure is a function of both the material properties and the geometry. In bending, the bending stiffness of a beam is given by:
where
E is the Young’s modulus of the material,
I is the moment of inertia of the cross section, and
L is the length [
30].
Upon substituting the kinetic energy into the Lagrange equation, one obtains.
Solving, we obtain the equation of the system dynamics:
Since the applied force
is located at the base, then:
Is substituted in (
54), obtaining the following system of equations:
And by representing the system in state variables, we obtain:
Up to this point, the mechanical system of the flexible manipulator has been represented [
11]. Next, the mechanical system is related to the electrical system. The physical variable that allows us to relate these two systems is the motor torque
, and for this, the mechanical torque is related to the electrical one in the following way:
where the torque
is related to the motor torque
and a torque constant
.
In addition to this, the equation that allows for observing the dynamics of the electrical system is determined, which is given by
where the motor torque
is related to
and the motor torque constant by means of
is the voltage applied to the motor;
is the back EMF, and it is given by:
The equation
represents the relationship between the voltage across the motor
, the back EMF constant
, and the angular velocity of the motor
.
Thus, by substituting the previous equations, the equation for the relationship between torque and applied voltage is obtained:
The inductive action of the system is neglected because it is small in relation to the other parameters of the system; therefore, the previous equation can be represented in the following way:
Decoupling the variable of interest,
And recalling the relationship:
, we proceed to represent our system in state variables.
For this work, we proceed to use the model from Equation (
69), where the state variables are a function of
, respectively.
The output is represented by the matrix:
Only the position of the servo and the tip of the link are being measured. Based on this, the matrix
C y la matrix
D are shown in the following way:
Identification of the Rotary Flexible Link System
The rotary flexible link is a two-degree-of-freedom system with an activated rotary servo and a flexible link. This simulates applications such as lightweight robot manipulators (for example, in space applications) and cantilever beams. The rotation angle at the initial end of the link produced by the rotary servo is measured using an incremental encoder, and the deflection of the flexible link (in relation to the servo) is measured with a strain gauge. According to [
11], data acquisition and communication are conducted through Simulink
® and a QUARC interface, as shown in
Figure 2.
This is made possible thanks to the virtual laboratory used for this work, as shown in
Figure 3. This virtual laboratory provides real data for the acquisition and identification of the system model for the evaluation of different control proposals.
The mechanical specifications of the rotary flexible link system are shown in
Table 2, according to the information provided by Quanser
®.
For system identification, the following is performed: a square wave voltage is applied to the motor, and the response of the servo motor angle is measured using the rotary encoder, and for the flexible link, the strain gauge. The Simulink model is run using the QUARC Real-Time Control Software, version 2.15 [
13] to measure new data or load previously measured data. These data are stored in a file for later use.
t: Time vector related to the motor voltage.
u: Motor voltage values.
: Servo angle values.
: Deflection values of the flexible link at the tip.
The state-space model is identified and compared with the measured hardware results without imposing restrictions on the identification shown in
Figure 4. The estimated states in the time domain have an estimation of 99.85–96.95% (prediction approach), FPE:
, MSE:
. As shown, the identified state-space model is quite accurate.
Once the model is obtained, it is compared with the actual system data as shown in
Figure 5.
With the mathematical state-space model obtained, featuring a accuracy for and accuracy for , the proposed controller is then evaluated.
3. GA-LQR Control
The design of LQR (linear quadratic regulator) control and closed-loop simulation in this context aims to first design a state feedback control based on LQR that is optimal for two main purposes: first, to control the servo position to reach a desired angle and second, to minimize the residual oscillations or vibrations of the flexible link, especially when the servo changes position. To be able to apply the LQR controller, certain criteria must first be checked: identification or verification of the stability of a system by observing the location of the eigenvalues in the complex plane [
31].
The eigenvalues of the system are negative, ensuring its stability. The controllability of the system is also verified; for this, the Kalman controllability criterion is based on the controllable matrix, formed from the matrices
, where
n is the dimension of the state vector
. If the rank of this matrix equals the dimension of the system’s state space, then it can be asserted that it is completely controllable [
32]. In this system, the rank of
equals
n; therefore, it is completely controllable.
Linear quadratic regulation (LQR) stands out as a powerful technique for controller synthesis. This approach is based on minimizing a quadratic cost function that balances system performance and control effort. By employing LQR, an optimal solution is sought that not only ensures system stability but also optimizes its response according to predefined performance criteria and energy efficiency. The following sections will describe how LQR is utilized to determine the gain matrix K, which is crucial for achieving the desired closed-loop behavior of the system.
LQR control, also known as linear quadratic control, is an optimal control strategy that seeks to maximize the performance of a system through the optimization of a cost function. This technique focuses on solving the regulation problem, which is addressed by minimizing a quadratic index with a linear solution. Thus, LQR control aims to minimize the quadratic function or cost index to improve system performance [
33]. It requires the controller to minimize a performance index of the form [
34]
where Q is a positive definite or positive semidefinite Hermitian matrix of nxn, R is a positive definite Hermitian matrix of rxr, and S is a positive definite or positive semidefinite Hermitian matrix of nxn.
The matrices Q and R determine the relative importance of the error and the cost of this energy.
The control signal is given by:
Substituting Equation (
78) into Equation (
77) gives
The Hermitian matrix P is real and nxn, and for fully controllable state systems, it is positive definite or positive semidefinite. Equation (
80) is equated as follows, and it must comply with the subsequent reduced equation.
Deriving the above expression results in
If A – BK is a stable matrix and there exists a positive definite matrix P that satisfies the above equation, then it is satisfied that
For the determination of
R, it is rewritten as
, where
T is a nonsingular matrix, having
Rewriting the previous equation yields
J is minimized with respect to K from the previous equation, and the following is obtained:
The matrix K, identified in Equation (
85) as the optimal solution, indicates that the most effective control method for tackling the linear quadratic control problem takes on a linear form.
The P matrix from Equation (
85) must satisfy the reduced equation, also called the Riccati equation, shown in Equation (
86), which has a unique solution. Therefore, it can be concluded that the optimal controller for the linear quadratic regulator problem has a unique solution in the form of a control signal that is a state feedback controller.
Searching for the optimal configuration for matrices Q and R can be complicated. Both manual selection and conventional optimization methodologies often fail to achieve the most effective results, particularly in systems of complex or nonlinear nature [
35], where this optimization strategy is applied to determine the optimal values in the LQR matrices used in the control of flexible structures, such as cantilever beams.
Genetic algorithms (GAs), founded on the Darwinian theory of species evolution, seek to find the optimal solution to a problem through the implementation of three distinctive operations that make up their genetics: Selection, crossover, and mutation cycles are repeatedly performed until satisfying a pre-established termination criterion. These algorithms do not require detailed knowledge of the problem to be solved but apply heuristics for the solution, which significantly restricts the number of data needed for their operation [
36]. The parameters for the development of the genetic algorithm for this proposal are presented in
Table 3.
The following presents the implementation of a genetic algorithm to optimize the coefficients of the Q and R matrices of the well-known LQR control algorithm according to the requirements for the control design. For this proposal, two parameters of the system dynamics are selected, and the cost function designed for this GA measures these two variables for each system output: overshoot (percentage), the percentage difference between the maximum value and the final value of the controlled signal, and the settling time, which is the time it takes for the signal to remain within 2% of its final value. Finally, it penalizes deviations from these values. The LQR design is based on minimizing the cost function:
where:
is the state vector.
is the control vector.
are defined weighting matrices.
The cost function design is made to evaluate the performance of a stable, time-invariant, second-order underdamped system with multiple outputs (SIMO: single-input multiple-output). It is based on two important metrics in control system theory: maximum overshoot and settling time. These are crucial metrics in many control applications, as they indicate how quickly and accurately a system can reach and maintain its desired state. It also allows for a quadratic penalty for deviations from desired targets, providing a stronger penalty for larger deviations, which helps guide the algorithm toward solutions that closely match the desired criteria. Furthermore, The cost function balances system performance by penalizing both overshoot and undesirable settling time. Primarily, it is designed with the real characteristics of a control system in mind, so the optimization results will be relevant and applicable in practical scenarios. Lastly, it allows for a clear and quantifiable measure of performance that the algorithm can optimize.
The cost function comprises two main components: the relative maximum oscillation component () and the settling time component ().
For the first component, the relative maximum oscillation for each output variable is calculated. This is determined as the maximum change between the values of the variable () and the reference (step signal), expressed as a percentage.
For the second variable (), the oscillation is calculated differently, considering the maximum absolute change relative to the initial value.
If the relative maximum oscillation exceeds a certain threshold, the number of samples before this oscillation occurs is calculated and multiplied by the time interval to obtain the stabilization time () for that variable.
The settling time component () represents the time required for each variable to reach a certain level of stability after undergoing significant oscillations. It is determined as the number of samples before the variable returns within a specific stability threshold and is multiplied by the time interval.
Finally, the cost function aggregates these components for each variable as shown in expression (
88).
where
is the maximum overshoot of the base angle of the RFL.
is the maximum overshoot of the tip angle of the RFL.
is the desired maximum overshoot.
is the settling time of the base angle of the RFL.
is the settling time of the tip angle of the RFL.
is the desired settling time.
This cost function seeks to penalize solutions that have significant oscillations or take a long time to stabilize. The values of the deviations can change depending on the context of the problem and the designer’s preferences. A lower cost indicates a better and more stable solution in terms of reducing the magnitude of oscillations and the stabilization time of the measured variables.
The function is the cost function, which is described as follows:
Input: matrix y, sampling time .
Output: cost function value f, peak overshoot , peak overshoot , minimum settling time .
Determine as the number of columns in y.
Initialize (peak overshoots) and (settling times) arrays to zeros.
For each output i from 1 to :
- (a)
Extract the i-th column from y.
- (b)
If i is 2 (special case for the second output):
- -
Calculate as the first element of .
- -
Determine as the maximum absolute deviation from .
- -
Compute the relative peak overshoot .
- -
Update as the maximum of .
- (c)
Else (for other outputs):
- -
Calculate as the relative peak overshoot from the final value.
- -
Update as the maximum of .
- (d)
Determine n as the last time index where the output deviation exceeds 1%.
- (e)
If no such n is found, set n to 0.
- (f)
Compute the settling time for output i.
Determine as the minimum settling time across all outputs.
Compute the cost function f as a weighted sum of squared deviations from desired overshoot and settling time.
The process of interaction of the genetic algorithm with the Simulink model to find the optimal controller parameters is as follows: The initial parameters of the genetic algorithm are established, and the initial population is generated. Each individual in the initial population is evaluated. This involves running the simulation in real-time with each individual’s parameters, followed by calculating the cost function for each set of parameters. The results of this initial evaluation are used to rank the population according to their performance. Then, the GA cycle generates a new temporary population, which includes elite individuals and new individuals created through crossover and mutation. With these results, pairs of individuals are selected, crossover and mutation operations are applied to create new individuals, and restrictions are applied. Finally, for each new individual, a simulation is set up and run using that individual’s parameters, the cost function is calculated for each new parameter configuration, and the population is updated with the new individuals, recalculating the selection probabilities based on the cost function. The parameters of the best individual are used to adjust the controller in the Quanser Interactive Labs virtual scenario.
Below is the control algorithm for the AG-LQR controller:
Definition of constants and parameters:
where
are the matrices that define the dynamics of a system in the state equations or transfer functions,
is the sampling time in seconds,
is the crossover probability in genetic algorithms, indicating the frequency at which pairs of individuals are combined to produce offspring,
is the mutation probability in genetic algorithms and reflects the frequency at which individuals undergo random changes,
is the population group number,
is the population size,
is the total number of generations in a genetic algorithm,
is the number of elite individuals, and finally
and
are the initialization values for the weighting matrices
Q and
R in optimal control.
Population initialization:
Evaluation process of the matrix values Q and R:
Fitness function for the GA:
In this context, is a cumulative probability vector used for the stochastic selection of individuals in the iterative process for the genetic algorithm. Then, the process of selection, crossover, mutation, and insertion is repeated to generate the next generation of the population.
Finally, the
K gains are calculated from the optimal values of
Q and
R obtained that meet the design requirements:
This approach provides a design that allows for the controlling of two parameters of the two output variables, and , demonstrating the computational work of the GA on the dynamic characteristics of the system, the overshoot, and the settling time, which enables one to obtain optimal values for the GA-LQR controller for these two parameters.