# Application of the MiL and HiL Simulation Techniques in Stewart Platform Control Development
## 3 Model-in-the-Loop (MiL) Simulation of the Stewart Platform  
Since the development of the Stewart platform is done according to the V-Cycle, it has been supported with modelling and simulation tools, and therefore the multibody simulation model of the Stewart platform has been created. There are several methods available to build multibody simulation models of the Stewart platform. The first one is to develop multibody simulation model with Newton-Euler, Lagrange or virtual work principle approach [24; 25; 26]; these approaches are demanding, and it is hard to implement such models in the HiL simulation. Another approach is to develop the multibody simulation model with the use of software such as MSC Adams [27], Matlab/Simulink [28], etc. In this paper, the presented simulation model has been developed with Matlab/Simulink and a Simscape Multibody toolbox. The mentioned software allows us to build a multibody simulation model in the Simulink environment with the blocks representing reference frames, bodies, joints, etc. However, it also supports the workflow, where the multibody assembly is exported from CAD software and is imported into the Matlab/Simulinkenvironment [28; 29]. The following Stewart platform simulation model has been created with the latter mentioned approach. In Figure 4 is the 3D visualisation of the created multibody simulation model of the Stewart platform. Its structure is similar to one presented in Figure 3, but it has specified physical properties now. The function of the extensible leg is performed by a linear actuator, and the upper and lower joints are spherical and universal joints, respectively. This 3D model is viewed in the Mechanics Explorer that allows one to investigate the performance of the simulation model visually. Each of the six linear actuators consists of a linear actuator body that is attached by a universal joint to the base and a piston rod that is attached to the moving plate by a spherical joint. Both the linear actuator body and the piston rod have reference frames attached to them. The linear actuator body has fixed coordinate frame \(\mathbf{O_{c}}x_{y}e_{z}\) and the piston rod has fixed coordinate frame \(\mathbf{O_{r}}x_{r}y_{r}z_{r}\) as is shown in Figure 5. As mentioned in Section 2, these two bodies are connected by a cylindrical joint and therefore the piston rod reference frame translates with respect to the linear actuator body reference frame along the \(z_{c}\) axis. As described in Figure 5, the distance between the mentioned reference frames is \(y_{k}\) and is equivalent to the piston rod extension. The distance between the lower joint position \(\mathbf{B_{k}}^{\mathbf{b}}\) and the origin of the linear actuator body \(\mathbf{O_{c}}\) is equal to the fixed length of the linear actuator body \(h_{k}\). A cylindrical joint block can be actuated and can have specified internal mechanics such as equilibrium position, spring stiffness, and a damping coefficient. Spring properties have not been used in our case and therefore this parameter is set to null. The cylindrical joint operates in the forward dynamics mode, where the input is the acting force, and the resulting position of the piston rod is automatically computed. In this simulation model, the dynamics of the single cylindrical joint \(k\) is described by the  
Figure 4: Multibody simulation model of the Stewart platform. Figure 5: Detail on the linear actuator reference frames. mass-damper model (6), defined by a damping coefficient \(b\) and a mass \(m\), which are the same for each linear actuator. The acting force \(F_{ak}(t)\) is provided by the linear actuator and it is calculated in the feedback controller. The loading force \(F_{lk}(t)\) is acting on the linear actuator and varies with time as well. Its magnitude depends on the static configuration of the moving plate, as well as its dynamic movement and inertial properties.