# Application of the MiL and HiL Simulation Techniques in Stewart Platform Control Development
## 3 Model-in-the-Loop (MiL) Simulation of the Stewart Platform
\[m\ddot{y}_{k}+b\dot{y}_{k}=F_{ak}(t)\ -\ F_{lk}(t) \tag{6}\]  
The MiL scenario allows us to explore and verify the control strategies, the dynamic performance, and the workspace of the Stewart platform. It can also be used for SiL, PiL, and HiL simulations, which have already been mentioned before. However, in this article we present only MiL and HiL techniques. The multibody simulation model of the Stewart platform consists of a plant, a feedback controller, and an inverse kinematics block as shown in Figure 6. The plant block in the Stewart platform simulation model has been mostly described in the previous text. The inputs \(u\) of this block are six action values that represent the force that will be applied by each linear actuator. The six outputs \(y\) carry information about the actual piston rod extension. These signals are used to control the position and orientation of the Stewart platform. Inside the plant block there is also an embedded block for a measurement of the position and orientation of the moving plate with respect to the world coordination system. The inverse kinematics block shown in Figure 6 calculates the desired piston rod extensions [\(w_{1}\), \(w_{2}\), \(w_{3}\), \(w_{4}\), \(w_{5}\), \(w_{6}\)]\({}^{T}\) based on the input \(\mathbf{q_{w}}\). The next block is the feedback controller that consists of six proportional feedback controllers. The feedback control loop for a single linear actuator is shown in Figure 7. It consists of a proportional feedback controller and the single linear actuator plant. For the single linear actuator, the desired value \(w_{k}\) is calculated by the inverse kinematics block. The error value is given by \(e_{k}=w_{k}\) - \(y_{k}\), where \(y_{k}\) is the actual piston rod extension. The action value \(u_{k}\) is equal to the acting force of the linear actuator \(F_{ak}\). It should be noted that \(w_{k}\) varies in time if the moving plate is about to follow the desired trajectory. Gain \(K_{F}\) serves for a unit conversion of the action value \(u_{k}\) given in volts (V) to the acting force \(F_{ak}\) given in newtons (N). Figure 6: Simulink block diagram of the Stewart platform for MiL simulation. Since our main focus during this experiment was not the best possible control performance, but rather an investigation of the model-based design approach, we designed a simple proportional feedback controller. For our system, it results in lower quality but functional control of the moving plate. In the simulations, authors used the Runge-Kutta (ode4) solver with the fixed-step size 2 ms. In Figure 8 can be seen transient responses of the moving plate for the step changes of the position of the Stewart platform. The initial desired position and orientation of the Stewart platform is \(\mathbf{q_{w0}}\) = [0, 0, 0.49, 0\({}^{\circ}\), 0\({}^{\circ}\), 0\({}^{\circ}\)]\({}^{\mathrm{T}}\). The second desired position and orientation of the moving plate is \(\mathbf{q_{w1}}\) = [0.02, 0, 0.52, 0\({}^{\circ}\), 0\({}^{\circ}\), 0\({}^{\circ}\)]\({}^{\mathrm{T}}\). From Figure 8 can be seen that the moving plate moves first from \(\mathbf{q_{w0}}\) to \(\mathbf{q_{w1}}\) and then back to the \(\mathbf{q_{w0}}\). There is a visible deviation from the desired position and orientation of the moving plate. It must be noted that the desired angles \(\varphi_{w}\), \(\theta_{w}\), \(\Psi_{w}\), which describe the orientation of the moving plate, are equal to 0\({}^{\circ}\). As can be seen in Figure 8, the deviation between desired and actual angles \(\varphi_{y}\), \(\Psi_{y}\) is negligible. The deviation between desired and actual angle \(\theta_{y}\) is more prominent. In Figure 9, six transient responses of the piston rod extensions can be seen. The response times are sufficient, but due to the choice of the proportional controller there is a  
Figure 8: Moving plate position and orientation (MiL).