## 7 Simulation Results  
In this section, the PSO algorithm is applied to an energy minimization problem for a three-linked active above-knee prosthesis. The objective of the study is to optimize the link masses of the above-knee prosthesis to achieve minimum energy consumption while having acceptable stiffness characteristics. The masses of the links are computed by using Cura software program, considering the infill density and infill pattern of the PLA material between 50% and 100%. The population size is used as 10 particles and each particle has two elements (\(m_{1},m_{2}=m_{3}\)). Thus, the swarm size becomes 10 \(\times\) 7 elements. The parameters of the PSO algorithm are selected as \(\chi\) = 0.76, c1 = c2 = 2.05, as in [32]. PSO algorithm is applied to the objective function for 60 generations according to the trajectory given by Figure 2 and it is repeated ten times. After performing the optimization, obeying specified criteria, the link masses are obtained as \(m_{1}=2910\) g and \(m_{2}=m_{3}=1080\) g, with the optimal infill rate of 60%. Optimized parameters are used in the discrete-time PID control scheme to illustrate the energy saving by means of mass optimization. Optimized actuator torques are obtained between \(-7.44\) Nm and 5.56 Nm along a walking cycle. These values are less than the specified actuator torque value 7.5 Nm which is given in Table 2. Note that this value is also less than the maximum continuous torque (7.5 Nm) of DC motors given by the manufacturer Maxon. Stiffness values are optimized such that displacement errors \((\delta\chi)\) along the \(x\), \(y\) and \(z\)-axes are kept smaller than 1 mm when the end-effector is subjected to forces \(F= \begin{bmatrix}fx&fy&fz\end{bmatrix} = \begin{bmatrix}117.68N&117.68N&1176.8N \end{bmatrix} \) at each axis, where \(1176.8N\) corresponds to a 120 kg amputee weight. Note that the amputee exerts full force in the \(z\) direction while he/she exerts 10 percent of full force in the \(x\) and \(y\) directions. Acceptable position tracking errors [33] as shown in Figure 8 are obtained from PID control scheme for each actuator. As can be seen from Figure 8, for a gait cycle, the maximum position tracking errors are obtained as \(4.4\times 10^{-3}\) rad for the first actuator, \(2.4\times 10^{-3}\) rad for the second actuator and \(0.14\times 10^{-3}\) rad for third actuator. In addition to joint tracking errors, Cartesian tracking errors are also demonstrated in Figure 9. The maximum error in Cartesian space is obtained as 1.6 mm for a gait cycle. \begin{table}
\begin{tabular}{l l l l} \hline \hline
**Parameters** & **Symbol** & **Value** & **Units** \\ \hline Rotor Inertia & Jm & \(96.6\times 10^{-7}\) & kgm\({}^{2}\) \\ Armature Resistance & Ra & 0.346 & ohm \\ Armature Inductance & La & 0.121 & Henry \\ Torque Constant & Km & \(29.3\times 10^{-3}\) & Nm/A \\ Back EMF Constant & Kb & \(1.18\times 10^{-2}\) & V/rad/s \\ Armature Voltage & Va & 24 & V \\ Gerbox Ratio & gb & 15:1 & \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Parameters of DC Motors. Figure 10 demonstrates each actuator torque. Maximum torques are obtained as 7.44 Nm for the first actuator, 3.28 Nm for the second actuator and 0.06 Nm for the third actuator. Figure 11 shows the power consumption values consumed by the three actuators. The average power consumptions are obtained as 17 W for the first actuator, 15.07 W for the second actuator and 0.02 W for the third actuator. It should be noted that although the third joint have power consumptions with small variations, the power consumed by the first and second actuators sometimes goes up to 1800 W and 2900 W due to the sudden increase in the load during the gait cycle. The change of joint positions causes these peaks which are normal values in a gait cycle. Figure 8: Position tracking errors of the joint actuators for a gait cycle. Figure 10: Joint torques for a gait cycle. Figure 9: Cartesian tracking errors: (**a**) Cartesian position; (**b**) Cartesian error.