Design and Implementation a Novel System for Estimation Precise Transfer Function of DC Motor

Article history: Received: 30 June, 2020 Accepted: 04 October, 2020 Online: 20 October, 2020 A precise modelling plant system is substantial to improve the design of the DC motor controller, where a low accurate model may cause an unacceptable controller system. This study presents a hardware-in-the-loop (HIL) system for design a high speed motor data acquisition system (HSMDAQS) and injected collected data (ICD) Simulink model to estimate accurately the transfer function (TF) of a DC motor, without needing motor’s specification, providing high accuracy estimation tool that can be used to develop the design of a DC motor controller. The proposed system generates synching data to be imported into system identification (Sys Ident) application through a serial port. To show the performance design, a comparative study has been conducted between the experimental realization and simulation results in terms of dead time(td), rise time(tr), and settling time(ts), using a scope simulator. It was used three different DC motors to demonstrate the effectiveness of our approach in terms of average error step responses (AE-SR). The estimation results show that the best FIT between the response of the estimated TF and the collected data augmented by 95.03 % and stabilized despite using different motor’s speed. A comparison step response between experimental and simulation shows a very low deviation and minimized AE-SR below 10% for all tested motors. The developed system could be applied in a wide range of industrial applications, offering faster with accurately capturing data, high precision stabilized platform, a simpler implementation for dynamic systems, lower computational cost design, and flexibility.


Introduction
This paper is an extension of work originally presented in the Prime Asia 2019 conference [1]. DC motors are being used in robotic systems, home appliance and an electric vehicle and many other applications in case of simple structure, high performance, low-cost installation, and easy control speed. However, DC motor systems still have nonlinear parameters, variation in load dynamics, unpredictable inputs and disturbances, that affect their quality. Therefore, these motors should be controlled and analyzed to improve their performance [2][3][4][5].The concept of a real-time processing must be considered when an engineer designs develops and deploys a new automation and control system [6].The improvement of DC motors' control arrangement to enhance their response characteristics is one way of reducing the amount of consumed energy and enhance the efficiency of the machines. Control systems engineering requires a knowledge of at least two basic components: (1)the plant model which describes the mathematically modeled behavior of the system;(2)the desired output [7]. For those systems are known their specifications, The DC motor can be mathematically modelled by using the dynamic equivalent circuit of DC motors based on the second order system as given in equation 1 [8,9] . (1) For DC motor with zero load, the TF from can be simplified as a first order system as given in equation 2.
ASTESJ ISSN: 2415-6698 where is the moment of inertia of the rotor,b is motor viscous friction constant,  is the speed of the shaft, is the electric inductance is the resistance of the coil, Kt is the motor torque and Ke is the back emf By contrast, modelling TF not so straightforward in case of not all manufactured motors are provided their specifications, which was considered the first problem in the field of controller system [10] .One of the most interesting criteria to improve the controller schemes is the optimized TF model. Therefore , it is necessary to base the control system design on a process model [11]. Consequently, the structure of a TF model should be accurately realized that is without following a suitable estimation process , the classical approaches for compensator design and stability analysis are rendered ineffectual [12][13][14][15][16][17], especially for controller based PID and PI algorithm, that were extensively applied to enhance the speed performance in terms of step response characteristics td, tr, ts and overshoot [18,19].However, the common problem in dynamic systems, that is impossible to describe the real plant system exactly in case of unbalancing behavior between controller and plant system. As some techniques are better than others for any given application, each method has its advantages and disadvantages [20].To estimate an approximate model for an unknown system's specification, it is desired to load a certain input signal and to collect the output with thanks to Sys Ident, providing simplified models for complex systems from time-series data [21 , 22]. However, the errorless of parameter estimation depends on the preciseness of data information and sampling time.Therefore, the precision of acquiring data determined the accurate level of estimation models [23]. There are numerous studies focusing on estimation TF model of plant systems, several using costly data acquisition (DAQ)system based Sys Ident application for loading and collecting input /output data [24,25], others using digital oscilloscope based Sys Ident [26,27].By contrast, improve the accuracy of DAQ system could be considered the best solution to boost the precise estimation, and if the modeling of TF can be acquired precisely, the control system could be greatly improved performance [28].
The objective of this study is to obtain high accuracy mathematical model for DC motors without need their specifications, providing low cost design, besides investigating the simulation and experimental realization in terms of step response characteristics to show the efficiency of the proposed system. This paper proposed a novel HSMDAQS coupled with ICD Simulink model to improve the accuracy of collecting data to be used with Sys Ident application to formulate the mathematical models. The novel system has several advantages such faster and accurately capturing data, high precision stabilized platform, a simpler implementation for dynamic systems, flexibility and reducing the total parts cost design less than 20 US dollars. It is well known that the Sys Ident application is very limited, but the proposed methodology assists the novel system to minimize significantly the error capturing data (injected signal and θ) leads to increase the accuracy of TF form. The contributions of this study are: (1) Design a novel HSMDAQS to guarantee capturing data with very low error; (2) high precision stabilized system (3) improve the estimation of TF model for unknown system's specification; (4) highly sensitives tool for measuring the deviation between experimental results and simulation. In order to verify the estimated TF models, a comparison between the simulation and the actual motor performed in terms of step response characteristics. This article is organized as follows: Section 2 presents the proposed system design to estimate TF and provides a brief description of the hardware design and Simulink model. Section 3 presents the results of the estimation TF models, besides simulation and experimental results are carried, highlighting the step response characteristics, further discussing the comparison between them. Finally, the conclusion and recommendation are presented in section 4.

System design
This section presents the multi-steps of design methodologies to estimate accurately the mathematical model of a DC motor, giving a brief detail about the injected signals and the collected data in a time domain specification. The proposed method relies on four parts:(1) design HSMDAQS;(2) implement ICD Simulink model;(3) software and hardware setup;(4) using Sys Ident to estimate TF form. The proposed HSMDAQS has been employed to inject a different signal, and to acquire θ data, to be imported into Sys Ident application. It is chosen three diverse DC motors (M1, M2, M3) to investigate the effectiveness of the proposed HSMDAQS in terms of AE-SR. The speed motors M1,M2,M3 are 56,400,107 RPM respectively. The M1 and M3 are gearbox type with a reduction ratio equal to 1/10 for both, where M2 is a speed type. These motors are unknown dynamic parameters. Physically, to acquire data in data output, the tested motors were connected with HSMDAQS via a driver amplifier, where the collected output data imported from the dual hall encoder sensor (DHES) through collecting data port. By using a model-based design technique, it is designed ICD Simulink model to be implemented on HSMDAQS to inject step pulse and to collect data out. It is essential to calibrate the θ by measuring the RPM on a tachometer and scope simulator then adjusting the potentiometer of HSMDAQS to ensure that the recording data from the scope simulator is corresponding with the tachometer reading. This step is very important to minimize the divergence between experimental and simulation results. The communication between HSMDAQS and DHES is designed to inject signal to drive a motor and to acquire data out from DHES. Figure 1 shows the proposed methodology to estimate precise TF model, it can be summarized into seven steps to meet the objective as follows:(1)connect HSMDAQS with PC through port6;(2)calibrate HSMDAQS by measuring θ in scope simulator and tachometer then proceed the adjustment between them to meet maximum similarity between experimental and simulation results;(3)using switching mode to inject one of the five different signals (square and triangle) wave by setting values as shown in Table 1;(4)acquiring data in data out and convert them into the time domain using iddata command to create a data object of (y, u, Ts);(5)import created data object into Sys Ident application to proceed the estimation process;(6) repeat again the same procedure with other injected signals until reached to signal 5;(7) from data model info, select the maximum percentage of best FIT that achieve high accurate TF model . The steps began with the measurement of data in data out of the tested motors M1, M2, M3 under different signals and voltages for a different speed with sampling time (Ts) equal to 0.02s to be imported into Sys Ident toolbox to evaluate a TF model of the tested motors. In this stage, the tested DC motor will begin to spin proportionally with the amplitude of the injected signal for the 30sec. The generated pulses are counted through the ICD model via Arduino analog inputs analog outputs. At this moment, the data in data out is ready to be imported accurately into the Sys Ident application.

Hardware design
As shown in Figure 2, the proposed HSMDAQS platformconstructed to be used as a high-speed capturing data. The platform constructed based on Arduino Uno with several electrical devices, HIL technique to communicate with the ICD Simulink model. It is used RF520 MOSFET to derive the tested motors, and designed a collecting data port to acquire data in data out, besides using a potentiometer to improve the accuracy of the collected data by calibrating the injected signal regarding maximum speed for each tested motors.

Proposed ICD simulink model
As shown in Figure 3, the ICD model is constructed based on Simulink block sets to run the HSMDAQS on external mode. It is designed several subsystem blocks such as a signal generator, count mode (CM), and selective switching mode (SSM). Figure 4 shows the SSM subsystem which contains five block set switches (SW) connected serially, to generate multiple signals. It is designed to choose one signal between five generated signals depending on setting the truth table, as illustrated in Table 2.  Triangle Figure 5 shows the shape of generated signals (square and triangle) to inject into the tested DC motors. Based on selective switching mode, it can be chosen the shape of the signal depending on setting truth table, by setting sw1,2,3,4,5 on appropriate logic level to get the desired signal, for example, to generate triangle wave (signal 2), it should be setting sw1 on logic 0 and others switches on logic 1, and to generate square wave (signal 5), the sw4 should setting on logic 0 and sw5 on logic 1. Finally, to calibrate the generating voltage on 12V, it is suggested to inject the step response signal to drive the motor by setting sw5 on logic 0. The C.M subsystem designed to evaluate the motor's speed based on count pulses, and to make a comparison between the present counts to the previous one from the last sample, and to specify whether a rollover has occurred between (-32768 to 32767), then to adjusts the cumulative number of counts and to remove the overflow counting. Examine the DHSE, it is observed some a certain error between the injected signals (u)and the angular speed signal (y), also when increasing the RPM speed, the capturing θ will become not smooth with augmented error as shown in Figure 6. To reduce the effect of noise ,it is suggested to design a low pass filter (LPF) to be implemented on the ICD model, by measuring the cut off frequency( ) at maximum speed for tested motor as given in equation 3 , to find a filter constant ( ) as represented in equation 4.Based on scope simulator recording, the measuring cutting frequencies for the tested motors M1,M2,M3 are 73HZ,187HZ,95HZ respectively. To cut unwanted these frequencies, it should be evaluated the TF of the LPF motor as given in equation 5. (3)

Software setup
By using a model-based design technique to construct the proposed ICD model and to do the communication with HSMDAQS, it is followed two steps. Firstly, by installing the ARDUINO I/O block set on MATLAB respiratory using the IDE ARDUINO program to scratch the application on the Arduino board. This program acts as a server for passing information between the hardware and the Simulink model. Together, these elements allow us to access Arduino digital inputs/outputs, analog inputs and read encoders through the Simulink model. Secondly, run MATLAB as an administrator to run the ICD model based on ARDUINO I/O block set that has been appeared in the respiratory library. Once the ARDUINO I/O Simulink block set installed, the Arduino IO block set (Digital Write block, the Encoder Read block, the Arduino IO Setup block, and the Real-Time Pacer block) are ready to be used for hardware communication. The sketch IDE program runs continuously and receives the commands from the ICD model via the serial port to executes the commands and returns a result. The final Arduino communication setting located on the workspace detecting that the port connection with the Arduino Uno board is connected through com6. For further information about Simulink block sets for communicating with an Arduino Uno board, programming code refers to [30].
Afterward, set the current MATLAB directory to the location of the file install_ arduino.m (in the Arduino IO/ folder), this will be allowed the update path to be saved continuously. Finally, importing ARDUINO I/O Simulink block set into the respiratory library by typing (install Arduino) at the MATLAB command line to run the IDE script through Simulink. The script simply adds the relevant Arduino IO folders to the MATLAB path and saves the path. After completing these steps, the proposed HSMDAQS is ready to communicate with the ICD model to inject a signal and to collect data out from DHES. Figure 7 shows the hardware setup for acquiring data to be used with the Sys Ident toolbox. In this process for the data acquisition, the tested motors connected with HSMDAQS via collecting data port. To run the hardware-based Simulink model, it should keep communication between PC and HSMDAQS through collecting data port, using serial data port com6. This process provides additional advantages, for instance, more synching data, measured real-time via scope simulator further rejecting noisy data by proceeding further modifications through running hardware.

Hardware setup
The communication between HSMDAQS and DHES through the ICD model will be beginning by sending the injected signal via pin A0 (Analog write) to drive the motor, then acquiring data in data out from DHES via (Digital read pins) D2 and D3, which already connected with Phases A and B of a DHES. Hence, sending a voltage through pin A0 input signal (data-u) and the encoder block set receives a couple of data through Digital read pins to generate single output speed data(y).
To run the proposed HSMDAQS in real-time, it should be configured Arduino board on Simulink using configuration parameter setting, by selecting Tools > Run on Target Hardware > Run. Afterward, the ICD model activated to acquire data in data Augmented error out in time domain specification, which will be run internally on the host computer.

Analysis based System Identification
This stage demonstrates how to estimate the TF model of M1, M2, M3 by acquiring data out θ based proposed HSMDAQS hardware to be imported into the Sys Ident toolbox. Mainly, this is done by modifying parameters within a given model until its output synchronizes as well as possible with the measured output.
To check the validation of the proposed TF, it is taken a close look at the model's output compared to the measured one on a data by finding the best FIT using the Model output box. By contrast, the accuracy of collecting data specifies the level of the best FIT estimation. Therefore, the HSMDAQS hardware should be designed to acquire synching data with lower noise.
Based on Sys Ident, it is used various estimated models, such as TF, state-space (SS), and polynomial (arx)models to choose a better estimation. It is essential to prepare the HSMDAQS for acquiring data. Firstly, connected M1, M2, M3 with the HSMDAQS system through data collecting port. Secondly, it is injected five various signals (triangle, square) waves to excite the system and to record the θ data. The reason behind using different injected signals is to provide sufficient data for model validation as PRBS signals, besides increasing the capability for finding a better accurate TF form. Figure 8 shows the several steps need to be followed to inject different signals and to collect the set of θ data from DHES using ICD Simulink model-based HSMDAQS as following:(1) run proposed HSMDAQS platform based proposed ICD Simulink model ;(2) using suggested SSM to inject five different signals with a frequency between 0.5 to 5 HZ;(3) the signal logging feature in Simulink will create a data set object in a workspace containing all the logged signals as time-series objects;(4) export five sets of data in data out (u, y) into the workspace, where (u) represents to an input signal and (y) to θ;(5) prepared the acquired data for estimation and validation, by converting the exported data into the time domain denoted data object using iddata command, to be imported into a workspace with Ts equal to 0.02s;(6) import created data objects (z1, z2, z3, z4, z5) into Sys Ident. Figure 9 shows the estimation process to obtain a TF form. Firstly, it is selected the θ data object (z1, z2, z3, z4, z5) imported from the workspace/MATLAB into Sys Ident application, then using three different estimation types; Polynomial model(arx), State Space model (SS)and TF model. Afterward, specify the number of poles and zeros for different cases. Next, the estimation for each data object is figured as an impulse response time characteristic. Ultimately, it can be imported the TF model (TF1,  TF2, TF3, TF4, TF5) and best FIT estimation for each impulse response by clicking the estimation box as shown in Figure 9.

Results and Discussion
This section presents the estimation TF models based HSMDAQS, besides measuring the simulation and experimental step response parameters in terms of td, tr, ts, and SST, where the AE-SR is the performance indices used for the comparison of the results. θ data object Estimation TF

Estimation TF model
It is used the Model Output box to show the best FIT of estimation. It is observed, when increasing the order of the estimation system, the best FIT will remain at the same value, therefore it is selected the first order system for the estimation because of the availability of a simple formula for designing a PID controller [31]. The estimated models are compared and selected regarding to the highest best FIT percentage. As shown in Figure  10, it is displayed that the best FIT of the estimated models are enhanced in TF form by 95.3 % and ARX by 95.01%, that means the novel HSMDAQS has rejected the noise significantly. The justification behind using three different types of DC motors is to verify the best FIT estimation in different conditions. It is observed that even though using different RPM speeds, the best FIT results are still the same value. That is mean the proposed HSMDAQS has excellent stability despite using different motor's speed. Consequently, it is possible to use the proposal for any other types of DC motor even in industrial applications to estimate TF.
From Figure 11, it is important to highlight that the estimated TFs for M1, M2, M3, shown an absolute structure models due to low error capturing data.

Simulation results
In order to evaluate the proposed TFs models of each DC motor, there are several experiments are performed to obtain step response characteristics. Hence, the simulation scenarios are carried out with 3 estimated TFs models for the tested motors M1, M2, M3. The step response results were investigated by using a scope simulator as shown in Figure 12. It is observed that the tr and ts measured in the second unit for all tested motors.  Figure 13 shows the plotted experimental results of the step response characteristics for M1, M2, M3. The experimental tests have shown that the step response characteristics are very convergence to simulation results.

Experimental results
To show the efficiency of the proposed HSMDAQS, the comparison between experimental and simulation results is performed. The deviation time (Δt) of the step response between experimental and simulation for each response parameter is represented in equation 9. The percentage error of the step response (PE-SR) and AE-SR can be calculated as represented in equations 10 ,11 respectively.  Table 3 highlights the comparison parameters between (simulation based models) and (experimental based HSMDAQS) in terms of td, tr, ts. It appears that the curves based on the proposed TF models are closer to the experimental results and the maximum AE-SR is less than 10%. Confidently, the HSMDAQS provides an acceptable △t [32,33], shows the magnificent performance design to be utilized as the best solution for estimating high-quality TF form that can be utilized in a wide range of industrial applications.

Conclusion
In this study, we have proposed a modern methodology and designed HSMDAQS to estimate the high accuracy TF model for unknown DC motor's specifications. It was observed from the quantification of the results, despite there are three different tested DC motors was used in this approach, but the best FIT resolution of estimation stabilized and enhanced by 95.3 %, besides reducing AE-SR below 10%. Graphically, when experimental realization and simulation results are compared, basic similarities between them were observed. The developed system could be used to improve many design sectors, offering faster with accurately capturing data, high precision stabilized platform, simpler implementation for dynamic systems, lower computational cost design and flexibility.
Ultimately, it is recommended to use the proposed system to enhance the speed performance of a PI controller-based DC motor for the CNC machine. In the future, we will intend to implement the proposed HSMDAS on a Field Programmable Gate Array (FPGA), by taking in consideration variable reference speed, variable load and current limiting protection.