# Dynamic Parameter Identification of a Lower Extremity Exoskeleton Using RLS-PSO
## 2 Methods
### Design of RLS-PSO Parameter Identification Algorithm
#### 2.2.2 PSO with a Finite Search Space  
PSO is an algorithm based on particle swarm intelligence. PSO is mainly used for parameter identification and optimization. In each iteration, PSO adjusts the direction and distance of the flight based on the best solution of the particle's own motion trajectories and the best solution of the whole particles' motion trajectories. Through continuous iterations, PSO finally converges into the neighborhood of the global minima. Under the same parameters, defining the search space is expected to improve the identification accuracy of PSO.  
Take the identification of \(X(1)\) and \(X(2)\) as an example. As shown in Figure 3, when the ranges of \(X(1)\) and \(X(2)\) are unknown, the search space of PSO is 2-dimensional (n is the number of parameters to-be-identified) infinite domain (the blue rectangle). If the number of iterations is insufficient or the settings are inappropriate, the PSO will converge to the local minima. In order to solve this problem, the \(X\)'s search space (the yellow dotted line rectangle) defined by the RLS is adopted to replace the infinite domain. The search space of PSO is greatly reduced. Under the same number of iterations, PSO is more likely to converge into a small neighborhood of real values (the red dotted circle). Since a much smaller search space is defined, a large number of local minima are excluded from the new search space.  
Figure 3: Two-dimensional search space.  
Linearly decreasing inertia weight was adopted in PSO. At the beginning of the iteration, the global search performance of PSO was good. PSO converged to the vicinity of the global minima quickly. In the latter part of the iteration, the local search performance of PSO was good, so as to accurately approximate the global minima.  
The PSO initialized the position \(S_{i}^{1}\) and velocity \(V_{i}^{1}\) of the particles by Equation (7).  
\[\begin{array}{l}S_{i}^{1}=\min(S_{i}^{1})+rand\times[\max(S_{i}^{1})-\min(S_{ i}^{1})]\\ V_{i}^{1}=\min(V_{i}^{1})+rand\times[\max(V_{i}^{1})-\min(V_{i}^{1})]\\ rand\in[0,1],(i=1,2,\ldots,10)\end{array} \tag{7}\]  
where \(\max(S_{i}^{1})\) and \(\min(S_{i}^{1})\) represent the maximum and minimum value of \(X(i)\)'s search space, respectively. \(\max(V_{i}^{1})\) and \(\min(V_{i}^{1})\) represent the maximum and minimum value of \(X(i)\)'s velocity, respectively. To ensure that the particles were always iteratively searched within the search space, once a particle's position or velocity exceeded the given range, the value was reset to its nearest maximum or minimum. The PSO performed \(G\) iterations. In the \(kg(kg>1,kg\in N+)\) iteration, the PSO updated the positions and velocities of the particles by Equation (8).  
\[\begin{array}{l}V_{i}^{kg}=w(t)\times V_{i}^{kg-1}+c_{1}r_{1}(p_{gb}^{kg-1}- S_{i}^{kg-1})+c_{2}r_{2}(p_{i\_{1}\_{1}\_{1}}^{kg-1}-S_{i}^{kg-1})\\ S_{i}^{kg}=S_{i}^{kg-1}+V_{i}^{kg},(r_{1}=rand,r_{2}=rand)\\ w(kg)=w_{max}-\frac{kg}{G}(w_{max}-w_{min})\\ rand\in[0,1],(i=1,2,\ldots,10)\end{array} \tag{8}\]  
where \(S_{i}^{kg}\) and \(V_{i}^{kg}\) represent the position and velocity of particle \(X(i)\) in the \(kg\) iteration, respectively. \(r_{1}\) and \(r_{2}\) represent the normal distribution random numbers between [0, 1]. \(c_{1}\) and \(c_{2}\) represent the learning factor of the particle. \(w(kg)\) represents the inertia time-variant weight in the \(kg\) iteration. \(p_{gb}^{kg-1}\) and \(p_{i\_{1}\_{1}}^{kg-1}\) represent the global minima of the \(kg-1\) iteration and the local minima of the particle \(X(i)\), respectively. Equations (7) and (8) are the PSO with a finite search space. Detailed derivation and principle of PSO can be found in [42].