A CMAC-Based Systematic Design Approach of an Adaptive Embedded Control Force Loading System A CMAC-Based Systematic Design Approach of an Adaptive Embedded Control Force Loading System

In this chapter, an adaptive embedded control system is developed to measure yield strength of the material plate with an applied load. A systematic approach is proposed to handle special requirements of embedded control systems which are different from computer-based control systems as there are much less computational power and hard-ware resources available. Efficient control algorithm has to be designed to remove CPU burden so that the microcontroller has enough power available. A three-step approach is proposed to address the embedded control issue: Firstly, the mathematical descrip- tion of the whole system is studied using both theoretical and experimental methods. A mathematical model is derived from the physical models of each component used, and an experiment is retrieved by employing Levy’s method and least square estimation to identify specific parameters of the system model. Secondly, an adaptive feedforward plus feedback controller is designed and simulated as a preparation for the embedded system implementation. The Cerebellar Model Articulation Controller (CMAC) is chosen as the feedforward part, and a PD controller is used as the feedback part to train the CMAC. Finally, the proposed algorithm is applied to the embedded system, and experi- ments are conducted to verify both the identified model and designed controller.


Introduction
With the increasing threat of global warming and the waning of fossil fuel reserves, renewable energy is playing more and more important roles in both environmental and economic aspect of lives. Solar photovoltaic (PV), as one of the most important renewable energy sources, has been widely used in more than a hundred of countries [1]. Solar panels are commonly deployed in harsh environments with high temperature, high humidity and strong winds [2], and are expected to be functional for over 30 years. Thus the glass panel, where the PV material will be located, has to be specially designed to sustain the harsh environments over its life of service [3]. As a necessary validation step, the strength and quality of the manufactured glass sheet must be tested and qualified, especially before the mass production stage. A rigorous test would require the strength of the solar glass sheet to be verified under a controlled environment with simulated temperature, humidity and induced vibration or forces on the PV glass sheet. Although commercial solutions exist for the various types of material-strength testing, environment simulated glass sheet strength testing is not available. As the booming of the PV industry and the increasing researching into stronger and better PV glass sheet, there has been a greater demand into the research and development of specially designed PV glass sheet test machines. This chapter presented the design of an environment controlled force loading machine specifically for solar panel glass sheet strength testing.
The glass sheet testing machine is basically a real-time electro-mechanical control system which is composed of actuators for simulated loading generation, sensors for monitoring and control feedback, a digital controller for the control of the overall system performance and mechanical supporting structures to hold everything together. The key part is the real-time digital controller which serves as the brain of such a system. Although computer-based control system with great computational power is able to host complex control algorithm, testing facilities with space, power and budget constraint cannot afford the size, power and cost of the computer-based design. Moreover, many extended and long hour testing scenarios require great robustness on the control system, where computer with standard operating system cannot meet the requirement. Embedded control systems with much lower power consumption, compact space, less cost and increased robustness is preferred over computer-based systems in many custom designed solutions [4][5][6]. Although embedded control systems have many advantages, they usually have limited or reduced computational powers that may not be able to host complex control algorithms. This poses challenges into the design of efficient real-time control algorithms. Specific embedded system-oriented control techniques must be carried out to guarantee control performances. For this reason, a simple and effective control law is preferred on the embedded control system and the Cerebellar Model Articulation Controller (CMAC) is a good choice.
The CMAC proposed by Albus [7] is a lookup-table adaptive neural network for estimating complicated nonlinear functions. The basic idea of CMAC is to quantify states from input, find memory addresses of states according to their locations in memory, add the content in the memory address, generate the CMAC output, compare the output with desired output and update the content in memory based on learning algorithms. Compared with other neural networks, advantages of the CMAC [8] are: (1) it is based on local learning and stores information in local memory, hence weights are changed slightly in each step and its learning speed is fast and suitable for real-time control; (2) it owns definite generalization property, so that the close inputs generate the close outputs, and the different inputs produce the different outputs; (3) it can receive continuous input and produce continuous output; (4) it can accelerate the response speed by using addressing mode and (5) it is a nonlinear approximation and robust to the sequences of training data. Owing to above predominant merits, the nonlinear approximating capacity of the CMAC is superior to that of other traditional neural networks and is more suitable for real-time control in the real world.
In summary, various CMAC control algorithms have been formed so far, such as CMAC feedforward control [9][10][11], CMAC feedback control [12][13][14], CMAC optimal control [15,16], CMAC fuzzy control [17][18][19][20][21][22], CMAC H-infinity control [23] and CMAC adaptive control [24][25][26]. The previous works can be divided into two categories: one is to improve the control structures of the CMAC, such as the CMAC feedforward control; the other is to improve the learning algorithms with other intelligent techniques, such as the fuzzy CMAC (FCMAC). Although a lot of complicated advanced CMAC control algorithms can well perform the control tasks in the simulations or with the computer-based control systems, the performances raised by some of them are very limited compared with the basic CMAC structure, even several advanced CMAC control algorithms, such as the FCMAC with the wavelet, cannot be implemented in real time with an embedded system due to the complicated improvement algorithms.
In this chapter, we adopt CMAC feedforward and PD feedback control, because [10,11]: (1) the CMAC carries out the feedforward part to approximate the inverse model of the plant; (2) the PD controller actualizes the feedback part to train the CMAC and guarantee the stability of the closed-loop system; (3) compared with other neural networks or other complicated CMACs, limited computation cost of the simple and effective CMAC plus PD control removes CPU burden, so that the microcontroller can have enough computational power available.
Since there is not much effort dealing with the systematic design problem of an embeddedcontrol glass strength testing machine, the contribution of this chapter is to present a three-step systematic design approach to address the embedded control issue: Firstly, the mathematical description of the system is studied using both theoretical and experimental method. A mathematical model is derived from the physical models of each component used, and an experiment is retrieved by employing Levy's method to identify parameters of the mathematical model. Secondly, an adaptive CMAC feedforward plus PD feedback controller is designed and simulated based on the identified system model as a preparation for the embedded system implementation. Finally, the proposed algorithm is applied to the embedded system with the same parameters as those of simulations, and experiments are conducted to verify both the identified model and designed controller. To design a machine systematically for practical use, these three steps are closely linked and indispensable. The three-step systematic design approach could benefit engineers in measurement and control as a guide.
Rest of this chapter is organized as follows. Section 2 analyses the system requirements and formulates a mathematical system model. Section 3 performs the system identification. Section 4 proposes the simulation-based controller design. Embedded system-based experiments are conducted in Section 5 and Section 6 concludes this work.

System analysis
The schematic diagram of the force loader unit is shown in Figures 1 and 2. The loader unit consists of one loader and one steel bar, which is connected to the load cell and linear motor actuator. The linear motor actuator, used to apply force, consists of a motor with linear motion and an encoder. The loader is attached to the steel bar and then through a load cell to the linear motor. In short, the force is applied on the material plate by a loader unit which is connected to a linear motor actuator through a steel bar, and the applied force is recorded by a force sensor.
The load applied on the material plate varies as a ramp function. The user can select the slope of the ramp function by setting the maximum force in a finite time period on the touch screen, and can perform the test under different forces ranging from 0 to 300 lbs. The control objective is to ensure the applied force track the reference force command for measuring the material plate's yield stress qualified or not.

Mathematic model of the motor-loader unit
DC motors are widely used as actuators for high-precision servo control owing to its good working characteristics and simple mathematical model. Mechanical resonance phenomena are ubiquitous because the transmission shaft is not completely rigid and will be distorted under force. For the servo-motor-drive system, considering the mechanical resonance phenomena, the double-mass structure model is commonly used to describe such dynamical systems.
where R a is the armature resistance, L a is the armature inductance, i is the armature current, K e is the counter-electromotive force coefficient, θ m is the motor rotating angle and u m is the motor voltage. K e θ ̇ m reflects that the back electromotive force (EMF) has a linear relationship with the motor speed. Figure 3 illustrates the mechanical parameter of the motor with a load.
The motor output torque T m is determined by the armature current as  where K t is the electromagnetism-torque constant.
The torque equilibrium equation of the motor is where J m is the moment of inertia of the motor, B m is the viscidity damping coefficient of the motor extremity and T l is the torque of the load extremity. T l can be represented as where θ l is the rotating angle of the load shaft and K s is the mechanical rigidity of the rotating shaft.
The torque equilibrium equation of the load is where J l is the moment of inertia of the load, B l is the damping coefficient on the load side and T d is the disturbance torque, including the friction torque, the coupling torque and the external disturbance torque. The displacement of the loader mass generated from the linear motor has a linear relationship with the rotating angle of the load shaft, which can be represented as The force generated on the solar panel glass has an almost linear relationship with the deformation of the glass, which can be represented as

Mathematical models of other components
The control objective is to track the input command through feedback control based on the signal measured by the force sensor. In addition to the motor-loader and the micro controller unit (MCU), other components included in the control loop are a digital to analog converter (DAC), an amplifier and a load cell. Figure 4 illustrates the open-loop plant structure.
The DAC converter is basically a zero-order hold. Assume the controller's output is u(t), the amplifier's input is u h (t) and the system's sampling time is T. The zero-order hold can be represented as Considering the sampling process, by replacing e −Ts with e −Ts ≈ ( − s + 2 __ T ) / ( s + 2 __ T ) , the DAC converter and the zero-order hold can be described as which is a low-pass filter.
In a high-precision servo system, PWM-based amplifiers are commonly used as the motor drivers [28]. The PWM power amplifiers can be represented as where K a is the amplifying multiple and f s is the modulation frequency.
The load cell signal conditioner linearly converts the force into a voltage signal, and its model can be simplified as

Simplified model
Without considering the disturbance torque T d , the angles of the motor and the load have the following dynamical relationship K s is very large and the time constant is very small, therefore in the lower frequency range By considering K s = ∞ and θ l ≡ θ m , the motor-loader model can be simplified as where J a = J m + J l , B a = B m + B l . Deleting the intermediate variables, the dynamical equation of the motor can be obtained as If the motor armature inductance is regarded as L a ≈ 0, the system can be further simplified as A CMAC-Based Systematic Design Approach of an Adaptive Embedded Control Force Loading… http://dx.doi.org/10.5772/intechopen.71420 And the transfer function between the input voltage and output rotational angle is is the time constant of the motor system, and is the gain coefficient of the motor system.

Open-loop transfer function
The mathematical model of the open-loop plant is the cascade of the units described previously: Because the system bandwidth is much lower than the system sampling rate and the modulation frequency of the PWM amplifier, the time constant of the DAC converter and the amplifier is very small. In the lower frequency range, the effect of the DAC converter and the amplifier can be omitted. Therefore, the open-loop plant can be simplified as where b 0 , b 1 , a 1 and a 2 are final parameters.
Obvious, it is a second-order model. Only four parameters need to be identified.

Parameters identification of the system model
Levy's method [29] and least square estimation are widely used in system identification. Assume that the identified transfer function is given as 1 + a 1 s + ⋯ a n s n (19) where b 0 , b 1 , ⋯, b m , a 1 , a 2 , ⋯, a n are real numbers, m and n are integers, and m ≤ n.
The frequency response is For each frequency point ω i (i = 1, 2, ⋯, L), it is assumed that the actual frequency response is Re(ω i ) + j Im(ω i ), and the approximation error is defined as Define an objective function: Minimize the objective function, and prompt ∂J/∂a j = 0 (j = 1, 2, …, n) and ∂J/∂b k = 0 (k = 1, 2, …, m), then two matrix equations will be obtained. By solving the matrix equations, we can get the estimated parameters b 0 , b 1 , ⋯, b m , a 1 , a 2 , ⋯, a n . Table 1 shows actual frequency response obtained by experiments. We employ different sinusoidal input r(t) = A m sin ωt with different angular frequency ω (from 0.1 to 1 rad/s) to excite the open-loop system. By theoretical analysis, the output signals are in the form y(t) = A f sin(ωt + Φ). Comparing the output with input sinusoidal signals, we can calculate the values of A f /A m and phase delay angle Φ based on the least square estimation as follows.
The output signals can be decomposed as First, we select the sampling interval t = 0, h, 2h, …, nh, where h is a step time.
Second, by defining Third, A f /A m and Φ are calculated as where A ̂ f is the estimation of A f . After A f /A m and Φ are obtained, it is easy to estimate the parameters b 0 , b 1 , a 1 and a 2 in Eq. (18) based on Levy's method. Finally, we get the identified transfer function:

Control scheme
As shown in Figure 5, in the CMAC plus PD control scheme, the PD controller is used to train the weights of the CMAC at the early stage of control. The output u n of the CMAC and the output u p of the PD controller are integrated as the control command u to track the desired input command. Once the system is running, the PD controller will play a main role at the beginning. As the weights are tuned by u p , u n will increase to become the main control command. The fast learning speed prompts the leading role of control to switch from the PD controller to the CMAC.
CMAC employs the supervisory learning algorithm. At the end of each control step k, the controller calculates the corresponding output u n (k), compares it with total control output u(k), amends the weights and enters into learning process to make error small between the total control output and the output of the CMAC. That means the total control output will be finally generated by the CMAC only via its learning strategy.
The control law can be described as where w i are weights of the CMAC, a i are binary vectors, u n (k) is output of the CMAC, u P (k) is output of the PD controller, k P and k D are gains, t s is the sampling time and e is the error between y and r.
And the learning function of the CMAC is given as (28) where E is the adjusting index, η is the learning speed and η ∈ (0, 1), α is the inertial variable and α ∈ (0, 1) and c is the generalizing parameter.
Once the system starts running, the controller initializes w = 0, then we have u n = 0 and u = u P at the beginning. At the early stage, the system is mainly controlled by the PD controller. As the CMAC is learning, error e will decreases, which makes u n (k) increase to become the main control command. Although the CMAC is trained by the output of the PD controller, the output of the CMAC is not a simple imitation of the output of the PD controller. The PD controller helps the CMAC to improve its performances, restrain disturbance and enhance stability of the closed-loop system. If the PD controller works alone, control performances are determined by the gain k P to a great extent. If the CMAC and PD controller work together, control performances will be independent of k P , which is flexible in a rational span.

Simulations
Choose the identified model (26) as the simulation plant to tune the controller and verify its performance. The force control is aimed at tracking a ramp command, of which the expression is given as r(t) = − 10t, where t is from 0 to 20 s.
The CMAC plus PD controller is tuned and trained by simulations. Figure 6 demonstrates that the PD controller plays a main role of control at the beginning. Then the control effect of the CMAC will gradually increase via learning from the output of the PD controller. Owing to the help of the CMAC, control performances are better than those of the only PD controller. Overshoots are reduced dramatically and control actions are speeded up while choosing the ramp signal as an input. Figure 7(a) shows an overview of control performances  from 0 to 20 s. Figure 7(b) is an enlarged view of control performances from 19 to 20s. It can be seen that the system output well tracks the input command. Figure 8 further exhibits the superiority of the CMAC: the tracking errors are tiny, mostly between −0.2 and 0.2 lbs.
Since there exists a modeling error between identified system and actual controlled plant, the controller's performances will be further validated in the real material-strength testing experiments.  Simulation Result(0-20s) 19 19.  Figure 7. Simulation results.

Experiments
For verifying the controller's adaption to modeling error in the real-time control experiments, we implement above control law in C language and download compiled files into the embedded system. The central processing unit is an ARM7-based processor LPC2294. The LPC2294 is a 32-bit reduced instruction set computer (RISC) processor with low power consumption and high performance. Although there is no Float Point Unit (FPU) in this processor, the 70 million instructions per second (MIPS) processing speed makes it ideal for the real-time control system. The control step size is set as 50 ms.
The actual force tracking control diagram is shown in Figure 9. The force is applied to the glass sheet specimen by a loader which is connected to a linear motor actuator through a steel bar. A three point bending test is utilized under this configuration. The load force followed a ramp function with time as the independent variable. The slope of the ramp function can be programmed through the LCD touch screen. The force range can be from 0 to 300 lbs. Displacement of the motor, which also reflected the deformation of the glass sheet specimen, is recorded during the test. The signal flow of the control system is as follows. The DAC generates the control outputs as a voltage signal, which is amplified by a power amplifier and exerted on the linear motor. The linear motor then transforms the voltage signal into rotation, and generates linear displacements. The force sensor and conditioner measure the displacements and generates charges, which are transformed back to a voltage signal and fed back through ADC to the microcontroller. The input command and control parameters are the same as those of simulations. Figure 10(a) shows that the output force basically tracks the input command well and the controller implemented on the embedded system can perform the control task in real time within the control step size. From Figure 10(b), it can be seen that tracking errors of the experiment are mostly between −2.5 and 2.5 lbs, which are larger than those of the simulation. The reason is that uncertainties and disturbances always exist in the real world, which mainly reflects in modeling error. However, the maximum absolute tracking error is 3.79, and the variance of tracking errors is 1.69, which are still acceptable in the actual real-time control environment. Moreover, it verifies that the controller tuned by simulations is also available for actual experiments, and indirectly proves the effectiveness of identified system model.

Comparisons
As shown in Figure 11, an inverse model feedforward control is compared with the CMAC feedforward control by embedded-system-based experiments. Its basic idea is to directly employ the inverse model 1/G(s) of the plant's identified transfer function G(s) in Eq. (26) to be the feedforward part. Obviously, this control scheme is also suitable for real-time implementations; even its computation cost is less than that of the CMAC scheme.

Figure 12(a)
shows overall performances of the tracking control with the inverse model scheme. It can be seen that the output force basically tracks the input command and the controller implemented on the embedded system can perform the control task in real time within the control step size; however, the tracking control is not performed very well. As shown in Figure 12(b), tracking errors are mostly between −5 and −2 lbs, which are larger than those of the CMAC scheme. Table 2 also shows that the maximum absolute tracking error and variance of tracking errors of the inverse model scheme are both larger than those of the CMAC scheme, so that performances of the CMAC scheme are superior to those of the inverse model scheme. Although the CMAC scheme and inverse model scheme both utilize inverse model idea, the difference is that the latter directly employs the unchanged inverse model of the identified transfer function and the modeling error always exists, but the inverse model approximated by the CMAC is dynamical and adaptive.

Results analysis
Compared with the traditional PID control method, the learning behavior and adaptive feature of the proposed CMAC control algorithm are embodied in the freedom of tuning control parameters and the robustness to the disturbances in the real world.
The PID control method has been widely used because of its simpleness, but the tuning problem of PID parameters (proportional, integral and differential) is difficult. At present, PID parameter-tuning optimization depends on the experiences of technical staffs and needs a lot of manpower and time, which means that the optimal PID parameters are difficult to be obtained by people's tuning, and the inappropriate parameters cannot guarantee the control performances to meet the control requirements. In addition, the PID control law is a kind of the linear control law which owns few robustness to the disturbances. It means that even though the PID parameters are tuned optimally and perfectly in the simulations, the tuned parameters may perform poor in the real world due to disturbances and uncertainties.
Thus, combining the adaptive CMAC and the traditional PID to construct an intelligent neural network PID controller, can automatically identify the controlled plant and adaptively adapt the control parameters of the CMAC, which can solve the difficult problem of tuning parameters of the traditional PID controller. As shown in Sections 4 and 5, the PID parameters of the proposed CMAC algorithm in the experiments are same as those in the simulations, which verifies control performances of the proposed CMAC algorithm are independent of tuning PID parameters. Experimental results in the real world in Section 5 also demonstrate the robustness of the proposed algorithm owing to the CMAC neural network, while the traditional PID controller does not have this capacity.

Conclusions
In this chapter, a three-step systematic design approach is proposed to design an adaptive control system for practical use. We firstly study the system model identification problem of the embedded control material-strength testing system, including mathematical modeling of all the open-loop physical components and parameters identification of the mathematical model. Both theoretical analyses and experimental comparisons validate the identified transfer function of the system model is applicable for controller design and simulation. Next, benefited from limited computation cost and compensation ability to the modeling error, a simple and effective CMAC plus PD controller is simulated based on the identified system model, and then applied to the embedded control system for real-time force tracking. Both numerical simulations and actual experiments illustrate the proposed algorithm satisfactorily performs the tracking control task under real-time constraints of the embedded system.
On the other hand, different strength features of different types of the material plates will affect the control performances. Since the yield strength generated by the solar panel glass has an almost linear relationship with the deformation of the glass sheet, K F in Eq. (7) is a constant.
If the tested material plate is not a solar panel glass and the yield strength generated does not have a linear relationship with the deformation of the material plate, K F in Eq. (7) will not be a constant. In this case, the problems how to identify the parameters of the system model accurately for simulation-based controller design and how to adjust the CMAC plus PD controller to compensate the varying K F , will be under consideration in our future work.