Professional Documents
Culture Documents
Abstract
This paper provides a study on the performance of the nonlinear regression/artificial neural
network hybrid optimization model on the PID controller coefficients of the nonlinear twin rotor
yaw system. The study was conducted using experimental data acquired from the live plant. The
software used is Wolfram Mathematica 11. R2 values above 0.6 are deemed acceptable and values
above 0.85 are deemed a good performance. The paper provides insight to the working of the title
model on a real plant with given parameters and steps between the acquisition of the data and the
optimization, focusing largely on the regression methods. The method of the study is to perform
nonlinear regression on the original data, which consists of PID parameters as independent
variables and settling time, rising time and maximum overshoot of the plant as dependent variables.
The data set is then split into training set and test set. The regression models are trained on the
training sets and tested for performance on the test sets. The study then continues on the final
model, which is a nonlinear model that takes the PID parameters, rising time and maximum
overshoot to predict the setting time. The performance of this model is again tested using the ANN
method. Then the optimization of the inputs to minimize the output with given constraints is
performed and evaluated. This study offers insight on the performance of the title model using
multiple inputs and outputs, examines the performance and robustness of a multiple optimization
method and provides comments on the success and failures of the methods used.
1. Introduction
The Twin Rotor MIMO System (TRMS) is a laboratory experiment set designed by Feedback
Instruments Ltd (Figure 1) [1]. In certain aspects, it behaves like a helicopter. Due to its multi-input
and multi-output structure, multi-axis motion capability and non-linear dynamics, it is frequently
1
used in the modeling and inspection of control systems. Because of high non-linearity and cross-
coupling factor between rotors, designing a controller for position of TRMS is a challenging work.
The mechanical structure of the system consists; bearing mounted on a fixed rod, two rods
attached to the bearing and two propellers placed perpendicular to each other to allow the bearing
to move horizontally and vertically at a certain limit and a mass attached to bearing with a rod to
reduce dynamic effects (Figure 2).
Main propeller of the system provides vertical, tail propeller provides horizontal movement,
the pitch move occurring in the vertical plane around the horizontal z and x axes caused by main
propeller, yaw movement in the horizontal plane around the vertical y axis due to the tail propeller
(Figure 2).
Proportional–integral–derivative (PID) controller is widely used to control TRMS. While
designing a PID controller the gain constants of each parameter (Kp , Ki , Kd ) is crucially important
to make system stable , fast and accurate. Those gain parameters can be tuned with experimental
tuning methods. As will be discussed later, those experimental tuning methods end up with
unsatisfactory results for TRMS.
Many students and even researchers tune gain parameters manually with certain constrains
until they come up with mediocre controller. This exhausting, time consuming and unreliable trial-
error method generally creates a controller which is not applicable or applicable with many
restrictions (small working range, high sensitivity for noise factors).
This study focuses on tuning PID parameters for yaw movement of TRMS with optimization
approach in Mathematica software environment [2]. Yaw movement’s response to PID parameters
is modeled with nonlinear regression/artificial neural network hybrid method based on
experimentally generated dataset which contains settling time(T s), rising time (Tr) and maximum
overshoot (µ0) responses of the system to different PID parameters (Appendix A). After modeling
is completed, settling time is minimized, maximum overshoot and rising time constrained as
minimum as possible. After the minimization process, obtained PID parameters are implemented
on TRMS. Response of the system to obtained PID parameters and performance of the optimization
model are discussed.
Figure 1 - Twin Rotor MIMO System Figure 2 - Twin Rotor MIMO System Motion Schematic
2
2. Literature Review
The optimization problems studied in this paper are the minimization of settling time as a
function of PID coefficients with maximum overshoot (µ0) and rising time (Tr) given as
constraints using the nonlinear regression/ANN hybrid optimization model. The objective
function (Eq. 1) is the function of T s. This function is created by fitting a nonlinear regression
3
model on the related part of the data set (Appendix 1) using FindFit [12] function of
Mathematica software. The model was used throughout all fitting tasks during the study as it
proved reliable.
where;
𝑐𝑘 = {0,5,13,25},
𝑑𝑘 = {2,3,4,5}
The minimization of the objective function was carried out in three different methods with
constraints given in Table 1.
Method Constraints
Differential Evolution 1≤ Kp ≤ 10
10≤ Ki ≤ 100
1≤ Kd ≤ 10
Simulated Annealing 5≤ Tr ≤ (Ts-3)
2≤ µ0 ≤ 10
9≤ Ts ≤ 20
Nelder Mead
The constraints for PID controller coefficients were chosen in the given range as it was
reasonable from an engineering point of view. While the system is operable outside of the given
ranges, the chosen ranges were previously operated in and was proven to be robust. This range
selection eliminated the need for further investigation of the behavior of PID coefficients.
The range selection for Tr was straight-forward. Tr cannot, naturally, be shorter than Ts, and
it is the system’s property that it is unnatural for it to rise faster than 5 seconds while operating in
the given PID coefficient range. It also, from an engineering point of view, cannot be faster than
(Ts-2) seconds.
The constraint on µ0 was a desired property. As µ0 increases, the plant’s robustness decreases
as it is more susceptible to external disturbances as indicated by the highly nonlinear nature of the
plant. A lower limit was set as 2 as a lower overshoot was never observed on plant.
The range selection for Ts was made for this same reason, and the plant is desired to settle
quickly. The goal of the optimization in this paper is therefore to find a minimum of the objective
function Ts in the given range. The lesser limit of T s was provided as it would be unnatural of the
system to settle in less than 9 seconds regarding the plant’s nature.
4
The use of the same constraints was decided upon as it would also provide insight on the
performances of different methods under certain conditions. The constraints µ0 and Tr were also
modeled with the fourth order nonlinear model, also dependent on PID coefficients, to be used
during the initial regression work and the optimization process.
In order to visualize the dynamics of yaw movement and create a comparison baseline for the
optimization results, experimental modeling of the system and PID Tuning on the created model
is performed in MATLAB environment.
Step Response method is used to identify the model. Step Input (Corresponds to constant 255
input signal for experimental setup) is applied to the system for 8 seconds with 50 ms sample rate
and positional outputs are recorded as raw sensor (optical encoder) data. (Figure 3,4).
5
Then step response of the yaw motion is applied to MATLAB System Identification Toolbox to
create a model that fits best to the output, %96 fit ratio is achieved (Figure 5).
After modeling is completed, MATLAB provided a discrete-time transfer function of the yaw
motion as given below:
−5.613 ∗ 10−7 ∗ z −1
𝑇𝑟𝑎𝑛𝑠𝑓𝑒𝑟 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 =
1 − 2.933 ∗ z −1 + 2.87 ∗ z −2 − 0.9367 ∗ z −3
With modeling completed, PID Tuning is performed on the created model’s transfer function in
MATLAB PID Tuner Toolbox. Tuned response, Generated PID Parameters and PID controller
performance on simulation is given in Figure 6,7.
6
Figure 6: Tuned PID Response of the Model
Generated PID parameters are implemented into real TRMS setup, ±%5 error was also
considered as tolerable. Response of the system is plotted (Figure 8) and controller performance
was recorded (Table 2).
7
Figure 8 - Obtained Output from the Experimental Setup with generated PID Parameters
In generation of the PID parameters, robustness and response time parameters in PID Tuner on
MATLAB are changed to obtain different PID parameters and performances. Parameters that
offers higher response speed caused high maximum overshoot which is undesirable because
when yaw motion overshoots highly, its settling time significantly increases and causes more
cross-coupling effect, adding more disturbance. Controller which was obtained and described
above had low overshoot but it was extremely slow. Tuning PID parameters with experimental
modeling resulted with unsatisfactory performance. Resulting outputs and performance are
recorded for comparison with result of optimization process.
5. Methods
Nonlinear regression is a common practice used in optimization studies which has proved its
reliability. This method consists of two steps; introducing a model of nonlinear nature that is a
function of input design variables, and finding the coefficients of each term which provide the
highest score in a fitness evaluation, usually by using iterative methods on a computer
environment. This is also an example of supervised learning machine learning practice, as the
correct outputs for each input are given to the model for comparison. In this paper the model used
has been defined as a fourth order nonlinear model given in Eq. 1, and the iteration process was
conducted using the FindFit function of Mathematica. This function is able to iterate to the
closest match to the data using different methods, such as Gradient Descent, Newton and
8
Levenberg Marquardt methods. In this study, Conjugate Gradient method was preferred for its
ability to reach a minimum in fewer steps [13].
The fitness evaluation throughout the study was decided to be the R2 (Eq.5) [14], as it is used
most commonly in optimization studies as the coefficient of determination. The cost function to
be minimized on nonlinear regression practices on this paper was chosen as sum of squared errors
(SSE) (Eq. 3) [15], as it is the most common and most easily implemented cost function for
regression tasks.
𝟔𝟒
𝟐
̂)
𝑺𝑺𝑬 = ∑(𝒀 − 𝒀 (𝟑)
𝒊=𝟏
𝟔𝟒
where 𝑌̂ is the output of the nonlinear regression model to the corresponding input variables.
Artificial Neural Networks (ANN) are also widely used in many computational tasks such as
optimization, control theory and signal processing. The idea of ANN was derived from the
operation of human neurons. The principle of ANN is to provide inputs to a neuron, with each
input having a certain weight, and the output is simply the summation of all x*w values
compared to a bias.
This aspect, however, was not used in this paper. Rather, to construct a nonlinear
regression/ANN hybrid model, the training and test aspects of ANN was adopted. This
application is to divide the original data set in two sets. In the hybrid method, the nonlinear
regression model is trained on the training set of the data, and then tested for fitness on the test
set. This ensures the model’s performance is satisfactory on data it has not encountered before.
6. Optimization Process
The dataset chosen for the optimization problem studied in this paper consists of a total of 384
experimental data, 64 samples for each variable. The independent variables of the data set are the
PID controller parameters, Kp, Ki and Kd. The data was obtained by purely experimental means.
The system was guaranteed to settle and be isolated from environmental disturbances before
each sampling process to ensure the integrity of the data.
The initial nonlinear regression work on samples, as all other optimization operations, were
9
conducted using Wolfram Mathematica 11. All variables were defined as arrays of their
respective samples. The 4th degree nonlinear model with 3 inputs was defined to be used at this
stage. This model will hereby be referred as the preparation model.
Three 64x4 tables in the form of
were constructed to be used in the FindFit function. All three data tables were used to find a
fit by modifying the coefficients,
𝑎𝑛 , 𝑏𝑛 𝑛 = {1 2 … 31}
of the preparation model to minimize the sum of square errors. After the fitting, the
respective 𝑅2 values for each fit was calculated using equations (3), (4) and (5).
𝑹𝟐
Dependant Variable
0.99
Tr
0.94
µ0
0.99
Ts
Table 3 - Initial regression results
In all graphics on this paper, dots stand for the original data, while lines represent the fit
functions. Figures 10, 11 and 12 show the fitted function versus the original data.
10
Figure 11 - Mo initial fitting
For the hybrid model, the entire dataset was split in two parts as training set and test set. The
initial study of this model was performed by splitting the datasets formed before to be used with
the preparation model.
The amount of the training set was chosen to be the 85% of the entire data. The rest of the
data was assigned to the test set. This separation was done using the RandomSample [16]
function of the Wolfram language and done so that two sets would consist of random rows of the
initial dataset.
As a result of the separation, a randomly ordered training set of 54 variables and a test set of
10 variables were formed.
The preparation model was fitted using the FindFit function on three different training sets
for each independent variable.The 𝑅2 values of the fits on the training sets are presented in Table
5.
11
Dependant Variable 𝑹𝟐
0.99
Tr
0.93
µ0
0.99
Ts
Figures 13, 14 and 15 show the fits of the model on the three training sets.
Mo Training Set
20
15
10
Mo Fit Data
Index
10 20 30 40 50
12
Figure 15 - Tr training set fitting
After the models were trained on the training sets and satisfactory 𝑅2 values were acquired, the
trained models were applied on the respective test sets. Table 6 shows the 𝑅2 values for the fits
on the test sets.
𝑹𝟐
Dependent Variable
0.93
Tr
0.95
µ0
0.97
Ts
Figures 16,17 and 18 show the test set values and their fits.
13
Figure 17 - Mo test set fitting
The optimization goal of the study is to minimize Ts with the inputs Kp, Ki and Kd and Mo and
Tr as constraints. This process was carried out using the NMinimize function on Mathematica
software [17]. This function minimizes the input function dependant on input variables with
respect to constraints. For this exercise, all previous output variables were transformed to
functions of the same variables. NMinimize function was then ran three times with different
methods. The results are shown in Table 7.
14
Method Kp Ki Kd µ0 Tr Ts Time(s)
7. Stability Results
For stability test, the actual model was applied to a series of test sets that is a percentage of
the elements on the original test set added to them until unreasonable outputs were acquired in
order to get insight on the robustness of the model. The randomly picked 10% of the input data is
presented in Table 7.
Kp Ki Kd
10 40 4
4 10 7
10 100 4
10 100 1
10 40 10
4 100 7
Table 7 - Stability test inputs
Inputs were altered by up to ±50%. The results are given in Tables 8, 9, 10.
Ts X1 X2 X3 X4 X5 X6
Real Values 24.6561 66.9365 13.371 15.4928 26.3391 17.3708
∆=0% 24.8991 66.9545 13.3343 15.4118 26.2124 17.5521
∆=1% 24.6902 69.4458 10.3851 15.106 25.4656 17.517
∆=-1% 25.1013 64.3454 14.6241 15.667 26.9081 17.5835
∆=5% 23.7224 77.9125 22.0229 12.6549 21.6173 17.3164
∆=-5% 25.8769 53.1596 16.4521 16.3996 29.3622 17.6946
∆=10% 21.3739 105.728 19.2458 52.5223 39.2572 17.0359
∆=-10% 26.8494 39.1893 17.2526 17.0197 32.0985 17.8302
∆=15% 202.193 87.1017 18.1887 20.6862 -224.63 18.361
∆=-15% 27.901 27.314 17.7496 17.5259 34.8318 17.9865
∆=20% 27.3263 86.7645 17.8192 18.8762 53.0688 17.9532
∆=-20% 29.0925 18.4541 18.1754 18.0062 37.8131 18.1823
∆=30% 24.4134 82.1139 17.3888 17.7189 35.4185 17.7885
∆=-30% 32.1572 8.5428 19.0681 19.0614 45.4436 18.7802
15
∆=40% 23.3805 76.503 17.1151 17.2024 31.3152 17.7526
∆=-40% 36.7973 4.75182 20.2539 20.4853 57.4489 19.9069
∆=50% 22.699 71.7391 16.9126 16.8746 29.1638 17.7534
∆=-50% 44.5752 3.47635 22.1138 22.7435 77.9416 22.2917
Table 8 - Ts stability results
Tr X1 X2 X3 X4 X5 X6
Real Values 18.7549 63.4742 10.9084 9.91063 19.3722 9.88991
∆=0% 18.8694 63.2117 11.4139 11.6278 21.7619 10.8651
∆=1% 18.7832 64.6299 11.3916 11.606 21.6638 10.8396
∆=-1% 18.9578 61.8204 11.4367 11.6502 21.8626 10.8912
∆=5% 18.4598 70.5854 11.3073 11.5233 21.2952 10.7431
∆=-5% 19.3363 56.5108 11.5332 11.7447 22.2932 11.0019
∆=10% 18.1059 75.9876 11.2287 11.4369 20.0706 10.6116
∆=-10% 19.8731 50.4045 11.6677 11.8763 22.903 11.1564
∆=15% 17.7754 87.7457 11.1251 11.3442 20.5136 10.5349
∆=-15% 20.4967 44.8276 11.8204 12.0254 23.6097 11.3322
∆=20% 17.4867 97.7842 11.0466 11.2669 20.1833 10.4454
∆=-20% 21.2293 39.725 11.9953 12.1959 24.438 11.534
∆=30% 16.9911 121.638 10.9095 11.1318 19.6157 10.2894
∆=-30% 23.1562 30.7644 12.4341 12.6218 26.6054 12.0421
∆=40% 16.5813 152.232 10.7938 11.0176 19.1455 10.158
∆=-40% 26.0893 23.2314 13.0513 13.2166 29.874 12.7606
∆=50% 16.2369 192.754 10.6948 10.9198 18.7499 10.0459
∆=-50% 31.0209 16.9202 13.9805 14.1023 35.2829 13.8485
Table 9 - Tr stability results
µ0 X1 X2 X3 X4 X5 X6
Real Values 74 26 12 53 54 68
∆=0% 76.0031 19.9566 12.2869 52.9574 56.8982 71.1031
∆=1% 85.0525 19.2461 11.3864 52.753 59.8422 77.6664
∆=-1% 68.2063 20.665 47.589 53.1034 54.1144 65.1745
Table 10 - Mo stability results
8. Performance Comparison
Optimization process provided three different PID parameters corresponding to three different
minimizing methods. Generated PID parameters implemented into the real plant and comparison
between experimental model’s and minimizing methods’ generated PID parameters are
performed and visualized.
16
A) Differential Evolution Method vs. Experimental Model
17
B) Simulated Annealing vs. Experimental Model
18
Kp Ki Kd Rising Settling Maximum
Time(T r) Time(Ts) Overshoot(µ0)
1 65.66 3.88 10.65 13.6 seconds %13
seconds
Table 14 - Nelder Mead Method Performance
The hybrid model proved to be a useful tool in order to design robust models. The model
trained on the training sets performed expectedly well on the test sets The optimization process
gave highly meaningful results.
According to Figure 19 and comparison between Table 11 and Table 12, differential
evolution method performed better in Rising Time and Settling time but performed significantly
worse in Maximum Overshoot. But when compared to decrease on Rising and Settling Time,
increase on maximum overshoot can be tolerable. It can be observed that differential evolution
method is performed better than experimental model.
According to Figure 20 and to the comparison between Table 11 and Table 13, Simulated
Annealing Method performed significantly better in terms of Rising Time and Settling time but
performed notably worse in Maximum Overshoot. But due to high Ki value system stabilized
exactly at reference point without necessarily a need for ±5% tolerance. Simulated Annealing
Method was more stable and faster than experimental model but high overshoot may cause
problems on different reference values.
19
According to Figure 21 and comparison between Table 11 and Table 13, Nelder-Mead
method performed better in Rising Time and Settling time compared to the model, but performed
worse in Maximum Overshoot. Nelder Mead method’s generated PID parameters also enabled
the system to stabilize at near reference level, it can be said that its overall performance was
better than that of the experimental model’s.
According to Figure 22 and comparison between Table 12, 13 and 14, Simulated Annealing
method’s performance on rising time was shorter than the other methods but high maximum
overshoot and settling time sets its performance as the most undesirable among the other
methods. Differential Evolution and Nelder Mead methods almost performed the same, but
Nelder Mead method scored slightly shorter on rising and less overshoot, and outperformed all
methods slightly on settling time. As an overall conclusion Nelder Mead method generated the
most desirable PID coefficients on this paper.
During the initial study of nonlinear regression, the fourth order model proved to be of
sufficiently high degree. During the hybrid model trials, µ0 could not be fitted as good as the rest.
This is due to the high nonlinearity of µ0 and to the randomness of the overshoot amount of the
twin rotor MIMO system’s aerodynamic properties. The lack of good predictions of µ0 may
indicate that the dominant parameters of this variable are not the PID parameters. Further
research may be required on this subject.
The final model provides insight to the model performance affected by the number of inputs
whether they be direct inputs or constraints. The increased input number made it easier to
correctly predict outputs. This leads to the notion that there may be more parameters other than
the PID parameters affecting the settling time. Another interesting proposal is that there is likely
some intercorrelation between the chosen outputs of this study.
The actual model stability range is determined to be ±1%, again µ0 being the limiting factor.
Ts and Tr performed unexpectedly well on the stability test, scoring ±50% stability range.
However, since µ0 is a constraint, its range is the limiting factor. Outputs differ greater than
reasonable limits. It is less than expected, but not unlikely considering the nature of the plant
worked on. The stability of the model may be dictated by the degree of the model, as it is as high
as one would expect, but in this study, the lowest order model was deemed to be the best given it
performed within acceptable limits as it would save computing time.
This paper has presented a study on the optimization of the PID parameters of a nonlinear
plant controller with the ANN/Regression hybrid model.
10. References
[1] Leybold, "Set Twin Rotor MIMO System," [Online]. Available: https://www.leybold-
shop.co.uk/set-twin-rotor-mimo-system-33-007-pci.html.
[2] Wolfram, "Mathematica 11," [Online]. Available: https://www.wolfram.com/mathematica/.
[3] Feedback Instruments, "Twin Rotor MIMO System," [Online]. Available: http://www.feedback-
instruments.com/pdf/brochures/33-007-PCI_datasheet_TwinRotorMIMO_MATLAB_10_2013.pdf.
[4] Toha et al., "Ant Colony Based Model Prediction of a Twin Rotor System".
[5] A. Rahideh and M. H. Shaheed, "Mathematical dynamic modelling of a twin-rotor multiple input-
multiple output system".
[6] Wen and Lu. [Online]. Available: http://ieeexplore.ieee.org/document/4668654.
[7] Juang and Liu. [Online]. Available: http://ieeexplore.ieee.org/document/5230018/.
[8] Ahmet et al., "LPV modelling and control of a Twin Rotor MIMO System".
20
[9] B. B. Alagoz, A. Ates and C. Yeroglu, "Auto-tuning of PID controller according to fractional-order
reference model approximation for DC rotor control".
[10] "Mohd Suhairil Meon," [Online]. Available: http://ieeexplore.ieee.org/abstract/document/6268848/.
[11] "F. Allouani," [Online]. Available: http://ieeexplore.ieee.org/abstract/document/6196611/.
[12] Wolfram Mathematica, "FindFit," [Online]. Available:
http://reference.wolfram.com/language/ref/FindFit.html.
[13] W. Mathworld, "Conjugate Gradient Method," [Online]. Available:
http://mathworld.wolfram.com/ConjugateGradientMethod.html.
[14] Penn State, "The Coefficient of Determination, r-squared," [Online]. Available:
https://onlinecourses.science.psu.edu/stat501/node/255.
[15] Stanford, "Error Sum of Squares," [Online]. Available:
https://hlab.stanford.edu/brian/error_sum_of_squares.html.
[16] Wolfram Mathematica, "RandomSample," [Online]. Available:
http://reference.wolfram.com/language/ref/RandomSample.html.
[17] Wolfram Mathematica, "NMinimize," [Online]. Available:
http://reference.wolfram.com/language/ref/NMinimize.html?q=NMinimize.
11. Appendix
1. Dataset
21
7 70 7 12.57220412 19.55582679 53
7 40 7 19.09296622 26.73785249 56
7 10 7 61.81325953 79.14029822 19
7 100 4 9.771772829 15.55250348 70
7 70 4 12.57284044 19.57420032 48
7 40 4 18.89238501 24.71683697 66
7 10 4 65.13861544 68.25767866 23
7 100 1 9.690811418 16.45181023 86
7 70 1 12.15211987 19.03306967 89
7 40 1 18.91389395 25.87558767 89
7 10 1 65.09531373 72.89525279 48
4 100 10 10.49056573 12.9886248 14
4 70 10 13.2305664 15.71236773 14
4 40 10 19.73400655 22.81515112 22
4 10 10 63.89416291 68.19574961 27
4 100 7 9.889905255 17.37076435 68
4 70 7 13.09057529 17.09219806 21
4 40 7 19.03516455 26.1969133 51
4 10 7 63.47415011 66.9365133 26
4 100 4 10.20825692 19.33175622 96
4 70 4 12.13097921 18.15225447 61
4 40 4 19.17520422 26.35847454 53
4 10 4 64.19569592 67.03681062 20
4 100 1 9.430426816 16.25047112 78
4 70 1 12.11230765 20.63475766 95
4 40 1 19.13268251 25.31611468 27
4 10 1 64.39783043 67.45708119 24
1 100 10 10.06759001 15.77199073 61
1 70 10 12.75224587 21.17555198 37
1 40 10 18.97290391 24.43704778 46
1 10 10 61.75227468 79.74284358 25
1 100 7 9.888994197 17.63423897 48
1 70 7 12.86925052 21.8767711 32
1 40 7 18.95433025 26.41825582 60
1 10 7 66.25761472 68.15745437 4
1 100 4 9.73145298 17.69181248 71
1 70 4 13.55279203 15.47244799 6
1 40 4 19.21747605 24.79888628 51
1 10 4 66.21529393 68.09899586 2
1 100 1 9.788736748 17.19266432 57
1 70 1 12.65037315 19.95630039 67
22
1 40 1 19.75389075 27.01706892 27
1 10 1 62.48944941 75.81823443 35
23