2. Methodology
This section presents the methodological strategies employed in estimating the model parameters for a mechanism using experimental data. The model parameters were effectively ascertained through the experimental measurements from an actual implementation of the mechanism with a metaheuristic algorithm.
2.1. Inverted Pendulum System
The inverted pendulum system comprises a planar double inverted pendulum. A DC motor drives the initial link, whereas the subsequent link is an underactuated simple pendulum.
and
represent the angular positions of the links,
u stands for the control torque input, while
and
are the masses of the links. The lengths of the links are denoted by
and
, and
and
indicate the distances to the center of masses. Finally,
and
stand for the inertia of the links. The system is shown in
Figure 1.
Mathematical Model
Underactuated Euler–Lagrange systems of fourth order can be generally represented as [
28]
Here, denotes the generalized coordinates, represents the inertia matrix, and describes the Coriolis and centrifugal forces. The vector represents the gravitational forces, and maps the external forces. Additionally, signifies the control input.
Such systems, described by (
1), can be alternatively expressed in state space as
where
represents the joint positions vector
,
denotes the articular velocities vector
, and
Utilizing the Euler–Lagrange formalism, the dynamic model of the system can be represented as
where
where
2.2. Experimental Setup
The experimental pendulous prototype is displayed in
Figure 2. It has a DC motor model NC5475, manufactured by NISCA, Tokio, Japan; to drive the first link. The angular positions of both links are monitored with incremental encoders of 10,000 counts per revolution, consistent with the earlier example. Power amplification is facilitated by the amplifier model VoltPAQ-X2, manufactured by Quanser, Markham, Canada. The control strategy is implemented in the Matlab–Simulink platform, with a sampling time of
.
The actual physical parameters of the prototype are outlined below and were measured before the assembly:
Link inertias: [kg·m2] and [kg·m2].
Masses of the links: [kg] and [kg].
Lengths of the links: [m] and [m].
Distances to the center of mass: [m] and [m].
Armature resistance: [].
Torque constant: [].
The provided values do not encompass any joints, glue, screws, or any accessories that are not part of the model. To refine the model, it is necessary to compute the equivalent values of mass, center of mass location, and inertia for each link. To assess the dynamic model, a trajectory is suggested with the initial conditions set as
[rad] and
[rad]. The trajectory involves a seamless transition from rest to rest.
Initially, at
, the trajectory starts from
, setting
and
. At
, it moves to
with
and
over a duration of
seconds. Subsequently, at
[s], it transitions to
with
and
within 4 s. Finally, at
[s], it returns to the initial position until the test concludes.
Figure 3 illustrates the rest-to-rest positions of the pendulum.
The velocity and angular acceleration for each link will be estimated from the position values derived from the smooth trajectory. These kinematic features will inform the evaluation of the prototype’s dynamic behavior, facilitating the acquisition of the experimental torque data necessary to proceed with the parametric estimation.
The experimental torque is estimated based on the motor’s angular velocity (
) and the supply voltage (
), expressed as
Here, represents the torque constant, denotes the back-EMF constant, and stands for the winding resistance.
2.3. Algorithm Implementation
To solve the optimization problem addressed, it is necessary to determine the limits of the optimization parameters, which define the solution space to the algorithms. These upper and lower limits ensure the algorithm produces accurate and relevant results. By defining these limits, the algorithm can effectively narrow down the range of potential solutions, resulting in faster and more efficient problem solving. The data presented in
Table 1 provide the upper and lower limits for the model parameters to be estimated, with consideration of the physical constraints. These limits were based on the estimated actual parameters and were determined by ensuring that the center of mass distance was below the length of the link.
To realize the optimization problem, the root mean square error is used as a fitness function (Equation (
18)); this calculates the square root over the average of the squared differences between the predicted values of the torque and the actual (experimental) values. This allows evaluation of how closely the model’s predictions match the real-world data [
29], where the main objective is to minimize this function, which means that the mathematical model with the estimated parameters matches the experimental values. To quantify the results obtained by the algorithms, the uncertainty associated with the mean solution errors is evaluated, where the confidence interval of 95% is calculated for each algorithm’s mean error across the 1000 simulation runs. The confidence interval provides a range in which the true mean error is expected with a 95% probability.
The mean solution is calculated by a set of RMSE measurements (Equation (
18)) for each algorithm.
n is the number of observations,
is the predicted torque value for the
i-th observation, and
is the experimental value for the
i-th observation.
The RMSE is a useful fitness function for assessing the effectiveness of a developed model with the estimated parameters. A lower RMSE implies that the model’s predictions are closer to the actual values, which is what we desire. Conversely, a higher RMSE indicates significant discrepancies between the predictions and actual values, resulting in poor parameter estimation on the model performance [
30]. Therefore, a lower RMSE denotes more accurate predictions, reflecting a better parameter estimation.
The standard deviation
s, is calculated with Equation (
19):
The standard error of the mean (SEM) is then given by Equation (
20):
We use the standard error and the Z-score corresponding to the desired confidence level to calculate the 95% confidence interval for the mean error. The Z-score is a statistical measure that indicates how many standard deviations an element is away from the mean of a distribution. For a two-tailed test at a 95% confidence level, the Z-score is approximately 1.96.
Thus, the confidence interval (CI) is calculated as follows:
In this study, we applied this methodology to compute the confidence intervals for the mean error obtained after applying the three proposed algorithms: SSA, CGA, and PSO. The computed intervals provide insight into the precision of the mean error estimates and allow us to ascertain the statistical significance of the differences observed between the algorithms’ performances in determining the parameters. The algorithms that determine the parameters of the model are presented in
Table 1. Their objective is to minimize the RMSE, finding the specific parameters that close the gap between the predictive torque and the experimental measurement, as shown in Equation (
18). Each metaheuristic algorithm proposed in this work is described below. Each algorithm setting was optimized using a stochastic PSO algorithm to obtain the best parameters and improve the performance for solving the optimization problem.
2.4. Particle Swarm Optimization
The PSO is a metaheuristic technique for optimizing non-convex nonlinear mathematical models. It is a bio-inspired algorithm that simulates the way flocks of birds sweep a terrain in search of food, where each animal is modeled as a particle. Each particle in the swarm has a cognitive and social component, allowing the swarm to follow the best particle that finds the best solution in the current iteration. Adding a velocity that changes in each iteration depending on its position allows the exploration of the entire solution space [
4,
31]. Algorithm 1 shows the process to solve an optimization problem. The RMSE is often employed as a fitness function in optimization scenarios to reduce the disparity between the predicted and observed values. The selection of the RMSE as the fitness metric does not directly impact how the optimization techniques perform; rather, it consistently gauges the error these algorithms strive to diminish. For instance, the PSO algorithm utilizing the RMSE offers a continuous error gauge, steering the particles toward the possible solution. The algorithm fine-tunes particles’ positions to minimize the RMSE. This choice does not inherently influence how well these optimization techniques function; instead, they leverage the RMSE to direct their quest for a solution. The efficacy of each technique in minimizing the RMSE depends on its mechanisms and parameter configurations.
Algorithm 1: Particle swarm optimization procedure. |
|
2.5. Continuous Genetic Algorithm
The genetic algorithm is a classic optimization technique widely used to solve continuous problems with nonlinear mathematical models. The algorithm starts by creating an initial population of individuals, each evaluated based on the objective function and a set of constraints representing the problem’s physics [
5]. These enable the evaluation of the response viability, allowing the algorithm to consider non-feasible points as potential solutions. This facilitates better exploration and exploitation of the solution space, preventing the algorithm from getting stuck in local optima. Subsequently, descendant populations are generated using recombination, selection, and mutation techniques. The objective function and set of restrictions are evaluated in each iteration, allowing for advancement through the solution space to find an adequate and viable solution to the analyzed problem [
8]. Algorithm 2 briefly details the CGA process to solve an optimization problem.
Algorithm 2: Continuous genetic algorithm procedure. |
|
2.6. Salp Swarm Algorithm
The salp swarm algorithm is a bio-inspired metaheuristic technique with key factors to avoid being trapped in local optima, allowing the exploration and exploitation of the solution space [
6,
30]. This algorithm is based on swarm intelligence, which simulates the behavior of salps in the ocean, which move in nature in the form of a chain, where the first individual is taken as the leader particle, and the rest of the salps are the followers, where in each iteration, the search is carried out for the area in which the food is found, which represents the optimal zone; then the movement of the leader particle towards the zone is carried out, solving the mathematical model of the various points where the followers are located, to update the positions of the leader particle, where the objective is that all the particles approach the area of the best food, finding the best solution to the problem [
32]. Algorithm 3 briefly details the SSA process to solve an optimization problem.
Algorithm 3: Salp swarm algorithm procedure. |
|
3. Results
Figure 4 presents the experimental torque results correlated with the position, velocity, and acceleration data outlined in
Section 2.2.
To provide a clear and direct comparison of the results on the parameter estimation for the mechanism,
Figure 5 shows the plots of the torque predicted using the mathematical model with the parameters found by the different algorithms. It also compares the experimentally measured torque with the theoretical model alongside the predictions made by the SSA, CGA, and PSO algorithms. A zoomed view box gives a detailed comparison for a specific time interval between 5 s and 6.6 s, allowing for closer scrutiny of the algorithms’ performance in relation to the experimental data.
Table 2 shows the parameter estimation found by each algorithm; those values correspond to the minimum RMSE over the 1000 runs.
The proposed mathematical model was validated by comparing it with the experimental torques. The overlapping lines show that the model closely aligns with the experimental observations, which serves as a benchmark for the algorithms. The estimated torques of the SSA, CGA, and PSO algorithms appear as distinct lines. The SSA estimation adheres most closely to the experimental and theoretical benchmarks, indicating that the SSA’s parameter optimization can accurately calculate the system dynamics over the observed time. The CGA and PSO estimations generally follow the same pattern; however, their divergence from the experimental and theoretical lines in different points indicates less precision in the model fitting.
The performance of the SSA algorithm is consistent, as indicated by its proximity to the experimental and theoretical lines shown in
Figure 5. This aligns with the low mean RMSE and small confidence interval mentioned earlier, which confirms that it is a robust optimization tool. On the other hand, the CGA and PSO lines exhibit greater variance from the expected torque values, particularly in areas where sharp changes in torque occur. This behavior could be attributed to these algorithms’ exploration and exploitation mechanisms, which may not be as well-tuned as the SSA algorithm to capture the intricacies of the modeled system.
A comparative result for the performance of the proposed algorithms, with value numbers, is presented in
Table 3 and
Table 4. The SSA algorithm achieved the best parameter estimation for the mechanism with a minimum error at
compared to the experimental results. This algorithm achieved a mean solution error of
, the lowest among the tested algorithms. The standard deviation RMSE for SSA was also the lowest, 1.44399 × 10
−6 N m, indicating highly consistent results across the 1000 runs. The 95% confidence interval for the error was narrow, further confirming the reliability of the SSA in finding the optimal solutions. This algorithm demonstrated a moderate mean computing time of
, with a standard deviation of
and a closed confidence interval that suggests consistent performance in terms of time efficiency.
The CGA also offered interesting results, with the best solution RMSE recorded at . However, the error of the mean solution was slightly higher at , with the standard deviation of error being more considerable, implying less consistency in obtaining the best-fit parameters compared to the SSA. The error’s confidence interval was wider than the SSA’s, implying a larger CGA performance variation. The algorithm also had a higher mean computing time of 954.1851 s, with an identical standard deviation to the SSA (18.7228 s). The PSO, although the fastest with a mean computing time of and a relatively low standard deviation of , had a higher mean RMSE solution, the largest among the three algorithms, and the confidence interval for the mean RMSE was notably broad. These values indicate a significant variation in PSO’s results’ accuracy, making it less reliable for parameter estimation despite its computational speed.
The bar chart in
Figure 6 provides a clear visual comparison of the average computing time required by the three metaheuristic algorithms. The PSO demanded the least amount of computing time on average, indicating a more time-efficient approach in parameter estimation, with the average time being noticeably less than that of the other two algorithms. The confidence limits in the bars suggest consideration of the variability in computing time, indicating the reliability and consistency of each algorithm’s performance over the 1000 runs. While the PSO led in terms of time efficiency, the SSA algorithm followed as a close second, displaying a marginally higher average computing time. According to the analysis, the average CGA algorithm took the longest time to compute, which may not be ideal when time is critical. Moreover, the analysis indicates an inverse relationship between the precision of the algorithms discussed in detail in
Table 4. This implies that there may be a trade-off situation where the CGA algorithm, despite its longer computation time, may not necessarily produce better solutions, as demonstrated by its mean solution error compared to the SSA and PSO algorithms.
Figure 7 presents a comparative analysis of the average RMSE for the applied metaheuristic algorithms. The bar chart reveals that the SSA algorithm has the lowest average RMSE, indicating the highest level of precision in fitting the experimental measurements to the mathematical model; it also has a comparatively lower height of the SSA confidence interval limits with a confidence of 95%. These error bars indicate variability in the accuracy of the algorithms from one run to another, with the SSA showing the least variability, followed by the CGA and PSO. The CGA algorithm, while surpassing the performance of the PSO, exhibits a higher average RMSE than the SSA, as visualized by the taller height of its corresponding bar. This suggests the CGA is less precise than the SSA but more so than the PSO. The error bars for the CGA and PSO are noticeably longer, particularly for the PSO, which signals a greater spread in the RMSE values and, consequently, less consistent performance. The PSO algorithm’s bar, which is the tallest and the longest error bar, indicates that it has the poorest response for this problem.
4. Conclusions
A parameter estimation via dynamic modeling of an inverted pendulum system was carried out, where the comparison between the mathematical model and the experimental measurements of the torque express a correlation that shows the accuracy of the methodology described.
To solve the mathematical model for the parameter estimation, three algorithms were implemented, where the best solution was achieved by the SSA, which was 0.163% better than the CGA and 0.2% than the PSO. Regarding the repeatability of the solution, the SSA also presented the best standard deviation, reflecting a better quality of solution compared with the CGA and the PSO. Finally, in terms of the computing time, the PSO algorithm took 7.013% less time to obtain the response compared with the SSA and CGA. The SSA was selected as the best algorithm, since, for the problem addressed, the quality of the response has more influence.
This research introduces an innovative methodology and empirically validates dynamic modeling for parameter estimation in inverted pendulum systems. By integrating metaheuristic algorithm techniques and a comparative analysis of their performance, this study improves the precision of the modeling of complex dynamic systems. In future work, it is proposed that these parametric estimation methods be used to determine gains and control parameters of various linear and nonlinear techniques to control dynamic systems like mobile robots, drones and other robotic systems. Furthermore, a comparison of the effectiveness of metaheuristic methodologies with other algorithms to obtain nonlinear models will be studied, such as in MPC.