Software In the Loop Simulation for Robot Manipulators

—In the last decades, the classical verification of robotic software component is postponed until the code is developed enough to function in real hardware. For this reason, the verification of code at early stages is essential to reduce development costs and necessary time for embedded systems such as robot manipulator. Therefore, Software In the Loop (SIL) simulation may be realized in the early stages of software development. It offers the possibility to execute tests before the hardware is available and thus detect errors. In this paper, we propose a Software In the Loop (SIL) test for robot manipulator driven by a Brushless DC Motor without a target system hardware. Simulation results prove the rapidity and the good performance of the developed code for the controller’s part by the validation of the behavior of robot manipulator software.


INTRODUCTION
The engineering of software and digital electronics represent an important place in the process of the design and the verification of the electronic systems [1,2].The levels of electronic components integration, the complexity and the size of embedded code are continually growing and this growth is accompanied by great sensitivity to the disturbance and uncertainties [3,4].The number of possible combinations states poses a problem of combinatorial explosion that led to huge numbers of possible states due to the complexity of mechatronic systems [5,6].This complexity is a challenge for dependability [1,5,7].Indeed, new robotic applications representing the most known mechatronic system have required the lightest and most precise robots that can be driven with small amounts of energy [8][9][10].Unfortunately, the flexibility of these robots leads to an oscillating behavior at the end of the link.Obtaining a precise trajectory tracking is an arduous task that requires a complex control in closed-loop [11][12][13][14].To achieve the control objectives, such as the accuracy of the position and vibration suppression, many control techniques were applied to these flexible joint manipulators [15][16][17][18].Thus, we consider the entire robotic system including actuator dynamics and flexibility in the joint.To guarantee a high performance of the control system, a flexible joint manipulator which is highly nonlinear, strongly coupled and uncertain is used [19][20][21].The embedded systems in the robotic industry must accomplish high safety requirements [22].Therefore, verification step is essential to verify the behavior of the proposed system and to detect and correct the errors at earlier stage without any hardware or physical environment [23].
This paper presents the SIL simulation technique for robot manipulator driven by Brushless DC Motor (BDCM).In section I, some related works were detailed.The second section described the manipulator control system.The third section defined the SIL simulation technique.The fourth section was devoted for SIL implementation method shown the speed and torque controller and the current hysteresis controller.Finally, simulation results in MATLAB/Simulink are shown in Section V. Extracted simulation time prove the role of the SIL technique to accelerate the simulation and prevent the risks.

II. RELATED WORKS
The Software In the Loop (SIL) approach allow us to integrate software component with an environment simulation [23][24].Besides, this approach allows testing different scenarios and control algorithms very quickly and benefit from its flexibility.In [25], authors realized a SIL environment for the development of control strategies for hybrid vehicles.This environment allows the evaluation of different vehicle dynamic behavior for each additional masses and each position of gravity center of the vehicle.In [26], authors described the SIL validation of a flight control system needed to develop low cost Unmanned Aerial Vehicles (UAV).Moreover, this technique allows modeling, linearizing and decoupling of the highly nonlinear six degrees-of-freedom dynamics of the vehicle.In [27], authors presented a low cost SIL simulation to evaluate performance of control law for quadricopter using MATLAB/Simulink for control law and Xplane for vehicle dynamics and flight environment.In [22], authors described a cost effective SIL simulation methodology for mobile nodes representing large-scale pervasive system.This methodology permits deploying the real code once and replicating environments and over virtual devices as often as they wish.In [28], authors used the High Level Simulation Framework Open Virtual Platforms (OVP) for SIL simulation of embedded control applications to benefit from rapid prototyping in early stages of the development cycle.This approach was applied for two cases which are the motor control application and the image processing application.In [29], authors described SIL simulators for autonomous navigation algorithms of planetary rovers due to temporarily unavailable hardware.This simulator is necessary to facilitate the continued algorithms development even in the absence of hardware.In [30], authors studied SIL technique for flying robots.In fact, the high production expenses need the validation of such system by simulation to predict the robot reactions in various flight modes.This technique was realized using MATLAB for control part and ADAMS for structural design.
Nowadays, validating complex systems in early stages needs a good simulation technique.This paper proposes the SIL simulation for robot arm driven by BDCM.The development of robot control algorithms for robot arm driven by BDCM often hinges on access to robot hardware that its access is usually very limited.In order to facilitate the continued development of these algorithms, the SIL simulation was used to integrate each algorithm change at low cost.

III. MANIPULATOR CONTROL SYSTEM
To implement control algorithms for the proposed manipulator, it is essential to check and study the performance of the manipulator in the MATLAB/Simulink environment.In fact, we focus on the implementation of the dynamic model of the proposed manipulator taking into consideration the controllers studied in the MATLAB/Simulink.Figure 1 presents the block diagram of the proposed manipulator.IV.SIL TECHNIQUE Designing a system with its controller requires mathematical model followed by adjusted certain parameters.Recently, the X In the Loop approach is often used to check the system in the middle stage of the design [31].This approach is an effective way to produce a fast and reliable short-time system.In the X In the Loop approach, there are two levels of the simulation configurations based on the PC shown in Figure 2: Model In The Loop (MIL) and SIL [31].Each configuration provides certain levels of progress and reduced the gap in the development process between the mathematical model and the proposed platform [31,32].Indeed, these techniques are essential to predict possible risks before the implementation phase and to accelerate the simulation time.Thus a check is made by exploiting several verification techniques.MIL simulation refers to the model verification in the modeling environment such as MATLAB/Simulink.Check system at MIL means that the model and its controllers are simulated in the modeling framework without physical hardware.When checking the implementation of complex systems models, it is necessary to distinguish between the verification of modules and the check of the overall system.This technique verifies the system at an earlier stage of the realization.In this step, any problem of the mathematical model of the controller can be quickly found and fixed [33].
In SIL simulation, the used model is replaced by executable code running on the same computer platform of a fixed-point arithmetic way.This step allows the developer to quickly find some bad choices of memory size and to ameliorate the controller code performance.Checking system in SIL level means that embedded software is verified in a simulation environment, but without any hardware such as mechanical or hydraulic components or sensors or actuators [33].Normally, these two steps are performed using a single integrated platform in a PC [33].After the algorithms in MIL stage operate as designed, the model of the controller can be converted into C code with a coder as Simulink Coder and TargetLink.The exported code can as well be connected to the external sources of code.The created code can first be tested in Simulink and also communicated with other systems and subsystems.In this section, we will present the modeling of the control part and simulation via SIL simulation.In SIL, the used model in MIL technique is replaced with executable code running on the same computer platform in a fixed-point arithmetic way.This step is performed using an integrated platform in a single computer.Figure 3 presents the block diagram of the proposed manipulator replacing the control block by the adequate Sfunction block to communicate with the executable code as well as an image of the C code area.To perform a SIL simulation, the flexible joint manipulator with brushless DC motor must be modeled.The control part to be replaced by the equivalent C code is articulated on two controllers that are the speed and torque controller and the current controller.Stills from the fuzzy logic PI controller code and hysterisis controller in C code are shown in Figure 4.For the speed and torque control part, the inputs are: the speed error (rad/s) and the position error (rad) and the output is the amplitude of the reference current.In order to obtain a compromise in performance between the simulation time and the reliability of the studied controllers and simulation results on previous works , we adopt the fuzzy PI controller.For the current control part that uses the hysteresis controller, the inputs are the current errors in the 3 phases (A) and the outputs are the states of IGBTs (S1-6) (1 or 0).In this part, the states of IGBTs applied to the inverter through the hysteresis controller will be verified through the SIL simulation replacing it by its equivalent C code.

VI. SIMULATION RESULTS
In order to implement these control algorithms of the studied manipulator, it is essential to check and study as a first step the controllers of the manipulator driven by BDCM in MATLAB/Simulink environment.To evaluate the effectiveness and performances of SIL simulation technique for different controllers, we are interested to the following principal variables: speed (rad/sec), position (rad), position error (rad), speed error (rad/sec), control law and simulation time.The system parameters are given in Table I. Figure 5 represents respectively the evolution of the speed, the position, the error of the position and speed and the electromagnetic torque in the case of fuzzy logic PI controller.To evaluate the performance of the SIL technique, we adopted the simulation results given on the MATLAB/Simulink environment specifying the execution time of the various controllers' codes.After checking the control algorithm in MATLAB/Simulink, SIL technique produces the same results in the case of MIL simulation by reaching the desired speed and position.The simulation time is decreased compared to those of MIL simulation technique.

VII. CONCLUSION
This work was developed within the SIL simulation technique for the verification of the proposed robot manipulator driven by Brushless DC Motor at an earlier stage.In such a complex system, the SIL simulation can guarantee the verification of software component i.e.C code without any hardware and benefit from its flexibility to validate different controller algorithms.So, the manipulators including their controllers have been presented.Then, the SIL technique has been defined.Also, SIL implementation method has been detailed.Finally, simulation results have shown that the SIL simulation technique leads to high performance at low cost and time and allows detecting errors code before implementation.

Based on Figure 1 ,
we distinguish three blocks describing the proposed system:  The model of the system,  The controllers,  The reference trajectory.

Fig. 3 .Fig. 4 .Fig. 5 .
Fig. 3. Different speed and torque controllers opted for the proposed manipulator (left) and the code area (right) Table II represents a simulation time recapitulation for each system for both MIL and SIL simulation techniques.