# Application of the MiL and HiL Simulation Techniques in Stewart Platform Control Development
## 5 Conclusions  
In this paper we used methods for the mechatronics system development as described in the V-Cycle. We applied the model-based techniques Model-in-the-Loop and Hardware-in-the-Loop simulations in the case of the Stewart platform control strategy development. We discovered that the MiL method allowed us to get acquainted with the behaviour and properties of the system in the early stage of the design and we could also verify the controller part which was inverse kinematics and feedback control design. In the next phase, we were able to translate smoothly from the design phase to the system integration phase, due to the fact that we were able to generate the inverse kinematics part of the designed controller code and used it as a subroutine in the real controller PLCnext. The feedback controller and HMI functions have then been coded manually and implemented in the single PLCnext programme with the inverse kinematic  
Figure 19: Acting forces of the Stewart platform linear actuators (HiL). part. Since inverse kinematic calculations require matrix operations, which are usually not supported by any libraries in the PLCs, the code generation tools really accelerated this transition, and therefore we avoided coding the inverse kinematics in the standard PLC languages that would be error prone and cumbersome. After obtaining the results from the HiL we found out that it slightly differs from the MiL scenario results. The main deviation was present in the slight oscillation of the transient response in the HiL results and the error in the magnitude in the piston rod extension of the first linear actuator. These discrepancies can be caused by multiple issues, mentioned in the article. From the perspective of the HiL simulation, it is important that the control shows stability, a required dynamics and accuracy, which also depend on the type and parameters of the used controller. The authors also must note, that during some of the scenarios of the HiL simulation experiments they ran into the numerical stability issues caused by the inability of the MicroLabBox to perform the calculations in the fixed step time. This issue did not occur in the MiL scenario. The authors therefore recommend that the readers use a more powerful real-time target than a MicroLabBox. During the experiments, we discovered that the model-based approach is a strong technique, because it allowed us to explore the behaviour and properties of the system before the first prototype has been made in a virtual environment and therefore, we discovered potential issues early in the development phase that would result in reduced costs and time. That includes avoiding the potential for damaging and destroying the real equipment. However, it is fair to say that the employment of this approach is time-consuming in the initial stages, because development of the plant simulation model is demanding as well, and it is hard to verify the fidelity of the simulation model if the real prototype is nonexistent. Therefore, in the early design stages, it is required to approach the simulation results as critically as possible and it is necessary to continually improve precision of the used simulation model. Otherwise, false conclusions could be drawn, which would result in negative consequences in a later development phase. In the HiL scenario, we are also able to test the developed functions of the controller and the higher control hierarchy as well. The obtained data can be processed and higher-level data processing algorithms can make decisions and conclusions based on them. Moreover, in case the developed simulation model of the plant accompanied the real product during the development cycle and has been previously verified and validated, it could possibly be used even after the development with the real product. The developed simulation model could be run in parallel with the real product as its digital twin. This could possibly add another value for the existing product and therefore it would return resources spent on the high-fidelity simulation model.