Chapter 6 Optimal Control System Design 6.1 INTRODUCTION The active AFO consists of sensor unit, control system and an actuator. While designing the control system for an AFO, a trade-off between the transient and steady state response is necessary since the system has to perform in real time. The control system is being used for the restoring correct angular motion pattern to the patients. Hence it is quite necessary that the motion should not be too quick such that it becomes uncomfortable for the wearer. At the same time the response should not be too slow such that the patient moves into the next phase of the gait cycle even before the previous actuation is finished. Thus an optimum transient response balancing both these conditions should be obtained. Along with this a trade-off for selecting the correct steady response is also required. The steady state response of the controller should have near to zero steady state error. If large oscillations are present at the output of the controller then the patient experiences a jerky motion which is going to defeat the whole purpose of rehabilitation. The design of an optimal PID control system that will account for inaccuracies in the transfer function model of the foot (plant) and the actuator is discussed in this chapter. The actuator modelling is derived from generalized DC motor equations. Foot modelling is done with multi body foot model using Sim-mechanics. The controller design involves the Ziegler- Nichols method using Root locus techniques to obtain the initial parameters of the controller. The optimization of the controller is done through an improvised method to get the best Page 79
performance of the system. The design is made such that best performance characteristics in terms of rise time, maximum percentage overshoot, steady state error etc., are obtained. 6.2 METHODOLOGY 6.2.1 Multi-body ankle foot model Instead of deriving and programming equations, biomechanical models can be developed in multi-body simulation tools. Multi-body systems are used to model the dynamic behavior of interconnected rigid or flexible bodies that have their relative motion constrained by kinematic joints and that are actuated by forces. The software used in the development of the multi-body biomechanical model is SimMechanics. SimMechanics [65] is a module of Simulink, which is a simulation tool from MATLAB (MathWorks) software. With SimMechanics software, it is possible to build models composed of bodies (links or segments), joints, constraints, and force elements that reflect the structure of the system by the use of Newtonian dynamics of forces and torques. Page 80
Figure 6.1 Multi-body foot model The multi body foot model shown in Figure 6.1 is simulated in Inverse dynamics mode, wherein the angular position is fed to the actuator and the output of the model is the torque value required for the movement of the ankle for specific characteristics of the foot. The model has been designed in a standard double pendulum structure as defined by Simulink itself. Body 2 represents the lower limb below the Knee. Body 1 represents the foot. Both these bodies are connected to a revolute joint which thus acts as the ankle joint. The machine environment block defines the simulation environment. This block defines the dimensionality of the simulation and also its dynamics i.e. forward or reversed. The ground block represents the termination or stationary point of the machine model for the lower leg also corresponds to the Knee termination. Angular displacement in terms of degrees, as a constant value, is given to actuate the model. The angular velocity and acceleration are kept zero. This model tries to inference the amount of torque required for a particular constant angular displacement for a given body Page 81
parameters so as to select an actuator for the prototype. The animated pattern depicts only rigid body movement, and as such does not give information on the different elements of human foot involved in walking. For a single simulation run, the model depicts either dorsiflexion or plantarflexion, depending on the input. To make the machine model as accurate as possible, the body moments data is entered for a 40 year old male from the Anthropometric table obtained from NASA, human space flight division. The data recorded by NASA, was measured in 1-g (Earth s Gravity) conditions [66]. A constant angle input is given to the foot to calculate the torque required for the required movement. Initial ankle position is at 0 degrees (with respect to the ground). All angular measurements are made with respect to the ground in anti-clockwise direction. The foot machine model actuation is as shown in Figure 6.2. Figure 6.2 Ankle foot machine models: during angular actuation of 0 degrees and 15 degrees. 6.2.2 Foot transfer function from the Simulink machine model Machine model representation of foot in Simulink is the most accurate modeling of the foot as it takes into account the actual data of a subject with respect to its weight and moment of inertia. Hence, the complex physics governing the motion of these blocks is already embedded in Simulink which makes it even more accurate. Page 82
Since there is no direct way to convert a Simulink model directly into transfer function, the entire machine model cannot be converted into a form that can be used in Matlab codes. Instead, it is possible to measure the input and output data from the Simulink block diagram of the foot machine model and use that to obtain the transfer function. The input to the machine model is angular velocity which is generated by a Matlab code. Figure 6.3 Foot model graph: angular velocity versus angular position The graph shown in Figure 6.3 represents one gait cycle of the foot in terms of the total angular displacement involved in one cycle. But bears no relation with time involved in one cycle. In this graph it is seen that the angular velocity ranges from - 6 radians/sec to 8 radians/sec as per which the output angular variation takes place from -0.3 radians to +0.3 radians, which is the desired range. The angular position values are in radians and cover a span of roughly, ± 17 degrees (+ 17 for plantarflexion and -17 for dorsiflexion). The objective is to determine the relation between input angular velocity and output angular displacement so as to determine the plant transfer function. The mathematical model of lower limb model, identical to the Simulink model is necessary in designing the controller for the same. The input and output data is given in a matrix form to the Transfer function estimation tool in LabVIEW to approximately derive the equivalent transfer function. The transfer function of the foot which takes angular velocity as input and angular displacement as output Page 83
is as given in equation 6.1. The plant model thus obtained, perform equally like the Simulink model of the lower foot. The step response for the model thus obtained is shown in Figure 6.4. It corresponds to the application of 1 rad/sec angular velocity. In the graph, Y axis has angular position output in radians and along the X axis there is simulation time. (6.1) Figure 6.4 Foot model step response Page 84
6.2.3 Actuator model with angular velocity as output The block diagram governing the input and output of the DC motor dynamics is shown in Figure 6.5. From the chapter two, the actuator transfer function model is rewritten: Figure 6.5 Actuator transfer function model [34] For design purposes the motor parameters are obtained from the datasheet of PITTMAN-MOTORS. The motor is a DC brush motor ID33904. Following are the motor parameters as obtained from the manufacturer s data sheet. Torque constant K T = 0.128 Nm/A Voltage constant K E = 0.128 V/rad/s Terminal Resistance R A = 0.78 ohms Inductance = 0.64 mh Rotor Inertia = 3.8x10-3 Kg-m 2 Coefficient of Friction = 1.8x10-6 N-m-s Thus the transfer function as obtained in Matlab workspace is shown below: (6.2) The step response of the DC motor actuator is given in Figure 6.6. It relates the output angular velocity with input voltage applied. Thus, in this step response it is interpreted that a voltage value of 1 volt is applied to the motor. Thus after 5 seconds, the output angular velocity reaches a steady state value of 8 rad/sec on application of 1 volt at motor terminals. Page 85
Figure 6.6 Actuator step response 6.2.4 Cascaded foot and actuator model The foot and the actuator model are cascaded together as shown in Figure 6.7 and its response shown in figure 6.8. The cascade is done to get the root locus of the system (Foot and the actuator) so that a range of gain values across the two regions of imaginary axis on the S-plane are obtained. This initial range is used to determine the critical gain value for the system. Using this critical gain value the initial parameters are obtained for the PID controller as per the Zeigler-Nichols method. In this, first the root locus plot of the system is obtained without any feedback or gain block. The system consists of the actuator and the plant model. Page 86
Figure 6.7 Cascaded model The idea here is to get the gain value at which the system is just at the brink of instability. Thus at the critical gain value, the system gives a sinusoidal output for a step input. When such a thing happens, it is inferred that at this gain value the system becomes instable and this boundary line is used to determine all the other parameters of a PID controller i.e. Kp, Ti, Td. Thus the critical gain value and the period of the output sinusoid are used to obtain other parameters. The formulas for the same are mentioned in the Table 6.1, where Kcr and Pcr correspond to critical gain and critical period respectively. PARAMETER TABLE 6.1 GAIN FORMULAS [65] FORMULA K P T I T D 0.6K cr 0.5P cr 0.125P cr Page 87
Figure 6.8 Cascaded model step response The Figure 6.8 denotes the angular position obtained at steady state when a 1 volt signal is applied at motor terminals. Here one can consider that the motor and ankle joint are attached and system dynamics is observed with respect to input applied voltage and corresponding output angular displacement of the ankle foot complex. All angular motions are in terms of radians and not degrees as MATlab by default considers angular calculations in terms of radians only. The critical gain values, root locus plot, and other important graphs and parameter values are shown in the next section. 6.2.5 Calculation of critical gain and the root locus plot The root locus plot is shown for the series cascaded system in Figure 6.9. Figure 6.10 shows the zoomed view of root locus plot. The two gain values are obtained on the two sides of the plot which give the initial range for determining the critical gain value as per the Zeigler-Nichols method. Thus the initial gain range is obtained from 39.7 to 341. Several iterations are performed to get the critical gain value for Zeigler-Nichols method. The critical gain value is found to be 44.40616. At 44.40615 the step response curve is converging and at 44.40620 the curve is found to be diverging. The graphs for all these responses are shown in Page 88
Figure 6.11 to Figure 6.14. The sinusoidal response is shown in Figure 16.11, at the critical gain value. The converging response is shown in Figure 6.12, when the gain is less than the critical value. At higher gain value there is a diverging response shown in Figure 6.13. There is a constant amplitude response at critical gain shown in Figure 6.14. For a span of three seconds the amplitude is increasing in Figure 6.13 whereas in Figure 6.14 it remains almost constant. The inference drawn from these graphs is to look for any convergence or divergence. The purpose is to determine the critical gain value at which the system becomes critically stable, that is, it gives a sinusoidal output. Figure 6.9 Root locus plot Page 89
Figure 6.10 Root locus zoomed view Figure 6.11 A sinusoidal response at critical gain value Page 90
Figure 6.12 Converging step response Figure 6.13 Divergent step response at higher gain value Page 91
Figure 6.14 Constant amplitude sinusoid waveform at critical gain. Although the result obtained for critical gain value is not purely sinusoidal, the same gain value, under same operating conditions, gave a perfect sinusoid in LabVIEW. The resulting gain is shown in Figure 6.15. The period of the curve again comes out to be 500ms. Thus the result for this particular value is verified. It is observed that the critical gain value is just above 44.399 i.e. at 44.400, at which the system becomes unstable and continues to oscillate sinusoidally. However, at the value 44.399, the response becomes converging after a long period of time which cannot be seen here because the time has been auto-scaled. But the indicator shows that the system is stable. The purpose is to determine the critical gain value at which the system becomes critically stable, that is, it gives a sinusoidal output. That is the theorem upon which the Ziegler-Nichols method is established for PID controller design. Page 92
Figure 6.15Constant amplitude sinusoid waveform at critical gain using LabVIEW 6.3 DESIGN OF THE PID CONTROLLER Once the PID parameters are obtained using the Zeigler-Nichols method, the initial PID controller can be designed. These parameters are not tuned however, and thus sufficient iterations need to be performed with these initial values before getting the finalized parameters for the controller. In the proposed work, parameters such as maximum overshoot percentage, rise time, settling time were given more importance in determining the optimum PID controller parameters. The maximum overshoot percentage relate to the excess of angular movement provided. Hence lesser this value, better the design. Rise time relate to the time taken for finally reaching the desired angular displacement in the AFO, hence smaller the value better the design. Settling time relates to the time taken for the output to become stable and thus emphasizes the fact that the final output should not oscillate as it causes discomfort to the patient. Hence, for the initial design improvement, only these major factors are given importance. Page 93
The PID controller is implemented in parallel mode form. This can be explained with the equation 6.3: (6.3) In this equation, u(t) is the controller output, e(t) is the error input to the controller : error is calculated after subtracting the reference input and the feedback input. Several different forms of the Basic PID controller exist which can be implemented to get the desired output response. Three such variations were implemented to get their response and evaluate them. The first one involved the basic PID controller in series with the plant and actuator model (without the use of any derivative filter) as shown in Figure 6.16. The second involved the use of a derivative filter in the derivative part of PID controller as shown in Figure 6.17. It is a simple Nth order low pass filter and it is only used with the derivative part because the D of PID controller is very sensitive to noise. The D deals with the rate of change of error at controller input and so if there is any noise present at the input of the controller, it will result in the derivative part to give a very high output for no reason at all and this could cause the hardware to get damaged. Thus to avoid the effect of noise in such a manner, called as the derivative kick, a low pass filter of appropriate order is used. Again the order is iteratively determined using simulation in MATlab codes. The third form of implementation is by using the derivative in the feedback part around the plant as shown in Figure 6.18. Figure 6.16 PID block without derivative filter. Page 94
Figure 6.17 PID block with derivative filter. Figure 6.18 PID block with Derivative and its filter part in feedback [67]. From the Figure 6.18, it is observed that the derivative part of the controller along with the filter of order N is present in the feedback around the plant model. This is done to avoid the derivative kick phenomenon. However, this trick is useful only if the damping ratio of the device is much less than 0.7 (zeta value) else the system output will be severely degraded. Hence the PID controller being used has the derivative part in series with the plant and the actuator model and not around the plant as feedback. The PID controller equation in parallel form with the derivative filter, in Laplace domain is shown in equation 6.4: ( ) ( ) { ( ( ) ( ))} (6.4) Where, U(s) is the controller output and E(s) is the controller input. 6.3.1 PID implementations The initial PID parameters are obtained from the critical gain and period values. The values are listed below: K P = 26.6437 Page 95
Ti = 0.25 Td = 0.0625 The first implementation is that of a PID controller without the derivative filter, PID block being in series with the plant. Figure 6.19 shows step response for the same and the transient responses are: the rise time is 0.0833 seconds, settling time is 1.8405 seconds and percentage of overshoot is 57.9011. Response of PID implementation with filter in the derivative part is shown in Figure 6.20. Its transient responses are: the rise time is 0.0797 seconds, settling time is 1.8082 seconds and percentage of overshoot is 58.7606. Finally the selection of the PID controller with derivative filter, attached in series to the plant and actuator is selected for final implementation. The order of the filter has been taken as 20 since the performance is coming optimum at this particular value. Figure 6.19 PID response without the derivative filter Page 96
Figure 6.20 PID response with derivative filter in series with plant 6.3.2 PID manual tuning After obtaining the results from the three implementations of PID, the controller has been manually tuned by writing an improvised manual tuning code. In this code the parameter K P was varied in steps of 1, T i is varied in steps of 0.1, and T d i s varied in steps of 0.01. The step increment values are chosen after observing the initial values. 100 iterations are performed, and the values from the each iteration are observed to determine the best performance characteristics. Within the 20 to 30 iteration cycle period, the best performance characteristics are observed, above which the step responses became unstable. Thus again the iterations are performed in this range to determine the best possible parameter combination among all. The performance criterion is decided to be in such a manner that the maximum overshoot percentage be less than 15% and the rise time and settling time should be lesser than 0.5 seconds. When these parameters are met, the iterative loops are stopped. Thus the finalized parameters for the PID controller are given as follows: K P = 27.8812 Page 97
T I = 1.9833 T D = 0.2108 The step response of the optimized PID controller is shown in Figure 6.21. The difference in performance is easily observed, when compared to the previous graphs on the same. The performance analysis of the controller implemented shown in Table 6.2. The controller claimed optimum shows the best performance in terms of rise time, settling time and overshoot. Figure 6.21 PID optimized response TABLE 6.2 PERFORMANCE ANALYSIS OF CONTROLLER IMPLEMENTED. Parameter PID with derivative filter PID without derivative filter Optimum PID Rise time (seconds) 0.0797 0.0833 0.0355 Settling time (seconds) 1.8082 1.8405 0.4406 Settling min (radians) 0.6571 0.6554 0.9018 Settling max(radians) 1.5876 1.5790 1.1487 Peak time (seconds) 0.2376 0.2411 0.0936 Over shoot ( ) 58.7606 57.9011 14.8738 Under shoot( ) 2.2543 3.3801 3.8402 Peak (radians) 1.5876 1.5790 1.1487 Page 98
6.4 CONCLUSION An optimal control system for the active ankle foot orthosis is designed. The design procedure involved the implementation of the plant model and the actuator models in the beginning. The Multi-body foot model is simulated and the results obtained. Using the plant model the torque requirements for the motor are determined, which thus helped in the selection of the actuator of the system. The implementation of different controllers is done and the optimum setting is chosen and the reasons for the same are shown. The improvised auto-tuning of the PID parameters is performed to get best performance of PID gain values. In the controller design maximum overshoot percentage, rise time, settling time are given more importance. Their significance is given. The best design shows minimum rise time with 0.0355 seconds, minimum settling time of 0.4406 seconds and minimum overshoot of 14.8738 compared to other two implementations. Further parameters can be added into the analysis to make the design more efficient. Page 99