EE 4343 Lab#1 * Part 1

advertisement
EE 4314 Lab 3
Modeling and Identification of the Torsion Disk System
ECP 205
The block diagram of the torsion disk system that will be used in this lab is shown in Figure 1. The combination
of masses, springs and dampers can be found everywhere in industry and in our everyday life. Some common
examples are the vehicle suspension or the anti-vibration systems in CD-ROM drives.
ENCODER 1
MASS
M1
ENCODER 2
MASS
M2
DAMPING
C1
MOTOR
τ
DISK 1
J1
TORSION SPRING
K
l1
MASS M1
DAMPING
C2
l2
d2
DISK 2
J2
d1
MASS
M2
Figure 1 Torsion disk system diagram with system parameters
The following are the parameters of the system:





Additional Masses
Damping constants for the viscous friction at revolute joints
Elasticity coefficient (stiffness) of the torsion spring
Mass moment of inertia of the disks with load masses
Torque generated by the motor
M1, M2
C1, C2
K
J1, J2
T
Among the above parameters K, C1, and C2 are unknowns. The goal of this lab is to present a simple method
for identification of systems that can be split into a set of second-order subsystems with complex-conjugate
poles. Starting from the first principles and differential equations, a set of second-order transfer functions will
be isolated. The response with zero input and nonzero initial conditions of these transfer functions will be
used to determine values for the rate of decay  and for the natural frequency n , which will finally be used to
determine the values of K, C1, and C2.
Using the differential equations and the identified parameters, a state-space model for the system will be built.
This model will be used in the fourth lab to design a state-feedback controller. The validation of the model will
be done in this lab by providing the same input to the real system and to the model and by comparing their
outputs.
1
03/23/16
Setting up and performing the identification experiment:
1. System description and setup
a. System setup (This part is done by the TA)
Figure 2 shows the elements of the control system. The computer runs a Simulink model in real-time. The
information from the encoders is sent to the computer and is processed by the model. The command to the motor
is a voltage that is amplified by the Input/Output Electronic Unit and sent to the plant.
Simulink Model
Readings from the
positions of the disks
Readings from
the positions of
the disks
Commands to
the motor
Input/Output Electronic Unit
Amplified
commands to
the motor
Figure 2 The elements of the control system
b. Sensors
There are two incremental rotary shaft encoders coupled to the disks. Each has a resolution of 4000 pulses per
revolution. The encoders are all optical type whose principle of operation is depicted in Figure 3. A low power
light source is used to generate two 90 degrees out of phase sinusoidal signals on the detectors as the moving
plate rotates with respect to the stationary plate. These signals are then squared up and amplified in order to
generate quadrate logic level signals suitable for input to the programmable gate array on the real-time
Controller. The gate array uses the A and B channel phasing to decode direction and detects the rising and falling
edge of each to generate 4×resolution – see Figure 4. As the encoders are coupled to the disks with 1:1 ratio, the
Simulink model will receive 16000 counts per revolution from the encoders.
2
03/23/16
Figure 3 The Operation Principle of Optical Incremental Encoders
Figure 4 The optical encoder output
c. Actuator
The motor receives an analog voltage from the I/O Electronic Unit and transforms it into motion. For a certain
interval of input voltages, it can be considered with relatively good approximation that the torque generated by
the motor is proportional to the input voltage.
d. Matlab/simulink file
Click on the Simulink file "TorsionSpring.mdl" in the “Lab3” folder. The following block diagram opens up.
Figure 5 Simulink diagram for system identification
The green block represents the physical torsion spring system. It has one input and a vector output. The
input is the voltage that the motor receives. The output is a vector that contains the two encoder readings. These
readings represent counts or the number of pulses since the simulation has started. When you connect to the
target, the readings are reset to zero. The number of counts is translated to the corresponding angular
displacement of the disks through the pi/16000 rad/count gain. The vector signal is demultiplexed to individual
signals x1 (Disk 1 angle) and x2 (Disk 2 angle) and these are displayed on the oscilloscopes and sent to the
Matlab workspace for further processing if needed. The Saturation block makes sure that the motor is not driven
with a high voltage that could damage the plant. Do not change the parameters of the Saturation block!
3
03/23/16
If you double-click the step block on the diagram, you can see its parameters. This is the input signal to
the motor. The following window should be seen:
Figure 6 Step input parameters
Click on the Tools menu in the Simulink diagram and, in the Real-Time Workshop submenu, select Build
Model. You will see the Matlab command window pop up and the build process will be displayed. Once the
build is successfully completed click the “Connect to target” button and after the connection is realized click on
the arrow that appears in the Simulink diagram. This will start running the Simulink code for a number of
seconds equal to the simulation time specified in the Simulink diagram.
Note: For real-time applications, Simulink compiles the model into a fast executable code that handles the data
acquisition and processing. Anytime a change is made in the Simulink file, except changing the value of the step
input or the Slider Gain, the file must be rebuilt.
Check the scopes to save the signal data to the Matlab Workspace. By clicking on the “parameters” button
in
the Scope window a new window containing the scope parameters will open up. In this window in the “Data
history” tab you will see that the data will be saved to workspace under the following names: disk1angle and
disk2angle.
Note: The data is saved in the “Array” format. In this case the data will be saved in the workspace as a two
column matrix. The first column is the time column and specifies the moments in time at which the signal values
were collected. The second column is the data collected.
Note: If you return to the Matlab workspace you will see the variables disk1angle and disk2angle saved as
matrices.
To plot the data in disk1angle and disk2angle, you can plot the second column of the data array versus the
first column.
Example: The following command plots the angular position of Disk 1
>> plot(disk1angle(:,1), disk1angle(:,2))
You can save the experiment results to your “results” folder by selecting and right clicking on the matrices in the
workspace and saving them as a new .mat file.
4
03/23/16
2. System modeling
The differential equations that model the system in Figure 7 are as follows:
J1x1  C1x1  K ( x1  x2 )    L  u
(1)
J 2 x2  C2 x2  K ( x1  x2 )
Constants
Variables of time
J1: mass moment of inertia on Disk 1 (kg.m2)
x1 : angular position of Disk 1 (rad)
J2: mass moment of inertia on Disk 2 (kg.m2)
x2 : angular position of Disk 2 (rad)
C1: viscous friction of Disk 1 (kg.m2/s)
τ : motor torque (kg.m2/s2)
C2: viscous friction of Disk 2 (kg.m2/s)
u: voltage input applied to the motor (V)
K: Torsion spring constant (kg.m2/s2)
L: motor constant (A.s)
X1(t)
X2(t)
T(t)
K
C1
C2
J1
J2
Figure 7 Physical system model
Since J1 and J2 are the total mass moment of inertia on Disk 1 and Disk 2,
J1  J D1  J M 1
J 2  J D2  J M 2
where JM1 and JM2 are the mass moment of inertia of the load masses attached to the respective disks and are
known values. On the other hand, JD1 and JD2 are the mass moment of inertia of the disks and are experimentally
calculated and provided in the handout. JM1 and JM2 are found as follows:
 M d2

J M 1  2 1 1  M 1l12 
 8



 0.0083
kg  m 2
 M d2

J M 2  4 2 2  M 2l 22 
 8



 0.0013
kg  m 2
M1: mass of the load cylinder attached to Disk 1 = 0.503 kg
M2: mass of the load cylinder attached to Disk 2 = 0.212 kg
d1: diameter of the load cylinder attached to Disk 1 = 0.049 m
d2: diameter of the load cylinder attached to Disk 2 = 0.032 m
l1: distance between the load cylinder attached to Disk 1 and
the axis of rotation = 0.089 m
l2: distance between the load cylinder attached to Disk 21 and
the axis of rotation = 0.037 m
(See also Figure 1)
Based on preliminary experiments not covered in this lab, JD1 and JD2 are found to be 0.0025 kg·m2 and 0.0021
kg·m2, respectively. Therefore, the total inertias of the two disks are found as follows:
J1  0.0108
kg  m 2
J 2  0.0034
5
03/23/16
kg  m 2
In this experiment, you will estimate the values of K, C1, C2 and L parameters.
a) Apply the Laplace transform on the first two differential equations given in (1). You will obtain the
results in the following form:
X 1 ( s )  G1 ( s )  U ( s )  G3 ( s )  X 2 ( s )
(2)
X 2 ( s )  G2 ( s )  X 1 ( s )
where G1 and G2 are second order transfer functions. The above equations can also be represented with the
following block diagram.
U(s)
G1(s)
X1(s)
+
X2(s)
G2(s)
+
G3(s)
Figure 8 Block diagram representation of the S-domain dynamical equations of the system
The G1 and G2 transfer functions that you obtain should be of second order with complex-conjugate poles.
b) Rewrite each of G1 and G2 in the following manner, by making sure that s2 on the denominator has a
coefficient of 1:
2
g 0i  ni
Gi ( s) 
, i  1, 2
(3)
2
s 2  2 i s  ni
where g 0i is the DC gain,  ni is the natural frequency and  is the rate of decay as will be made more clear in
the following parts of the handout.
c) By identifying the coefficients of the different powers of the s variable on the denominator with your
calculated coefficients, write K, C1 and C2 as functions of  n1 , n2 , 1 and  2 .
3. Identification of parameters
The identification procedure requires you to analyze the response of the G1 and G2 transfer functions
with nonzero initial conditions and zero input. This means that you have to measure the output of the transfer
function after you force its input to zero and force a nonzero value on at least one of the states. From the
diagram in Figure 8, you can see that the output of the G1 transfer function is not available for measurement.
Still, it is possible to measure it through X1 if X2 is forced to be zero. This means that if you block Disk 2 and do
not allow it to move, the G3 transfer function will not have any effect on X1 and you will see the output of G1 on
the X1 measurements. The exact formula for the response can be calculated using the Laplace transforms and
considering nonzero initial conditions (x1(0) = initial angle of the disk). To obtain the response, follow the next
steps:
a) Let Disk 1 free to rotate while Disk 2 is blocked by screwing to the frame of the plant. Connect to the
target and run the model with the slider gain set to zero initially. Slowly increase the slider gain value and note
on the first scope window that Disk 1 starts turning only when the input exceeds a small value such as 0.05V.
You can call this input level as the deadband voltage udb. Then apply a test voltage utest such as 0.75 V. You will
see a displacement of Disk 1 that stabilizes after some time to a steady-state value x1,test. As a result, the DC gain
of G1 can be calculated as
g 01 
x1, test
utest
(4)
b) While you keep Disk 2 blocked, connect to the target again and run the model with the slider gain set
to zero. Slowly turn Disk 1 with your hand in counter-clock-wise direction until the signal reaches 0.15 (about
10 degrees) in the first scope window. Then, suddenly release the disk. After the disk oscillations cease, stop the
simulink model. Observe the response if it looks like the one in Figure 9.
6
03/23/16
0.025
t0 , x1(t0)
t1 , x1(t1)
0.02
sin t frequency
0.015
t5 , x1(t5)
0.01
Initial angle
x (m)
0.005
1
x1 (rad)
0
-0.005
Small amplitude: unreliable for
identification due to friction
-0.01
-0.015
e t envelope
-0.02
-0.025
0
1
2
3
4
5
6
7
8
time (sec)
9
10
11
12
13
14
15
Figure 9 Zero input, nonzero initial state response used for identification
c) Choose n consecutive cycles (e.g. n = 5) in the higher amplitude range of the response such that they
are not affected too much by the nonlinear friction effects. Divide the number of cycles by the time taken to
complete them ( t n  t 0 ) being sure to take beginning and end times from the same phase of the respective cycles
(it is best to look at the peaks). You may need to zoom into the graph or see the data in a table in the Matlab
workspace. The following calculation gives you the period of oscillations T and the associated frequencies f and
β in Hz and radians, respectively.
t t
1
(5)
T1  n 0 , f1 
, 1  2f
n
T
d) Measure the initial cycle amplitude x1 t 0  and the last cycle amplitude x1 t n  for the n cycles
measured in the previous step. Use the relationships associated with the logarithmic decay to obtain 1 :
x1 t 0  e

x1 t n  e  1 t n
 1 t 0
 x t  
 x t  
 x t  
ln  1 0  1 ln  1 0  ln  1 0 
x1 t n  
 x1 t n     x1 t n  
 1  

t n  t0
2n
nT1
(6)
f) Calculate n1 with the following formula:
 n1  12  12
g) Using the formulas you derived in part 2(c), calculate the values for K and C1.
h) Repeat steps (b) – (g) for Disk 2. In this case, block Disk 1 by screwing it to the frame of the plant.
Calculate the values K and C2. Note that g 02  1 for the G2 transfer function.
4. Validation of the model
In this part, you are going to validate the identified model of the system. You will use the state-space
representation. Consider the following assignment of states for a state realization of the system:
x1  x1 (angular position of Disk 1)
x2  x1 ( angular velocity of Disk 1)
x3  x2 (angular position of Disk 2)
x4  x 2 ( angular velocity of Disk 2)
a) Find the state-space representation of the system (i.e. find A and B):
7
03/23/16
 x1 
x 
x   2   Ax  Bu
 x3 
 
 x4 
Considering the output of the system to be made of the angular positions of the two disks,
1 0 0 0
0 
y
x


0  u
0 0 1 0 
 
b) Open the Simulink block diagram named “simulation.mdl” (Figure 10). Configure the State-Space
block with the values of the A, B, C and D matrices above.
Figure 10 Simulation model of the torsion spring system in Simulink
Copy the blocks before the State-Space block in Figure 10 to the experiment model as shown below and rebuilt
the model. Make sure that the two Simulink diagrams are functionally the same except you have a simulation
model in Figure 10 and a real system in Figure 11. Then, run both models. If the responses are similar it means
that the model that you just identified for the torsion spring system is fairly good. If the two responses are not
similar then you have to go back and find out where you might have made a mistake.
Figure 11 Simulink diagram of the experiment with pulse input
8
03/23/16
Lab Report:
You are responsible for performing everything listed in all lab procedures. The lab report should include results
from every section in the lab instruction. Provide graphs if available. The lab report should also include the
answers to the following points.



What are the parameters K, C1, C2 and L that you found from the experiment?
The estimated model of the system.
Can you get a time response of the estimated model to perfectly match a time response of the actual
system? (Please also explain the reason to support your answer)
Note that you will need to use the results presented in these lab reports for the experiments in future lab sessions.
9
03/23/16
Download