45709865 System Identifiction of Servo Rig
-
Upload
salman-zahid -
Category
Documents
-
view
47 -
download
1
description
Transcript of 45709865 System Identifiction of Servo Rig
Prof Ian French MSc Control & Electronics
TEESSIDE UNIVERSITY
SCHOOL OF SCIENCE AND TECHNOLOGY
MSc CONTROL AND ELECTRONICS
System Identification and Adaptive Control
Karthik Kumar Naddi
J9026070
08 April 2023
1Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
PART 1-SYSTEM IDENTIFICATION:
1) Describe with the aid of diagrams why it is important to select an appropriate
sampling time when performing system identification. Describe a sampling method
that may be used to select an appropriate sampling time for the lab servo.
2) Why it is important to remove outliers, bias and trends prior to parameter estimation.
Illustrate your answer using results based on the s_datagen_b.mdl simulink model.
3) Why will the basic Least Squares method result in biased estimated when used to
estimate the parameters of an ARMA type model. Show that IV will result in
unbiased estimates.
4) Using the results obtained during the practical sessions, outline the steps needed to
obtain discrete transfer function models of the lab servo, for both the velocity and the
position.
PART 2-ADAPTIVE CONTROL:
5) Describe the Recursive Least Squares algorithm. Why is the RLS algorithm more
suited to the adaptive control problem than the basic LS algorithm?
6) Outline the theoretical basis of the phase margin design algorithm used in the self-
tuning PI control tutorial.
7) Using the results obtained during the in the practical sessions, outline the steps needed
to design and apply a PI controller for the velocity of the Lab Servo.
8) Using the results obtained during the in the practical sessions, outline the steps needed
to design and apply a PIP controller for the position of the Lab Servo.
2Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Abstract:
In this assignment we are discussing system identification and adaptive or model based
control. The system identification scope includes all aspects of system modelling and
identification, from theoretical and methodological developments to practical applications. It
also includes the topics of model selection, identification methods, fault detection,
experiment design etc. In this we are using a servo-rig system to obtain mathematical model
which corresponds to the working of the servo-rig without using known laws, equation or
system behaviour which is associated with the device. We are also using Matlab and
Simulink programs to eliminate time consuming calculations which are associated in the
Automatic PIP controller for this servo-rig.
In this we use identification tool box to obtain appropriate discrete parametric models such as
position, velocity for the laboratory servo rig by using matlab programs like data collection,
structure selection and data conditioning. Following we are using the models to obtained
design and implement in pip controllers from laboratory servo-rig and then compare the
simulink response that are obtained with the real system response.
3Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
CONTENTS
1) INTRODUCTION:........................................................................................................................5
2) SAMPLING TIME:.......................................................................................................................5
3) Data Preprocessing:...................................................................................................................8
4) Bias of the Least Squares Estimator:..........................................................................................9
4.1) Instrumental variable methods:...........................................................................................11
5) Discrete transfer functions for velocity and position of servo rig:..............................................12
5.1)Young’s Information Criteria (YIC):........................................................................................14
6) Recursive Least Squares algorithm:.........................................................................................18
7) Phase Margin Algorithm:.........................................................................................................19
8) PI CONTROLLER FOR SERVO:....................................................................................................20
8.1) STPI controller for Position of servo rig:..............................................................................23
9) PIP CONTROLLER FOR SERVO:..................................................................................................24
10) Conclusion:..........................................................................................................................28
11) Reference:..........................................................................................................................29
4Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
1) INTRODUCTION:
System Identification is defined as the name given to the process of identifying models from
experimental data. This process is in a compact way and most useful to summarise the
knowledge about a process. The system response modelled with a mathematical relationship
with the given system input and obtained system output by the classification of the systems in
the sense of the system response is also known as system identification. For communication
and education, this model is very useful tool.
This model is designed and used for a number of reasons but in the field of engineering it is
used for three different tasks.
Used for the design of control system,
For forecasting and prediction and
Used for fault analysis and condition monitoring.
By one mathematical model this process is not characterised. The hierarchy of models should
depend on the models ranging from complex and detailed simulation to simple and easily
manipulated models. The gross features of the system behaviour are obtained by the simple
models which are used for exploratory purposes and to develop complicated models it takes
long time. The models can be available by two various principles from the prior in terms of
physical laws or by the experimentation of the process. Here the experimental process is
known as the system identification.
2) SAMPLING TIME:The selection of the sampling time is very important when using least squares system
identification techniques to estimate the parameters of dynamic discrete time systems. If the
sampling time is taken too long then the important information is lost and the process will
appear to be simple gain element. And if the sampling time is taken too short then changes in
the observed output will approach the noise levels of the system and all the meaningful
5Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
information is lost. In selecting sampling time, some conditions are usually provided to
accommodate processes with different output responses. Intuitively, sampling time has to be
smaller than the settling time for discrete control to be effective in order to allow the system
act without contradicting interference.
The choice of sampling time is a key issue in automatic digital control. Selection of sampling
time has major influences on many properties of the system under observation such as
rejection of load disturbances and measurement noise, and sensitivity to un-modelled
dynamics.
The selection of an appropriate sampling interval can be obtained by statistical analysis of the
data, based on ‘information’ content. It is, however, somewhat easier to use an iterative
approach to the model building process and use simple test to give the information required
to select the sampling time.
If we define the rise time of the process as the time taken for the process to move from 5% to
95% of its final steady state value. Then a good thumb rule suggests that the sampling period
should lie in the range Trise/15 < Ts < Trise/5 this rule is consistent with the sampling theorem.
Fig1: Data collect servo model
6Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Fig2: Velocity of the servo
Data collect servo model is used to collect the data from the servo rig. In the above graph we
can see the data collected from the servo rig for the velocity. To get the reasonable sampling
time, we have to calculate the rise time (Tr). By using the below graph we can clearly say that
the rise time (Tr) is 1sec.
Fig3: velocity of the servo
From the above graph we calculate the sampling time
Here rise time =1sec
The thumb rule is that the sampling time must be in the range of Tr/15 < Ts < Tr/5.
Here, sampling time(Ts) = Tr/10
Tr= rise time
Sampling time(Ts)= 1/10
=0.1s
7Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
3) Data Preprocessing:
Fig4: s_datagen_b model
In the above model we can see, some constants were added. These can be adjusted to get the approximate result. Run the above model.
Load the Ident GUI by typing ident in the Matlab command window. Next import the data to
be analysed (which will be u & z ) by clicking on Time domain data in the Import data drop
down menu. Next perform the linear parametric models operation.
Fig5: identification toolbox before removing means
8Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Now pre-process the data click on Remove means from the Pre-process drop down menu. An
additional data set will appear with the last letter d. Drag the new data set to the Working
data and Validation data positions.
Fig6: identification toolbox for removing means
In the above diagram, when we observe the time plot dialog box it is clearly evident that the
starting point is changed after performing the remove means operation. Data conditioning is
very important aspect in the system identification.
4) Bias of the Least Squares Estimator:The question to be addressed is whether the estimates obtained from similar experiments will
cluster about the true value.
Defining the bias as
b = E(θ)- θ
now for the least squares algorithm
θ = [XTX]-1XTY
and for the case the observations of the output, y, are subject to measurement errors we may
write;
Y=X θ + e
Therefore we can write:
b=E{[XTX]-1XT[Xθ+e]}- θ
b= E{[XTX]-1XTXθ-Iθ}+ E{[XTX]-1XTe}
b= E{[XTX]-1XTe}
from the above it is clear that the bias will be zero if the expected or mean value of e is zero.
9Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Consider the output of the following dynamic system sampled at point r, Yr
The output of the process is dependent upon the current state of the input and what that input
was doing for some time in the past. This leads to defining a model with the following
structure:
yr=b0ur+b1ur-1+b2ur-2........+bru0 known as moving average(MA)
The above model can also be expressed in the following structure
yr(z)=b0ur(z)+b1ur(z)z-1+b2ur(z)z-2........+brur(z)z-r
Where z-1 represents a time shift of one sample into the past and is defined by
z-1 = e-sT
T, is the sampling period and is usually fixed.
Alternative logic to above, however, may argue that the value of the output at the current
sample must be in some way related to its value at the previous sample therefore the best
model structure may be defined as:-
yr= -a1yr(z)z-1 –a2yr(z)z-2......-aryr(z)z-r known as Auto Regressive AR
which may be expressed as:
yr(z) = -a1yr(z)z-1 –a2yr(z)z-2........-aryr(z)z-r
The obvious solution to this dilemma is to recognise that the present value of the output is
dependent upon the present and past values of the input together with the past values of the
output. The most probable model structure is therefore
yr = -a1yr-1-a2yr-2.....-apyr-p AR
b0ur+b1ur-2.....+bqur-q MA+
ARMA
10Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
If we rewrite the above structure in matrix form:
Yr=xrT θ
Where
θT = [a1,a2.....ap,b0,b1,b2.....bq]
xrT = [-yr-1,-yr-2....-yr-p,ur,ur-1,ur-2....ur-q]
The equations can be written as
Y = [ y1
.
.yr
] X=[ x1T
.
.xr
T ]Which suggest the least squares procedure can be applied to find θ̂
It is clear from above that the data vector Xr is dependent on past values of the output, y-r to
yr-p. Since the observations of y are in general subject to measurement noise then the estimate
of the parameters, θ, obtained using the standard least squares algorithm must be biased. We
must therefore look for some method for removing this bias.
4.1) Instrumental variable methods:
The bias due to correlation between the data vector and the error can be avoided by
modifying the least squares estimator into the variable estimator:
θ = [ZTX]-1ZTY
Where Z is a matrix closely related to X in which the error correlated repressor are replaced
by other variable (the instrumental variables or just instruments) not correlate with the error.
An additional requirement is that
Det ZTX ≠ 0
Bias of the IV estimator:
Writing the system model, when both X and Y are subject to measurement noise, as
Y = Xθ + (V- Wθ)
Where
M = Y-V
= X-W
And V and W are mutually uncorrelated, zero mean noise sequences.
11Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
The bias of the IV estimator is given by:
b=E (θ ¿ – θ = E {[ZTX]-1ZTe}
=E {[ZT (U+W)]-1ZTV} – E {[ZT (U+W)]-1ZTW}θ
Since Z and e are uncorrelated it follows that θ is an unbiased estimator of θ.
4) Using the results obtained during the practical sessions, outline the steps needed to obtain
discrete transfer function models of the lab servo, for both the velocity and the position.
5) Discrete transfer functions for velocity and position of servo rig:In the identification algorithms, the data collected from the final test is always not good.
Fig7: data collect siac model
12Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Fig8: graph for the position of servo
In the above graph we can clearly observe, the dc level of the servo is different when
compared to the input. The dc level can be changed by dataconditioning.
Fig9: Graph for velocity of the servo
The above graph is for the velocity of servo. Even this graph is conditioned to get the output
with less noise.
Now, the steps to find the discrete transfer function of the servo for both velocity and
position.
Data conditioning:
For data conditioning we have to download an m file called datacond.m.
Datacond.m : this file is used to bias the output signal and filter the noise.
This is a matlab program which is used to condition the data. We have to call this file
whenever we required this function.
For Position,
uu = datacond(u,0.5);
By using the above command the input is conditioned.
pp = datacond(pos,0.5);
now, the position of the servo is conditioned.
13Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
To get the conditioned output, we use the following command
Plot(t,uu,t,pp)
Fig10: Data conditioned output for position
For Velocity,
uu=datacond(u,0.5);
By using the above command the input is conditioned.
vv=datacond(vel,0.5);
now, the velocity of the servo is conditioned.
To get the conditioned output, we use the following command
Plot(t,uu,t,vv)
Fig11: data conditioned output for velocity
5.1)Young’s Information Criteria (YIC):
Different fits and parameter estimates are produced by the particular data sets, different types
of model structures. Generally the parameters numbers are increased with improve in the fit.
The improvements in the parameter numbers are dramatic, until the point of threshold is
reached. The threshold point represents the optimal number of parameters which are needs
for the particular set models. The schemes are proposed to perform this model structure
14Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
selection automatically by searching through a range of structures and assigning to each a
figure of merit denoting efficiency. One suitable figure of merit is known as Young’s
information criteria (YIC).
To get the structure of the servo rig we use YIC model for position.
[nn score fit]=yic(pp,uu,5,5,5)
nn = score = fit =
2 2 1 58.5087 97.5303
1 3 1 58.1364 96.9660
3 1 1 57.9475 95.4774
These fit values denotes us to find the strength of the transfer function. For this position
transfer function these are the fit values. After the procedure follows we will get the best fit
value for the transfer function of the position.
By entering the ident command on the command page, we get the ident toolbox.
15Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Fig12: system identification tool box for Position
After opening the ident toolbox, we have to select the time domain data at the import data
button as our results are time domain based. Now, we have to give the input and output
variables. Then the graph is visible. And then the linear parameter model dialog box we
should give the order and the method is IV. By pressing the estimate button we get the
transfer function.
The transfer function for the position of the servo is,
posu
=0.07133 z−1+0.04348 z−2
1−1.23 z−1+0.225 z−2
16Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
To get the structure of the servo rig we use YIC model for velocity.
[nn score fit]=yic(vv,uu,5,5,5)
nn = score = fit =
1 1 1 58.5397 93.9686
2 4 1 54.3793 94.0302
3 5 1 54.2231 94.0030
By entering the ident command on the command page, we get the ident toolbox.
Fig13: system identification tool box for Velocity
The transfer function for velocity of servo is,
17Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
velu
= 0.4872 z−1
1−0.3018 z−1
6) Recursive Least Squares algorithm:The least squares method is inefficient, in that, if an estimate of the parameters, θ̂ , is made
from r observations then it is not possible to make use of this prior knowledge if subsequently
it is required to update the estimates having obtained one more observation making a total or
r+1. It is again required to fill out the matrices X and Y and then perform the computational
time consuming matrix inversion, [XTX]-1.
Consider the least squares estimates biased on r observations:
θ̂r=( X rT X r)-1X r
T Y r
Where
Y = [ y1
.
.yr
] X=[ x1T
.
.xr
T ]To establish the recursive least squares algorithm, we consider the situation in which we
make one more observation:YY+1
Defining
Pr=[X rT X ¿-1
Then
Pr+1=[[ X r
X r+1T ]
T
[ X r
X r+1T ]]
−1
= [ X rT X r+xr+1 xr+1
T ]
The reculsive least squares (RLS) is used for on-line identification of parameters that vary
quickly with time. In many instances, the identification problem is extremely ill-conditioned.
Consequently, when designing algorithms for such problems, it is essential to exercise care,
otherwise there may be no precision in a computed solution.
18Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Why is the RLS algorithm more suited to the adaptive control problem than the basic LS
algorithm?
By using least squares, the calculations have to be done for every new sample and it is not
efficient. Using RLS the calculation part is very simple and the parameters are varied for
every new sample instantly.
Outline the theoretical basis of the phase margin design algorithm used in the self-tuning PI
control tutorial.
7) Phase Margin Algorithm:For a phase margin design we must ensure that the gain of the FR of the open loop transfer
function (TF).
L02= -Π + ϕm rads
To calculate the phase angle of L02(z) we need to remember that
Z=est
(z-1=e-st)
Now for a frequency response we substitute s=jw.
Hence:
z=ejwT
(z-1=e-jwT)
Thus,
L02(jw)=Kc(1+KiT)b1 e− jwT+b2 e− j 2wT+b3 e− j 3 wT +… ..+b6e− j 6wT
1−e− jwT
Now we know
e-jθ = cosθ – jsinθ
Hence,
∟L02= -tan-1 sin wT¿¿
19Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Using the above formula (for ϕm design) we need to find the frequency ω(which we will call
ωgc)
This is usually done using a simple ‘line search’ algorithm since ωgc must lie in the ramge
0 ≤ ωgc ≤ πT
8) PI CONTROLLER FOR SERVO:A PI Controller (proportional-integral controller) is a feedback controller which drives the plant to be controlled with a weighted sum of the error (difference between the output and desired set-point) and the integral of that value. This STPI describes a variation of Iterative Feedback technique, which aids the PI controller compensating at a fixed level, which is also used for online monitoring which is the case in this assignment. The advantage in using STPI is that user will not be required to distract the system severally, which as a result tuning will not be observed if status of the system does not change.
Technically the STPI uses superimpositions principles, which over reacts to a small injected test signal to levels on the top of fixed set points. As a matter of fact any change in set point will stop the tuning process; this means that STPI cannot be used in variable set point environment.
The self tuning PI controller is designed to control the servo rig, the velocity and position models designed.
The self tuning PI controller selftu1.mdl is loaded into the Matlab current directory.
20Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Fig14: Model for finding the velocity
The above model is the simulink model for the velocity. After running the model, we get the values of control parameters Kc and Ki. In this model we add two displays for finding the valoues of Ki and Kc .We give one dispaly to the product which gives the value of Kc and other one to the mux gives the value of Ki.
Next the transfer function of velocity is given to the model ,then the model is simulated and the values for Kc and Ki are displayed in the model.
Then the ouput at the scope is obtained as shown in the figure below.
Fig15: output from rls.m file
The above graph is the output for the reculsive least squares.
21Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Fig16: output graph for the simulink model for velocity
Fig17: comparing Real-time and simulink model
Fig18: Output for real-time
22Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Fig19: Output for the both simulink and real time model
Above graph is the output for the comparison of the simulink and real time to control the
velocity of the servo rig. In the above graph yellow graph is for real time servo, purple graph
is the set point and the green graph is for the simulink model. We can observe by seeing the
graph is that the real time servo rig is following the simulink graph.
8.1) STPI controller for Position of servo rig:
Fig20: comparing simulink and real-time model
By comparing the real-time and simulink model we can clearly observe the controllability of
the controller.
23Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Fig21: output for the model
In the above graph we can clearly observe that the PI controller is not performing according
to the requirement. For the first few cycles it controlled but when we observe at the last part
of the wave, it is very clear that the waveform of the real time servo is not following the
waveform of the simulink model.
So, to control the position of the servo rig PIP controller is designed.
9) PIP CONTROLLER FOR SERVO:To design the pip controller, we have to solve the transfer function of the position and make
in ‘n’ notation. From that we get a matrix form.
PIP controller for position:
Calculating the gain values for position.
Posn- 1.23 Posn-1 +0.225 Posn-2=0.07135un-1+0.0435un-2
Posn = 1.23 Posn-1 -0.225 Posn-2+0.07135un-1-0.0435un-2
Posn+1 1.23 -0.2250 0.0435 0 Posn 0.0713
Posn 1 0 0 0 Posn-1 0
24Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
= + un
Un 0 0 0 0 Un-1 1
Mn+1 -1.23 0.2250 -0.0435 1 Mn -0.0713
a =
1.2300 -0.2250 0.0435 0
1.0000 0 0 0
0 0 0 0
-1.2300 0.2250 -0.0435 1.0000
b =
0.0713
0
1.0000
-0.0713
q =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
r=1
By using the command,
k=optpip(a,b,q,r)
We get the values of K
k = 3.7875 -0.8084 0.1563 -0.5575
By using the above gain values, implement the PIP controller.
25Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
The simulink description below is obtained when this gain values were inserted appropriately
into the default PIP controller block diagram. The figure below shows the scope of the
position response of the PIP controller, which is a first order response curve, attaining a
steady state in less than 2 seconds of start up with a step function used as the input signal.
Fig22: Simulink model for position
In case of position we are having four gain values. In this case we are taking three discrete
filters. By using this plant of PIP controller we are getting the output for position.
The output for position of this PIP controller is shown below.
Fig23: output for the simulink model
26Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Fig24: comparison of simulink and real time servo
The above model is the comparison of the real time servo and the simulink model. The transfer function for the position is given in the discrete filter.
Fig25: o/p from real model
The above graph is the output of the real time servo rig.
27Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
Fig26: comparing the outputs of real time and the simulink model
In the above graph, pink colour wave is the setpoint or the input. The green line is the output
for the simulink model and the yellow colour wave is the output for the real time servo rig.
We can clearly see how the position of the servo is following the simulink model. We can say
that, by designing the pip controller the position of the servo rig is controlled.
10) Conclusion:
The mathematical models of the servo rig demonstrate how physical systems can be
represented and how the representation can be used to design controller to regulate the
operation of such system. This report, along with the prior knowledge of servo system, helps
one to understand the basic dynamics of the servo rig.
28Karthik Kumar Naddi(J9026070)
Prof Ian French MSc Control & Electronics
11) Reference:
1) System identification notes by Mr Ian French
2) AstrÖm, K.J and Wittenmark, (1995) B, Adaptive Control, Second Edition, Addison-Wesley Publishing Company.
3) Zhu, Y (2001), Multivariable System Identification for Process Control, Elsevier Science and Technology Books.
29Karthik Kumar Naddi(J9026070)