A Comparative Study of Computer-Aided Engineering Techniques for Robot Arm Applications

As systems become increasingly complex, their simulation techniques have to be more accurate and enhanced. Despite the wide use of robotic arms in industries, they still encompass a wide number of complexities. The control of a flexible robot arm driven by a Brushless DC Motor (BDCM) for tracking problems is a great challenge, not only for its complex algorithms but also for its verification process. Robotic systems are designed heterogeneously by combining continuous and event discrete models. Therefore, computer-aided engineering tools have to be enhanced in order to support the verification of the control algorithms. Ensuring definite and rapid simulations is a challenging task for robotic application systems. Although control strategies can be tested using the Matlab/Simulink environment to assess their performance, their verification at a low-level still remains a very difficult task. This paper studies different simulation techniques based on Model In the Loop (MIL), Hardware In the Loop (HIL), and Hardware Software In the Loop (HSIL) on a flexible robot arm driven by BDCM in order to overcome each method's limits, focusing on performance and cost and simulation time reduction. The HSIL achieves the highest accuracy and speed than MIL and HIL and provides reusability and portability of the control unit compared to the other techniques. Keywordscontrol; robot arm; brushless DC motor; model in the toop; hardware in the loop; hardware software in the loop

INTRODUCTION Robots' control driven by BDCM has achieved an interesting breakthrough recently [1][2]. The utilization of BDCMs is widely spread due to their independence of bearings and brushes, providing them a long survival time, robustness, energy efficiency, and implementation simplicity [3][4][5][6][7]. Authors in [8] utilized BDCM in robotics to benefit from its advantages, such as the execution time decrease of control algorithms. They showed that this was a great advantage, especially when looking for robot manipulators either in the industry performing repetitive tasks, or in service robots performing manipulation tasks. Nevertheless, despite the progress in this field, there is still an urgent need to minimize cost and time for certain robotic applications [9][10][11][12][13]. Robotic systems still require many improvements in design, accuracy, and real-time processing. On the other hand, computer-aided design methods have to be up to date in order to support the complexity and the needs of these systems. This challenge is the main subject of this paper, as it attempts to evaluate the control algorithm performance for a flexible robot arm with one freedom degree using Model In the Loop (MIL), Hardware In the Loop (HIL), and Hardware Software In the Loop (HSIL) [14] simulation techniques.
The more complex is a control algorithm, the longer simulation time it requires. Hence, the design of accurate and rapid simulations is a great challenge for robotic systems, as the need for high performance and available real-time systems has increased their complexity. The design of these complex systems requires an efficient simulation tool for verification, ensuring high performance in less time. HIL appends the sincere device in the verification process. This may enhance the test capacity, diminish conceit time and predict the environment interaction. Despite its pertinence, compounding variant architecture conceits and protocols at the same time is a complex mission [15]. In [16], an environment to verify and test the hardware via HIL was presented and integrated in MATLAB/Simulink. The simulation model was synchronized via real-time communication, and logic control was performed by Simulink. Authors in [17] presented a technique to test real time embedded systems via HIL, benefiting from High-Level Architecture (HLA) for interoperability and synchronization of heterogeneous architectures. Their proposed test used Ptolemy to verify the patterns operating in hardware and their correspondent Ptolemy developed reference patterns in realtime. This approach developed further performers in Ptolemy to integrate it in an HLA and to interface the software in the hardware under verification. As substantiation of concept, it was applied on a navigation algorithm for a mobile robot. Every data collected by the sensors and the reactions were transmitted in real-time to Ptolemy performing the check in the face of a reference model. This allowed multiple computation models to be exploited as reference models, in order to checkout multiple hardware architectures synchronously based on HLA [17]. In [18], a distributed co-simulation environment to integrate virtual components was introduced. The cosimulation used a modified HLA nominated as Distributed Cosimulation Backbone, which was the standard to exchange data, claiming specific appeals to run-time infrastructure functions. In general, the operation was similar to high-level architecture. Similarly, other works used HIL to test embedded systems, whereas they were restrained to a restricted set of models and devices, with specific architectures and computation models making the integration harder. In contrast, in [17] the co-simulation was performed for homogeneous models only. Unfortunately, these models lack any easy extensions for integration with heterogeneous systems, and their adaptation to diverse hardware platforms, synchronization and communication protocols require much effort. Authors in [19] attempted to support synchronization and heterogeneity by involving different computation patterns and integrating realtime hardware devices in Ptolemy using high-level architecture. This was an improvement to the integration of several instances of Ptolemy to improve performance without HIL [20]. In [21], Ptolemy was integrated with hardware devices for testing excluding real-time constraints. However, test integration of embedded systems with HIL via Ptolemy and high-level architecture has not been found.
Nowadays, designing complex systems requires tools and methods that allow verification and simulation in a practical and efficient way [22]. The use of different modeling and simulation tools during a unique design flow is a very common procedure. However, the integration of hybrid systems is not easy, as there is no guarantee that continuous and discrete systems that work smoothly when separated, will work well when combined [23]. This paper studies the development and evaluation of different verification techniques, based on highlevel architecture, for a flexible robot arm driven by BDCM. To reach this goal, a verification environment for the control of the robot system is necessary. Therefore, at first, the MIL simulation based on Matlab/Simulink was used. Then, its results were compared with the results of HIL and HSIL, in order to feature a high performance and short-time method for heterogeneous and complex embedded robot systems. This approach of co-simulation was expected to allow the synchronization between heterogeneous models, such as continuous and discrete models, integrating different simulators.

II. PROBLEM FORMULATION AND CONTROL STRATEGY
This section describes the control strategy associated to the BDCM and the flexible robot arm.

A. BDCM Control
The DC voltage ensuring power over the three arms in high-and low-level was conventionally provided by an AC-DC converter which was easily achievable through batteries. In line with [24], it was assumed that the Insulated-Gate Bipolar Transistors (IGBTs) and the diodes constituting the inverter were ideal switches, in order to simplify the brushless motorconventional inverter association formulation. The voltages of the BDCM's three phases, V an , V bn , and V cn were expressed as functions of S1-6 signals, characterizing the IGBTs of the three arms state. The BDCM phase voltages a, b, and c were determined considering the signals combinations S1-6. Each functioning sequence was divided into motor sub-sequence during which the power was transmitted from the battery to the motor stator phases through two IGBTs, and a generator subsequence resulting in a power recovery that was returned to the battery through two diodes. The IGBTs conduction outbreak was ensured by the hysteresis current controllers. The principle of the hysteresis controller was to maintain the real current within a centered given width band around the reference current I ref . Figure 1 shows the flowchart of the BDCM control.

B. Flexible Robot Arm Control
The proposed design focused on a flexible robot arm with one degree of freedom. Most similar robots use an actuator brushless motor. The flexible robot arm based on BDCM provides fast, precise movements, and excellent dynamic response with a high dynamic and torque performance. The use of a transmission system is essential for the flexible robot arm. Figure 2 describes the flowchart of the flexible robot arm control.

III. VERIFICATION TECHNIQUES
The choice of the verification technique of the developed digital systems is a very important task. Any verification technique should be based on two essential requirements. At first, the existence of a software simulation tool is essential to monitor the performance and avoid potential risk scenarios in real tests. Additionally, the provision of a hardware simulation tool is imperative to verify its functionality and measure its performance under realistic conditions. The following section

A. MIL Simulation Technique
The simulation approach for dynamic systems analysis is a vital step in all robotics studies. For this reason, the scheme of the closed-loop robot manipulator control was modeled using Simulink as shown in Figure 3. Machine-converter associations were particularly involved in this, study since these systems are quite complex, nonlinear, presenting multiple time scales with very small time constants, and variables depending on the operating point. Within a perspective to implement the control algorithms for brushless motors driving the robot arm, special focus was given on studying and checking the dynamic performance of this robot in Matlab/Simulink environment. This model uses the electrical and mechanical equations and quantities already developed from the considered BDCM, and this section focuses on the implementation of the control strategy, adopting the dynamic model of the robot with the determined controller parameters.

B. HIL Simulation Technique
There is an increased interest in using electrical drives and power electronics in the control of a large variety of different applications, particularly in the robotic field. However, authors in [25,26] recommended a serious consideration of the design and strict control of electrical drives and power electronics to validate their control strategies. Therefore, HIL and rapid prototyping methods are described as a deep layer of verification that is required after the software simulation. HIL simulators were essentially used for the verification of complex electromechanical systems such as industrial robots [27]. HIL simulations always performed the real-time simulation of the system including actuator and sensor models. Furthermore, theoretical considerations have been reported along with simulation results related to differences and the evaluation of approaches [28]. This technique has multiple advantages [27]: • During the initial design phases, the platform is not always available to perform real tests.
• Cost and simulation time will be reduced.
• In the presence of system uncertainties during the initial phases of the design, HIL is the safest simulation technique to avoid all scenarios risks and dangerous situations.
• The verification flexibility can be automated and reproducible.
Simulink/Matlab provides HIL by performing cosimulation between the FPGA board and the Quartus II software design [27,[29][30][31][32][33]. HIL simulation is used to achieve the control strategy of the flexible robot arm, and ensures the verification of the effectiveness of controllers in a repeatable and cost-effective way [29,31]. The steps required to perform the verification of the controller's accuracy according to the HIL [30][31][32][33], are: • Step 1: Provide the model of the controllers based on the DSP builder blocks in the Simulink/Matlab environment.
• Step 2: Compile the design based on the Signal Compiler. Compilation creates a compiled Quartus II project presented in Figure 4. The compilation procedure ( Figure 5) comprises of four steps. The closed-loop flexible robot arm control driven by BDCM is described using the DSP builder tool to perform the HIL simulation based on the Altera DE2 board, as shown in Figure 6. After finishing all these steps, the verification of the controllers' efficiency is performed through simulation with MATLAB/Simulink and an Altera FPGA board. However, despite the provided modeling language and the HIL multiple advantages, this verification technique is not suitable for hardware/software co-design. One of the contributions of this paper is to deal with HIL weaknesses by developing a new standard target based on the FPGA board [29,33]. Shortcomings could be resumed as: • Only a few targets are supported.
• Lack of reuse and portability: the model associated with the Control Unit (CU) target block set decreases reusability and portability.
• Unchangeable HW: the HW is created based on the generated code that prevents the modification of HW architecture.

C. HSIL Co-Simulation Technique
In line with [29], the control part was an embedded system defined by SW and HW components. Each part had to be aware of the other part's characteristics to obtain optimized components. The most adequate strategy was the co-design, since it was expected to develop HW/SW components concurrently. The main idea was to set the HSIL to overcome its limits, as it was recommended in [29,[32][33]. The described method could improve HIL, having the following advantages: • Expanding the HIL to attend the co-design strategy.
• The S-function can be integrated into the Simulink block to perform specific communication with the FPGA board. This is a very powerful way to extend the capabilities of Simulink, guaranteeing reusability and portability.
• Without modifying the architecture, the CU modification and verification is enabled.
The main advantage of the proposed method is the synchronization mechanism that ensures the relationship between the Simulink/Matlab simulator and the HW architecture emulated on the FPGA board. The aim of the flexible robot manipulator control design was to verify the CUs. The model had a speed controller, a torque controller, and current controllers were considered as SW applications. Three steps were crucial for the implementation of the controller units [29][30]34]: • Target architecture: The verification needs several tools to satisfy continuous and discrete models. The discrete model was implemented on the ALTERA DE2-70 FPGA board, using the Quartus II, NIOSII IDEs. MATLAB was used for the continuous model.
• Synchronization block integration: This block ensures communication and synchronization between the Matlab/Simulink simulator and the target architecture described in S-function block. The endpoints related to the synchronization interface represent the input signals of the continuous model. When an activation signal is triggered, the synchronization block ensures a context switch to the board by sending a data packet. Upon resuming execution, the data packet read by the interface synchronization defines the next activation time.
• Simulation results: The signals' update events were not periodic, so the simulation was performed using the synchronization scheme.
IV. EXPERIMENTS Figures 4 and 5 represent the design in the Matlab/Simulink environment associated to the MIL and HIL techniques respectively. Controllers were replaced with the HIL block, and the control algorithm was computed on the board. The HIL technique was performed using the DSP builder tool provided by Matlab/Simulink. Figure 6 shows the different characteristics mounted. A Cyclone version of FPGA was used, based on architecture done in Quartus II (BDCM DSPbuilder was the file architecture). As shown in Figure 6, the compilation passed through four steps: Analyze, Synthesis, Fitter, and Program. Figures 7 and 8 describe HIL technique's parameters. Fig. 4.
Flexible robot arm control using DSP Builder blocks.  The simulation results for the three techniques, MIL using Simulink, HIL using DSP Builder tools and Altera FPGA board, and the HSIL using S-function and NIOSII were compared. The implementation steps of the HSIL techniques are described in [33]. Figures 9-11 show speed evolution, position, speed and position error, and the control law respectively using MIL, HIL, and HSIL techniques. However, as the curves in the MIL and HSIL are similar, only the curves using MIL are presented. As it can be observed, the flexible robot arm followed the desired trajectory with a tiny static error rate, confirming the robustness of the controllers orienting the flexible robot arm to the desired position respecting a definite speed. Moreover, when the desired final position is reached, the electromagnetic torque is equal to the load torque. In addition, it would be worth noting that the controllers applied on a flexible robot arm driven by the BDCM yielded an acceptable performance using all techniques. Therefore, the desired speeds and accelerations were reached. Fig. 7. Selection of the HIL configuration.  Table I shows the simulation time for the hysteresis, PID, and torque controllers and all systems using MIL, HIL, and HSIL techniques. Table I shows that: • The output signals obtained using HIL have an error compared to the output signals using MIL and HSIL. At first, this error was not expected as the same control algorithm was used in both cases. After a deep research it was concluded that this error happened due to the insufficient memory of the FPGA board. This lack of memory led to data corruption which affected the computation results.
• Satisfactory performance is obtained to achieve the desired speeds and positions at a lower cost.
• The presence of a precision loss using HIL compared to simulation results using MIL, due to the high sampling time. This caused the failure to get all the points for more accuracy, while it allowed having a faster system.    were closer to the real case. This could enable a faster run of verification scenarios than with the software simulation. Following the previously described design methods, HIL simulation was much faster and more confident than software simulation. In addition, the refinement of the development and the rapidity of the control strategy were continued by the combination of the HSIL co-simulation, as it benefited from each technique's advantages. These results proved that HIL simulation was 4 times faster than software simulation. Furthermore, the HSIL simulation was twice faster than the HIL simulation, proving that HSIL is the best verification method.
V. CONCLUSION This paper aimed to evaluate three Computer-Aided Engineering techniques in robotic systems, focusing on a BDCM control fitted to a flexible robot arm and simulating in Matlab/Simulink environment via verification methods. The model and the control of the BDCM-inverter flexible robot arm were presented. Then, different control strategies such as a speed controller, a torque controller and a hysteresis controller for controlling currents were described. MIL, HIL, and HSIL simulations were studied and analyzed, showing the HSIL's benefits. According to simulation results via the Simulink environment and the FPGA board, the HSIL achieves the highest accuracy and speed than MIL and HIL techniques. In addition, HSIL provides reusability and portability of the control unit compared to the other techniques.