Only this pageAll pages
Powered by GitBook
1 of 44

AE4610

Loading...

Experiments

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Archive

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

B. Modelling (Week 1)

The objective of this experiment is to find a transfer function that describes the rotary motion of the Rotary Servo Base Unit load shaft. The dynamic model is derived analytically from classical mechanics principles and using experimental methods.

The angular speed of the Rotary Servo Base Unit load shaft with respect to the input motor voltage can be described by the following first-order transfer function:

Ωl(s)Vm(s)=Kτs+1(2.1)\frac{\Omega_l(s)}{V_m(s)} = \frac{K}{\tau s+1} \qquad \qquad \qquad \tag{2.1}Vm​(s)Ωl​(s)​=τs+1K​(2.1)

where Ωl(s)\Omega_l(\mathrm{s})Ωl​(s) is the Laplace transform of the load shaft speed ωl(t)\omega_l(\mathrm{t})ωl​(t), Vm(s)V_m(\mathrm{s})Vm​(s) is the Laplace transform of motor input voltage vm(t)v_m(\mathrm{t})vm​(t), KKK is the steady-state gain, τ\tauτ is the time constant, and s\mathrm{s}s is the Laplace operator. The Rotary Servo Base Unit transfer function model is derived analytically in Modelling Using First-Principles and its KKK and τ\tauτ parameters are evaluated. These are known as the nominal model parameter values. The model parameters can also be found experimentally. Modeling Using Experiment describes how to use the frequency response and bump-test methods to find KKK and τ\tauτ. These methods are useful when the dynamics of a system are not known, for example in a more complex system. After the lab experiments, the experimental model parameters are compared with the nominal values.

1. Modelling Using First-Principles

a) Electrical Equations

The DC motor armature circuit schematic and gear train is illustrated in Figure 7.

Figure 7 Rotary Servo Base Unit DC motor armature circuit and gear train

RmR_mRm​ is the motor resistance, LmL_mLm​ is the inductance, and KmK_mKm​ is the back-emf constant.

The back-emf (electromotive) voltage eb(t)e_b(\mathrm{t})eb​(t) depends on the speed of the motor shaft, ωm\omega_mωm​, and the back-emf constant of the motor, kmk_mkm​. It opposes the current flow. The back emf voltage is given by:

eb(t)=kmωm(t)(2.2)e_b(\mathrm{t}) = k_m\omega_m(\mathrm{t}) \qquad \qquad \qquad \tag{2.2}eb​(t)=km​ωm​(t)(2.2)

Using Kirchoff’s Voltage Law, we can write the following equation:

Vm(t)−RmIm(t)−LmdIm(t)dt−kmωm(t)=0(2.3)V_m(\mathrm{t}) - R_mI_m(\mathrm{t}) - L_m \frac{dI_m(\mathrm{t})}{dt} - k_m \omega_m(\mathrm{t}) = 0 \qquad \qquad \qquad \tag{2.3}Vm​(t)−Rm​Im​(t)−Lm​dtdIm​(t)​−km​ωm​(t)=0(2.3)

Since the motor inductance LmL_mLm​ is much less than its resistance, it can be ignored. Then, the equation becomes:

Vm(t)−RmIm(t)−kmωm(t)=0(2.4)V_m(\mathrm{t}) - R_mI_m(\mathrm{t})-k_m\omega_m(\mathrm{t}) = 0 \qquad \qquad \qquad \tag{2.4}Vm​(t)−Rm​Im​(t)−km​ωm​(t)=0(2.4)

Solving for Im(t)I_m(\mathrm{t})Im​(t), the motor current can be found as:

Im(t)=Vm(t)−kmωm(t)Rm(2.5)I_m(\mathrm{t}) = \frac{V_m(\mathrm{t}) - k_m\omega_m(\mathrm{t})}{R_m} \qquad \qquad \qquad \tag{2.5}Im​(t)=Rm​Vm​(t)−km​ωm​(t)​(2.5)

b) Mechanical Equations

In this section, the equation of motion describing the speed of the load shaft, ωl\omega_lωl​, with respect to the applied motor torque, LmL_mLm​, is developed. Since the Rotary Servo Base Unit is a one degree-of-freedom rotary system, Newton’s Second Law of Motion can be written as:

J⋅α=τ(2.6)J \cdot \alpha = \tau \qquad \qquad \qquad \tag{2.6}J⋅α=τ(2.6)

where JJJ is the moment of inertia of the body (about its center of mass), α\alpha α is the angular acceleration of the system, and τ\tauτ is the sum of the torques being applied to the body. As illustrated in Figure 7, the Rotary Servo Base Unit gear train along with the viscous friction acting on the motor shaft, BmB_mBm​, and the load shaft BlB_lBl​ are considered. The load equation of motion is:

Jldωl(t)dt+Blωl(t)=τl(t)(2.7)J_l \frac{d\omega_l(\mathrm{t})}{dt} + B_l\omega_l(\mathrm{t}) = \tau_l(\mathrm{t}) \qquad \qquad \qquad \tag{2.7}Jl​dtdωl​(t)​+Bl​ωl​(t)=τl​(t)(2.7)

where JlJ_lJl​ is the moment of inertia of the load and τl\tau_lτl​ is the total torque applied on the load. The load inertia includes the inertia from the gear train and from any external loads attached, e.g. disc or bar. The motor shaft equation is expressed as:

Jmdωl(t)dt+Bmωm(t)+τml=τm(t)(2.8)J_m \frac{d\omega_l(t)}{dt} + B_m\omega_m(t) +\tau_{ml}= \tau_m(t) \qquad \qquad \qquad \tag{2.8}Jm​dtdωl​(t)​+Bm​ωm​(t)+τml​=τm​(t)(2.8)

where JmJ_mJm​ is the motor shaft moment of inertia and τml\tau_{ml}τml​ is the resulting torque acting on the motor shaft from the load torque. The torque at the load shaft from an applied motor torque can be written as:

τl(t)=ηgKgτml(t)(2.9)\tau_l(t) = \eta_gK_g\tau_{ml}(t) \qquad \qquad \qquad \tag{2.9}τl​(t)=ηg​Kg​τml​(t)(2.9)

where KgK_gKg​ is the gear ratio and ηg\eta_gηg​ is the gearbox efficiency. The planetary gearbox that is directly mounted on the Rotary Servo Base Unit motor (see Rotary Servo Base Unit User Manual for more details) is represented by the N1N_1N1​ and N2N_2N2​ gears in Figure 7 and has a gear ratio of

Kgi=N2N1(2.10)K_{gi} = \frac{N_2}{N_1} \qquad \qquad \qquad \tag{2.10}Kgi​=N1​N2​​(2.10)

This is the internal gear box ratio. The motor gear N3N_3N3​ and the load gear N4N_4N4​ are directly meshed together and are visible from the outside. These gears comprise the external gear box which has an associated gear ratio of

Kge=N4N3(2.11)K_{ge} = \frac{N_4}{N_3} \qquad \qquad \qquad \tag{2.11}Kge​=N3​N4​​(2.11)

The gear ratio of the Rotary Servo Base Unit gear train is then given by:

Kg=KgeKgi(2.12)K_g = K_{ge} K_{gi} \qquad \qquad \qquad \tag{2.12}Kg​=Kge​Kgi​(2.12)

Thus, the torque seen at the motor shaft through the gears can be expressed as:

τml(t)=τl(t)ηgKg(2.13)\tau_{ml} (t) = \frac{\tau_l(t)}{\eta_gK_g} \qquad \qquad \qquad \tag{2.13}τml​(t)=ηg​Kg​τl​(t)​(2.13)

Intuitively, the motor shaft must rotate KgK_gKg​ times for the output shaft to rotate one revolution.

θm(t)=Kgθl(t)(2.14)\theta_m(t) = K_g\theta_l(t) \qquad \qquad \qquad \tag{2.14}θm​(t)=Kg​θl​(t)(2.14)

We can find the relationship between the angular speed of the motor shaft, ωm\omega_mωm​, and the angular speed of the load shaft, ωl\omega_lωl​ by taking the time derivative:

ωm(t)=Kgωl(t)(2.15)\omega_m(t) = K_g\omega_l(t) \qquad \qquad \qquad \tag{2.15}ωm​(t)=Kg​ωl​(t)(2.15)

To find the differential equation that describes the motion of the load shaft with respect to an applied motor torque substitute (Eq 2.13), (Eq 2.15) and (Eq 2.7) into (Eq 2.8) to get the following:

JmKgdωl(t)dt+BmKgωl(t)+Jldωl(t)dt+Blωl(t)ηgKg=τm(t)(2.16)J_mK_g \frac{d\omega_l(t)}{dt} + B_mK_g\omega_l(t) +\frac{J_l \frac{d\omega_l(t)}{dt} + B_l\omega_l(t)}{\eta_gK_g}= \tau_m(t) \qquad \qquad \qquad \tag{2.16}Jm​Kg​dtdωl​(t)​+Bm​Kg​ωl​(t)+ηg​Kg​Jl​dtdωl​(t)​+Bl​ωl​(t)​=τm​(t)(2.16)

Collecting the coefficients in terms of the load shaft velocity and acceleration gives

(ηgKg2Jm+Jl)dωl(t)dt+(ηgKg2Bm+Bl)ωl(t)=ηgKgτm(t)(2.17)(\eta_gK_g^2J_m + J_l) \frac{d\omega_l(t)}{dt} + (\eta_gK_g^2B_m + B_l)\omega_l(t) = \eta_gK_g\tau_m(t) \qquad \qquad \qquad \tag{2.17}(ηg​Kg2​Jm​+Jl​)dtdωl​(t)​+(ηg​Kg2​Bm​+Bl​)ωl​(t)=ηg​Kg​τm​(t)(2.17)

Defining the following terms:

Jeq=ηgKg2Jm+Jl(2.18)J_{eq} = \eta_gK_g^2J_m+J_l \qquad \qquad \qquad \tag{2.18} Jeq​=ηg​Kg2​Jm​+Jl​(2.18)
Beq=ηgKg2Bm+Bl(2.19)B_{eq} = \eta_gK_g^2B_m+B_l \qquad \qquad \qquad \tag{2.19} Beq​=ηg​Kg2​Bm​+Bl​(2.19)

simplifies the equation as:

Jeqdωl(t)dt+Beqωl(t)=ηgKgτm(t)(2.20)J_{eq} \frac{d\omega_l(t)}{dt} +B_{eq}\omega_l(t) = \eta_gK_g\tau_m(t) \qquad \qquad \qquad \tag{2.20}Jeq​dtdωl​(t)​+Beq​ωl​(t)=ηg​Kg​τm​(t)(2.20)

c) Combining the Electrical and Mechanical Equations

In this section the electrical equation and the mechanical equation are brought together to get an expression that represents the load shaft speed in terms of the applied motor voltage.

The motor torque is proportional to the voltage applied and is described as

τm(t)=ηmktIm(t)(2.21)\tau_m(t) = \eta_mk_tI_m(t) \qquad \qquad \qquad \tag{2.21}τm​(t)=ηm​kt​Im​(t)(2.21)

where KtK_tKt​ is the current-torque constant (N⋅m/AN \cdot m / AN⋅m/A), ηm\eta_mηm​ is the motor efficiency, and ImI_mIm​ is the armature current. See Rotary Servo Base Unit User Manual for more details on the Rotary Servo Base Unit motor specifications. We can express the motor torque with respect to the input voltage Vm(t)V_m(t)Vm​(t) and load shaft speed ωl(t)\omega_l(t)ωl​(t) by substituting the motor armature current given by Eq 2.5, into the current-torque relationship given in Eq 2.21:

τm(t)=ηmkt(Vm(t)−kmωm(t))Rm(2.22)\tau_m(t) = \frac{\eta_mk_t(V_m(t) - k_m\omega_m(t))}{R_m} \qquad \qquad \qquad \tag{2.22}τm​(t)=Rm​ηm​kt​(Vm​(t)−km​ωm​(t))​(2.22)

To express this in terms of VmV_mVm​ and ωl\omega_lωl​, insert the motor-load shaft speed Eq 2.15, into Eq 2.21 to get:

τm(t)=ηmkt(Vm(t)−kmKgωl(t))Rm(2.23)\tau_m(t) = \frac{\eta_mk_t(V_m(t) - k_mK_g\omega_l(t))}{R_m} \qquad \qquad \qquad \tag{2.23}τm​(t)=Rm​ηm​kt​(Vm​(t)−km​Kg​ωl​(t))​(2.23)

If we substitute (Eq 2.23) into (Eq 2.20), we get:

Jeqdωl(t)dt+Beqωl(t)=ηgKgηmkt(Vm(t)−kmKgωl(t))Rm(2.24)J_{eq} \frac{d\omega_l(t)}{dt} +B_{eq}\omega_l(t) = \frac{\eta_gK_g\eta_mk_t(V_m(t) - k_mK_g\omega_l(t))}{R_m} \qquad \qquad \qquad \tag{2.24}Jeq​dtdωl​(t)​+Beq​ωl​(t)=Rm​ηg​Kg​ηm​kt​(Vm​(t)−km​Kg​ωl​(t))​(2.24)

After collecting the terms, the equation becomes

Jeqdωl(t)dt+(kmηgKg2ηmktRm+Beq)ωl(t)=ηgKgηmktVm(t)Rm(2.25)J_{eq} \frac{d\omega_l(t)}{dt} +\left (\frac{k_m\eta_gK_g^2\eta_mk_t}{R_m}+B_{eq}\right) \omega_l(t) = \frac{\eta_gK_g\eta_mk_tV_m(t) }{R_m} \qquad \qquad \qquad \tag{2.25}Jeq​dtdωl​(t)​+(Rm​km​ηg​Kg2​ηm​kt​​+Beq​)ωl​(t)=Rm​ηg​Kg​ηm​kt​Vm​(t)​(2.25)

This equation can be re-written as:

Jeqdωl(t)dt+(Beq,v)ωl(t)=AmVm(t)(2.26)J_{eq} \frac{d\omega_l(t)}{dt} +\left (B_{eq,v}\right) \omega_l(t) = A_mV_m(t) \qquad \qquad \qquad \tag{2.26}Jeq​dtdωl​(t)​+(Beq,v​)ωl​(t)=Am​Vm​(t)(2.26)

where the equivalent damping term is given by:

Beq,v=kmηgKg2ηmkt+BeqRmRm(2.27)B_{eq,v} = \frac{k_m\eta_gK_g^2\eta_mk_t + B_{eq}R_m}{R_m} \qquad \qquad \qquad \tag{2.27}Beq,v​=Rm​km​ηg​Kg2​ηm​kt​+Beq​Rm​​(2.27)

and the actuator gain equals

Am=ηgKgηmktRm(2.28)A_m = \frac{\eta_gK_g\eta_mk_t}{R_m} \qquad \qquad \qquad \tag{2.28}Am​=Rm​ηg​Kg​ηm​kt​​(2.28)

2. Modeling Using Experiments

A linear model of a system can also be determined purely experimentally. The main idea is to experimentally observe how a system reacts to different inputs and change structure and parameters of a model until a reasonable fit is obtained. The inputs can be chosen in many different ways and there are a large variety of methods. Two methods of modeling the Rotary Servo Base Unit are: (1) frequency response and, (2) bump test.

a) Frequency Response

In Figure 8, the response of a typical first-order time-invariant system to a sine wave input is shown. As it can be seen from the figure, the input signal (uuu) is a sine wave with a fixed amplitude and frequency. The resulting output (yyy) is also a sinusoid with the same frequency but with a different amplitude. By varying the frequency of the input sine wave and observing the resulting outputs, a Bode plot of the system can be obtained as shown in Figure 9.

Figure 8 Typical frequency response

The Bode plot can then be used to find the steady-state gain, i.e. the DC gain, and the time constant of the system. The cuttoff frequency, ωc\omega_cωc​, shown in Figure 9 is defined as the frequency where the gain is 3 dB less than the maximum gain (i.e. the DC gain). When working in the linear non-decibel range, the 3 dB frequency is defined as the frequency where the gain is 12\frac{1}{\sqrt{2}}2​1​ , or about 0.707, of the maximum gain. The cutoff frequency is also known as the bandwidth of the system which represents how fast the system responds to a given input.

Figure 9 Magnitude Bode plot

The magnitude of the frequency response of the Rotary Servo Base Unit plant transfer function given in equation Eq 2.1 is defined as:

∣Gωl,v(ω)∣=∣Ωl(ωj)Vm(ωj)∣(2.29)|G_{\omega l,v}(\omega)| = \left |\frac{\Omega_l(\omega j)}{V_m(\omega j)}\right| \qquad \qquad \qquad \tag{2.29}∣Gωl,v​(ω)∣=​Vm​(ωj)Ωl​(ωj)​​(2.29)

where ω\omegaω is the frequency of the motor input voltage signal VmV_mVm​. We know that the transfer function of the system has the generic first-order system form given in Eq 2.1. By substituting s=jωs = j \omegas=jω in this equation, we can find the frequency response of the system as:

∣Ωl(ωj)Vm(ωj)∣=Kτωj+1(2.30) \left |\frac{\Omega_l(\omega j)}{V_m(\omega j)}\right| = \frac{K}{\tau \omega j + 1} \qquad \qquad \qquad \tag{2.30}​Vm​(ωj)Ωl​(ωj)​​=τωj+1K​(2.30)

Then, the magnitude of it equals

∣Gwl,v(w)∣=K1+τ2ω2(2.31)|G_{wl,v}(w)| = \frac{K}{\sqrt{1+\tau^2\omega^2}} \qquad \qquad \qquad \tag{2.31}∣Gwl,v​(w)∣=1+τ2ω2​K​(2.31)

Let’s call the frequency response model parameters Ke,fK_{e,f}Ke,f​ and τe,f\tau_{e,f}τe,f​ to differentiate them from the nominal model parameters, KKK and τ\tauτ, used previously. The steady-state gain or the DC gain (i.e. gain at zero frequency) of the model is:

Ke,f=∣Gwl,v(0)∣(2.32)K_{e,f} = |G_{wl,v}(0)| \qquad \qquad \qquad \tag{2.32}Ke,f​=∣Gwl,v​(0)∣(2.32)

b) Bump Test / Unit Step Input Test

The bump test is a simple test based on the step response of a stable system. A step input is given to the system and its response is recorded. As an example, consider a system given by the following transfer function:

Y(s)U(s)=Kτs+1(2.33)\frac{Y(s)}{U(s)} = \frac{K}{\tau s + 1} \qquad \qquad \qquad \tag{2.33}U(s)Y(s)​=τs+1K​(2.33)

The step response shown in Figure 10 is generated using this transfer function with K=5rad/VsK = 5 rad/VsK=5rad/Vs and τ=0.05s\tau = 0.05sτ=0.05s.

The step input begins at time t0t_0t0​. The input signal has a minimum value of uminu_{min}umin​ and a maximum value of umaxu_{max}umax​. The resulting output signal is initially at y0y_0y0​. Once the step is applied, the output tries to follow it and eventually settles at its steady-state value yss. From the output and input signals, the steady-state gain is

K=ΔyΔu(2.34)K = \frac{\Delta y}{\Delta u} \qquad \qquad \qquad \tag{2.34}K=ΔuΔy​(2.34)

where Δy=yss−y0\Delta y = y_{ss} - y_0Δy=yss​−y0​ and Δu=umax−umin\Delta u =u_{max} - u_{min}Δu=umax​−umin​. In order to find the model time constant, τ\tauτ , we can first calculate where the output is supposed to be at the time constant from:

y(t1)=0.632(yss−y0)+y0(2.35)y(t_1) = 0.632(y_{ss}-y_0) + y_0 \qquad \qquad \qquad \tag{2.35}y(t1​)=0.632(yss​−y0​)+y0​(2.35)

Then, we can read the time t1t_1t1​ that corresponds to y(t1)y(t_1)y(t1​) from the response data in Figure 10. From the figure we can see that the time t1t_1t1​ is equal to:

t1=t0+τ(2.36)t_1 = t_0 + \tau \qquad \qquad \qquad \tag{2.36}t1​=t0​+τ(2.36)
Figure 10 Input and output signal used in the bump test method

From this, the model time constant can be found as:

τ=t1−t0(2.37)\tau = t_1 - t_0 \qquad \qquad \qquad \tag{2.37}τ=t1​−t0​(2.37)

Going back to the Rotary Servo Base Unit system, a step input voltage with a time delay t0t_0t0​ can be expressed as follows in the Laplace domain:

Vm(s)=Ave(−st0)s(2.38)V_m(s) = \frac{A_ve^{(-st_0)}}{s} \qquad \qquad \qquad \tag{2.38}Vm​(s)=sAv​e(−st0​)​(2.38)

where AvA_vAv​ is the amplitude of the step and t0t_0t0​ is the step time (i.e. the delay). If we substitute this input into the system transfer function given in Eq 2.1, we get:

Ωl(s)=KAve(−st0)(τs+1)s(2.39)\Omega_l(s) = \frac{KA_ve^{(-s t_0)}}{(\tau s + 1)s} \qquad \qquad \qquad \tag{2.39}Ωl​(s)=(τs+1)sKAv​e(−st0​)​(2.39)

We can then find the Rotary Servo Base Unit load speed step response, ωl(t)\omega_l(t)ωl​(t), by taking inverse Laplace of this equation. Here we need to be careful with the time delay t0t_0t0​ and note that the initial condition is

ωl(t)=KAv(1−e(−t−t0τ))+ωl(t0)(2.40)\omega_l(t) = KA_v\left(1-e^{(-\frac{t-t_0}{\tau})}\right) + \omega_l(t_0) \qquad \qquad \qquad \tag{2.40}ωl​(t)=KAv​(1−e(−τt−t0​​))+ωl​(t0​)(2.40)

Pre-Lab (before lab starts)

Do Problem 1,2,3,7,9,10

  1. We obtained Eq (2.26) which described the dynamic behavior of the load shaft speed as a function of the motor input voltage. Starting from this equation, find the transfer function

  2. Express the steady-state gain (KKK) and the time constant (τ\tauτ) of the process model Eq (2.1) in terms of the JeqJ_{eq}Jeq​, Beq,vB_{eq,v}Beq,v​, and AmA_mAm​ parameters.

  3. Calculate the Beq,vB_{eq,v}Beq,v​ and AmA_mAm​ model parameters using the system specifications given in Rotary Servo Base Unit User Manual. The parameters are to be calculated based on an the Rotary Servo Base Unit in the high-gear configuration.

  4. The load attached to the motor shaft includes a 24-tooth gear, two 72-tooth gears, and a single 120-tooth gear along with any other external load that is attached to the load shaft. Thus, for the gear moment of inertia JgJ_gJg​ and the external load moment of inertia Jl,extJ_{l,ext}Jl,ext​, the load inertia is Jl=Jg+Jl,extJ_l = J_g + J_{l,ext}Jl​=Jg​+Jl,ext​. Using the specifications given in the Rotary Servo Base Unit User Manual find the total moment of inertia JgJ_gJg​ from the gears. Hint: Use the definition of moment of inertia for a disc Jdisc=mr2/2J_{disc} = {mr^2}/{2}Jdisc​=mr2/2 .

  5. Assuming that the disc load is attached to the load shaft, calculate the inertia of the disc load, JdJ_dJd​, and the total load moment of inertia acting on the motor shaft from the disc and gears, JlJ_lJl​.

  6. Evaluate the equivalent moment of inertia JeqJ_{eq}Jeq​. This is the total inertia from the motor, gears, and disc load. The moment of inertia of the DC motor can be found in the Rotary Servo Base Unit User Manual.

  7. Calculate the steady-state model gain KKK and time constant τ\tauτ. These are the nominal model parameters and will be used to compare with parameters that are later found experimentally.

  8. Referring to the Frequency Response, find the expression representing the time constant τ\tauτ of the frequency response model given in Eq. (2.31). Begin by evaluating the magnitude of the transfer function at the cutoff frequency ωc\omega_cωc​.

  9. Referring to Bump Test, find the equation of steady-state gain of the step response and compare it with Eq 2.34. Hint: The the steady-state value of the load shaft speed can be defined as ωl,ss=lim⁡t→∞ωl(t)\omega_{l,ss} = \lim_{t\to \infty} \omega_l(t)ωl,ss​=limt→∞​ωl​(t).

  10. Evaluate the step response given in Eq. (2.40) at t=t0+τt = t_0 + \taut=t0​+τ and compare it with Eq. (2.35).

↓↓↓ In Lab Exercise ↓↓↓

Experimental Setup

The q_servo_modeling Simulink diagram shown in Figure 11 will be used to conduct the experiments. The Rotary Servo Base Unit subsystem contains QUARC blocks that interface with the DC motor and sensors of the Rotary Servo Base Unit system. The Rotary Servo Base Unit Model uses a Transfer Fcn block from the SIMULINK library to simulate the Rotary Servo Base Unit system. Thus, both the measured and simulated load shaft speed can be monitored simultaneously given an input voltage.

Figure 11 q_servo_modeling Simulink diagram used to model Rotary Servo Base Unit.
32KB
Modeling_files.zip
archive
  1. Download the Modeling_files.zip and extract the files to desktop.

  2. Open q_servo_modeling.m SIMULINK file.

  3. Configure DAQ: Double-click on the HIL Initialize block in the SIMULINK diagram and ensure it is configured for the DAQ device that is installed in your system (e.g. Q2-USB).

  4. Open setup_servo_modeling.m file to open the setup script for the q_servo_modeling SIMULINK model.

  5. Run the script. Note: The calculated servo model parameter are default model parameters and do not accurately represent the Rotary Servo Base Unit system.

Frequency Response Experiment

The frequency response of a linear system can be obtained by providing a sine wave input signal to it and recording the resulting output sine wave from it. In this experiment, the input signal is the motor voltage and the output is the motor speed. In this method, we keep the amplitude of the input sine wave constant but vary its frequency. At each frequency setting, we record the amplitude of the output sine wave. The ratio of the output and input amplitudes at a given frequency can then be used to create a Bode magnitude plot. Then, the transfer function for the system can be extracted from this Bode plot.

a). Steady-state gain

First, we need to find the steady-state gain of the system. This requires running the system with a constant input voltage. To create a 2V2V2V constant input voltage follow these steps:

  1. In the SIMULINK diagram, double-click on the Signal Generator block and ensure the following parameters are set: • Wave form: sine • Amplitude: 1.0 • Frequency: 0.4 • Units: Hertz

  2. Set the Amplitude (V) slider gain to 0.

  3. Set the Offset (V) block to 2.0 V.

  4. Set the Simulation stop time to 5 seconds.

  5. Open the load shaft speed scope, Speed (rad/s), and the motor input voltage scope, Vm (V) .

  6. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  7. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  8. The Rotary Servo Base Unit unit should begin rotating in one direction. The scopes should be reading something similar to figure below. Note that in the Speed (rad/s) scope, the yellow trace is the measured speed while the blue trace is the simulated speed (generated by Servo Model block).

    Figure 12 Load shaft speed response to a constant input
  9. Measure the speed of the load shaft and enter the measurement in Table B.1 below under the f = 0 Hz row. Since amplitude gain is set to 0. Technically no sine input or f = 0Hz is applied. Hint: The measurement can be done directly from the scope using the Cursor Measurements tool. Alternatively, you can use MATLAB commands max(wl(:,2)) to find the maximum load speed using the saved wl variable. When the controller is stopped, the Speed (rad/s) scope saves data to the MATLAB workspace in the wl parameter. It has the following structure: wl(:,1) is the time vector, wl(:,2) is the measured speed, and wl(:,3) is the simulated speed.

Result: Calculate the steady-state gain both in linear and decibel (dB) units as explained in Frequency Response. Enter the resulting numerical value in the f = 0 Hz row of Table B.1. Also, enter its non-decibel value in Table B.2 in Result.

b). Gain at varying frequencies

In this part of the experiment, we will send an input sine wave at a certain frequency to the system and record the amplitude of the output signal. We will then increment the frequency and repeat the same observation. To create the input sine wave:

  1. In the SIMULINK diagram, double-click on the Signal Generator block and ensure the following parameters are set: • Wave form: sine • Amplitude: 1.0 • Frequency: 1.0 • Units: Hertz

  2. Set the Amplitude (V) slider gain to 2.0 V.

  3. Set the Offset (V) block to 0 V.

  4. Set the Simulation stop time to 5 seconds.

  5. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  6. The Rotary Servo Base Unit unit should begin rotating smoothly back and forth and the scopes should be reading a response similar to Figure 13 a) and b).

    Figure 13 Load shaft speed sine wave response
  7. Measure the maximum positive speed of the load shaft at f = 1.0 Hz input and enter it in Table B.1 below. As before, this measurement can be done directly from the scope using the Cursor Measurements tool or you can use MATLAB commands to find the maximum load speed using the saved wl variable. Result: Calculate the gain of the system (in both linear and dB units) and enter the results in Table B.1.

  8. Increase the frequency to f = 2.0 Hz by adjusting the frequency parameter in the Signal Generator block. Measure the maximum load speed and calculate the gain. Repeat this step for each of the frequency settings in Table B.1. Result: Using the MATLAB plot command and the data collected in Table B.1, generate a Bode magnitude plot. Make sure the amplitude and frequency scales are in decibels. When making the Bode plot, ignore the f = 0 Hz entry as the logarithm of 0 is not defined. Result: Calculate the time constant τe,f\tau_{e,f}τe,f​ using the obtained Bode plot by finding the cutoff frequency. Label the Bode plot with the -3 dB gain and the cutoff frequency. Enter the resulting time constant in Table B.2. Hint: Use the Data Tips tool to obtain values from the MATLAB Figure.

Step Response Experiment

In this method, a step input is given to the Rotary Servo Base Unit and the corresponding load shaft response is recorded. Using the saved response, the model parameters can then be found as discussed in Bump Test.

To create the step input:

  1. Double-click on the Signal Generator block and ensure the following parameters are set: • Wave form: square • Amplitude: 1.0 • Frequency: 0.4 • Units: Hertz

  2. Set the Amplitude (V) gain block to 1.0 V.

  3. Set the Offset (V)gain block to 2.0 V.

  4. Set the Simulation stop time to 5 seconds.

  5. Open the load shaft speed scope, Speed (rad/s), and the motor input voltage cope, Vm (V).

  6. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  7. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  8. The gears on the Rotary Servo Base Unit should be rotating in the same direction and alternating between low and high speeds. The response in the scopes should be similar to Figure 14 a) and b).

    Figure 14
  9. Save wl data and name it as modelling_section#_Group#_step. Result: Plot the response in MATLAB. Recall that the maximum load speed is saved in the MATLAB workspace under the wl variable. Result: Find the steady-state gain using the measured step response and enter it in Table B.2. Hint: Use the MATLAB ginput command to measure points off the plot.

  10. Find the time constant from the obtained response and enter the result in Table B.2.

  11. Click the Stop button on the SIMULINK diagram toolbar (or select QUARC | Stop from the menu) to stop the experiment.

Model Validation Experiment

In this experiment, you will adjust the model parameters you found in the previous experiments to tune the transfer function. Our goal is to match the simulated system response with the parameters you found as closely as possible to the response of the actual system. To create a step input:

  1. Double-click on the Signal Generator block and ensure the following parameters are set: • Wave form: square • Amplitude: 1.0 • Frequency: 0.4 • Units: Hertz

  2. Set the Amplitude (V) slider gain to 1.0 V.

  3. Set the Offset (V) block to 1.5 V.

  4. Set the Simulation stop time to 5 seconds.

  5. Open the load shaft speed scope, Speed (rad/s), and the motor input voltage scope, V_m (V).

  6. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  7. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  8. The gears on the Rotary Servo Base Unit should be rotating in the same direction and alternating between low and high speeds and the scopes should be as shown in Figure 15 a) and b). Recall that the yellow trace is the measured load shaft rate and the purple trace is the simulated trace. By default, the steady-state gain and the time constant of the transfer function used in simulation are set to: K = 1 rad/s/V and τ\tauτ = 0.1s. These model parameters do not accurately represent the system.

    Figure 15 Simulation done with default model parameters: K = 1 and = 0.1Save wl data and name it something like modelling_section#_Group#_K1tau01.
  9. Save wl data and name it as modelling_section#_Group#_K1tau01.

  10. Enter the command K = 1.25 in the MATLAB Command Window.

  11. Update the parameters used by the Transfer Function block in the simulation by updating diagram in the q_servo_modeling SIMULINK diagram. To update the diagram, from the Modeling tab, click Update Model. Alternatively, press Ctrl+D. Connect and run the SIMULINK model and observe how the simulation response changes. Remember we have increased K from 1 to 1.25.

  12. Save wl data and name it as modelling_section#_Group#_K125tau01.

  13. Enter the command tau = 0.2 in the MATLAB Command Window.

  14. Update the simulation again by updating diagram. Connect and run the SIMULINK model and observe how the simulation response changes. Remember we have increased τ\tauτ from 0.1 to 0.2.

  15. Save wl data and name it as modelling_section#_Group#_K125tau02. Result: We have varied the gain and time constant model parameters. How do the gain and the time constant affect the system response?

  16. Enter the nominal values, KKK and τ\tauτ , that were found in Pre-lab Q7 in the MATALB Command Window. Update the parameters and examine how well the simulated response matches the measured one.

  17. Save wl data and name it as modelling_section#_Group#_K#tau#. If the calculations were done properly, then the model should represent the actual system quite well. However, there are always some differences between each servo unit and, as a result, the model can always be tuned to match the system better. Try varying the model parameters until the simulated trace matches the measured response better. Enter these tuned values under the Model Validation section of Table B.2. If you have tried with different KKK and τ\tauτ values save the data. Result: Provide two reasons why the nominal model might not represent the Rotary Servo Base Unit with better accuracy. Result: Create a MATLAB figure that shows the measured and simulated response of the model validation response using the tuned model parameters of KKK and τ\tauτ. This can be done by manually changing the Servo Model Transfer Function block parameters or changing the K and tau parameters in the MATLAB Command Window and going to Simulation | Update Diagram in the SIMULINK model. Result: Explain how well the nominal model, the frequency response model, and the bump-test model represent the Rotary Servo Base Unit system.

Results

Table B.1 Collected frequency response data.

Table B.2 Summary of results for the Rotary Servo Base Unit Modeling laboratory.

Appendix

Rotary Servo User Manual

14MB
Rotary Servo User Manual.pdf
pdf

τ\tauτ

Lab 0: MATLAB & SIMULINK

The objective of this lab is to get familiar with MATLAB/SIMULINK in general.

Important Note: Georgia Tech honor code applies to this and all other experiments in this course. Ask the TAs or the instructor for help if you have any questions on these problems.

MATLAB & SIMULINK

It is critical that you read following two pdf files to know how to use MATLAB and SIMULINK to perform well in this course.

75KB
Helpful Matlab Stuff.pdf
pdf
1MB
SimulinkTutorial.pdf
pdf

Appendix

The following material contains detailed information on how to use MATLAB for control that you might find useful throughout the semester.

3MB
An-introduction-to-Control-Theory-Applications-with-Matlab.pdf
pdf

C. Control Design (Week 2)

Objective

The objective of this experiment is to design a position control system for the motor to meet a given set of specifications in frequency-domain.

Experiment Notes

Now that we have identified the time constant and the DC gain for the system in the modeling part of this experiment, the next step is to design a position control system in order to convert the given DC motor into a position servo. A classical PID controller will be used to control the position of the motor subject to a given set of specifications, for example, bandwidth, steady-state error requirements, etc.

Recall that the transfer function of the motor from VmV_mVm​ to Ωl\Omega_lΩl​ in Modelling is approximated as

Ωl(s)Vm(s)=Aτs+1(2.1)\displaystyle\frac{\Omega_l(s)}{V_m(s)} = \frac{A}{\tau s+1} \qquad \qquad \qquad \tag{2.1}Vm​(s)Ωl​(s)​=τs+1A​(2.1)

let A=KA = KA=K, DC gain of the motor.

Proportional (P) Control

Since θ˙=Ω\dot{\theta} = \Omegaθ˙=Ω, where θ\thetaθ is the angular position of the motor, the transfer function from the applied voltage to the motor angular position is

G(s)=θ(s)Vm(s)=As(τs+1)(3.1)G(s) = \displaystyle\frac{\theta (s)}{V_m (s)} = \frac{A}{s(\tau s+1)} \qquad \qquad \qquad \tag{3.1}G(s)=Vm​(s)θ(s)​=s(τs+1)A​(3.1)

The block diagram of a DC motor with a proportional controller is shown in Fig.1. In this case, the controller transfer function (HHH) is a simple gain KPK_PKP​. From Fig. 1, the closed-loop transfer function from the commanded angular position θc\theta_cθc​ to the actual angular position θ\thetaθ is given by

θ(s)θc(s)=AKpτs2+s+AKp=AKpτs2+1τs+AKpτ\frac{\theta(s)}{\theta_c(s)} = \frac{AK_p}{\tau s^2 + s + AK_p} = \frac{\cfrac{AK_p}{\tau}}{s^2 + \cfrac{1}{\tau}s + \cfrac{AK_p}{\tau}} θc​(s)θ(s)​=τs2+s+AKp​AKp​​=s2+τ1​s+τAKp​​τAKp​​​

Comparing the above transfer function to the standard form for a second-order system, i.e.,

θ(s)θc(s)=ωn2s2+2ζωns+ωn2\frac{\theta(s)}{\theta_c(s)} = \frac{\omega_n^2}{s^2 + 2\zeta \omega_n s + \omega_n^2}θc​(s)θ(s)​=s2+2ζωn​s+ωn2​ωn2​​

we notice that the proportional gain KpK_pKp​ affects the natural frequency (and hence the bandwidth) of the closed-loop system.

Figure 1: Closed-loop block diagram for the position control of a DC motor using a proportional controller

Proportional-plus-Derivative (PD) Control

The block diagram of a DC motor with an inner loop angular rate (i.e., derivative) feedback and an outer loop angular position error (proportional) feedback is shown in Fig. 2. From Fig. 2, the closed-loop transfer function from the commanded angular position θc\theta_cθc​ to the actual angular position θ\thetaθ is given by

θ(s)θc(s)=AKpτms2+(1+AKd)s+AKp=AKpτms2+(1+AKd)τms+AKpτm\frac{\theta(s)}{\theta_c(s)} = \frac{AK_p}{\tau_m s^2 + (1 + AK_d)s + AK_p} = \frac{\cfrac{AK_p}{\tau_m}}{s^2 + \cfrac{(1 + AK_d)}{\tau_m}s + \cfrac{AK_p}{\tau_m}}θc​(s)θ(s)​=τm​s2+(1+AKd​)s+AKp​AKp​​=s2+τm​(1+AKd​)​s+τm​AKp​​τm​AKp​​​
Figure 2: Closed-loop block diagram for the position control of a DC motor using a proportional-plus-derivative (PD) controller.

Comparing the above transfer function with the standard form for a second-order system, we notice that the derivative gain KdK_dKd​ affects the damping while the proportional gain KpK_pKp​ affects the natural frequency of the closed-loop system.

Proportional-plus-Integral-plus-Derivative (PID) Control

The block diagram of a DC motor with an inner loop angular rate (i.e., derivative) feedback and an outer loop angular position error plus integral of angular position error (i.e., proportional plus integral) feedback is shown in Fig. 3.

Figure 3: Closed-loop block diagram for the position control of the DC motor using a proportional-plus-Integral-plus-derivative (PID) controller

From Fig. 3, the open-loop transfer function GHGHGH becomes

GH=(Kps+Ki)sA(τms+1+AKd)1sGH = \frac{(K_ps+K_i)}{s} \frac{A}{(\tau_ms+1+AK_d)}\frac{1}{s}GH=s(Kp​s+Ki​)​(τm​s+1+AKd​)A​s1​

indicating that with integral feedback, the type of the system increases from 1 to 2 and hence, results in zero steady-state error to both ramp and step command inputs.

Controller Gain Limits

In control design, a factor to be considered is saturation. This is a nonlinear element and is represented by a saturation block as shown in Figure 4. In a system like the Rotary Servo Base Unit, the computer calculates a numeric control voltage value. This value is then converted into a voltage, Vdac(t)V_{\text{dac}}(t)Vdac​(t), by the digital-to-analog converter of the data-acquisition device in the computer. The voltage is then amplified by a power amplifier by a factor of KaK_aKa​. If the amplified voltage, Vamp(t)V_{\text{amp}}(t)Vamp​(t), is greater than the maximum output voltage of the amplifier or the input voltage limits of the motor (whichever is smaller), then it is saturated (limited) at VmaxV_{\text{max}}Vmax​. Therefore, the input voltage Vm(t)V_m(t)Vm​(t) is the effective voltage being applied to the Rotary Servo Base Unit motor.

The limitations of the actuator must be taken into account when designing a controller. For instance, the voltage entering the Rotary Servo Base Unit motor should never exceed V_{\text{max}} = 10.0 V \qquad \qquad \qquad \tag{3.2}

Figure 4. Actuator saturation.

Sampling Time

The most important difference between analog and digital control is that digital systems operate using a clock. The timing of this clock and the number of operations necessary to implement a controller place a limit on how frequently the controller can access sensors, make calculations, and modify the control inputs. (In addition, other elements of the control system themselves may introduce an additional time delay. For this reason, the sampling time TsT_sTs​ of the digital system is an important parameter.) Digital controllers, in general, will have a maximum TsT_sTs​. Increasing the TsT_sTs​ further will make the closed-loop system unstable.

Design Specifications

The closed-loop DC motor system must meet the following specifications.

  1. Bandwidth frequency of at least 25 rad/s (Bandwidth is an important measure of the frequency range over which the system output follows well the command signal. It is defined as the frequency at which the magnitude ratio is -3 dB in the closed-loop system frequency response plot. Sinusoidal inputs with frequencies less than the bandwidth frequency are tracked ‘reasonably well’ by the system.)

  2. Phase margin of at least 70 deg. (Gain and phase margins are stability margins to accommodate model variations. A flight control system actuator is typically subject to varying load, resulting in model variations. Hence, it is important to design a controller with sufficient stability margins to accommodate such variations and other effects such as wear with usage.)

  3. Zero steady-state error to both step and ramp commands.

Guidelines for saving plots

  1. Save root locus open-loop Bode, closed-loop bode and step response plots as separate figures.

  2. In open-loop or closed-loop Bode plots, you should show Bandwidth frequency and Phase margin values.

  3. In the step response plot, you should show the steady-state value.

  4. Only for controlSystemDesigner or rltool only, you may use the Snipping tool and save the figures in a Word document.

  5. For other Simulink-generated data, you need to use the plot MATLAB command.

Results from each step below must be checked with TAs before proceeding to the next:

Procedure

  1. Using the model, i.e., K and tau values, you have obtained from the Modeling - Model Validation, input the transfer function G(s)G(s)G(s) (Equation 3.1) into MATLAB. Use K and tau from the model validation values.

  2. First consider a proportional controller, i.e., C = Kp. Input C = 1 into MATLAB.

  3. Run controlSystemDesigner(G,C) (you can alternatively run rltool(G,C) for versions R2020b and older). Select ‘New Plot -> New Step’ to launch the step response plot (if it is not automatically launched). In the time response plot, only the ‘closed loop: r to y' (blue plot) should be visible. Always do this in all the labs. Select ‘New Plot -> New Bode’ and choose the appropriate option to launch the closed-loop Bode plot. In the closed-loop Bode response window, select the magnitude plot only and readjust the magnitude plot limits to -3.5 dB and -2.5 dB under properties and limits. The bandwidth frequency (defined above) can be read from the closed-loop Bode plot. It may be useful to add a grid to the bode plot. Note: If the closed-loop Bode plot is not visible after adjusting magnitude plot limits, it indicates that the design specification is not met, which would require gain tuning. This will be performed in Step 5.

  4. If Open-loop Bode Editor is not automatically launched. In Control System Designer or rltool, select ‘Open-loop Bode’ under ‘Tuning Methods -> Bode Editor’. The phase margin (PM) of the system can be read off the open-loop bode plot. Note: The LoopTransfer_C Bode is the open-loop Bode.

  5. Change the controller gain by double-clicking ‘C’ under ‘Controllers and Fixed Blocks’ or by using your cursor on the root locus and check if all the design specifications can be met using a proportional controller, which would be optimal from a design standpoint. If not, at least select a value of KpK_pKp​ such that the bandwidth is more than 25 rad/sec. Save the root locus, open and closed-loop Bode, time response plot and P gain.

  6. Consider a proportional and derivative controller. In the compensator editor window under ‘C’, add a zero around -60. Using the cursor or manually input values, adjust the zero location of the controller first and see if the specification can be met. If adjusting the zero location cannot achieve the specification, readjust the proportional gain (if necessary) such that, at least, the bandwidth and phase margin specifications are met. (Note that with a PD controller for this system, the open-loop transfer function GCGCGC is still of Type 1. Hence, the zero steady-state error specification for ramp input cannot be met with a PD controller.) Save the root locus, open and closed-loop Bode, time response plot and PD gains. The compensator transfer function in Control System Designer or rltool in this step is of the form shown below. Use it to determine the gains KpK_pKp​ and KdK_dKd​. Save these gains.

    Save a screenshot of the control structure that you now have in Control System Designer or rltool (go to Edit Architecture tab). This screenshot will be required to answer a question for the report (refer to Questions for Report).

  7. Consider a PID controller. Using KpK_pKp​ and KdK_dKd​ values you have obtained from the previous steps, edit the compensator (i.e. add poles and zeros to match the format below) to include integral feedback with the integral gain set to a small value (i.e., KiK_iKi​ is 1% of KpK_pKp​). The controller transfer function for this step is Hint: We have all PID values, plug into above controller transfer function and solve for A and B in Ki(1+As)(1+Bs)sK_i\frac{(1+As)(1+Bs)}{s}Ki​s(1+As)(1+Bs)​ form. This should give you value of AB=KdKi,A+B=KpKiAB = \frac{K_d}{K_i}, A+B = \frac{K_p}{K_i}AB=Ki​Kd​​,A+B=Ki​Kp​​. To put it in the compensator the zero locations are -1/A and -1/B.

  8. Readjust the proportional and derivative gains (if necessary, by modifying the zeros, not the overall gain, KiK_iKi​) such that bandwidth and phase margin specs are met.

  9. Save the root locus plot, open and closed-loop system Bode plots, and time response plot as graphs. Also, save your gains (if you readjusted any values in Step 8, you must convert from the Control System Designer or rltool compensator format, back to our conventional gain representation – KpK_pKp​ , KdK_dKd​ , KiK_iKi​).

  10. Using the controller you have designed, obtain the closed-loop transfer function and save your result. (Do this in MATLAB using the transfer function variables of GGG and CCC , or export the closed-loop transfer function from Control System Designer or rltool(T_r2y), using the ‘Export’.) (May be listed as ‘IOTransfer_r2y’). In MATLAB, change the exported state space into a transfer function using tf(IOTransfer_r2y)

  11. Obtain poles of the closed-loop system. Compute the natural frequency and damping of the dominant poles of the closed-loop system. You can do all this from your exported transfer function using the function damp(). Save your results.

  12. Construct a SIMULINK diagram using Fig. 3 as a guide. Use a transfer function block for the plant (use K and tau from the model validation). Add saturation of max 10V and min -10V block before the Plant transfer function. Set the solver type to Fixed-step with size of 0.002. Include the controller gains from your design. Do not use the transfer function block or the inbuilt PID controller block for the controller gains. Save your Simulink model for further use in Part C of the experiment. Save the Simulink block diagram as a .jpg or .png image.

  13. Run the responses to a unit ramp input first with a PD controller (by setting Ki = 0) and then with a PID controller (Ki = 1% Kp). Run the simulation for about 30 sec. Make comparison plots of ramp responses with PD and PID controllers (on the same plot) to show any differences between the two responses, especially in steady-state response (i.e., for t>>0, also you may zoom in to see the difference clearly). The difference can be more easily spotted by plotting the error variable (i.e. error between the commanded position and the actual position) for each controller. Save the comparison plot and error plot.

You must have your work checked out by one of the TAs before leaving the lab.

Results for Report

Note:

  • The plots for controller design, i.e., root locus, open-loop Bode, closed-loop Bode, and step response, must be shown as separate figures.

  • In open-loop or closed-loop Bode plots, you should show Bandwidth frequency and Phase margin values.

  • In the step response plot, you should show the steady-state value. This can be done by right-clicking on the plot -> "Characteristics" -> "Steady-state".

  • Only for controlSystemDesigner or rltool plots, you can include the plots as obtained using the Snipping tool.

  • For other Simulink-generated data, you need to use the plot MATLAB command.

(A) From Step 5

  1. Root locus plot

  2. Open-loop Bode plot

  3. Closed-loop Bode plot

  4. Time response plot

  5. P (proportional) gain

(B) From Step 6

  1. Root locus plot

  2. Open-loop Bode plot

  3. Closed-loop Bode plot

  4. Time response plot

  5. PD (proportional and derivative) gains

(C) From Step 9

  1. Root locus plot

  2. Open-loop Bode plot

  3. Closed-loop Bode plot

  4. Time response plot

  5. PID (proportional, derivative and integral) gain values (mention if the gains are the same values or readjusted values from Step 8)

(D) From Step 10

  1. Closed-loop transfer function

(E) From Step 11

  1. Poles of the closed-loop system

  2. Natural frequency of the closed-loop system dominant poles

  3. Damping of the closed-loop system dominant poles

(F) From Step 12

  1. PID controller SIMULINK block diagram (image)

(G) From Step 13

  1. Plots comparing the ramp responses of PD and PID controllers (on the same figure)

  2. Plots comparing the error variable of PD and PID controllers (on the same figure)

Questions for Report

  1. What is the difference between Fig. 2 and the control structure screenshot that you saved in Step 6? Hint: Focus on where KdK_dKd​ is located in the control loop and what it is multiplied by.

  2. Why is this difference between the two control structures acceptable when dealing with a step input? Use and modify the Simulink model that you built in Step 12 for the two control structure cases (i.e.,KdK_dKd​ is multiplied by the derivative of error or speed directly). You may create two separate Simulink files or build two models within the same Simulink file. Run each Simulink with a unit step input and a unit ramp input for 5 seconds. Use the PD gains found in Step 6 (Result B.5) and set Ki = 0. Create plots below to help you explain the question asked above:

    1. Step responses (two plots on the same figure)

    2. Ramp responses (two plots on the same figure)

    3. Derivative of error signal and speed value in one figure for the step input from both models

    4. Derivative of error signal and speed value in one figure for the ramp input from both models

Lab 1: Rotary Servo Base

Welcome to the first hands-on experiment!

Welcome

AE4610 - Dynamics and Control Laboratory

Welcome to AE4610 - Dynamics and Control Laboratory!

Here you will find the lab manuals for all experiments that will take place this semester. Navigate to the appropriate experiment on the left-hand menu. You can export each experiment as a PDF if you want a copy for your records, or to print as a hard copy. Also, bookmark this page on your smartphone or tablet as well as your PC/laptop as a handy guide during your lab session.

Lab 2: 3 DOF Gyroscope

A. Integration (Week 1)

1. QUANSER Rotary Servo Base

The Quanser Rotary Servo Base Unit rotary servo plant, shown below, consists of a DC motor that is encased in a solid aluminum frame and equipped with a planetary gearbox. The motor has its own internal gearbox that drives external gears. The Rotary Servo Base Unit is equipped with two sensors: a potentiometer and an encoder. The potentiometer and the encoder sensors measure the angular position of the load gear using different methods.

ID
Component
ID
Component

2. Components & Sensors

a) DC Motor

The Rotary Servo Base Unit incorporates a Faulhaber Coreless DC Motor model 2338S006 and is shown in Figure 1c with ID #9. This is a high-efficiency, low-inductance motor that can obtain a much faster response than a conventional DC motor.

b) Potentiometer

A rotary potentiometer, or pot, is a manually controlled variable resistor. See the example shown below. It typically consists of an exposed shaft, three terminals (A, W, and B), an encased internal resistive element shaped in a circular pattern, and a sliding contact known as a wiper. By rotating the shaft, the internal wiper makes contact with the resistive element at different positions, causing a change in resistance when measured between the centre terminal (W) and either of the side terminals (A or B). The total resistance of the potentiometer can be measured by clamping a multimeter to terminals A and B.

A schematic diagram of the voltage dividing characteristic of a potentiometer is illustrated below. By applying a known voltage between terminals A and B (), voltage is divided between terminals AW and WB where:

When connected to an external shaft, a rotary potentiometer can measure absolute angular displacement. By applying a known voltage to the outside terminals of the pot, we can determine the position of the sensor based on the output voltage or which will be directly proportional to the position of the shaft. One of the advantages of using a potentiometer as an absolute sensor is that after a power loss, position information is retained since the resistance of the pot remains unchanged. While pots are an effective way to obtain a unique position measurement, caution must be used since their signal output may be discontinuous. That is, after a few revolutions potentiometers may reset their signal back to zero. Another disadvantage of most pots is that they have physical stops that prevent continuous shaft rotation.

c) Encoders

An incremental optical encoder is a relative angular displacement sensor that measures angular displacement relative to a previously known position. Unlike an absolute encoder, an incremental encoder does not retain its position information upon power loss. An incremental encoder outputs a series of pulses that correlate to the relative change in angular position. Encoders are commonly used to measure the angular displacement of rotating load shafts. The information extracted from an incremental encoder can also be used to derive instantaneous rotational velocities.

An incremental optical encoder typically consists of a coded disk, an LED, and two photo sensors. The disk is coded with an alternating light and dark radial pattern causing it to act as a shutter. As shown schematically above, the light emitted by the LED is interrupted by the coding as the disk rotates around its axis. The two photo sensors (A and B) positioned behind the coded disk sense the light emitted by the LED. The process results in A and B signals, or pulses, in four distinct states: (1) A off, B on; (2) A off, B off; (3) A on, B off; (4) A on, B on. Encoders that output A and B signals are often referred to as quadrature encoders since the signals are separated in phase by 90◦. The resolution of an encoder corresponds to the number of light or dark patterns on the disk and is given in terms of pulses per revolution, or PPR. In order to make encoder measurements, you need to connect the encoder to a counter to count the A and B signals. Then use a decoder algorithm to determine the number of counts and direction of rotation. Three decoding algorithms are used: X1, X2, X4.

X1 Decoder: When an X1 decoder is used, only the rising or falling edge of signal A is counted as the shaft rotates. When signal A leads signal B, the counter is incremented on the rising edge of signal A. When signal B leads signal A, the counter is decremented on the falling edge of signal A. Using an X1 decoder, a 1,024 PPR encoder will result in a total of 1,024 counts for every rotation of the encoder shaft. X2 Decoder: When an X2 decoder is used, both the rising and falling edges of signal A are counted as the shaft rotates. When signal A leads signal B, the counter is incremented on both the rising and falling edge of signal A. When signal B leads signal A, the counter is decremented on both the rising and falling edges of signal A. Using an X2 decoder, a 1,024 PPR encoder will generate a total of 2,048 counts for every rotation of the encoder shaft. X4 Decoder: When an X4 algorithm is used, both the rising and falling edges of both signals A and B are counted. Depending on which signal leads, the counter will either increment or decrement. An X4 decoder generates four times the number of counts generated by an X1 decoder resulting in the highest resolution among the three types of decoders. Using an X4 decoder, a 1,024 PPR encoder will generate a total of 4,096 counts for every rotation of the encoder shaft.

The angular resolution of an encoder depends on the encoder’s pulses per revolution (PPR) and the decoding algorithm used:

where N = 1, 2, or 4 corresponds to X1, X2, and X4 decoders respectively

3. Velocity Estimation

While encoders are typically used for measuring angular displacement, they can also measure rotational speeds. The velocity can be found by taking the difference between consecutive angle measurements

​where represents the position measurement sample and is the sampling interval of the control software. The resolution or ripple in the velocity measurement is given by

is rotational speed (rad/s) and is the resolution of the encoder given in Equation 1.1, and is the sampling interval. Note that the ripple velocity increases when the sampling period decreases.

4. Filtering the Velocity Signal

In practice, determining rotational speeds by means of derivation of the discontinuous encoder output often results in signal noise. The ripple in the velocity signal due to sampling can be reduced by filtering. Applying a first-order low-pass filter to the measured velocity signal

​where is the measured signal, is the filtered signal, and is the filter time constant. Low-pass filters are also often represented in terms of cutoff frequency :

where . The low-pass filter attenuates the high-frequency components of the signal higher than the cut-off frequency specified, i.e. passes signal with frequencies

Rearranging the filter transfer function above,

we can represent the filtering using the differential equation

​The derivative can be approximated by the difference between the currently measured sample, , and the previous sample, :

​Solving for ,

Thus the high-frequency error is reduced by a factor of . The ripple in the filtered velocity signal caused by the encoder is

Note: Filtering does add dynamics to the signal, i.e. small delay, as given by the term in Equation 1.3.

5. Encoder Counter Wrapping

Encoder counters on data acquisition (DAQ) devices have a rated number of bits, n. For example, a DAQ with an 8-bit signed counter has a range between −128 and +127 (i.e. and ). When the encoder counts go beyond this range, the measured counts from the DAQ ends up wrapped. Consider the following example. If the encoder is measuring 100 counts, then the DAQ counter will output 100 (no wrapping). However, if the encoder is measuring 150 counts, then the 8-bit signed counter will read counts. Thus the encoder wraps and causes a discontinuity. This can be very problematic in closed-loop feedback control. The QUARC software includes an Inverse Modulus block that unwraps the counter signal and keeps a continuous signal. For more information, see the Inverse Modulus block in the QUARC documentation.

Experiment

Follow the steps and build the SIMULINK model below:

Follow these steps to read the motor velocity:

  1. First, download and open q_servo_vel_direct.slx Simulink model.

  2. Configure the model to apply a 0.4 Hz square wave voltage signal going between 0.5V and 2.5V.

  3. Change the simulation time to 5 seconds from Simulation tab, stop time.

  4. Go to Modelling tab and open modelling setting. Check that sample time is set to 0.002s and check that solver is set to ode1 (euler).

  5. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  6. Click the Deploy button under Monitor & Tune, next click the Connect button, also under Monitor & Tune and then run SIMULINK by clicking Start .

  7. The velocity measurement using a direct derivative will be noisy. After the SIMULINK has run for 5 seconds and stopped, note down the velocity ripple (crest to peak or height within ripple). You can use the Cursor Measurements tool in the Scope for more accurate measurements. Save the speed data (wl) to plot in the report. Name the file such as integration_sampletime0.002s.

  8. Increase the control loop rate of the QUARC controller by decreasing the sampling interval to 0.001 s, i.e. increasing the sampling rate to 1 kHz. Build, Connect and run the Simulink. Once SIMULINK has run for 5 seconds and stopped, note down the velocity ripple and examine the change in the ripple velocity measurement. Save the speed data (wl) to plot in the report. Name the file such as integration_sampletime0.001s.

  9. Run the controller for a minute or two (stop time to inf). Depending on the data acquisition device you are using (e.g. Q2-USB or Q8-USB), you may notice a spike or discontinuity that occurs in the velocity estimation, as shown below (once the discontinuity occurs stop the simulation). Save the speed data (wl) to plot in the report. Name the file such as integration_wrapping.

    This encoder wrapping is due to the range of the DAQ encoder counter. To remove the wrapping and maintain a continuous signal, use the QUARC Inverse Modulus block before Encoder: count to rad block. Build, connect and run your QUARC controller and ensure the signal is now continuous (i.e. no spike occurs). Save the speed data (wl) to plot in the report. Name the file such as integration_no_wrapping. Note : The Inverse Modulus block should be added to the output of the HIL Read Encoder and set to the where n is the bits of the DAQ encoder counter. Quanser Q2-USB has 16-bit encoder counter and Quanser Q8-USB has 24-bit encoder counter.

  10. Add a low-pass filter with a time constant of s using the Simulink Transfer Fcn block. This translates into having a filter with a cutoff frequency of 1/0.01 = 100 rad/s. Run it for 5 seconds.

    Save the speed data (wl) to plot in the report. Name the file such as integration_lowpass. Save a screenshot of the Simulink model designed (block diagram).

Results for Report

(A) From Step 7

  1. Given that the Rotary Servo Base Unit rotary encoder has 1024 PPR and the quadrature (X4) decoding is used in the DAQ, find the resolution of the encoder () using Eq. 1.1. Using this encoder resolution and Eq. 1.2, find the estimated velocity ripple of the Rotary Servo Base Unit for sampling interval 0.002 s. Compare this estimated velocity ripple with the measured velocity ripple from Step 7.

  2. Response plots from Step 7.

(B) From Step 8

  1. Using the encoder resolution () found in Result A.1 and Eq. 1.2, find the estimated velocity ripple for sampling interval 0.001 s. Compare this estimated velocity ripple with the measured velocity ripple from Step 8.

  2. Response plots from Step 8.

(C) From Step 9

  1. Response plots with and without encoder wrapping from Step 9.

(D) From Step 10

  1. Using found in Result A.1, along with Eq. 1.4, and , find the estimated velocity ripple with filter. Compare the estimated velocity ripple with the measured velocity ripple from Step 10.

  2. Compare the measured velocity ripple from Step 8 (without filter) with the measured velocity ripple from Step 10 (with filter). How much noise does the filter remove?

  3. Completed SIMULINK block diagram with low-pass filter from Step 10.

  4. Response plots from Step 10.

B. Modeling (Week 1)

The objective of this experiment is to find a transfer function that describes the rotary motion of the Rotary Servo Base Unit load shaft. The dynamic model is derived analytically from classical mechanics principles and using experimental methods.

The angular speed of the Rotary Servo Base Unit load shaft with respect to the input motor voltage can be described by the following first-order transfer function:

where is the Laplace transform of the load shaft speed , is the Laplace transform of motor input voltage , is the steady-state gain, is the time constant, and is the Laplace operator. The Rotary Servo Base Unit transfer function model is derived analytically in and its and parameters are evaluated. These are known as the nominal model parameter values. The model parameters can also be found experimentally. describes how to use the frequency response and bump-test methods to find and . These methods are useful when the dynamics of a system are not known, for example in a more complex system. After the lab experiments, the experimental model parameters are compared with the nominal values.

1. Modeling Using First-Principles

a) Electrical Equations

The DC motor armature circuit schematic and gear train is illustrated in Figure 7.

is the motor resistance, is the inductance, and is the back-emf constant.

The back-emf (electromotive) voltage depends on the speed of the motor shaft, , and the back-emf constant of the motor, . It opposes the current flow. The back emf voltage is given by:

Using Kirchoff’s Voltage Law, we can write the following equation:

Since the motor inductance is much less than its resistance, it can be ignored. Then, the equation becomes:

Solving for , the motor current can be found as:

b) Mechanical Equations

In this section, the equation of motion describing the speed of the load shaft, , with respect to the applied motor torque, , is developed. Since the Rotary Servo Base Unit is a one degree-of-freedom rotary system, Newton’s Second Law of Motion can be written as:

where is the moment of inertia of the body (about its center of mass), is the angular acceleration of the system, and is the sum of the torques being applied to the body. As illustrated in Figure 7, the Rotary Servo Base Unit gear train along with the viscous friction acting on the motor shaft, , and the load shaft are considered. The load equation of motion is:

where is the moment of inertia of the load and is the total torque applied on the load. The load inertia includes the inertia from the gear train and from any external loads attached, e.g. disc or bar. The motor shaft equation is expressed as:

where is the motor shaft moment of inertia and is the resulting torque acting on the motor shaft from the load torque. The torque at the load shaft from an applied motor torque can be written as:

where is the gear ratio and is the gearbox efficiency. The planetary gearbox that is directly mounted on the Rotary Servo Base Unit motor (see for more details) is represented by the and gears in Figure 7 and has a gear ratio of

This is the internal gear box ratio. The motor gear and the load gear are directly meshed together and are visible from the outside. These gears comprise the external gear box which has an associated gear ratio of

The gear ratio of the Rotary Servo Base Unit gear train is then given by:

Thus, the torque seen at the motor shaft through the gears can be expressed as:

Intuitively, the motor shaft must rotate times for the output shaft to rotate one revolution.

We can find the relationship between the angular speed of the motor shaft, , and the angular speed of the load shaft, by taking the time derivative:

To find the differential equation that describes the motion of the load shaft with respect to an applied motor torque substitute (Eq 2.13), (Eq 2.15) and (Eq 2.7) into (Eq 2.8) to get the following:

Collecting the coefficients in terms of the load shaft velocity and acceleration gives

Defining the following terms:

simplifies the equation as:

c) Combining the Electrical and Mechanical Equations

In this section the electrical equation and the mechanical equation are brought together to get an expression that represents the load shaft speed in terms of the applied motor voltage.

The motor torque is proportional to the voltage applied and is described as

where is the current-torque constant (), is the motor efficiency, and is the armature current. See for more details on the Rotary Servo Base Unit motor specifications. We can express the motor torque with respect to the input voltage and load shaft speed by substituting the motor armature current given by Eq 2.5, into the current-torque relationship given in Eq 2.21:

To express this in terms of and , insert the motor-load shaft speed Eq 2.15, into Eq 2.21 to get:

If we substitute (Eq 2.23) into (Eq 2.20), we get:

After collecting the terms, the equation becomes

This equation can be re-written as:

where the equivalent damping term is given by:

and the actuator gain equals

2. Modeling Using Experiments

A linear model of a system can also be determined purely experimentally. The main idea is to experimentally observe how a system reacts to different inputs and change structure and parameters of a model until a reasonable fit is obtained. The inputs can be chosen in many different ways and there are a large variety of methods. Two methods of modeling the Rotary Servo Base Unit are: (1) frequency response and, (2) bump test.

a) Frequency Response

In Figure 8, the response of a typical first-order time-invariant system to a sine wave input is shown. As it can be seen from the figure, the input signal () is a sine wave with a fixed amplitude and frequency. The resulting output () is also a sinusoid with the same frequency but with a different amplitude. By varying the frequency of the input sine wave and observing the resulting outputs, a Bode plot of the system can be obtained as shown in Figure 9.

The Bode plot can then be used to find the steady-state gain, i.e. the DC gain, and the time constant of the system. The cuttoff frequency, , shown in Figure 9 is defined as the frequency where the gain is 3 dB less than the maximum gain (i.e. the DC gain) in dB. When working in the linear non-decibel range, the 3 dB frequency is defined as the frequency where the gain is , or about 0.707, of the maximum gain. The cutoff frequency is also known as the bandwidth of the system which represents how fast the system responds to a given input.

The magnitude of the frequency response of the Rotary Servo Base Unit plant transfer function given in equation Eq 2.1 is defined as:

where is the frequency of the motor input voltage signal . We know that the transfer function of the system has the generic first-order system form given in Eq 2.1. By substituting in this equation, we can find the frequency response of the system as:

Then, the magnitude of it equals

Let’s call the frequency response model parameters and to differentiate them from the nominal model parameters, and , used previously. The steady-state gain or the DC gain (i.e. gain at zero frequency) of the model is:

b) Bump Test / Unit Step Input Test

The bump test is a simple test based on the step response of a stable system. A step input is given to the system and its response is recorded. As an example, consider a system given by the following transfer function:

The step response shown in Figure 10 is generated using this transfer function with and .

The step input begins at time . The input signal has a minimum value of and a maximum value of . The resulting output signal is initially at . Once the step is applied, the output tries to follow it and eventually settles at its steady-state value yss. From the output and input signals, the steady-state gain is

where and . In order to find the model time constant, , we can first calculate where the output is supposed to be at the time constant from:

Then, we can read the time that corresponds to from the response data in Figure 10. From the figure we can see that the time is equal to:

From this, the model time constant can be found as:

Going back to the Rotary Servo Base Unit system, a step input voltage with a time delay can be expressed as follows in the Laplace domain:

where is the amplitude of the step and is the step time (i.e. the delay). If we substitute this input into the system transfer function given in Eq 2.1, we get:

We can then find the Rotary Servo Base Unit load speed step response, , by taking inverse Laplace of this equation. Here we need to be careful with the time delay and note that the initial condition is

Experimental Setup

The q_servo_modeling Simulink diagram shown in Figure 11a will be used to conduct the experiments. The Rotary Servo Base Unit subsystem contains QUARC blocks that interface with the DC motor and sensors of the Rotary Servo Base Unit system. The Rotary Servo Base Unit Model uses a Transfer Fcn block from the SIMULINK library to simulate the Rotary Servo Base Unit system. Thus, both the measured and simulated load shaft speed can be monitored simultaneously given an input voltage. We have implemented a first-order low-pass filter in integration but for modeling second-order low-pass filter has been implemented with cutoff frequency of rad/s damping ratio of 0.9.

  1. Download the Modeling_files.zip and extract the files to desktop.

  2. Open q_servo_modeling.m SIMULINK file.

  3. Double click on the "Rotary Servo Interface - Speed" subsystem to access the DAQ configuration

  4. Configure DAQ: Double-click on the HIL Initialize block in the SIMULINK diagram and ensure it is configured for the DAQ device that is installed in your system (e.g. Q2-USB).

  5. Open setup_servo_modeling.m file to open the setup script for the q_servo_modeling SIMULINK model.

  6. Run the script. Note: The calculated servo model parameter are default model parameters and do not accurately represent the Rotary Servo Base Unit system.

Frequency Response Experiment

The frequency response of a linear system can be obtained by providing a sine wave input signal to it and recording the resulting output sine wave from it. In this experiment, the input signal is the motor voltage and the output is the motor speed. In this method, we keep the amplitude of the input sine wave constant but vary its frequency. At each frequency setting, we record the amplitude of the output sine wave. The ratio of the output and input amplitudes at a given frequency can then be used to create a Bode magnitude plot. Then, the transfer function for the system can be extracted from this Bode plot.

a) Steady-state gain

First, we need to find the steady-state gain of the system. This requires running the system with a constant input voltage. To create a constant input voltage follow these steps:

  1. In the SIMULINK diagram, double-click on the Signal Generator block and ensure the following parameters are set: • Wave form: sine • Amplitude: 1.0 • Frequency: 0.4 • Units: Hertz

  2. Set the Amplitude (V) slider gain to 0.

  3. Set the Offset (V) block to 2.0 V. Note: Execution of steps 1 through 3 generates a step input of 2.0 V magnitude.

  4. Set the Simulation stop time to 5 seconds.

  5. Open the load shaft speed scope, Speed (rad/s), and the motor input voltage scope, Vm (V) .

  6. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  7. Click the Deploy button under Monitor & Tune, followed by the Connect button and then run SIMULINK by clicking Start .

  8. The Rotary Servo Base Unit unit should begin rotating in one direction. The scopes should be reading something similar to figure below. Note that in the Speed (rad/s) scope, the yellow trace is the measured speed while the blue trace is the simulated speed (generated by Servo Model block).

  9. Measure the speed of the load shaft and enter the measurement in below under the f = 0 Hz row. Since amplitude gain is set to 0, technically no sine input when f = 0 Hz is applied. Note: No need to save wl variable data or scope plot. Hint: The measurement can be done directly from the scope using the Cursor Measurements tool. Alternatively, you can use MATLAB commands max(wl(:,2)) to find the maximum load speed using the saved wl variable. When the controller is stopped, the Speed (rad/s) scope saves data to the MATLAB workspace in the wl parameter. It has the following structure: wl(:,1) is the time vector, wl(:,2) is the measured speed, and wl(:,3) is the simulated speed. Calculate the steady-state gain both in linear and decibel (dB) units, i.e. , as explained in . Enter the resulting numerical value in the f = 0 Hz row of . Also, enter its non-decibel value in under the 'Frequency Response Experiment' section.

b) Gain at varying frequencies

In this part of the experiment, we will send an input sine wave at a certain frequency to the system and record the amplitude of the output signal. We will then increment the frequency and repeat the same observation. To create the input sine wave:

  1. In the SIMULINK diagram, double-click on the Signal Generator block and ensure the following parameters are set: • Wave form: sine • Amplitude: 1.0 • Frequency: 1.0 • Units: Hertz

  2. Set the Amplitude (V) slider gain to 2.0 V.

  3. Set the Offset (V) block to 0 V.

  4. Set the Simulation stop time to 5 seconds.

  5. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  6. The Rotary Servo Base Unit unit should begin rotating smoothly back and forth and the scopes should be reading a response similar to Figure 13 a) and b).

  7. Measure the maximum positive speed of the load shaft at f = 1.0 Hz input and enter it in below. As before, this measurement can be done directly from the scope using the Cursor Measurements tool or you can use MATLAB commands to find the maximum load speed using the saved wl variable. Calculate the gain of the system (in both linear and dB units) and enter the results in .

  8. Increase the frequency to f = 2.0 Hz by adjusting the frequency parameter in the Signal Generator block. Measure the maximum load speed and calculate the gain. Repeat this step for each of the frequency settings in .

Step Response Experiment

In this method, a step input is given to the Rotary Servo Base Unit and the corresponding load shaft response is recorded. Using the saved response, the model parameters can then be found as discussed in .

To create the step input:

  1. Double-click on the Signal Generator block and ensure the following parameters are set: • Wave form: square • Amplitude: 1.0 • Frequency: 0.4 • Units: Hertz

  2. Set the Amplitude (V) gain block to 1.0 V.

  3. Set the Offset (V)gain block to 2.0 V.

  4. Set the Simulation stop time to 5 seconds.

  5. Open the load shaft speed scope, Speed (rad/s), and the motor input voltage cope, Vm (V).

  6. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  7. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  8. The gears on the Rotary Servo Base Unit should be rotating in the same direction and alternating between low and high speeds. The response in the scopes should be similar to Figure 14 a) and b).

  9. Save wl data and name it as modeling_section#_Group#_step. Note down the magnitude of input voltage as this will be required to calculate the steady-state gain in the section.

  10. Click the Stop button on the SIMULINK diagram toolbar (or select QUARC | Stop from the menu) to stop the experiment.

Model Validation Experiment

In this experiment, you will use the calculated values of K and from the frequency response experiment, bump test experiment, and nominal values calculated to see if it matches the measured response. To create a step input:

  1. Double-click on the Signal Generator block and ensure the following parameters are set: • Wave form: square • Amplitude: 1.0 • Frequency: 0.4 • Units: Hertz

  2. Set the Amplitude (V) slider gain to 1.0 V.

  3. Set the Offset (V) block to 1.5 V.

  4. Set the Simulation stop time to 5 seconds.

  5. Open the load shaft speed scope, Speed (rad/s), and the motor input voltage scope, V_m (V).

  6. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  7. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  8. The gears on the Rotary Servo Base Unit should be rotating in the same direction and alternating between low and high speeds and the scopes should be as shown in Figure 15 a) and b). Recall that the yellow trace is the measured load shaft rate and the purple trace is the simulated trace. By default, the steady-state gain and the time constant of the transfer function used in simulation are set to: K = 1 rad/s/V and = 0.1s. These model parameters do not accurately represent the system.

  9. Notice that the model response does not match with the measured response.

  10. Calculate the nominal values, and , using Eqs. 2.1, 2.26, 2.27, 2.28 and the specifications provided in and for the high-gear configuration. Note: Eq. 2.26 must be converted to the Laplace domain to obtain the transfer function, which should be simplified to resemble Eq. 2.1. This would yield the formulae to determine and . You may also refer to the lecture slides.

  11. Enter the nominal values, and , that were found in Step 10 in the MATLAB Command Window. Update the parameters and examine how well the simulated response matches the measured one.

  12. Save wl data and name it as modeling_section#_Group#_K#tau#.

If the calculations of the nominal values were done properly, then the model should represent the actual system quite well. Compare the responses you get by using the and values from the frequency response experiment, bump test experiment (this needs to be done while writing the report), and when using nominal values. Check which of the three responses matches the measured response best, and record this and as your model validation values. Use this set of values for controller implementation (next week). If there is no clear set of values that matches the measured response, take the average. Note: Changing the model parameters can be done by manually changing the Servo Model Transfer Function block parameters OR by changing the K and tau parameters in the MATLAB Command Window and going to Simulation | Update Diagram in the SIMULINK model.

Tables for Report

Table B.1 Collected frequency response data.

Table B.2 Summary of results for the Rotary Servo Base Unit Modeling laboratory.

Results for Report

(A) Frequency Response Experiment

  1. Using the MATLAB plot command and the data collected in , generate a Bode magnitude plot. Make sure the amplitude and frequency scales are in decibels. When making the Bode plot, ignore the f = 0 Hz entry as the logarithm of 0 is not defined. Label the Bode plot where the gain is reduced by 3 dB from the DC gain and the corresponding frequency as the cutoff frequency. Time constant (units are seconds) of a first-order system is equal to the inverse of its cutoff frequency (units are rad/s). Enter the resulting time constant in . Hint: May use the Data Tips tool to obtain values from the MATLAB Figure. Include the labelled Bode plot along with tabulated values of in the report.

(B) Step Response Experiment

  1. Plot the maximum load speed response (saved in the MATLAB workspace under the wl variable) from Step 9 in MATLAB.

  2. Find the steady-state gain using the measured step response (Result B.1) and enter it in under the 'Step Response Experiment' section. Hint: Use the MATLAB ginput command to measure points off the plot.

  3. Find the time constant from the obtained response (Result B.1) using Eqs. 2.35, 2.36 and 2.37, and enter the value in under the 'Step Response Experiment' section. Show the calculations in the report.

(C) Model Validation Experiment

  1. Create a MATLAB figure that shows the simulation nominal values response, the step response (generated by using the K and tau values calculated from the bump test experiment), the frequency response (generated by using the K and tau values calculated for frequency response experiment), the response you got from step 8, and the measured response as five plots on the same graph in the report. Provide two reasons why the nominal model might not represent the Rotary Servo Base Unit with better accuracy. Which response matches most closely with the measured response?

  2. From the plots, describe how the gain and time constant affect the system's response.

(D) Additional Results

  1. Include the completed .

  2. Explain how well the nominal model, the frequency response model, and the bump-test model represent the Rotary Servo Base Unit system (you may refer to Result D.1).

Appendix

Table A.1 Main Rotary Servo Base Unit Specifications

Table A.2 Rotary Servo Base Unit Gearhead Specifications

A & B. Modeling and Control Design (Week 1)

Objective

The purpose of this experiment is to design a controller that maintains the direction of a gyroscope under base excitation. The controller can also be used to rotate the gyro platform to a desired orientation using the gyroscopic principle.

Introduction

Gyroscopes have become of great practical interest as they are used in control and guidance systems for air, sea, and space vehicles. One of their biggest advantages is that they can generate a large output (orientation change of an entire spacecraft) using a small input (torque input tilting a rotating disk) through torque amplification.

Description of Quanser Gyroscope system

The Quanser 3 DOF Gyroscope system (see Figure 1) can be actuated about all of its frames using the mounted motors while encoders measure the angle about each axis. In addition, the rotor itself is actuated and measured in the same manner.

The gyroscope setup is shown in Figure 2, and its components are provided in a table in Figure 3. The outer rectangular gray frame, the outer red gimbal and the inner blue gimbal are designed such that they can be individually fixed in place upon desire. This allows the users to perform a variety of different experiments using the device.

In this experiment, the gyroscopic effect will be employed to control the angle of the gray frame by applying the control command about the blue gimbal. The red outer gimbal will be fixed. In order to do this, the rotor has to have acquired enough angular momentum (RPM) for the gyroscopic effect to take place. Therefore, a controller is required to control the angular speed of the disk while another is required to control the blue gimbal angle.

In the next sections, we will develop a model of the gyroscope device from first principles in order to obtain a transfer function of the plant, which we will later use in a control scheme.

A. Modeling

The angular position about the outer gray frame (Body A), i.e., the yaw angle , is controlled by changing the angular position, the roll angle , of the blue gimbal (Body C), with the torque generated by motor 2, (see Figure 4). The red gimbal/y-axis (Body B) is locked in our experiment.

The rotational dynamics of rigid bodies can be modeled using the Newton-Euler equation, which states that the rate of change of angular momentum of a rigid body about its mass center equals the total external moment applied about its mass center. Using the Newton-Euler equation, one can derive the equations for rotational motion of individual gimbals and the outer frame. The resulting equations will be non-linear. They are linearized with the disk spinning at a constant high speed with the gyroscope system at rest, i.e., roll , pitch and yaw equal zero. In our experiment, we will lock the the rotation of the red gimbal, i.e., , for all the time. Further, we will align the disk spin axis along the y-axis (see Figure 4).

The resulting linearized equations of motion when the red gimbal is locked, i.e., , and after neglecting the small amount of bearing friction associated with gimbal and frame rotations can be obtained as

where is the change in disc speed from its steady state value of , is the disc mass moment of inertia about its spin axis, is the mass moment of inertia of the disk and motor 1 plus the blue gimbal and motor 2 about the x-axis (roll axis), is the mass moment of inertia of the entire system, i.e., including the disk, red and blue gimbals, motors 1 and 2 and the outer gray frame about the z-axis.

Equation (1) is for the disc spinning about its own axis. Equation (2) is for the motion about the roll/blue x-axis that is driven by the torque applied from motor 2 and the gyroscopic reaction torque. Equation (3) is for the motion about the yaw/gray frame that is driven exclusively by the gyroscopic reaction torque.

The Quanser 3 DOF Gyroscope is driven by a current-controller amplifier. The relation between the torque outputs of motors 1 and 2 and their respective current inputs are

where is the current-to-torque constant of the motor, is the current applied to motor 1, and is the current applied to motor 2.

The disc is rotated at a fixed, steady-state speed of . Given this and applying Laplace transforms to Equations (1) to (3) we arrive at the following transfer function models:

A state-space model representation of Equations (2-3) with the state vector as can be written as

The gyroscope system parameters are provided in Table 1:

Parameter Name
Parameter Symbol
Value
Unit

B. Control Design

The objective is to design a controller for regulation and control of the outer frame (gray frame) angular position using the inner gimbal (blue gimbal) torque . This mimics the following problem: Given a spacecraft with a momentum gyro, we would like to regulate and control the spacecraft yaw angle using the tilting of a high-speed spinning disk mounted in the spacecraft. In this lab, the rotation about the z-axis, , is controlled by torque applied about the x-axis through motor 2.

Controller Specifications:

Specification 1: All closed-loop poles must be in the left half of the complex plane.

Specification 2: The peak time in response to a step command must be less than 0.45 seconds.

Specification 3: The 2% settling time to a step command input must be less than 0.50 seconds.

Specification 4: Control current must not saturate (see Table 1 for max current input).

Specification 5: For the outer loop, and .

In order to meet the given controller specifications, we will make use of a technique known as successive loop closures. We will first design an inner loop rate feedback, i.e., feedback of , to damp the rotation of the inner blue gimbal. Subsequently, an outer loop PD controller is used to control the outer frame (gray frame) rotation . The selected control logic is summarized in Figure 5.

The transfer functions and are previously obtained in the modeling section as Equations (7) and (8). In the following section, we will form the overall transfer function and do controller design.

Controller Design Procedure:

  1. Open the script gyro_sim_week1.mlx and run the first section to initialize symbolic system parameters.

  2. At the second section of the script, generate the transfer functions and using the given parameters. Note that has a negative sign in the numerator.

  3. Obtain the overall transfer function from to , which will be your plant (see Figure 5) for the outer loop PD controller design. Remember to close the loop for .

  4. Select a nominal value for the inner loop rate feedback gain , for example

  5. Based on the symbolic G function from step 3, generate a numeric transfer function from to that you will use for the controlSystemDesigner window. This function should not contain any symbols. Note: Check your with your TA before proceeding.

  6. Initialize C = 1, then open controlSystemDesigner(G,C) in MATLAB.

  7. The control architecture shown in Figure 5 is different from the default architecture that opens in controlSystemDesigner. To account for this change, on the Control System Designer window, select CONTROL SYSTEM > Edit Architecture, and select the following architecture:

  8. Select some arbitrary negative values (within the limits of Specification 5) for both (C1 in Figure 6) and (C2 in Figure 6). Since C2 is a pure derivative gain, you need to add a differentiator in C2, not a real zero.

  9. Tune the values for and as needed to meet the given set of specifications. If needed, readjust the value of the inner loop, which is positive.

  10. Save the controlSystemDesigner window plots, and your final gains Note: Check your final gains with your TA before proceeding.

  11. Use Figure 5 as a guide to create the SImulink diagram for this experiment. Adjust the step size to be a fixed-step size of 0.002 under model settings.

  12. To the model created in step 10, add the following:

    • A scope for the commanded input to the system.

    • A saturation block before to limit the torque applied to the system. Note: Since we need to satisfy Specification 4 (current saturation), we should ensure torque saturation as torque and current are linearly related (see Equation (5)).

    • A scope to the torque applied to the system, (after the saturation block).

    • A scope between and that measures the gyro angle, .

    • A scope at the final output, . Note: Check your final Simulink diagram with your TA before proceeding.

  13. Run the Simulink diagram for a reference angle of . This can be accomplished in one of two ways:

    1. Provide a step input of an initial value of 0 and a final value of 10. This will generate a step input of .

    2. Provide a square wave of amplitude 5, frequency of 0.333 Hz and an offset of +5. This will generate a square wave of an upper value and a lower value of 0.

  14. Verify if the Simulink diagram output is similar to the controlSystemDesigner step-input plot.

  15. Check if the Simulink response satisfies all the given specifications (not on controlSystemDesigner). If not, further tune your and values (and if required) till all requirements are met. Note: Check your final gains with your TA before proceeding.

To check if your Simulink response meets Specification 2 and Specification 3, you can do one of the following approaches:

  • Place markers on the plot to manually check for peak time and 2% settling time.

  • Use stepinfo() command in MATLAB window to obtain the peak time and 2% settling time.

Results and Questions for Report

Modeling

Results

  1. General principle used to obtain equations of motion for the gyroscope.

  2. The three time-domain linearized equations of motion for the experiment.

  3. (both symbolic and numerical forms).

  4. (both symbolic and numerical forms).

Control Design

Results

  1. Brief description of control design objective.

  2. The closed-loop transfer function for using rate feedback.

  3. , the transfer function from to (both symbolic and numerical forms).

  4. Gain values from controlSystemDesigner (Step 10).

  5. Control System Designer plots (root locus and bode plots for C1 and C2 and step response plot with peak time, settling time and steady-state values indicated).

  6. Simulink model (Step 12).

  7. Simulink response plots (to be generated using MATLAB, not Scope).

  8. Validation of control design specifications being met or not.

  9. Final tuned gain values from Simulink (Step 15).

Questions

  1. How is the default Control System Designer control architecture different from the one used in this experiment? In your explanation, mention how the locations of the PD controller gains in Figure 5 are different from a traditional PD controller.

  2. Briefly explain the need for the inner loop rate () feedback.

D. Controller Implementation & Evaluation (Week 3)

Objectives

The objective of this part of the DC motor experiment is to implement the controller designed in part B and evaluate its performance.

Equipment Required

The following is a list of the required equipment to perform this experiment:

Controller Implementation

1. Step Response Experiments

  1. Open q_servo_pos_cntrl.slx file. Do not change anything except the PID gains.

  2. Double-click on the Signal Generator block and ensure that a 0.4 Hz square wave input is being applied. Note that the gain blocks outside the Signal Generator block are introduced to generate the square wave with amplitude between 0 V to 0.4 V.

  3. Check that the sampling time is set to 0.002 s (located under “Modeling” -> “Model Settings” -> “Solver Details”).

  4. P Controller Test: To understand the behavior of a Proportional controller, implement a P controller by typing the values for to 0 and to 0 in the command window. Set as the value obtained in .

  5. Turn on the power amplifier.

  6. To build the model, click down arrow on Monitor & Tune under Hardware tab and then Build for monitoring .

  7. Open the position scope.

  8. Press Connect button under Monitor & Tune and then press Start . Run the experiment for 5 seconds.

  9. Save your data. No need to Build again unless you change any blocks or configuration settings in the model.

  10. PD Controller Test: By introducing a derivative gain (), notice how the system characteristics change. Set and to the respective values found in . will remain as 0. Connect and Start. Observe the behavior and save the data.

  11. Sampling Time Test: Change the sampling time to 0.04 sec. To set the sampling time, you need to go to the block diagram file, and choose “Modeling” -> “Model Settings” -> “Solver Details”. Set the fixed step to 0.04 sec (it should have been 0.002 previously). Build, connect and Run PD Controller, observe the behaviour and save the data with an appropriate filename (e.g. - PD_sampling_0.04).

2. Ramp Response Experiments

  1. Double-click on the Signal Generator and set the following parameters to generate a triangular wave (i.e. ramp reference):

    • Signal Type = triangle

    • Amplitude = 1

    • Frequency = 0.4 Hz

  2. In the Simulink diagram, set the Amplitude gain block to and the Constant offset gain block to . This will generate a triangular wave with amplitude between 0 to .

  3. Change the sampling time back to 0.002 sec (“Modeling” -> “Model Settings” -> “Solver Details”).

  4. PD Controller Test: This test is to determine the ramp response of the system with a PD controller. Set and to the respective values found in . will remain as 0. Connect and Start. Observe the behavior and save the data.

  5. PID Controller Test: In the respective controller gain blocks, change the current values of , and to the PID values found in . Observe the behavior. Save the data only if there is no steady-state error.

  6. PID Controller Tuning: If the PID controller test has not eliminated the steady-state error, tune the gain values (, and ) until the system ramp response has zero (or nearly zero) steady-state error. Save the data and gain values after the final tuning.

Results and Questions for Report

Note: Some results require simulation response. This would require running a simulation using your SIMULINK model from Part C Control Design using the model validation K and tau values. The command input will be identical to either the square wave signal or triangle signal implemented during the experiment. The attributes of the simulation will be mentioned in the corresponding section.

(A) Step Response

Any simulation results in this subsection will have the following attributes:

  • Command input: Square wave

    • Amplitude: Maximum of 0.4 and minimum of 0

    • Frequency: 0.4 Hz

  • Sampling time: 0.002 s (Go to "Modeling" -> "Model Settings" -> "Solver details" -> "Fixed-step size")

i) P Controller

  1. Plot angle or rotary position, i.e., commanded, experimental from Step 1.9, and simulation responses on one figure. Use the same gain value evaluated in Step 1.4 for the simulation response.

  2. What is the effect of proportional controller gain on closed-loop system behaviour?

ii) PD Controller

  1. Plot angle or rotary position, i.e., commanded, experimental from Step 1.10, and simulation responses on one figure. Use the same and gain values evaluated in Step 1.10 for the simulation response.

  2. What is the effect of derivative controller gain on closed-loop system behaviour?

  3. Compare the PD simulation (that shows zero steady-state error) and experimental (that shows a steady-state error) results to also discuss regarding the dead zone in the DC motor and how it affects the steady-state error.

iii) Sampling Time

  1. Plot angle or rotary position (commanded and experimental) and control input Vm from Step 1.11.

  2. What is the effect of sampling time on closed-loop system behaviour?

(B) Ramp Response

Any simulation results in this subsection will have the following attributes:

  • Command input: Triangle wave

    • Amplitude: Maximum of and minimum of 0

    • Frequency: 0.4 Hz

  • Sampling time: 0.002 s (Go to "Modeling" -> "Model Settings" -> "Solver details" -> "Fixed-step size")

i) PD Controller

  1. Plot angle or rotary position, i.e., commanded, experimental from Step 2.3, and simulation responses on one figure. Use the same and gain values evaluated in Step 2.4 for the simulation response.

iii) PID Controller

  1. Plot angle or rotary position, i.e., commanded, experimental from Step 2.5 (or 2.4 if applicable), and simulation responses on one figure. Use the tuned , and gain values evaluated in Step 2.6 for the simulation response.

  2. Mention the final PID gains after tuning.

C. Controller Implementation (Week 2)

Objective

In this section, the gyroscopic control developed in Part B is implemented on the actual hardware. The goal is to see if the gyro module can maintain its heading when a disturbance is added by the user, i.e., the base plate is rotated.

The controller will also enable the gyroscope to track a small step, large step and ramp-input commands.

The q_3dgyro_reaction_torque_m2021.slx diagram shown in Figure 8 is used to implement the controller on the Quanser Gyroscope system. The 3 DOF Gyroscope system shown in Figure 9 contains the Quanser blocks that interface with their hardware.

Part 1: Heading-hold experiment

1. Orient the gyroscope discs as shown:

2. Make sure the pitch axis/red gimbal is locked.

3. Make sure the gray frame and blue gimbal ( and respectively) are unlocked.

Note: Show your setup to your TA before proceeding. This will be the default orientation for all subsequent experiments.

4. Turn on the amplifier (big box) and verify the DAQ (small box) is connected to a power source. In previous experiments the smaller DAQ boards could be powered by the computer USB connection, but this is no longer the case.

5. Run gyro_sim_data.mlx script in MATLAB 2021 (not 2019) to initialize values.

6. Open q_3dgyro_reaction_torque.m2021.slx in MATLAB 2021 as well.

7. Set the and values to those found in Week 1 Part B.

8. Set the Psi_Ref to 0. This will make the controller hold the 0-degree heading.

9. Set Hardware > Stop Time to 20 seconds.

10. Open all three scopes (Disc Rate, phi, psi) in a separate window.

11. When ready with the provided ruler, press Monitor & Tune (no need to build).

12. Watch the Disc Rate scope. When the angular velocity of the wheel reaches its maximum of ~78 rad/s, push the gray axis using the ruler at different angles/locations. Observe the behavior of the setup and notice the resistance to your disturbance by the gray axis, even though it is stationary.

IMPORTANT: After the experiment stops, use the provided towel to slowly stop the disc from spinning. Be careful since touching the disc while it is rotating may cause injury.

13. Check the saved data for disk rate, phi and psi, labelled as omega, phi, psi respectively. These are automatically saved as .mat files in your working directory. Rename them with "part1_" as the prefix, followed by the variable name. The data is saved as follows:

  • The variable omega has the rows saving time, commanded speed, and actual speed respectively.

  • The variable phi saves time, phi response, and phi gimbal current respectively.

  • The variable psi saves time, reference psi angle, and psi response respectively.

Part 2: Small step response

1. Make sure the disc is fully stopped from the previous experiment.

2. Orient the gyroscope as shown in Figure 10.

3. Set simulation Stop Time to 20 seconds.

4. Set Psi_Ref to 0, apply the change, but keep the window open.

5. Open all three scopes in a separate monitor.

6. Click Monitor & Tune, and watch the Disc Rate scope.

7. When disc rate reaches its maximum, change Psi_Ref (deg) gain to 10 degrees.

8. Observe the gyroscope tracking the desired heading command.

IMPORTANT: After the experiment stops, use the provided towel to slowly stop the disc from spinning. Be careful since touching the disc while it is rotating may cause injury.

9. Refer to Part 1 Step 13 for the saved data format. Rename them with "part2_" as prefix, followed by the variable names as shown in Part 1 step 13.

Part 3: Large step response

1. Make sure the disc is fully stopped from the previous experiment.

2. Orient the gyroscope as shown in Figure 10.

3. Set simulation Stop Time to 20 seconds.

4. Set Psi_Ref (deg) gain to 0, apply the change, but keep the window open.

5. Open all three scopes in a separate monitor.

6. Click Monitor & Tune, and watch the Disc Rate scope.

7. When disc rate reaches its maximum, change Psi_Ref (deg) gain to 40 degrees.

8. Observe the gyroscope tracking the desired heading command.

IMPORTANT: After the experiment stops, use the provided towel to slowly stop the disc from spinning. Be careful since touching the disc while it is rotating may cause injury.

9. Refer to Part 1 Step 13 for the saved data format. Rename them with "part3_" as the prefix, followed by the variable names shown in Part 1 step 13.

Part 4: Ramp input response

While the step response is useful for system characterization, it is seldom used for an actual in-service trajectory because it is excessively harsh (high acceleration and jerk, which is the rate of change of acceleration). A more common trajectory used for tracking applications is a ramp.

1. Make sure the disc is fully stopped from the previous experiment.

2. Orient the gyroscope as shown in Figure 10.

3. Set simulation Stop Time to 20 seconds.

4. Open the Signal Generator block, and select the “sawtooth” waveform

5. Set Psi_Ref (deg) gain to 0, apply the change, but keep the window open.

6. Open all three scopes in a separate monitor.

7. Click Monitor & Tune, and watch the Disc Rate scope.

8. When disc rate reaches its maximum, change Psi_Ref (deg) gain to 20 degrees.

9. Observe the gyroscope tracking the desired heading command.

IMPORTANT: After the experiment stops, use the provided towel to slowly stop the disc from spinning. Be careful since touching the disc while it is rotating may cause injury.

10. Refer to Part 1 Step 13 for the saved data format. Rename them with "part4_" as the prefix, followed by the variable names shown in Part 1 step 13.

Results for Report

Note: Some results require simulation response. This would require running a simulation using your SIMULINK model from Part B Control Design using the same , and gain values evaluated in Part C Controller Implementation. The command input will be identical to either the square wave signal or triangle signal implemented during the experiment. The simulation command input should be identical to experimental input.

  1. Briefly describe the controller implementation experiments.

Part 1: Heading hold

  1. Plot commanded and response plots on the same axes.

  2. Plot response.

  3. Plot motor 2 current ( gimbal control current).

  4. Explain the behavior of the gray axis as you disturb it.

Part 2: Small step input

  1. Plot commanded, simulated, and experimental plots on the same axes.

  2. Plot simulated and experimental responses on the same axes.

  3. Plot motor 2 current simulated and experimental responses on the same axes.

  4. Explain any differences between simulated and experimental responses.

Part 3: Large step input

  1. Plot commanded and response plots on the same axes.

  2. Plot response.

  3. Plot motor 2 current.

Part 4: Ramp input

  1. Plot commanded and response plots on the same axes.

  2. Plot response.

  3. Plot motor 2 current.

Questions for Report

  1. There is some drift in the response overtime in all experiments. Despite this, the control is still able to maintain the desired yaw position. Explain using conservation of angular momentum and control theory why this is the case.

  2. Which axis of the setup is fixed to the spacecraft?

  3. Using the gyroscopic principle, what changes would you make to the gyroscope system for measuring yaw rate of the spacecraft?

Lab 4: Rotary Inverted Pendulum

Lab 3: Rotary Flexible Link

1

Top plate

12

Encoder

2

Bottom plate

13

Ball-bearing block

3

Posts

14

Motor

4

Motor pinion gear: 72-teeth (low-gear)

15

Motor Gearbox

5

Load gear: 72 teeth (low-gear)

16

Motor connector

6

Potentiometer gear

17

Encoder connector

7

Anti-backlash springs

18

Potentiometer connector

8

Load shaft (i.e. output shaft)

19

Bar inertial load

9

Motor pinion gear: 24-teeth (high-gear)

20

Disc inertial load

10

Load gear: 120-teeth (high-gear)

21

Thumb screws

11

Potentiometer

VABV_{AB}VAB​
VAB=VAW+VWBV_{AB} = V_{AW} + V_{WB}VAB​=VAW​+VWB​
VAWV_{AW}VAW​
VWBV_{WB}VWB​
Δθ=2πN×PPR(1.1)\Delta \theta = \frac{2\pi}{N\times PPR} \qquad \qquad \qquad \tag{1.1}Δθ=N×PPR2π​(1.1)
ω(k)=θ(k)−θ(k−1)h\omega (k) = \frac{\theta(k) - \theta(k-1)}{h}ω(k)=hθ(k)−θ(k−1)​
θ(k)\theta(k)θ(k)
kthk^{th}kth
hhh
Δω=Δθh(1.2)\Delta\omega = \frac{\Delta \theta}{h} \qquad \qquad \qquad \tag{1.2} Δω=hΔθ​(1.2)
ω\omegaω
Δθ\Delta \thetaΔθ
hhh
Yf(s)Y=1Tf(s)+1\frac{Y_f(s)}{Y} = \frac{1}{T_f(s) + 1}YYf​(s)​=Tf​(s)+11​
YYY
YfY_fYf​
TfT_fTf​
ωf\omega_fωf​
Yf(s)Y=ωfs+ωf\frac{Y_f(s)}{Y} = \frac{\omega_f}{s+\omega_f}YYf​(s)​=s+ωf​ωf​​
ωf=1/Tf\omega_f = 1 / T_fωf​=1/Tf​
ω≤ωf.\omega \leq \omega_f .ω≤ωf​.
sTfYf(s)+Yf(s)=Y(s)sT_fY_f(s) + Y_f(s) = Y(s)sTf​Yf​(s)+Yf​(s)=Y(s)
Tfdyf(t)dt+yf(t)=y(t)T_f \frac{dy_f(t)}{dt} + y_f(t) = y(t)Tf​dtdyf​(t)​+yf​(t)=y(t)
yf(t)y_f(t)yf​(t)
yf(t−h)y_f(t − h)yf​(t−h)
Tfyf(t)−yf(t−h)h+yf(t)=y(t)T_f\frac{y_f(t) - y_f(t-h)}{h}+y_f(t) = y(t)Tf​hyf​(t)−yf​(t−h)​+yf​(t)=y(t)
yf(t)y_f(t)yf​(t)
yf(t)=TfTf+hyf(t−h)+hTf+hy(t)(1.3)y_f(t) = \frac{T_f}{T_f + h}y_f(t-h)+\frac{h}{T_f + h}y(t) \qquad \qquad \qquad \tag{1.3}yf​(t)=Tf​+hTf​​yf​(t−h)+Tf​+hh​y(t)(1.3)
h/(Tf+h)h/(T_f + h)h/(Tf​+h)
Δyf(t)=hTf+hΔθh(1.4)\Delta y_f(t) = \frac{h}{T_f + h} \frac{\Delta \theta}{h} \qquad \qquad \qquad \tag{1.4}Δyf​(t)=Tf​+hh​hΔθ​(1.4)
TfTf+hyf(t−h)\frac{T_f}{T_f + h}y_f (t-h)Tf​+hTf​​yf​(t−h)
−27-2^{7}−27
27−12^7-127−1
(150+128)mod  256 − 128=−106(150+128) \mod 256 ~ − ~128 = −106(150+128)mod256 − 128=−106
2n2^n2n
Tf=0.01T_f = 0.01Tf​=0.01
Δθ\Delta \thetaΔθ
Δθ\Delta \thetaΔθ
Δθ\Delta \thetaΔθ
Tf=0.01sT_f = 0.01 sTf​=0.01s
h=0.001sh = 0.001 sh=0.001s
30KB
q_servo_vel_direct.slx
Figure 1 Rotary Servo Base
Figure 2 Potentiometer
Figure 3 Schematic diagram of the voltage dividing characteristic of a rotary potentiometer.
Figure 4 Output of an incremental encoder showing signals A and B when rotating in a clockwise manner.
Figure 5 Comparison of the number of counts generated by the X1, X2, and X4 decoding algorithms
Figure 6 SIMULINK model
Sample velocity estimate usign direct derivative when running at 500 Hz
Ωl(s)Vm(s)=Kτs+1(2.1)\frac{\Omega_l(s)}{V_m(s)} = \frac{K}{\tau s+1} \qquad \qquad \qquad \tag{2.1}Vm​(s)Ωl​(s)​=τs+1K​(2.1)
Ωl(s)\Omega_l(\mathrm{s})Ωl​(s)
ωl(t)\omega_l(\mathrm{t})ωl​(t)
Vm(s)V_m(\mathrm{s})Vm​(s)
vm(t)v_m(\mathrm{t})vm​(t)
KKK
τ\tauτ
s\mathrm{s}s
KKK
τ\tauτ
KKK
τ\tauτ
RmR_mRm​
LmL_mLm​
KmK_mKm​
eb(t)e_b(\mathrm{t})eb​(t)
ωm\omega_mωm​
kmk_mkm​
eb(t)=kmωm(t)(2.2)e_b(\mathrm{t}) = k_m\omega_m(\mathrm{t}) \qquad \qquad \qquad \tag{2.2}eb​(t)=km​ωm​(t)(2.2)
Vm(t)−RmIm(t)−LmdIm(t)dt−kmωm(t)=0(2.3)V_m(\mathrm{t}) - R_mI_m(\mathrm{t}) - L_m \frac{dI_m(\mathrm{t})}{dt} - k_m \omega_m(\mathrm{t}) = 0 \qquad \qquad \qquad \tag{2.3}Vm​(t)−Rm​Im​(t)−Lm​dtdIm​(t)​−km​ωm​(t)=0(2.3)
LmL_mLm​
Vm(t)−RmIm(t)−kmωm(t)=0(2.4)V_m(\mathrm{t}) - R_mI_m(\mathrm{t})-k_m\omega_m(\mathrm{t}) = 0 \qquad \qquad \qquad \tag{2.4}Vm​(t)−Rm​Im​(t)−km​ωm​(t)=0(2.4)
Im(t)I_m(\mathrm{t})Im​(t)
Im(t)=Vm(t)−kmωm(t)Rm(2.5)I_m(\mathrm{t}) = \frac{V_m(\mathrm{t}) - k_m\omega_m(\mathrm{t})}{R_m} \qquad \qquad \qquad \tag{2.5}Im​(t)=Rm​Vm​(t)−km​ωm​(t)​(2.5)
ωl\omega_lωl​
LmL_mLm​
J⋅α=τ(2.6)J \cdot \alpha = \tau \qquad \qquad \qquad \tag{2.6}J⋅α=τ(2.6)
JJJ
α\alpha α
τ\tauτ
BmB_mBm​
BlB_lBl​
Jldωl(t)dt+Blωl(t)=τl(t)(2.7)J_l \frac{d\omega_l(\mathrm{t})}{dt} + B_l\omega_l(\mathrm{t}) = \tau_l(\mathrm{t}) \qquad \qquad \qquad \tag{2.7}Jl​dtdωl​(t)​+Bl​ωl​(t)=τl​(t)(2.7)
JlJ_lJl​
τl\tau_lτl​
Jmdωl(t)dt+Bmωm(t)+τml=τm(t)(2.8)J_m \frac{d\omega_l(t)}{dt} + B_m\omega_m(t) +\tau_{ml}= \tau_m(t) \qquad \qquad \qquad \tag{2.8}Jm​dtdωl​(t)​+Bm​ωm​(t)+τml​=τm​(t)(2.8)
JmJ_mJm​
τml\tau_{ml}τml​
τl(t)=ηgKgτml(t)(2.9)\tau_l(t) = \eta_gK_g\tau_{ml}(t) \qquad \qquad \qquad \tag{2.9}τl​(t)=ηg​Kg​τml​(t)(2.9)
KgK_gKg​
ηg\eta_gηg​
N1N_1N1​
N2N_2N2​
Kgi=N2N1(2.10)K_{gi} = \frac{N_2}{N_1} \qquad \qquad \qquad \tag{2.10}Kgi​=N1​N2​​(2.10)
N3N_3N3​
N4N_4N4​
Kge=N4N3(2.11)K_{ge} = \frac{N_4}{N_3} \qquad \qquad \qquad \tag{2.11}Kge​=N3​N4​​(2.11)
Kg=KgeKgi(2.12)K_g = K_{ge} K_{gi} \qquad \qquad \qquad \tag{2.12}Kg​=Kge​Kgi​(2.12)
τml(t)=τl(t)ηgKg(2.13)\tau_{ml} (t) = \frac{\tau_l(t)}{\eta_gK_g} \qquad \qquad \qquad \tag{2.13}τml​(t)=ηg​Kg​τl​(t)​(2.13)
KgK_gKg​
θm(t)=Kgθl(t)(2.14)\theta_m(t) = K_g\theta_l(t) \qquad \qquad \qquad \tag{2.14}θm​(t)=Kg​θl​(t)(2.14)
ωm\omega_mωm​
ωl\omega_lωl​
ωm(t)=Kgωl(t)(2.15)\omega_m(t) = K_g\omega_l(t) \qquad \qquad \qquad \tag{2.15}ωm​(t)=Kg​ωl​(t)(2.15)
JmKgdωl(t)dt+BmKgωl(t)+Jldωl(t)dt+Blωl(t)ηgKg=τm(t)(2.16)J_mK_g \frac{d\omega_l(t)}{dt} + B_mK_g\omega_l(t) +\frac{J_l \frac{d\omega_l(t)}{dt} + B_l\omega_l(t)}{\eta_gK_g}= \tau_m(t) \qquad \qquad \qquad \tag{2.16}Jm​Kg​dtdωl​(t)​+Bm​Kg​ωl​(t)+ηg​Kg​Jl​dtdωl​(t)​+Bl​ωl​(t)​=τm​(t)(2.16)
(ηgKg2Jm+Jl)dωl(t)dt+(ηgKg2Bm+Bl)ωl(t)=ηgKgτm(t)(2.17)(\eta_gK_g^2J_m + J_l) \frac{d\omega_l(t)}{dt} + (\eta_gK_g^2B_m + B_l)\omega_l(t) = \eta_gK_g\tau_m(t) \qquad \qquad \qquad \tag{2.17}(ηg​Kg2​Jm​+Jl​)dtdωl​(t)​+(ηg​Kg2​Bm​+Bl​)ωl​(t)=ηg​Kg​τm​(t)(2.17)
Jeq=ηgKg2Jm+Jl(2.18)J_{eq} = \eta_gK_g^2J_m+J_l \qquad \qquad \qquad \tag{2.18} Jeq​=ηg​Kg2​Jm​+Jl​(2.18)
Beq=ηgKg2Bm+Bl(2.19)B_{eq} = \eta_gK_g^2B_m+B_l \qquad \qquad \qquad \tag{2.19} Beq​=ηg​Kg2​Bm​+Bl​(2.19)
Jeqdωl(t)dt+Beqωl(t)=ηgKgτm(t)(2.20)J_{eq} \frac{d\omega_l(t)}{dt} +B_{eq}\omega_l(t) = \eta_gK_g\tau_m(t) \qquad \qquad \qquad \tag{2.20}Jeq​dtdωl​(t)​+Beq​ωl​(t)=ηg​Kg​τm​(t)(2.20)
τm(t)=ηmktIm(t)(2.21)\tau_m(t) = \eta_mk_tI_m(t) \qquad \qquad \qquad \tag{2.21}τm​(t)=ηm​kt​Im​(t)(2.21)
KtK_tKt​
N⋅m/AN \cdot m / AN⋅m/A
ηm\eta_mηm​
ImI_mIm​
Vm(t)V_m(t)Vm​(t)
ωl(t)\omega_l(t)ωl​(t)
τm(t)=ηmkt(Vm(t)−kmωm(t))Rm(2.22)\tau_m(t) = \frac{\eta_mk_t(V_m(t) - k_m\omega_m(t))}{R_m} \qquad \qquad \qquad \tag{2.22}τm​(t)=Rm​ηm​kt​(Vm​(t)−km​ωm​(t))​(2.22)
VmV_mVm​
ωl\omega_lωl​
τm(t)=ηmkt(Vm(t)−kmKgωl(t))Rm(2.23)\tau_m(t) = \frac{\eta_mk_t(V_m(t) - k_mK_g\omega_l(t))}{R_m} \qquad \qquad \qquad \tag{2.23}τm​(t)=Rm​ηm​kt​(Vm​(t)−km​Kg​ωl​(t))​(2.23)
Jeqdωl(t)dt+Beqωl(t)=ηgKgηmkt(Vm(t)−kmKgωl(t))Rm(2.24)J_{eq} \frac{d\omega_l(t)}{dt} +B_{eq}\omega_l(t) = \frac{\eta_gK_g\eta_mk_t(V_m(t) - k_mK_g\omega_l(t))}{R_m} \qquad \qquad \qquad \tag{2.24}Jeq​dtdωl​(t)​+Beq​ωl​(t)=Rm​ηg​Kg​ηm​kt​(Vm​(t)−km​Kg​ωl​(t))​(2.24)
Jeqdωl(t)dt+(kmηgKg2ηmktRm+Beq)ωl(t)=ηgKgηmktVm(t)Rm(2.25)J_{eq} \frac{d\omega_l(t)}{dt} +\left (\frac{k_m\eta_gK_g^2\eta_mk_t}{R_m}+B_{eq}\right) \omega_l(t) = \frac{\eta_gK_g\eta_mk_tV_m(t) }{R_m} \qquad \qquad \qquad \tag{2.25}Jeq​dtdωl​(t)​+(Rm​km​ηg​Kg2​ηm​kt​​+Beq​)ωl​(t)=Rm​ηg​Kg​ηm​kt​Vm​(t)​(2.25)
Jeqdωl(t)dt+(Beq,v)ωl(t)=AmVm(t)(2.26)J_{eq} \frac{d\omega_l(t)}{dt} +\left (B_{eq,v}\right) \omega_l(t) = A_mV_m(t) \qquad \qquad \qquad \tag{2.26}Jeq​dtdωl​(t)​+(Beq,v​)ωl​(t)=Am​Vm​(t)(2.26)
Beq,v=kmηgKg2ηmkt+BeqRmRm(2.27)B_{eq,v} = \frac{k_m\eta_gK_g^2\eta_mk_t + B_{eq}R_m}{R_m} \qquad \qquad \qquad \tag{2.27}Beq,v​=Rm​km​ηg​Kg2​ηm​kt​+Beq​Rm​​(2.27)
Am=ηgKgηmktRm(2.28)A_m = \frac{\eta_gK_g\eta_mk_t}{R_m} \qquad \qquad \qquad \tag{2.28}Am​=Rm​ηg​Kg​ηm​kt​​(2.28)
uuu
yyy
ωc\omega_cωc​
12\frac{1}{\sqrt{2}}2​1​
∣Gωl,v(ω)∣=∣Ωl(ωj)Vm(ωj)∣(2.29)|G_{\omega l,v}(\omega)| = \left |\frac{\Omega_l(\omega j)}{V_m(\omega j)}\right| \qquad \qquad \qquad \tag{2.29}∣Gωl,v​(ω)∣=​Vm​(ωj)Ωl​(ωj)​​(2.29)
ω\omegaω
VmV_mVm​
s=jωs = j \omegas=jω
∣Ωl(ωj)Vm(ωj)∣=Kτωj+1(2.30) \left |\frac{\Omega_l(\omega j)}{V_m(\omega j)}\right| = \frac{K}{\tau \omega j + 1} \qquad \qquad \qquad \tag{2.30}​Vm​(ωj)Ωl​(ωj)​​=τωj+1K​(2.30)
∣Gwl,v(w)∣=K1+τ2ω2(2.31)|G_{wl,v}(w)| = \frac{K}{\sqrt{1+\tau^2\omega^2}} \qquad \qquad \qquad \tag{2.31}∣Gwl,v​(w)∣=1+τ2ω2​K​(2.31)
Ke,fK_{e,f}Ke,f​
τe,f\tau_{e,f}τe,f​
KKK
τ\tauτ
Ke,f=∣Gwl,v(0)∣(2.32)K_{e,f} = |G_{wl,v}(0)| \qquad \qquad \qquad \tag{2.32}Ke,f​=∣Gwl,v​(0)∣(2.32)
Y(s)U(s)=Kτs+1(2.33)\frac{Y(s)}{U(s)} = \frac{K}{\tau s + 1} \qquad \qquad \qquad \tag{2.33}U(s)Y(s)​=τs+1K​(2.33)
K=5rad/VsK = 5 rad/VsK=5rad/Vs
τ=0.05s\tau = 0.05sτ=0.05s
t0t_0t0​
uminu_{min}umin​
umaxu_{max}umax​
y0y_0y0​
K=ΔyΔu(2.34)K = \frac{\Delta y}{\Delta u} \qquad \qquad \qquad \tag{2.34}K=ΔuΔy​(2.34)
Δy=yss−y0\Delta y = y_{ss} - y_0Δy=yss​−y0​
Δu=umax−umin\Delta u =u_{max} - u_{min}Δu=umax​−umin​
τ\tauτ
y(t1)=0.632(yss−y0)+y0(2.35)y(t_1) = 0.632(y_{ss}-y_0) + y_0 \qquad \qquad \qquad \tag{2.35}y(t1​)=0.632(yss​−y0​)+y0​(2.35)
t1t_1t1​
y(t1)y(t_1)y(t1​)
t1t_1t1​
t1=t0+τ(2.36)t_1 = t_0 + \tau \qquad \qquad \qquad \tag{2.36}t1​=t0​+τ(2.36)
τ=t1−t0(2.37)\tau = t_1 - t_0 \qquad \qquad \qquad \tag{2.37}τ=t1​−t0​(2.37)
t0t_0t0​
Vm(s)=Ave(−st0)s(2.38)V_m(s) = \frac{A_ve^{(-st_0)}}{s} \qquad \qquad \qquad \tag{2.38}Vm​(s)=sAv​e(−st0​)​(2.38)
AvA_vAv​
t0t_0t0​
Ωl(s)=KAve(−st0)(τs+1)s(2.39)\Omega_l(s) = \frac{KA_ve^{(-s t_0)}}{(\tau s + 1)s} \qquad \qquad \qquad \tag{2.39}Ωl​(s)=(τs+1)sKAv​e(−st0​)​(2.39)
ωl(t)\omega_l(t)ωl​(t)
t0t_0t0​
ωl(t)=KAv(1−e(−t−t0τ))+ωl(t0)(2.40)\omega_l(t) = KA_v\left(1-e^{(-\frac{t-t_0}{\tau})}\right) + \omega_l(t_0) \qquad \qquad \qquad \tag{2.40}ωl​(t)=KAv​(1−e(−τt−t0​​))+ωl​(t0​)(2.40)
2π×352\pi \times35 2π×35
2V2V2V
20log⁡10(Gain)20\log_{10}(\text{Gain})20log10​(Gain)
τ\tauτ
τ\tauτ
KKK
τ\tauτ
KKK
τ\tauτ
KKK
τ\tauτ
KKK
τ\tauτ
KKK
τ\tauτ
τe,f\tau_{e,f}τe,f​
Modeling Using First-Principles
Modeling Using Experiment
Rotary Servo Base Unit User Manual
Rotary Servo Base Unit User Manual
32KB
Modeling_files.zip
archive
Table B.1
Frequency Response
Table B.1
Table B.2
Table B.1
Table B.1
Table B.1
Bump Test
Results
Table A.1
Table A.2
Table B.1
Table B.2
Table B.1
Table B.2
Table B.2
Table B.2
Figure 7 Rotary Servo Base Unit DC motor armature circuit and gear train
Figure 8 Typical frequency response
Figure 9 Magnitude Bode plot
Figure 10 Input and output signal used in the bump test method
Figure 11a q_servo_modeling Simulink diagram used to model Rotary Servo Base Unit.
Figure 11b Rotary Servo Interface - Speed, second-oder low-pass filter implemented
Figure 12 Load shaft speed response to a constant input
Figure 13 Load shaft speed sine wave response
Figure 14
Figure 15 Simulation done with default model parameters: K = 1 and = 0.1Save wl data and name it something like modeling_section#_Group#_K1tau01.
ψ\psiψ
ϕ\phiϕ
τ2\tau_2τ2​
(Ω)(\Omega)(Ω)
(ϕ)(\phi)(ϕ)
(θ)(\theta)(θ)
(ψ)(\psi)(ψ)
θ=0\theta=0θ=0
θ=0\theta=0θ=0
Jdω˙=τ1(1)J_d\dot{\omega}=\tau_1 \qquad \qquad \tag{1}Jd​ω˙=τ1​(1)
Jxϕ¨=τ2+JdΩψ˙(2)J_x\ddot{\phi}=\tau_2+J_d\Omega\dot{\psi}\qquad \qquad \tag{2}Jx​ϕ¨​=τ2​+Jd​Ωψ˙​(2)
Jzψ¨=−JdΩϕ˙(3)J_z \ddot{\psi}=-J_d\Omega\dot{\phi}\qquad \qquad \tag{3}Jz​ψ¨​=−Jd​Ωϕ˙​(3)
ω\omegaω
Ω\OmegaΩ
JdJ_dJd​
JxJ_xJx​
JzJ_zJz​
τ1=ktu1(4)\tau_1=k_tu_1\qquad \qquad \tag{4}τ1​=kt​u1​(4)
τ2=ktu2(5)\tau_2=k_tu_2\qquad \qquad \tag{5}τ2​=kt​u2​(5)
ktk_tkt​
u1u_1u1​
u2u_2u2​
Ω\OmegaΩ
ω(s)τ1(s)=1Jds(6)\frac{\omega(s)}{\tau_1 (s)}=\frac{1}{J_d s }\qquad \qquad \tag{6}τ1​(s)ω(s)​=Jd​s1​(6)
Φ(s)τ2(s)=JzJxJzs2+Jd2Ω2=P1(s)(7)\frac{Φ(s)}{τ_2 (s)}=\frac{J_z}{J_x J_z s^2+J_d^2 Ω^2}=P_1 (s)\qquad \qquad \tag{7}τ2​(s)Φ(s)​=Jx​Jz​s2+Jd2​Ω2Jz​​=P1​(s)(7)
Ψ(s)Φ(s)=−ΩJdJzs=P2(s)(8)\frac{Ψ(s)}{Φ(s)}=\frac{-ΩJ_d}{J_z s}=P_2 (s)\qquad \qquad \tag{8}Φ(s)Ψ(s)​=Jz​s−ΩJd​​=P2​(s)(8)
[ϕψϕ˙ψ˙]T[\phi \quad \psi \quad \dot{\phi} \quad \dot{\psi}]^T[ϕψϕ˙​ψ˙​]T
ddt[ϕψϕ˙ψ˙]=[00100001000JdΩ/Jx00−JdΩ/Jz0][ϕψϕ˙ψ˙]+[001/Jx0](9)\frac{d}{dt} \begin{bmatrix} \phi \\ \psi \\ \dot{\phi} \\ \dot{\psi} \\ \end{bmatrix} = \begin{bmatrix} 0& 0& 1& 0 \\ 0& 0& 0& 1 \\ 0& 0& 0& J_d\Omega/J_x \\ 0& 0& -J_d\Omega/J_z& 0 \end{bmatrix}\begin{bmatrix} \phi \\ \psi \\ \dot{\phi} \\ \dot{\psi} \\ \end{bmatrix} + \begin{bmatrix} 0 \\ 0 \\ 1/J_x \\ 0 \\ \end{bmatrix}\qquad \qquad \tag{9}dtd​​ϕψϕ˙​ψ˙​​​=​0000​0000​100−Jd​Ω/Jz​​01Jd​Ω/Jx​0​​​ϕψϕ˙​ψ˙​​​+​001/Jx​0​​(9)

Rotor mass

1.907

kg

Rotor radius

0.0762

m

MOI of disk about spin axis

0.0055

kg

MOI about x-axis/blue gimbal (disc rotor + blue gimbal)

0.00388552

kgm^2

MOI about y-axis/red gimbal (disc rotor + blue gimbal + red gimbal)

0.02344554

kgm^2

MOI about z-axis/gray gimbal, i.e., disc and blue, red, gray frames

0.06632120

kgm^2

Gimbal motor current-torque constant

0.115

Nm/A

Disc motor current-torque constant

0.0704

Nm/A

Max current

3

A

Max torque

0.3450

Nm

Disk rotor steady-state speed

78.5398

rad/s

ψ\psiψ
τ2\tau_2τ2​
ψ\psiψ
ψ\psiψ
10°10\degree10°
10°10\degree10°
∣kp∣<6|k_p|<6∣kp​∣<6
∣kd∣<0.4|k_d|<0.4∣kd​∣<0.4
ϕ˙\dot{\phi}ϕ˙​
ψ\psiψ
P1(s)P_1(s)P1​(s)
P2(s)P_2(s)P2​(s)
P1(s)P_1(s)P1​(s)
P2(s)P_2(s)P2​(s)
P2(s)P_2(s)P2​(s)
rir_iri​
ψ\psiψ
G(s)G(s)G(s)
P1(s)P_1(s)P1​(s)
kvk_vkv​
kv=0.2k_v=0.2kv​=0.2
G(s)G(s)G(s)
rir_iri​
ψ\psiψ
G(s)G(s)G(s)
kpk_pkp​
kdk_dkd​
kpk_pkp​
kdk_dkd​
kvk_vkv​
kp, kd, kv.k_p, \, k_d, \, k_v.kp​,kd​,kv​.
P1(s)P_1(s)P1​(s)
τ2\tau_2τ2​
τ2\tau_2τ2​
P1(s)P_1(s)P1​(s)
P2(s)P_2(s)P2​(s)
ϕ\phiϕ
ψ\psiψ
ψref=10o\psi_{ref}=10^oψref​=10o
ψref=10o\psi_{ref}=10^oψref​=10o
ψref=10o\psi_{ref}=10^oψref​=10o
kpk_pkp​
kdk_dkd​
kvk_vkv​
P1(s)P_1(s)P1​(s)
P2(s)P_2(s)P2​(s)
P1(s)P_1(s)P1​(s)
G(s)G(s)G(s)
rir_iri​
ψ\psiψ
kp, kd, kvk_p, \, k_d, \, k_vkp​,kd​,kv​
kp, kd, kvk_p, \, k_d, \, k_vkp​,kd​,kv​
ϕ˙\dot{\phi}ϕ˙​
4KB
gyro_sim_week1.mlx
Figure 1. Quanser 3-DOF Gyroscope
Figure 2. Gyroscope components figure
Figure 3. Gyroscope components table
Figure 4. Components of Quanser 3 DOF gyroscope
Figure 5. Gyroscope plant and control architecture
Figure 6. Gyroscope outer control loop architecture – Control System Designer
Figure 7. Simulation plots for square wave
KdK_dKd​
KiK_iKi​
KpK_pKp​
KdK_dKd​
KpK_pKp​
KdK_dKd​
KiK_iKi​
π/6\pi/6π/6
π/6\pi/6π/6
60∘60^{\circ}60∘
KpK_pKp​
KdK_dKd​
KiK_iKi​
KpK_pKp​
KdK_dKd​
KiK_iKi​
KpK_pKp​
KdK_dKd​
KiK_iKi​
KpK_pKp​
KpK_pKp​
KdK_dKd​
π/3\pi/3π/3
KpK_pKp​
KdK_dKd​
KpK_pKp​
KdK_dKd​
KiK_iKi​
48KB
q_servo_pos_cntrl.slx
Step 5 of Part C Control Design
Step 6 of Part C Control Design
Step 6 of Part C Control Design
Step 9 of Part C Control Design
(ψ)(\psi)(ψ)
ψ\psiψ
ϕ\phiϕ
kp,  kd  k_p, \,\, k_d \,\,kp​,kd​
kvk_vkv​
kpk_pkp​
kdk_dkd​
kvk_vkv​
ψ\psiψ
ψ\psiψ
ϕ\phiϕ
ϕ\phiϕ
ψ\psiψ
ψ\psiψ
ψ\psiψ
ϕ\phiϕ
ϕ\phiϕ
ψ\psiψ
ψ\psiψ
ϕ\phiϕ
ψ\psiψ
ψ\psiψ
ϕ\phiϕ
ϕ\phiϕ
3KB
gyro_sim_data.mlx
59KB
q_3dgyro_reaction_torque_m2021.slx
Figure 8. q_3dgyro_reaction_torque_m2021 Simulink diagram
Figure 9. 3 DOF Gyroscope Simulink subsystem
Figure 10. Gyroscope orientation for heading-hold, facing side opposite wires

A & B. Modeling and Balance Control

Objective

The objectives of this laboratory experiment are as follows:

  1. Obtain the linear state-space representation of the rotary pendulum system.

  2. Design a controller that balances the pendulum in its upright position using Pole Placement.

  3. Simulate the closed-loop system to ensure the given specifications are met.

  4. Implement the balance controller on the Quanser Rotary Pendulum system and evaluate its performance.

Equipment

A. Modeling

This experiment involves modeling of the rotary inverted pendulum.

Rotary Inverted Pendulum Model

A picture of the rotary servo base with rotary pendulum module is shown in Fig 1. The numbered components in Fig. 1 are listed in Table 1 along with the numerical values of the system parameters in Table 2.

Table 1 Rotary Pendulum components (Figure 1)

ID#
Component

Table 2 Main Parameters associated with the Rotary Pendulum module

Symbol
Description
Value
Unit

Model Convention

A simplified form of the inverted pendulum system used in the development of the mathematical model is shown in Figure 2. The rotary arm pivot is attached to the Rotary Servo system. The arm has a length of , a moment of inertia of , and its angle, , increases positively when it rotates counterclockwise (CCW). The servo (and thus the arm) should turn in the CCW direction when the control voltage is positive, i.e. > 0.

The pendulum link is connected to the end of the rotary arm. It has a total length of and its center of mass is at . The moment of inertia about its center of mass is . The inverted pendulum angle, , is zero when it is perfectly upright in the vertical position and increases positively when rotated CCW.

Nonlinear Equations of Motion

Instead of using classical (Newtonian) mechanics, the Lagrange method is used to find the equations of motion of the system. This systematic method is often used for more complicated systems such as robot manipulators with multiple joints.

Specifically, the equations that describe the motions of the rotary arm and the pendulum with respect to the servo motor voltage, i.e., the dynamics, are obtained using the Euler-Lagrange equation:

The variables 's are called generalized coordinates.'s are called generalised force and L is the Langrangian (difference between Kinetic and Potential energies of the system). For this system let

where, as shown in Figure 2, is the rotary arm angle and is the inverted pendulum angle. The corresponding angular rates are

With the generalized coordinates defined, the Euler-Lagrange equations for the rotary pendulum system are

The Lagrangian of the system is described by

where is the total kinetic energy of the system and is the total potential energy of the system. Thus the Lagrangian is the difference between a system’s kinetic and potential energies.

The generalized forces are used to describe the nonconservative forces (e.g. friction) applied to a system with respect to the generalized coordinates. In this case, the generalized force acting on the rotary arm is

and acting on the pendulum is

​See in the Appendix for a description of the corresponding Rotary Servo parameters (e.g., such as the back-emf constant, ). Our control variable is the input servo motor voltage, . Opposing the applied torque is the viscous friction torque, or viscous damping, corresponding to the term . Since the pendulum is not actuated, the only force acting on the link is the damping. The viscous damping coefficient of the pendulum is denoted by .

Once expressions for the kinetic and potential energy are obtained and the Lagrangian is found, then the task is to compute various derivatives to get the EOMs. After going through this process, the nonlinear equations of motion for the Rotary Pendulum are:​

The torque applied at the base of the rotary arm (i.e. at the load gear) is generated by the servo motor as described by the equation 7. Refer to in the Appendix for the Rotary Servo parameters.

Linearization

Linearization of a nonlinear function about a selected point is obtained by retaining upto first order term in the Taylor Series expansion of the function about the selected point. For example, linearization of a two variable nonlinear function f(z) where

about the point

can be written as

​

Linearization of Inverted Pendulum Equations

The nonlinear equations of the inverted pendulum system obtained as Equations (7) and (8) are linearized about the equilibrium point with the pendulum in the upright position, i.e.,

, , , , ,

Linearization of Equation (7) about the above equilibrium state gives

where, from Equation(9) the servo motor torque coefficient is

and the back emf coefficient is

Likewise, linearization of Equation (8) about the equilibrium point with the pendulum in the upright position gives

where is the acceleration due to gravity. Note that the negative sign of the gravity torque ( term) in Equation 11 indicates negative stiffness with the pendulum in the vertically upright position.

Equations (10) and (11) can be arranged in the matrix form as

Where mass matrix , damping matrix , and the stiffness matrix become

Defining the state vector , output vector and the control input as

Equation (12) can be rewritten in state space form as

where the system state matrix , control matrix , output matrix and the feedthrough of input to the output matrix become

In the equations above, note that is a matrix of zeros, is a matrix of zeros, and is a identity matrix. Using the parameters of the system listed in and the appendix , the linear model matrices and can be computed.

Analysis: Modeling

  1. Download the Part 1.zip file and extract the folder contents.

  2. Open rotpen_part1_student.mlx live script and run the Modelling section. It will automatically load the parameters required for the state-space representation, and subsequently generate the A, B, C and D matrices required for the upcoming analysis. Please refer to and for additional information regarding the parameters. Note: The representative C and D matrices have already been included. The actuator dynamics have been added to convert your state-space matrices to be in terms of voltage. Recall that the input of the state-space model is the torque acting at the servo load gear. However, we control the servo input voltage instead of control torque directly. The script uses the voltage torque relationship given in Equation 9 to transform torque to voltage.

  3. Note down your state-space matrices for your report. Note: You may want to cross-check the state-space matrix with TAs before proceeding to balance control.

  4. Find the open-loop poles of the system. Hint: Use eig(A).

B. Balance Control

Specification

The control design and time-response requirements are: Specification 1: Damping ratio: 0.6 < < 0.8 Specification 2: Natural frequency: 3.5 rad/s < < 4.5 rad/s Specification 3: Maximum pendulum angle deflection: < 15 deg. Specification 4: Maximum control effort / voltage: < 10 V. The necessary closed-loop poles are found from specifications 1 and 2. The pendulum deflection and control effort requirements (i.e. specifications 3 and 4) are to be satisfied when the rotary arm is tracking a degree angle square wave.

Stability

The stability of a system can be determined from its poles ([1]):

  • Stable systems have poles only in the left-half of the complex plane.

  • Unstable systems have at least one pole in the right-half of the complex plane and/or poles of multiplicity greater than 1 on the imaginary axis.

  • Marginally stable systems have one pole on the imaginary axis and the other poles in the left-half of the complex plane.

The poles are the roots of the system’s characteristic equation. From the state-space, the characteristic equation of the system can be found using

where is the determinant of a matrix, is the Laplace operator, and is the identity matrix. These are the eigenvalues of the system matrix .

Controllability

If the control input of a system can take each state variable, where , from an initial state to a final state in finite time then the system is controllable, otherwise it is uncontrollable ([1]).

Rank Test The system is controllable if the rank of its controllability matrix

equals the number of states in the system, i.e.

Companion Matrix

For a controllable system with nxn system matrix A and nx1 control matrix B. The companion matrices of A and B are

and

Where are the coefficients of the characteristic equation of the system matrix A written as

Now define W,

where is the controllability matrix defined in Equation 16 and

Then

and

Pole Placement Theory

If are controllable, then pole placement can be used to design the controller. Given the control law , the state-space model of Equation (13) becomes

We can generalize the procedure to design a gain for a controllable system as follows:

Step 1 Find the companion matrices and . Compute . Step 2 Compute to assign the poles of to the desired locations.

Step 3 Find to get the feedback gain for the original system . Remark-1: It is important to do the conversion. Remember that represents the actual system while the companion matrices and do not.

Remark-2: The entire control design procedure using the pole placement method can be simply done in MATLAB using the function called 'place' or 'acker'. For a selected desired set of closed loop poles DP, the full state feedback gain matrix is obtained from

Desired Poles

The rotary inverted pendulum system has four poles. As depicted in Figure 3, poles and are the complex conjugate dominant poles and are chosen to satisfy the natural frequency, , and the damping ratio, , as given in the s. Let the conjugate poles be

and

where​ and is the damped frequency. The remaining closed-loop poles, and , are placed along the real-axis to the left of the dominant poles, as shown in Figure 3.

Simulation Model with Feedback

The feedback control loop that balances the rotary pendulum is illustrated in Figure 4. The reference state is defined as

where is the desired rotary arm angle. The controller is

Note that if then , which is the control used in the pole-placement algorithm.

When running this on the actual system, the pendulum begins in the hanging, downward position. We only want the balance control to be enabled when the pendulum is brought up around its upright vertical position. The controller is therefore

where is the angle about which the controller should engage. Also is the pendulum angle. For example if degrees, then the control will begin when the pendulum is within ±10 degrees of its upright position, i.e. when degrees.

B.1 Experiment: Designing the Balance Control

  1. Select and from the table below. Ensure to choose a different set of values from your groupmates

    Parameter
    1
    2
    3
    4
    5
    6
    7
    8
  2. In the same rotpen_part1_student.mlx live script, go to the Balance Control section. Enter the chosen zeta and omega_n values.

  3. Determine the locations of the two dominant poles and based on the specifications and enter their values in the MATLAB live script. Ensure that the other poles are placed at p3 = -30 and p4 = -40. Hint: Use Equation 27.

  4. Find gain K using a predefined Compensator Design MATLAB command K = acker(A,B,DP), which is based on pole-placement design. Note: DP is a row vector of the desired poles found in Step 3.

For sanity check, if you use damping ratio of 0.7 and natural frequency of 4 rad/s, you should get around K = [-12 63 -5.5 7].

B.2 Experiment: Simulating the Balance Control

The s_rotpen_bal SIMULINK diagram shown in Figure 5 is used to simulate the closed-loop response of the Rotary Pendulum using the state-feedback control described in with the control gain K found above. The Signal Generator block generates a 0.1 Hz square wave (with an amplitude of 1). The Amplitude (deg) gain block is used to change the desired rotary arm position. The state-feedback gain K is set in the Control Gain gain block and is read from the MATLAB workspace. The SIMULINK State-Space block reads the A, B, C, and D state-space matrices that are loaded in the MATLAB workspace. The Find State X block contains high-pass filters to find the angular rates of the rotary arm and pendulum.

  1. Run rotpen_part1_student.mlx live script. Ensure the gain K you found is loaded in the workspace (type K matrix in the command window).

  2. Open and run the s_rotpen_bal.mdl for 10 seconds. The responses in the scopes shown in Figure 6 were generated using an arbitrary feedback control gain. Note: When the simulation stops, the last 10 seconds of data is automatically saved in the MATLAB workspace to the variables data_theta, data_alpha, and data_Vm.

  3. Save the data corresponding to the simulated response of the rotary arm, pendulum, and motor input voltage obtained using your obtained gain K. Note: The time is stored in the data_theta(:,1) vector, the desired and measured rotary arm angles are saved in the data_theta(:,2) and data_theta(:,3) arrays. Similarly, the pendulum angle is stored in the data_alpha(:,2) vector, and the control input is in the data_Vm(:,2) structure.

  4. Measure the pendulum deflection and voltage used. Are the given satisfied?

B.3 Experiment: Implementing the Balance Controller

In this section, the state-feedback control that was designed and simulated in the previous sections is run on the actual Rotary Pendulum device.

Experiment Setup

The q_rotpen_bal_student SIMULINK diagram shown in Figure 7 is used to run the state-feedback control on the Quanser Rotary Pendulum system. The Rotary Pendulum Interface subsystem contains QUARC blocks that interface with the DC motor and sensors of the system. The feedback developed in the previous section is implemented using a Simulink Gain block.

  1. Download the Part 2.zip file, extract the folder contents and open the part2setup.m script.

  2. Go to the 'Balance Control' section and put the gain K you found in . Run the script.

  3. Open the q_rotpen_bal_student SIMULINK diagram.

  4. As shown in Figure 7, the SIMULINK diagram is incomplete. Add the necessary blocks from the Simulink library to implement the balance control.

    • You need to add a switch logic to implement Equation 30. Use Multi-port switch with 2 data points and zero-based contiguous. The output from the compare to constant block will be 0 if false and 1 if true. Check your block with TA.

    • Ensure that you connect the final signal going into the u(V) terminal of the Rotary Pendulum Interface, which is also connected to the u scope terminal.

  5. Turn ON the power amplifier.

  6. Ensure the pendulum is in the hanging down position, with the rotary arm aligned with the 0 marking, and is motionless.

  7. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  8. Press Connect button under Monitor & Tune and Press Start .

  9. Once it is running, manually bring up the pendulum to its upright vertical position. You should feel the voltage kick-in when it is within the range where the balance control engages. Once it is balanced, the controller will introduce the ±20 degree rotary arm rotation.

  10. The response should look similar to your simulation. Once you have obtained a response, click on the STOP button to stop the controller (data is saved for the last 10 seconds, so stop SIMULINK around 18-19 seconds once the response looks similar to Figure 8).

    CAUTION Be careful, as the pendulum will fall down when the controller is stopped.

  11. Similar to the simulation Simulink model, the response data will be saved to the workspace. Copy and paste into your group's folder. Ensure that the data variables have 10 seconds of data saved.

Results for Report

A) Modeling

  1. The linear state-space representation of the rotary inverted pendulum system, i.e., , , and matrices (numerical values).

  2. Open-loop poles of the system.

B.1) Balance Control Design

  1. Chosen and based on design specifications.

  2. Corresponding locations of the two dominant poles and .

  3. Gain vector .

B.2) Balance Control Simulation

  1. Plots of the commanded position of the rotary arm (), simulated responses of the rotary arm (), pendulum (), and motor input voltage () generated using your obtained gain K.

  2. Are satisfied? Justify using the measured maximum pendulum deflection and motor input voltage values.

B.3) Balance Controller Implementation

  1. From , plots of the commanded position of the rotary arm (), experimental responses of the rotary arm (), pendulum (), and motor input voltage () generated using the chosen gain K.

  2. Are satisfied? Justify using the measured maximum pendulum deflection and motor input voltage values.

Questions for Report

A) Modeling

  1. Based on your open-loop poles found in , is the system stable, marginally stable, or unstable?

  2. Did you expect the stability of the inverted pendulum to be as what was determined? Justify.

B.1) Balance Control Design

For the questions below, calculations and intermediate steps must be shown.

  1. Determine the controllability matrix of the system. Is the inverted pendulum system controllable? Hint: Use Equation 17.

  2. Using the open-loop poles, find the characteristic equation of . Hint: The roots of the characteristic equation are the open-­loop poles.

    Instead of using , characteristic polynomials can also be found using MATLAB function .

  3. Find the corresponding companion matrices and . Hint: For , use the characteristic equation of A found in and Equation 19. For , use Equation 20.

  4. Determine the controllability matrix of the companion system.

  5. Determine the transformation matrix .

  6. Check if and with the obtained matrices.

  7. Using the locations of the two dominant poles, and , based on the (), and the other poles at and , determine the desired closed-loop characteristic equation. Hint: The roots of the closed-loop characteristic equation are the closed-­loop poles.

  8. When applying the control to the companion form, it changes to . Find the gain that assigns the poles to their new desired location. Hint: Use Equation 26 and find the corresponding characteristic equation. Compare this equation with the desired closed-loop characteristic equation found in to determine the gain vector .

  9. Once you have found , find using .

  10. Compare the gain vector calculated using Pole Placement Theory () with the gain vector obtained using MATLAB ().

Appendix

Table A Main Rotary Servo Base Unit Specifications

Reference

[1] Norman S. Nise. Control Systems Engineering. John Wiley & Sons, Inc., 2008.

[2] Bruce Francis. Ece1619 linear systems, 2001.

B & C. Control Design and Controller Implementation (Week 2)

Objective

The objective is to design a controller that allows rapid reorientation of the link with very little vibrations from the link flexibility. This analysis is a preliminary approach to containing structural vibrations in real-world applications like aircraft and spacecraft structures as well as robotic links/manipulators

B. Control Design

The methodology used is to design the control law assuming full state feedback to meet a given set of specifications. This will be followed by studying the loss of controller performance with servo feedback alone. The method we will use for full state feedback is based on the linear quadratic regulator (LQR) theory, which requires the given system to be controllable.

State Space Model

The equations that describe the motions of the servo and the link with respect to the servo motor voltage are obtained using the lumped mass method and can be written as

Assuming the viscous damping of the link is negligible, i.e. = 0 and substituting the torque using the expression,

the EOM can be rearranged as

The various system parameters can be found in Table 2 of Part A: System Identification.

Equations 3 and 4 can be represented in state-space form

with and, where

In the output equation, only the position of the servo and link angles are being measured.

As such, the velocities of the servo and link angles can be computed in the digital controller if required, e.g., by taking the derivative and filtering the result though a high-pass filter. Hence, with all the states of the system as outputs, the C and D matrices are

Linear Quadratic Regulator (LQR) Design

Controllability

If the control input of a system can take each state variable, where , from an initial state to a final state in finite time, then the system is controllable, otherwise it is uncontrollable. The controllability of a system can be determined using the ‘Rank Test’. According to the Rank Test, the system is controllable if the rank of its controllability matrix

equals the number of states of the system,

LQR controller

If (A,B) are controllable, then the Linear Quadratic Regular optimization method can be used to find full state feedback controller gains. Given the plant model in state-space form where represents the state vector, this technique finds a control input ‘’ that minimizes the cost function

where Q and R are the user-defined weighting matrices and . It is assumed that Q is positive semi-definite (all the eigenvalues of are non-negative) and is positive definite (all the eigenvalues of are positive). The weighting matrices affect how LQR minimizes the function and are, essentially, tuning variables. Here, is the state vector and is the servo motor voltage input .

Given the control law , the state-space model of the closed loop system becomes

where is given by

is the controller gain vector. Note that the input voltage is scalar, and therefore, is also scalar. In practice, the weighting matrices and are chosen to be diagonal. A simple way for choosing and is using the Bryson's rule. This method works best when control design specifications regarding the system response and control input are given in terms of limits on excursions from equilibrium.

Assuming the time-domain design specifications are

Then one can use the Bryson’s rule to choose the weighting matrices as

Further tuning of and may be required for improving the controller performance. Note that increasing means increasing the penalty on the control input (using less control effort). Similarly, increasing means increasing the penalty on the states (states reaching equilibrium position quickly and with less overshoot). Matrix sets the weight on the states and determines how will minimize (and hence how it generates gain ).

In our case,

Substituting and in Eqn. 9 gives

where , , , ,

On observing Eq. 12, it can be seen that increasing causes control input to work harder to minimize state , which will predominately increase. If is increased, then will increase to compensate for the larger weight placed on state . Depending on the model, changing a single can affect multiple gains because each state is not independent. If is increased, then control input has to work less to minimize. In that case, LQR would generate a lower overall value of. A block diagram of the system with fill state feedback controller is shown in Figure 1.

The feedback control loop in Figure 1 is designed to stabilize the servo to a desired position,, while minimizing the deflection of the flexible link, where is the state column vector and is the gain row vector as shown earlier. Note that isidentity matrix and is column of zeros in Figure 1.

The reference state is defined as

and the controller is

Controller Specifications:

The following specifications in the time domain are to be met when the rotary arm is tracking a step change in its angular position.

Specification 1: Servo angle 2% settling time:

Specification 2: Servo angle percentage overshoot:

Specification 3: Maximum link angle deflection:

Specification 4: Maximum control effort (voltage):

Controller Design Procedure:

Note: The results from the following steps have to be included in the Analysis section of the report.

  1. Obtain the and matrices of the system using the parameters from Part A: System identification. Check your A and B matrices with the TA.

  2. Using Bryson’s rule (Eq. 12-15) calculate and matrices, based on the following suggested maximum values of state and control excursions:

    Check if and (by finding eigenvalues of the matrix).

  3. Using the lqr command in MATLAB, calculate the optimal feedback gain vector . The lqr command solves the Algebraic Riccati equation which is required to determine the gain vector is

    >> [K,S,E] = lqr(A,B,Q,R);

    where is the gain matrix, is the solution to the Riccati equation and E are closed loop system poles. Check your gain matrix K with the TA.

  4. Using Figure 1 as a guide, develop a Simulink model of the system.

    Note: SIMULINK references the current MATLAB workspace when setting variables. Use the variable names for the system matrices and and the control gain matrix from your MATLAB script file for the LQR design.

    Make sure to include servo position command input, saturation blocks, and appropriate outputs. Use scopes and To Workspace blocks so that reference, output, and response signals can be tracked. (Make sure to maintain consistency between deg and rad in SIMULINK)

  5. Using the controller gains found in step 3, simulate the closed loop system for a step servo position command of over a 10s duration.

    • Record (and plot for lab report) the servo angle () link angle () and voltage input .

    • Check if all the given specifications are met.

    • If not, keep adjusting the and weighting matrices parameters, till all specifications are met. Record the final Q and R matrices, the servo angle (), link angle () and voltage input plots.

  6. Study in simulation the degradation, if any, in closed loop system performance (in meeting the given specifications) using partial feedback. For partial feedback consider feedback of servo angle () and servo angle rate ().

    • This is easily done by retaining the gain value of the chosen feedback loops and zeroing out the remaining gains in the gain matrix used in your Simulink model.

    • Check your plots with the TA.

    • Check if the specifications are met (no need to tune Q and R matrices.)

    • Record (and plot for lab report) the servo angle () link angle () and voltage input

C. Controller Implementation and Evaluation

In this experiment, the servo position is controlled while minimizing the link deflection using the LQR­ based control found. Measurements will then be taken to ensure that the specifications are satisfied.

Warning: In closed loop experiments, the link may swing around rather quickly. Stay clear of it during closed loop experiments.

Experiment

  1. Turn the amplifier power on.

  2. Download the q_flex.zip and open the Simulink file q_flex for controller implementation. This is the block diagram for this part of the experiment. Make sure you have K gain variable in the MATLAB workspace. Note: The Smooth Signal Generator block generates a 0.33 Hz square wave (with amplitude of 1) that is passed through a Rate Limiter block to smooth the signal (Rising slew rate of 100 and falling slew rate of -100). The Amplitude (deg) gain block is used to change the desired servo position command. The state-feedback gain K is set in the LQR Control gain block and is read from the MATLAB workspace.

  3. To build the model, click down arrow on Monitor & Tune under Hardware tab and then Build for monitoring . This generates the controller code.

  4. Align the flexible link along the 0 mark on the servo stand.

  5. Double click on the scopes and open them.

  6. Ensure that the manual switch is connected to the full state feedback.

  7. Click Connect button under Monitor & Tune and then click Start

  8. A periodic square wave is given as commanded link rotation to the servo motor, causing the link to move left and right alternately for 10 seconds.

  9. Copy the response data to your group folder. The response data is saved in variables data_theta, data_alpha, and data_vm. DO NOT DELETE or SAVE THE SIMULINK MODEL.

  10. Connect the manual switch to the partial state feedback and repeat steps 4-9 again. Make sure your files name is different from full state feedback.

  11. Turn the power off.

Results & Questions for Report

Control Design

Results

  1. Include the results from the controller design procedure Steps 1-6.

Questions

  1. Estimate the bandwidth for your full state and partial state feedback controllers. Hint: Use 'bandwidth(sysclosed)' command in MATLAB with link rotation () as the output.

>> sysclosed = ss((A-B*K), B, [1 0 0 0], 0);

>> bw = bandwidth(sysclosed)

>> bode(sysclosed)

The bode() function produces closed loop system frequency response plot. Include Bode Plots of the closed loop system and list the bandwidth of the system with full and partial state feedback.

  1. Estimate the stability margins (gain and phase margins) of your full state and partial state feedback controllers. Hint: Use 'margin(sysopen)' command in MATLAB where 'sysopen' is the state space model of the open loop system with the controller.

>> sysopen = ss(A,B,K,0)

>> margin(sysopen)

We get bode plot of the open loop system with the controller with margins listed on the plots. Include the Bode plots for the full state and partial state feedback.

Controller Implementation

Results

  1. Plots of servo angle, link deflection angle and input voltage vs time for full state and partial state feedback. Compare the results and explain the differences.

  2. Run the Simulink that you built in control design with the same command input used in the experiment. Compare the simulated response with the experimental response for both full state and partial state feedback and explain any differences between them. Note 1: Generate two sets of figures with one set containing the plots of simulation and experiment for full state feedback and the second set containing the plots of simulation and experiment for partial state feedback. For each feedback case, the simulated response and corresponding experimental response must be on the same graph. Note 2: Average the first few seconds of the experimental data to obtain initial conditions for your state-space block in Simulink.

Questions

  1. Explain why the link deflection angle goes opposite to servo rotation initially.

  2. For a controllable system, can partial state feedback guarantee stability like full state feedback? Briefly explain.

C. Swing-up Control (Demo)

Objective

The objectives of this part of the laboratory experiment of the rotary inverted pendulum are as follows:

  1. Use energy-based control scheme to develop a swing-up pendulum controller.

  2. Implement the swing-up controller on the Quanser Rotary Pendulum plant and evaluate its performance.

C. Swing up Control

In this section a nonlinear, energy-based control scheme is developed to swing the pendulum up from its hanging, downward position. The swing-up control described herein is based on the strategy outlined in [3]. Once upright, the control developed to balance the pendulum in the upright vertical position can be used.

Pendulum Dynamics

The dynamics of the pendulum can be redefined in terms of pivot acceleration (see Figure 9) as

The pivot acceleration, , is the linear acceleration of the pendulum link base. The acceleration is proportional to the torque of the rotary arm and is expressed as

Control Law based on Lyapunov Function​

According to Lyapunov’s stability theory, a sufficient condition for asymptotic stability of a nonlinear system about an equilibrium point is that the first time derivative of a selected Lyapunov’s function () is negative, i.e.,

Given

sufficient condition for asymptotic stability is

Swing-up Control

Let us select a candidate Lyapunov function for arriving at the control law as a quadratic function of the difference in total energy () and the reference energy () when the pendulum is in equilibrium in the upright position, i.e.,

where the total energy () is the sum of kinetic energy and potential energy .

Also, the reference energy of the pendulum in equilibrium in its fully upright position as compared to its fully downward position becomes

Taking the time derivative of Equation 35, we get

Taking the time derivative of Equation 38, we get

Now, we replace the bracketed term on the right-hand side of Equation 41 using the equation of motion of the pendulum obtained in Equation 31 to get

Substituting Equation 42 in Equation 38, the time rate of change of the selected Lyapunov equation becomes

Now, we need to select such that for asymptotic stability. This can easily be achieved by selecting as

With the above selection of control law for the pivot acceleration, Equation 43 becomes

which guarantees .

The selected control law (Equation 44) will continuously decrease the difference between current energy () and the energy of the pendulum in the vertically up position (). Note that the selected control law is nonlinear, it changes sign for and .

Now, for the quickest change in energy, we may want to use the maximum controller input (acceleration of the pivot), i.e.,

but this controller can lead to chattering. Instead, we use

where is a tunable controller gain.

Recall that the acceleration of the pendulum pivot is related to the torque applied on the rotary arm

Additionally, from Equation 9 of the balance controller design section, we have

Then, the voltage supplied to the rotary base motor is obtained by combining Equations 48 and 49 as

Where from Equation 47,

The selected nonlinear control law will swing up the pendulum from the downward position towards the upright position. Once the pendulum is near the upright position, it is balanced around the fully upward position using the linear balance controller.

Combined Balance and Swing-up Control

The energy-based swing-up control can be combined with the balancing control in Equation 29 to obtain a control law that performs the dual tasks of swinging up the pendulum and balancing it. This can be accomplished by switching between the two control systems.

Basically, the same switching implemented for the balance control in Equation 30 is used. Only instead of feeding 0 V when the balance control is not enabled, the swing-up control is engaged. The controller therefore becomes

where

The parameter in Equation 51 is a user-selected range of over which the balance controller becomes active.

Experiment: Implementing the Swing up Control

  1. Run the part2setup.m script extracted from the Part 2.zip file in the 'Balance Control' section.

  2. Check if the correct gain K value is loaded onto the workspace.

  3. Open q_rotpen_swingup_student_2 Simulink diagram.

  4. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  5. Press Connect button under Monitor & Tune and Press Start . The pendulum should be moving back and forth slowly. Gradually increase until the pendulum goes up. You may do this by increasing the gain slider. When the pendulum swings up to the vertical upright position, the balance controller should engage and balance the link.

  6. After the link swings up and is balanced, wait for ~5 seconds and stop the SIMULINK.

  7. OPTIONAL: Save the data_alpha, data_theta, and data_Vm. Ensure that the data variables have 10 seconds of data saved.

Question for Report

Briefly summarize the swing-up controller experiment and your observations. Did the swing-up control behave as you expected?

Reference

[3] K. J. Åström and K. Furuta. Swinging up a pendulum by energy control. 13th IFAC World Congress, 1996.

A. System Identification (Week 1)

Objective

The purpose of this experiment is to understand the existence of vibrations in a rotary flexible link and the resulting mode shapes. Any beam-like structure exhibits vibrations either due to external changing loads or due to reorientation via actuators. The experiment deals with the modeling and identification of modal frequencies and mode shapes of free vibrations for a rotary flexible link. This analysis is particularly useful to understand structural vibrations and modes and how to contain them in real-world applications like aircraft and spacecraft structures as well as robotic links/manipulators.

Equipment Required

Modeling and Vibration Analysis

This experiment involves system identification and modeling of the flexible link. The objective is find the stiffness and the viscous damping coefficient of the flexible link and conduct a frequency sweep across a range to determine the structural frequencies and mode shapes of the link.

Rotary Flexible Link Model

This experiment is performed using the Quanser Rotary Flexible Link mounted on an SRV-02 servo motor. This system, shown in Fig. 1, consists of an electromechanical plant, where a flexible link is rotated using a servo motor. The base of the flexible link is mounted on the load gear of the servo motor system. The servo angle, , increases positively when it rotates counter-clockwise (CCW). The servo (and thus the link) turn in the CCW direction when the control voltage is positive, i.e., .

The main components of the setup are labeled in Figs. 2 and 3 and are listed in Table 1.

Table 1. Setup Components

The FLEXGAGE module consists of the strain gauge, the strain gauge circuitry, and a sensor connector. The flexible link is attached to this module and the strain gauge is fixed at the root of the link. The module is mounted onto the servo motor, which is the actuator for this system. The strain gauge sensor produces an analog signal proportional to the deflection of the link tip.

The link can be schematically represented as shown in Fig. 4. The flexible link has a total length of , a mass of , and its moment of inertia about the pivoted end is . The deflection angle of the link is denoted as and increases positively when rotated CCW.

The complete flexible link system can be represented by the diagram shown in Fig. 5. The control variable is the input servo motor voltage, which is proportional to the angular rate of the servo motor. This generates a torque , at the load gear of the servo that rotates the base of the link, which is given by​

where the various constants are SRV02 parameters which are mentioned in Table 2.

The viscous friction coefficient of the servo is denoted by . This is the friction that opposes the torque being applied at the servo load gear. represents the moment of inertia of the SRV02 when there is no load. The friction acting on the link is represented by the viscous damping coefficient . The flexible link is modeled as a linear spring with the stiffness and with moment of inertia .

Table 2. Setup Parameters

Equations of Motion

The servo and the flexible link can be approximated as a lumped mass system interconnected by a spring and a damper, which represent the stiffness and damping coefficient of the flexible link, respectively (see Fig.5). The equations that describe the motion of the servo and the link, i.e., the dynamics, can be obtained using free body diagram (FBD) analysis of the lumped mass moments of inertia ( and ).

The torque balance on yields Eq. (1.2) and the torque balance on yields Eq. (1.3).

On rearranging Eq. (1.3) to obtain an expression for and substituting it in Eq. (1.2), the equations of motion (EOM) for the rotary flexible link system can be obtained as

Note that the rigid rotation of the link () and its flexible deflection () are inertially coupled as seen from Eqns. (1.4) and (1.5).

Part 1: Determination of Link Stiffness and Viscous Damping from Experiment

Part 1: Theory

The stiffness and the viscous damping coefficient of the flexible link can be determined from the free oscillation of the link using a second-order model. The free-oscillatory equation of motion of this second-order system is obtained by setting the term to zero in Eq. (1.5), i.e., by holding constant, yielding:

With initial conditions and , the Laplace transform of Eqn. (1.6) yields Eq (1.7) where is the Laplace transform of .

Inverse Laplace of Eq. (1.7) yields . An example plot of is shown in Fig. 6.

The characteristic polynomial for a second-order system is:

where is the damping ratio, and is the natural frequency. Equating this to the characteristic polynomial (denominator) in Eq. (1.7) yields

where is the mass moment of inertia of the link about the pivot. This can be calculated approximately by considering the link as a rod rotating about a pivot at one edge . Equations (1.8) and (1.9) can be used to determine the stiffness and damping of the flexible link once the natural frequency and damping ratio are known.

The damping ratio of this second-order system can be found from its response (underdamped system) using the logarithmic decrement given by

where is the peak of the first oscillation and is the peak of the nth oscillation. Note that , as this is a decaying response (positive damping).

The damping ratio can be shown to be related to the logarithmic decrement as

The period of oscillation in a system response can be found using the equation

where is the time of the peak is the time of the first peak, and is the number of peaks considered.

From this, the damped natural frequency (in rad/s) is

and the natural frequency is

Part 1 Experimental Procedure:

  1. Mount the flexible link onto the calibration bench.

  2. Download and open FlexLink_FreeOsc_Q2_USB.slx. This is the block diagram for this part of the experiment. Change the simulation time to 5-10 seconds.

  3. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  4. Open the scope alpha.

  5. Turn on the power supply.

  6. Press Connect button under Monitor & Tune and hold on to the base to prevent any rotation at the root.

  7. Press Start and immediately perturb the flexible link (for example, at the tip). Keep holding the base until the data is collected for the complete run.

  8. Check you have good data and save the link deflection angle data for the free oscillation using the filename FreeOsc_1 to your folder.

  9. Repeat the steps 7 and 8 two more times for different perturbation locations along the link (for example, around the middle and near the base) or different perturbation angles.

Part 1: Analysis:

  1. Plot the measured angular deflection of the link vs. time for each case. Ensure that the data is centered around 0°, and if it is not, adjust it so that it is. Select peaks that are smooth (focus on the region after initial transients) as shown in the figure below. Ensure that there are at least 4-5 peaks in between the two chosen peaks. Option: Usage offindpeak MATLAB function might be helpful, but not required. If you use this function, verify the peaks identified.

  2. From the peaks selected, determine the logarithmic decrement (Eq 1.10) and the time period (Eq 1.12).

  3. Average the logarithmic decrement and the time period for the three sets of data to get single values of and .

  4. Compute the mass moment of inertia of the link using the equation in Table 2.

  5. Using the average values of and from step 3 and the value of from step 4, compute damping ratio, damped frequency, natural frequency, link stiffness and link viscous damping coefficient.

Part 2: Determination of Modal Frequencies

Part 2 Theory:

The flexible link can be considered as a thin continuous (uniform) cantilever beam anchored at one end and free at the other end. Using the Euler-Bernoulli beam theory, the equation of motion can be written as

where is the Young's modulus of the material of the beam (assumed constant), is the area moment of inertia of the beam cross-section (assumed constant), is the displacement in direction at a distance from the fixed end at time , is the circular natural frequency, is the mass per unit length (, is the material density, is the cross-section area), is the distance measured from the fixed end and is the external applied force per unit length.

Also, the angle of deflection is related to the displacement as

The general solution to Eq. (1.15) can be obtained using separation of variables, as in Eq. (1.17) below.

Substituting (1.17) in (1.15), setting and rearranging gives

Equation (1.18) can be rewritten as

Since the left side of Eq. (1.19) is only a function of and the right side of Eq. (1.19) is only a function of , they both must equal a constant. Let this constant be . Thus, Eq. (1.19) can be written as the following two equations

The solution of Eq. (1.20) gives , which is of the form

where and are unknown constants. The general solution of Eq. (1.21) is given by

where , and are unknown constants.

The constants in Eq. (1.22) are determined from four boundary conditions, while the constants in Eq. (1.23) are determined from two initial conditions.

For a clamped-free or cantilever beam, the geometric boundary conditions are

and the natural boundary conditions are

where represents the bending moment and represents the shear force.

On substitution of the geometric boundary conditions at in Eq. (1.22) and its derivative, the following relations can be obtained

Hence, Eq. (1.22) becomes

On further substitution of the natural boundary conditions at in the derivatives of Eq. (1.24) yields

or

For a non-trivial solution, the determinant of the above matrix must be 0, i.e.

which gives the following characteristic equation

The above equation simplifies to

There are infinite solutions to this characteristic equation, which are given by

Thus, the mode shapes are

Since , the modal frequencies are given by

or

is mass per unit length

The mode shapes of a uniform cantilever beam are shown in Fig. 7.

Part 2 Experimental Procedure:

In order to determine the modal frequencies and mode shapes, the link is rotated using a sinusoidal input to the link via external means. When the frequency of the input coincides with either the fundamental frequency or higher frequency modes, the corresponding modes will be excited due to resonance and their mode shapes can be visually observed. Hence, the following experiment involves a frequency sweep across a range provided as input to the flexible link via the servo motor to identify the frequencies and observe the corresponding mode shapes.

  1. Mount the flexible link onto the rotary servo base.

  2. Download and open FlexLink_ExciteMode.mdl

  3. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  4. Open the scope alpha.

  5. Turn on the power supply.

  6. Ensure that the manual switch is connected to the Chirp signal input. This signal will provide a sinusoidal signal of fixed amplitude, with frequency increasing at a linear rate with time.

  7. Open the Chirp signal command block and make sure that the Initial frequency is 0.1 Hz, the target time is 0.25 s and the Frequency at target time is 0.2 Hz. This will allow the frequency sweep to take place at a reasonable rate and ensure that the relevant frequencies are covered within the span of time.

  8. Press the Connect button under Monitor & Tune and click on Start . Run the servo motor with the chirp input voltage for 60 seconds.

  9. Save the data using the format Osc_ChirpSignal into your folder.

Part 2 Analysis:

  1. Plot the measured angular deflection of the link vs. time. Using the time domain plot, perform frequency analysis using Fast Fourier Transform (FFT) [refer to the Appendix for the code] or a similar technique to identify the number of dominant frequencies and their magnitudes present in the signal.

  2. Using the system parameters provided in Table 2, determine the mass per unit length of the beam .

  3. Using Eqn. 1.26 and the values of necessary system parameters, calculate the first and second modal frequencies.

Part 3 Observation of Mode Shapes

Part 3 Theory:

Analytical expressions for the mode shapes are given in Eq 1.25.

Part 3: Experimental Procedure

  1. Open the FlexLink_ExciteMode.mdl Simulink file used in part 2.

  2. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  3. Open the scope alpha.

  4. Turn on the power supply.

  5. Connect the manual switch to the Sine wave signal input. This signal will provide a sinusoidal signal of fixed amplitude and fixed frequency.

  6. Open the Sine wave signal command block and make sure that the Amplitude is 3 and Phase is 0 rad. Enter the first modal frequency determined from Eq. 1.26 in rad/sec.

  7. Press Connect button under Monitor & Tune and Press Start . Run the servo motor with the sine wave for at least 20 seconds.

  8. Tune the frequency value by increasing or decreasing in steps of 1 rad/sec until the first mode shape is clearly visible (do this while the simulation is running).

  9. Observe the corresponding mode in the link and note down the number of nodes and their locations with respect to length of the link.

  10. Save the data using the file name Osc_Sineinput into your folder. This is the result for the first modal frequency.

  11. Repeat steps 6 to 10 for the second modal frequency determined from Eq. 1.26. Save the results for this as well (second modal frequency).

Part 3: Analysis

  1. Plot the mode shapes using Eq. (1.25) in MATLAB (plot v(x) vs x/L) and record the node locations. Plot both theoretical shape and experiment shape. For theoretical, use and from and for experimental, use two modal frequencies from FFT and to find .

  2. Record the number of nodes and their locations for each mode. Determine the locations as a ratio of the link length and compare them with the values between the theoretical and experimental mode shape plots.

Results for Report

(A) From Part 1

  1. Plot of the measured angular deflection of the link vs. time with the chosen peaks marked for each dataset, i.e., three plots corresponding to three perturbation locations. Plot as three subplots in one figure.

  2. Equations for time period of oscillation, damped frequency, undamped frequency, damping ratio, stiffness, and viscous damping coefficient.

  3. Values of logarithmic decrement and time period for each data set, along with corresponding average values. Use table B.1 to document these values.

  4. Values of the damped frequency , the natural frequency , the damping ratio , the stiffness and the viscous damping coefficient of the link computed with average values of and .

  5. Calculation of mass moment of inertia of the link ()

(B) From Part 2

  1. Plot of measured angular deflection of the link vs. time

  2. Fast Fourier Transform (FFT) plot of link deflection with dominant frequencies and their magnitudes identified (either marked on the plot or mentioned in writing).

  3. Calculation of mass per unit length of the link

  4. Calculations and values for the theoretical first and second modal frequencies (calculated using Eqn. 1.26).

  5. Compare the first dominant frequency (from FFT) with the natural frequency of the flexible link and state your observations. Explain any similarities or differences observed and the reasons behind them.

  6. Compare the first and second dominant frequencies obtained from the FFT with the corresponding calculated first and second modal frequencies (Result B.4) and explain your observation.

(C) From Part 3

  1. 1st and 2nd Mode shapes (theoretical and experimental) are plotted on the same graph with node locations marked. (plot of v(x) vs x/L)

  2. Number of nodes and their locations for each mode (theoretical and experimental). Use Table B.2 to document the values.

  3. Comparison of experimental and theoretical mode shapes/node locations and state the reason(s) for why they differ.

Table B.1 System Identification Parameters

Parameter
Dataset 1
Dataset 2
Dataset 3
Average

Table B.2 Locations of Nodes

Mode
Node Number
Location (Theoretical)
Location (Experimental)

Questions for Report

  1. Compare the damped and undamped frequencies of the link and report your observation. What does this signify with respect to the flexible link damping?

Appendix

The following code performs FFT analysis on the flexible link angle response

Final Project

This page details information about the AE 4610 Final Project

Project Overview

The purpose of this project is to introduce you to experimental controller design by allowing you to design and execute your own experiment. You will be given the unique opportunity to design all aspects of the experiment beginning-to-end. This process includes but is not limited to defining the experimental goals, fleshing out how you will achieve those experimental goals, laying out your success criteria, creating the experimental procedure, executing your experiment to acquire and process data, and presenting your findings. This project will span roughly the entire semester and will allow you the unique opportunity to design, build, implement, and test your own controllers based on what you have learned during your coursework in AE 3531 and AE 4610.

This project will include 4 mandatory technical components:

  1. System dynamics modeling

  2. Simulation

  3. Controller design and implementation

  4. Physical hardware implementation

As such, you will gather into groups of 3-5 individuals depending on the size of your section. These groups will be the same ones you perform the canned experiments with. Groups across sections will NOT be permitted.

The topic of your project will be entirely up to you! You may design your experiment around anything that your group finds interesting as long as your project contains the four technical components listed above. You will have a vast arsenal of hardware that is available for your group to use to complete your projects. Core components that will be provided include: microcontrollers, various actuators, various sensors, and an arsenal of ancillaries. For more information on this, please read the “Engineering Support Provided” and the “Equipment Provided” sections of this page. There is a small budget of $50 allocated for this project, though plenty of hardware will already be provided. You are restricted only to the sensors, actuators, and microcontrollers we provide. There is a little wiggle room with this (e.g. if you need a different type of DC Motor or Servo than what is provided, you may put that on your BOM from an approved vendor and it can be purchased). However, some sensors, actuators, and projects may be rejected if the technical team decides we will not be able to adequetely support it in the allotted time and within the scope of this course.

Note: We will be providing Arduinos as the microcontroller because of the ready availability of the Simulink Arduino support package. This minimizes the necessity for your group to do any sort of coding. You are required to use Simulink or Arduino IDE for this project--this is so the TAs can better help all groups with troubleshooting their projects.

Once you have picked a topic, your group will submit a project proposal containing the information in the “Proposal Minimum Contents” section below. Upon submission of this proposal, the feasibility of your project will be assessed by a technical team consisting of the course professor, the lab manager, and the TA assigned to your section. This technical team will give you feedback and give you advice to ensure that your project is feasible and has an appropriate level of complexity while maintaining the overarching goal of the project. Once your project has been approved by the technical review team, you will begin working on your project.

Here is an example of a project to give you better context. This is not an entire project proposal but is more so to give you a better understanding of what your project may entail

  • Goal: I am interested in creating a controller for adaptive cruise control that will keep a car exactly 5 feet away from a moving wall. This will be a 1 DOF problem.

  • Controller Selection and Specifications: I decide to try to design a PID controller to achieve this goal. I will need to ensure that the controller design specifications needed to achieve the goal I want will allow me to implement a PID controller. If not, the controller type or experimental goals may need to change.

  • System Dynamics Modeling: I will need to model the physics-based system dynamics of applying torque to the wheels of the car to move it in the direction I want at the speed and acceleration I want.

  • Simulation: I will need to create a simulation of this system using the dynamics model I created. I decide to do this using Simulink.

  • Controller Design: I will need to design a [PID] controller that will effectively control my car to achieve the design specifications and overarching goals laid out. I decide to do this using Simulink. The controller type may need to change during this step, though my guess is a PID will work.

  • Hardware Implementation: I will need to design a hardware system to prove that my controller works. In this case, I decide to use an Arduino Uno, a linear position sensor, and a DC motor to turn the wheels of the car among various ancillaries.

  • Success Criteria: The distance error should be less than 3 inches at all times

Please know that this project is to be within the scope of this course—we are not expecting you to be doing experimentation worthy of journal articles! From a course perspective, we want you to gain good exposure to designing and implementing controllers, working with hardware, and understanding and developing the experimental process through your own expertise, though your TAs and course instructor will be available to help you. As such, please be aware of the following:

  • This project will be limited to 1 Degree of Freedom

  • Project pivots are permitted provided you are working hard towards your goals (TAs will be watching!). Trying, failing, and pivoting is permitted!

  • However, you MUST have presentable data and results at the end of the semester--pivot wisely and use your TAs!

  • All 4 mandatory technical components of the project must be accomplished

Project Proposal Minimum Contents

In order for us to fully assess the feasibility and support needs for your experiment, your proposal needs to be accurately and thoroughly communicated. As such, ensure it includes the following contents at a minimum. An example project proposal and a proposal template are provided at the end of this section to aid you in creating your proposals. Include:

  • Your section number and a list of group members

  • A short summary of what the over-arching goal of your experiment is (3-5 sentences)

  • What control specifications and requirements you are trying to achieve (success criteria)?

  • What type of controller you are planning on designing and implementing (PD, PID, etc.)?

  • What is your control signal and your control variable and how do you plan to measure them? (Hint: run this by your TAs)

  • A Bill of Materials using the form provided:

    • Fill this out only ONE time per group!!!

  • A GTAE Responsible Itemized Bill of Materials for all items you will use from the (instrumentation/hardware/sensors/tools) including information on:

    • Item descriptions

    • Quantity of each item you will use

    • Note: It is best to do this in table format

  • A Team Responsible Itemized Bill of Materials for all parts you will need to supply outside of the GTAE provided equipment including information on:

    • Item descriptions

    • Quantities of each item

    • Unit Costs of each item

    • Extended costs (unit cost * quantity) of each item

    • The vendor name with a hyperlink to the specific URL for each item

      • GTAE can only buy from the four vendors listed

      • You may purchase items from elsewhere but the team must purchase these themselves without GTAE financial support

    • Total cost of order

      • Remember your budget is $50

      • We do not pay sales tax

    • Note: It is best to do this in table format

  • Will you need LTWT or IFL access?

    • Training is required for this!

  • A short description of how your project covers the 4 mandatory technical components (1 sentence for each)

    • System Dynamics Modeling – Physics-based, System ID, etc.

    • Simulation – Not limited to Simulink. You may use any software you are comfortable with

    • Controller Design and Implementation

    • Physical Hardware – microcontrollers, actuators, sensors, etc.

  • List any software you will need outside of Simulink and Arduino IDE

  • What data you will be collecting and how you will process/reduce the data (if applicable)?

  • A high-level timeline outlining modeling, simulation, fabrication, testing, data processing, etc.

  • Note on your proposal if you will need to use the AE Machine Shop

    • Note: you MUST be machine shop trained to use the AE Machine Shop!

You are NOT free to format the above information according to your judgement. You must follow the format provided. Keep it short and to the point. Only the bare minimum to communicate the above in a readable fashion is required; bullet points and tables should cover most of it.

Write your proposal with the notion in mind that whoever is reading it has absolutely no idea what your project will be about and is reading it for the first time. After reading, they should be able to understand your project scope at a high level.

Below is an example proposal in pdf format:

Below is an example proposal in docx format. You may use this as a template to create your own.

Engineering Support Provided

Prior to proposal sign-off, each group's initial proposal will be reviewed by a technical review team including the Lab Manager, an assigned TA who will remain with you throughout the rest of the semester, and the course professor. Teams will have continued access to their assigned TAs for assistance during assigned lab times and, to a limited degree, other times throughout the week.

Within GT-AE, the and its mentors are available to you. If any of your group have completed Machine Shop training, you also have access to the machines therein. DO NOT USE THE MACHINE SHOP IF YOU ARE NOT TRAINED TO DO SO. The Machine Shop machinists SHOULD NOT BE APPROACHED FOR INDIVIDUAL HELP.

Outside of GT-AE, GT's other maker spaces are also available for your use, for example the and .

Finally, if your test plan requires something that will be useful to future 4610 semesters, GT-AE *may* provide engineering and financial support for these. Any such item should be proposed to the technical review team, but there is no implied guarantee of such support.

In all cases, please remember that all resources outside of your section are subject to real-life constraints and are not solely dedicated to your project. As such, there is no implied guarantee that any of these resources are available to you when and how you need them. Where possible, we recommend that you aim to be as self-sufficient as possible, to maximize your chance of success.

Lab Spaces Available

There are various shared laboratory spaces available for you to use within the AE department. All of these spaces require special training to gain buzzcard access and they will need to be booked ahead of time. Furthermore, you will need a laboratory-trained individual to be with you during operation of any equipment or testing of any kind in these spaces.

If you feel you must use one of these spaces for your project, reach out to your TA and tell them why you believe you will need to use the space. Your TA will reach out to the Lab Manager who will assess your need to use the space. If they deem it necessary for your project, one of the following will happen:

  1. A member (or members) of your group will be trained on how to use the lab space. That member will then gain buzzcard and calendar booking access for you to book the space and use for your project. The trained member(s) MUST be present during all usage of the space.

  2. Your TA will be trained on how to use the lab space. If this happens, your TA MUST be present during all usage of the space.

If you feel you can do your project without utilizing these spaces, that is completely fine. These spaces are not required to be used but are rather there in case you need to use them. The recommendation is to use spaces outside of these areas so as to decrease your own commitments and constraints.

Below is the list of shared laboratory spaces that are available for you:

  • Structures Laboratory

Equipment Provided and Supplementary Budget

Equipment Provided by GTAE

This section provides a list of hardware provided by GTAE that is available for you to borrow. Some items are limited in quantity so your borrowing of this hardware is subject to availability.

!! YOU ARE RESTRICTED TO THE GTAE PROVIDED MICROCONTROLLERS, SENSORS, AND ACTUATORS THAT ARE LISTED BELOW !!

Microcontrollers:

  • Arduino Uno Rev3 SMD

  • Arduino Nano 33 IOT

  • Arduino Due

Sensors:

  • Adafruit 9-DOF Orientation IMU

    • Accelerometer, Magnetometer, 3 axis sensor evaluation board, gyroscope

  • Rotary Position:

    • 2W 10k-Ohm 10 turn potentiometer

    • Magnetic rotary position encoder with magnets

    • Normal potentiometer (300 degrees)

  • Linear Position:

    • 30-1000m time of flight distance sensor

    • 75 mm 10k-Ohm slide potentiometer

    • 10-250 cm ultrasonic sonar distance sensor

  • Microphone: 20Hz-20kHz microphone

  • 12" Liquid Level Sensor

Actuators:

  • Servos:

    • 9g micro servo

    • 55g servo

    • 20kg large servo

  • Stepper motor (small, medium, large) and Drivers

  • DC Motors:

    • 200 rpm small DC motor

    • 1000 rpm large DC motor

    • Brushless DC motor

  • Motor Shield for Arduino Uno

  • Relays:

    • MCU controlled AC relay

    • 30v 10a DC Relay

  • Fans:

    • 120mm PWM PC cooling fan

  • Submersible Water Pumps (small and large)

Ancillaries--an assortment of:

  • Wheels

  • Breadboard and Protoboards

  • Bare Wires

  • Jumper Wires (M-M, F-M, F-F)

  • Switches and Buttons

  • Resistors and Capacitors

  • LEDs

  • Power supplies

    • 5V 5A

    • 12V 5A

    • Variable voltage 45W

  • Servo cables

Tools:

  • Digital multimeters

  • General tools

  • General electronics tools

  • Heat shrink and heat gun

General Consumables

  • Adhesives (JB Weld, Kwikweld, Super Glue, Wood Glue, All-Purpose Glue)

  • Tape (Gorilla, Duct, Scotch, Packaging, Aluminum HVAC, Masking, Painters, Electrical)

Supplementary Budget

Each team will be allotted a $50 budget per group in case there is supplementary hardware you need in order to do your projects. Supplementary hardware must be approved by the lab manager before being purchased and MUST be on the hardware sign-out form. The $50 budget can only be spent at the following locations:

  • McMaster-Carr

  • Home Depot (Midtown Location Only) -- make sure it is in stock

  • Adafruit

  • Sparkfun

  • Amazon -- keep in mind some items are organization restricted and therefore cannot be ordered!

!! REMEMBER CORE HARDWARE (MCU, ACTUATORS, SENSORS) CANNOT BE PURCHASED WITH THIS SUPPLEMENTAL BUDGET !!

You may purchase supplemental items for your projects from other locations if you wish but you must provide these items yourselves. GTAE will not financially support supplementary budgets over $50 or items purchased from vendors outside of those listed above without expressed approval from the lab manager.

This financial support will come in the form of a one-time purchase in the days after the final project proposal and BOM list is finalized. All items on your BOM list will be picked up in person by GTAE staff once and once only; it is on you to make sure your items are verified as in stock at the aforementioned locations. Items will be made available for pickup at the same time for all sections. An announcement will be made when items are available for pick-up. Any funds not used during this one-time purchase will be forever lost, so use it wisely. You will not be charged for sales tax. Purchases from other vendors or after this one-time purchase are permitted, but no funds or purchasing support for these items will be provided--you must purchase these yourselves.

General Consumables Available

In addition to discretionary funds for each section, GTAE also provides certain raw materials via the Aero Maker Space. The exact list of raw materials should be checked each semester with the AMS directly, but typically includes 3D printer filament, solder, various bits of plastic and wood, and lots of consumables.

GTAE will also provide any consumables that benefit AE4610 as a whole. All provided consumables are outlined in the section above under General Consumables. Note that general consumables are provided for typical small amounts of use. If you need a gallon of epoxy to mold something, that is not a typical small use! In this case, you must include epoxy in your "Team Responsible BOM" using the form and add the cost of this item to your total costs. We will make general consumables available to you in a common location for use (ESM G2) during the rest of the semester. You must still include small amount consumables provided by GTAE in your GTAE Responsible BOM list! This is to ensure enough of everything gets purchased.

https://forms.office.com/r/xRGb346nJC
GTAE provided equipment
here
148KB
AE4610_ExampleProposal_Fall2024.pdf
pdf
18KB
AE4610_ExampleProposal_Fall2024.docx
Aero Maker Space
Invention Studio
Hive Makerspace
Indoor Flight Lab
Low Turbulence Wind Tunnel
Equipment Provided by GTAE
mdm_dmd​
rdr_drd​
JdJ_dJd​
JxJ_xJx​
JyJ_yJy​
JzJ_zJz​
ktk_tkt​
kt,diskk_{t,disk}kt,disk​
ImaxI_{max}Imax​
τmax\tau_{max}τmax​
Ω,  ωss\Omega, \,\, \omega_{ss}Ω,ωss​
ψref=10o\psi_{ref}=10^oψref​=10o

Lab 1: Rotary Servo Base (Older Version)

Welcome to the first hands-on experiment!

The current schedule of the Lab 1 is as follow:

Location: ESM G1

Aug 29th - Sep 2nd : Integration and Modelling

Sep 12th - Sep 16th : Position Control

When submitting lab manual on Gradescope please attach rubric on first page before your cover page and clearly tag each section.

21KB
Lab 1 Rubric.docx

Copy of Lab 4: Rotary Inverted Pendulum

2 DOF AERO

τ\tauτ

1

Rotary Servo

2

Thumbscrews

3

Rotary Arm

4

Shaft Housing

5

Shaft

6

Pendulum T-Fitting

7

Pendulum Link

8

Pendulum Encoder Connector

9

Pendulum Encoder

Mass of pendulum

0.127

kg\mathrm{kg}kg​

​

Total length of pendulum

0.337

m\rm{m}m

​

Distance from pivot to center of mass

0.156

m\rm{m}m

​

Pendulum moment of intertia about center of mass

0.0012

kg⋅m2\rm{kg \cdot m^2}kg⋅m2

Pendulum viscous damping coeffi­cient as seen at the pivot axis

0.0024

N⋅m⋅s/rad\rm{N\cdot m\cdot s/rad}N⋅m⋅s/rad

​

Mass of rotary arm with two thumb screws

0.257

kg\rm{kg}kg​

Rotary arm length from pivot to tip

0.216

m\rm{m}m​

​

Rotary arm length from pivot to center of mass

0.0619

m\rm{m}m

​

Rotary arm moment of inertia about its center of mass

9.98 x 10^-4

kg⋅m2\rm{kg \cdot m^2}kg⋅m2​

​

Rotary arm viscous damping coeffi­cient as seen at the pivot axis

0.0024

N⋅m⋅s/rad\rm{N\cdot m\cdot s/rad}N⋅m⋅s/rad

​

Rotary arm moment of inertia about pivot

0.0020

kg⋅m2\rm{kg\cdot m^2}kg⋅m2

​

Pendulum encoder resolution

4096

counts/rev\rm{counts/rev}counts/rev​

θ\bm\thetaθ
LpL_pLp​
α\bm\alphaα
ddt∂L∂qi˙−∂L∂qi=Qi(1)\frac{d}{dt}\frac{\partial L}{\partial \dot{q_i}} - \frac{\partial L}{\partial q_i} = Q_i \qquad \qquad \tag{1}dtd​∂qi​˙​∂L​−∂qi​∂L​=Qi​(1)
qi\bm q_iqi​
θi\theta_iθi​
q(t)=[θ(t)α(t)]T(2)q(t) =\begin{bmatrix} \theta(t) & \alpha(t) \end{bmatrix}^T \qquad \qquad \tag{2}q(t)=[θ(t)​α(t)​]T(2)
θ(t)\theta(t)θ(t)
α(t)\alpha(t)α(t)
q˙(t)=[dθ(t)dtdα(t)dt]T(3)\dot{q}(t)=\begin{bmatrix} \displaystyle \frac{d\theta(t)}{dt} & \displaystyle\frac{d\alpha(t)}{dt} \end{bmatrix} ^T \qquad \qquad \tag{3}q˙​(t)=[dtdθ(t)​​dtdα(t)​​]T(3)
ddt∂L∂θ˙−∂L∂θ=Q1(4a)\frac{d}{dt} \frac{\partial L}{\partial \dot{\theta}} - \frac{\partial L}{\partial \theta} = Q_1 \qquad \qquad \tag{4a}dtd​∂θ˙∂L​−∂θ∂L​=Q1​(4a)
ddt∂L∂α˙−∂L∂α=Q2(4b)\frac{d}{dt}\frac{\partial L}{\partial \dot{\alpha}} - \frac{\partial L}{\partial \alpha} = Q_2 \qquad \qquad \tag{4b}dtd​∂α˙∂L​−∂α∂L​=Q2​(4b)
L=T−V(5)L = T - V \qquad \qquad \tag{5}L=T−V(5)
TTT
VVV
QiQ_iQi​
Q1=τ−Brθ˙(6a)Q_1 = \tau - B_\mathrm{r}\dot{\theta} \qquad \qquad \tag{6a}Q1​=τ−Br​θ˙(6a)
Q2=−Bpα˙(6b)Q_2 = -B_\mathrm{p}\dot{\alpha} \qquad \qquad\tag{6b}Q2​=−Bp​α˙(6b)
kmk_mkm​
VmV_mVm​
BrB_\mathrm{r}Br​
BpB_\mathrm{p}Bp​
(mpLr2+14mpLp2−14mpLp2cos⁡2(α)+Jr)θ¨−(12mpLpLrcos⁡(α))α¨+(12mpLp2sin⁡(α)cos⁡(α))θ˙α˙+(12mpLpLrsin⁡(α))α˙2=τ−Brθ˙(7)\displaystyle\left (m_pL_r^2 + \frac{1}{4}m_pL_p^2 - \frac{1}{4}m_pL_p^2 \cos^2(\alpha)+J_r \right )\ddot{\theta} - \left (\frac{1}{2}m_pL_pL_r\cos(\alpha) \right)\ddot{\alpha} \\+ \displaystyle\left(\frac{1}{2}m_pL_p^2\sin(\alpha)\cos(\alpha)\right)\dot{\theta}\dot{\alpha} + \left( \frac{1}{2}m_pL_pL_r\sin(\alpha)\right)\dot{\alpha}^2 = \tau - B_r\dot{\theta} \qquad \qquad \tag{7}(mp​Lr2​+41​mp​Lp2​−41​mp​Lp2​cos2(α)+Jr​)θ¨−(21​mp​Lp​Lr​cos(α))α¨+(21​mp​Lp2​sin(α)cos(α))θ˙α˙+(21​mp​Lp​Lr​sin(α))α˙2=τ−Br​θ˙(7)
(−12mpLpLrcos⁡(α))θ¨+(Jp+14mpLp2)α¨−(14mpLp2cos⁡(α)sin⁡(α))θ˙2−12mpLpgsin⁡(α)=−Bpα˙(8)\displaystyle{\left(-\frac{1}{2}m_pL_pL_r\cos(\alpha) \right)\ddot{\theta} + \left(J_p + \frac{1}{4}m_pL_p^2 \right) \ddot{\alpha} - \left(\frac{1}{4} m_pL_p^2\cos(\alpha)\sin(\alpha)\right)\dot{\theta}^2} \\ -\frac{1}{2} m_pL_pg\sin(\alpha) = -B_p\dot{\alpha} \qquad \qquad \tag{8}(−21​mp​Lp​Lr​cos(α))θ¨+(Jp​+41​mp​Lp2​)α¨−(41​mp​Lp2​cos(α)sin(α))θ˙2−21​mp​Lp​gsin(α)=−Bp​α˙(8)
τ=ηgKgηmkt(Vm−Kgkmθ˙)Rm(9)\tau = \displaystyle\frac{\eta_gK_g\eta_mk_t(V_m - K_gk_m\dot{\theta})}{R_m} \qquad \qquad \tag{9}τ=Rm​ηg​Kg​ηm​kt​(Vm​−Kg​km​θ˙)​(9)
z=[z1z2]Tz = \begin {bmatrix} z_1 & z_2\end {bmatrix}^Tz=[z1​​z2​​]T
z0=[ab]Tz_0 = \begin {bmatrix} a & b\end {bmatrix}^Tz0​=[a​b​]T
flin(z)=f(z0)+∂f(z)∂z1∣z=z0(z1−a)+∂f(z)∂z2∣z=z0(z2−b)f_{lin}(z) = f(z_0) + \frac{\partial f(z)}{\partial z_1}\Bigr|_{z = z_0} (z_1 - a)+\frac{\partial f(z)}{\partial z_2}\Bigr|_{z=z_0}(z_2 - b)flin​(z)=f(z0​)+∂z1​∂f(z)​​z=z0​​(z1​−a)+∂z2​∂f(z)​​z=z0​​(z2​−b)
θo=0\theta_o = 0θo​=0
αo=0\alpha_o = 0αo​=0
θ˙o=0\dot{\theta}_o = 0θ˙o​=0
α˙o=0\dot{\alpha}_o = 0α˙o​=0
θ¨o=0\ddot{\theta}_o = 0θ¨o​=0
α¨o=0\ddot{\alpha}_o = 0α¨o​=0
(Jr+mpLr2)θ¨−12mpLpLrα¨=kVm−bθ˙−Brθ˙(10)(J_r + m_pL_r^2)\ddot{\theta} - \frac{1}{2}m_pL_pL_r\ddot{\alpha} = kV_m-b\dot{\theta} - B_r\dot{\theta} \quad\quad (10)(Jr​+mp​Lr2​)θ¨−21​mp​Lp​Lr​α¨=kVm​−bθ˙−Br​θ˙(10)
kkk
k=ηgKgηmktRmk = \frac{\eta_gK_g\eta_mk_t}{R_m}k=Rm​ηg​Kg​ηm​kt​​
bbb
b=ηgKg2ηmktkmRmb = \frac{\eta_gK_g^2\eta_mk_tk_m}{R_m}b=Rm​ηg​Kg2​ηm​kt​km​​
−12mpLpLrθ¨+(Jp+14mpLp2)α¨−12mpLpgα=−Bα˙(11)-\frac{1}{2}m_pL_pL_r\ddot{\theta} + (J_p + \frac{1}{4}m_pL_p^2)\ddot{\alpha} - \frac{1}{2}m_pL_pg\alpha= -B\dot{\alpha} \quad \quad (11)−21​mp​Lp​Lr​θ¨+(Jp​+41​mp​Lp2​)α¨−21​mp​Lp​gα=−Bα˙(11)
ggg
α\alphaα
[M][θ¨α¨]+[D][θ˙α˙]+[K][θα]=[k0]Vm(12)[M]\begin{bmatrix}\ddot{\theta} \\ \ddot{\alpha} \end{bmatrix} +[D] \begin{bmatrix}\dot{\theta} \\ \dot{\alpha} \end{bmatrix} + [K] \begin{bmatrix}\theta \\ \alpha \end{bmatrix} = \begin{bmatrix}k \\ 0 \end{bmatrix}V_m \quad \quad (12)[M][θ¨α¨​]+[D][θ˙α˙​]+[K][θα​]=[k0​]Vm​(12)
MMM
DDD
KKK
[M]=[(Jr+mpLr2)−12mpLpLr−12mpLpLr(Jp+14mpLp2)][M] = \begin{bmatrix} (J_r + m_pL_r^2) & -\frac{1}{2}m_pL_pL_r \\ -\frac{1}{2}m_pL_pL_r & (J_p + \frac{1}{4}m_pL_p^2) \end{bmatrix}[M]=[(Jr​+mp​Lr2​)−21​mp​Lp​Lr​​−21​mp​Lp​Lr​(Jp​+41​mp​Lp2​)​]
[D]=[b+Br00Bp][D] = \begin{bmatrix} b+B_r & 0 \\ 0 & B_p \end{bmatrix}[D]=[b+Br​0​0Bp​​]
[K]=[000−12mpLpg][K] = \begin{bmatrix} 0 & 0 \\ 0 & -\frac{1}{2}m_pL_pg \end{bmatrix}[K]=[00​0−21​mp​Lp​g​]
xxx
yyy
uuu
x=[θαθ˙α˙]T,y=[θα]T,u=Vmx = \begin{bmatrix} \theta & \alpha & \dot{\theta} & \dot{\alpha}\end{bmatrix}^T , \quad y = \begin{bmatrix} \theta & \alpha \end{bmatrix}^T, \quad u = V_mx=[θ​α​θ˙​α˙​]T,y=[θ​α​]T,u=Vm​
x˙=Ax+Bu(13)\dot{x} = Ax + Bu \quad \quad (13)x˙=Ax+Bu(13)
y=Cx+Du(14)y = Cx + Du \quad \quad (14)y=Cx+Du(14)
AAA
BBB
CCC
DDD
A=[O2×2I2×2−[M]−1[K]−[M]−1[D]]A = \begin{bmatrix} O_{2\times2} & I_{2\times2} \\ -[M]^{-1}[K] & -[M]^{-1}[D] \end{bmatrix} A=[O2×2​−[M]−1[K]​I2×2​−[M]−1[D]​]
B=[O2×1M−1[k0]]B = \begin{bmatrix} O_{2\times1} \\ M^{-1} \begin{bmatrix} k \\0 \end{bmatrix} \end{bmatrix}B=​O2×1​M−1[k0​]​​
C=[10000100]C = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \end{bmatrix}C=[10​01​00​00​]
D=[00]D = \begin{bmatrix} 0 \\ 0 \end{bmatrix}D=[00​]
O2×2O_{2\times2}O2×2​
2×22 \times 22×2
O2×1O_{2\times1}O2×1​
2×12 \times 12×1
I2×2I_{2 \times 2} I2×2​
2×22\times22×2
AAA
BBB
ζ\zetaζ
∣α∣|\alpha|∣α∣
±20\pm 20±20
det(sI−A)=0(15)\mathrm{det}(sI - A) = 0 \qquad \qquad\tag{15}det(sI−A)=0(15)
det()\mathrm{det}()det()
sss
III
AAA
uuu
xix_ixi​
i=1...ni = 1 ... ni=1...n
T=[B AB A2B ... An−1B](16)T = [B \ AB \ A^2B \ ... \ A^{n-1}B] \qquad \qquad \tag{16}T=[B AB A2B ... An−1B](16)
rank(T)=n(17)\mathrm{rank}(T) = n \qquad \qquad \tag{17}rank(T)=n(17)
rank(T)=n(17)\mathrm{rank}(T) = n \qquad \qquad \tag{17}rank(T)=n(17)
A~=[01…0000…00⋮⋮⋱⋮⋮00…01−a1−a2…−an−1−an](18)\tilde{A} = \begin{bmatrix} 0 & 1 & \dots & 0& 0 \\ 0 & 0 & \dots & 0& 0 \\ \vdots & \vdots & \ddots & \vdots& \vdots \\ 0 & 0 & \dots & 0& 1 \\ -a_1 & -a_2 & \dots & -a_{n-1}& -a_n \end{bmatrix} \qquad \qquad \tag{18}A~=​00⋮0−a1​​10⋮0−a2​​……⋱……​00⋮0−an−1​​00⋮1−an​​​(18)
B~=[0⋮1](19)\tilde{B} = \begin{bmatrix} 0\\\vdots\\ \\1 \end{bmatrix} \qquad \qquad \tag{19}B~=​0⋮1​​(19)
a1,a2,...ana_1, a_2, ...a_na1​,a2​,...an​
sn+ansn−1+an−1sn−2+...+a2s+a1=0s^n + a_ns^{n-1} + a_{n-1}s^{n-2} + ...+a_2s + a_1 = 0 sn+an​sn−1+an−1​sn−2+...+a2​s+a1​=0
W=TT~−1(20)W = T\tilde{T}^{-1} \qquad \qquad \tag{20}W=TT~−1(20)
TTT
T~=[B~A~B~⋯A~n−1B~](21)\tilde{T} = \begin{bmatrix}\tilde{B} & \tilde{A}\tilde{B} & \cdots & \tilde{A}^{n-1}\tilde{B}\end{bmatrix} \qquad \qquad \tag{21} T~=[B~​A~B~​⋯​A~n−1B~​](21)
W−1AW=A~(22)W^{-1}AW = \tilde{A} \qquad \qquad \tag{22}W−1AW=A~(22)
W−1B=B~(23)W^{-1}B = \tilde{B} \qquad \qquad \tag{23}W−1B=B~(23)
(A,B)(A,B)(A,B)
u=−Kxu = -Kxu=−Kx
x˙=Ax+B(−Kx)=(A−BK)x(25)\dot{x} = Ax + B(-Kx) =(A - BK)x \qquad \qquad \tag{25} x˙=Ax+B(−Kx)=(A−BK)x(25)
KKK
(A,B)(A,B)(A,B)
A~\tilde{A}A~
B~\tilde{B}B~
W=TT~−1W = T\tilde{T}^{-1}W=TT~−1
K~\tilde{K}K~
A~−B~K~\tilde{A} - \tilde{B}\tilde{K}A~−B~K~
A~−B~K~=[01…0000…00⋮⋮⋱⋮⋮00…01−a1−k1~−a2−k2~…−an−1−kn−1~−an−kn~](26)\tilde{A} - \tilde{B}\tilde{K}= \begin{bmatrix} 0 & 1 & \dots & 0& 0 \\ 0 & 0 & \dots & 0& 0 \\ \vdots & \vdots & \ddots & \vdots& \vdots \\ 0 & 0 & \dots & 0& 1 \\ -a_1-\tilde{k_1} & -a_2-\tilde{k_2} & \dots & -a_{n-1}-\tilde{k_{n-1}}& -a_n -\tilde{k_n} \end{bmatrix} \qquad \qquad \tag{26}A~−B~K~=​00⋮0−a1​−k1​~​​10⋮0−a2​−k2​~​​……⋱……​00⋮0−an−1​−kn−1​~​​00⋮1−an​−kn​~​​​(26)
K=K~W−1K = \tilde{K}W^{-1}K=K~W−1
(A,B)(A,B)(A,B)
K~→K\tilde{K} \rightarrow KK~→K
(A,B)(A,B)(A,B)
A~\tilde{A}A~
B~\tilde{B}B~
KKK
>> K = acker(A,B,DP);
p1p_1p1​
p2p_2p2​
ωn\omega_nωn​
ζ\zetaζ
p1=−σ+jωd(27a)p_1 = -\sigma + j\omega_d \qquad \qquad \tag{27a} p1​=−σ+jωd​(27a)
p2=−σ−jωd(27b)p_2 = -\sigma - j\omega_d \qquad \qquad \tag{27b} p2​=−σ−jωd​(27b)
σ=ζωn\sigma = \zeta\omega_nσ=ζωn​
ωd=ωn1−ζ2\omega_d = \omega_n \sqrt{1-\zeta^2}ωd​=ωn​1−ζ2​
p3p_3p3​
p4p_4p4​
xd=[θd 0 0 0]⊺(28)x_d = [\theta_d \ 0\ 0\ 0]^ \intercal \qquad \qquad \tag{28}xd​=[θd​ 0 0 0]⊺(28)
θd\theta_dθd​
u=K(xd−x)(29)u = K(x_d - x) \qquad \qquad \tag{29}u=K(xd​−x)(29)
xd=0x_d = 0xd​=0
u=−Kxu = -Kxu=−Kx
u={K(xd−x)∣x2∣<ϵ 0otherwise(30)u = \begin{cases} K(x_d - x) & |x_2| <\epsilon \\\ 0 & \text{otherwise} \end{cases} \qquad \qquad \tag{30}u={K(xd​−x) 0​∣x2​∣<ϵotherwise​(30)
ϵ\epsilonϵ
x2x_2x2​
ϵ=10\epsilon = 10ϵ=10
∣x2∣<10|x_2| < 10∣x2​∣<10
ζ\zetaζ
ωn\omega_nωn​

wnw_nwn​ (rad/s)

3.75
4
4.25
3.75
4.25
3.75
4
4.25

ζ\zetaζ

0.65
0.65
0.65
0.7
0.7
0.75
0.75
0.75
p1p_1p1​
p2p_2p2​
AAA
BBB
CCC
DDD
ζ\zetaζ
ωn\omega_nωn​
p1p_1p1​
p2p_2p2​
KKK
θc\theta_cθc​
θ\thetaθ
α\alphaα
VmV_mVm​
θc\theta_cθc​
θ\thetaθ
α\alphaα
u(Vm)u(V_m)u(Vm​)
TTT
AAA
det(sI−A)=0\mathrm{det}(sI - A) = 0 det(sI−A)=0
A~\tilde{A}A~
B~\tilde{B}B~
A~\tilde{A}A~
B~\tilde{B}B~
T~\tilde{T}T~
WWW
A~=W−1AW\tilde{A} = W^{-1}AWA~=W−1AW
B~=W−1B\tilde{B} = W^{-1}BB~=W−1B
p1p_1p1​
p2p_2p2​
p3=−30p_3 = -30p3​=−30
p4=−40p_4 = -40p4​=−40
u=−K~xu = -\tilde{K}xu=−K~x
(A~,B~)(\tilde{A}, \tilde{B})(A~,B~)
(A~−B~K~,B~)(\tilde{A}-\tilde{B}\tilde{K}, \tilde{B})(A~−B~K~,B~)
K~\tilde{K}K~
K~\tilde{K}K~
K~\tilde{K}K~
KKK
KKK
KKK

VnomV_{\rm{nom}}Vnom​

Motor nominal input voltage

6.0 V

Motor armature resistance

2.6 Ω ± 12%

Motor armature inductance

0.18 mH

Motor current-torque constant

7.68 × 10−3 N-m/A ± 12%

Motor back-emf constant

7.68 × 10−3 V/(rad/s) ± 12%

High-gear total gear ratio

70

Motor efficiency

0.69 ± 5%

Gearbox efficiency

0.90 ± 10%

rotor Rotor moment of inertia

3.90 × 10−7 kg-m2 ± 10%

High-gear equivalent moment of inertia without external load

1.823 × 10−3 kg-m2

High-gear Equivalent viscous damping coefficient

0.015 N-m/(rad/s)

Mass of bar load

0.038 kg

Length of bar load

0.1525 m

Mass of disc load

0.04 kg

Radius of disc load

0.05 m

Maximum load mass

5 kg

Maximum input voltage frequency

50 Hz

Maximum input current

1 A

Maximum motor speed

628.3 rad/s

Table A
Table A
Table 2
Table A
19KB
Part 1.zip
archive
Table 2
Table A
Specification
Balance Control
specifications
75KB
Part 2.zip
archive
Step 4 of Designing the Balance Control experiment
Design Specifications 3 and 4
Step B.3.10
Design Specifications 3 and 4
Result A.2
poly()
Question B.1.2
specifications
Result B.1.1
Question B.1.7
Step 3 in Pole Placement Theory
Question B.1.9
Result B.1.3
Figure 1 Rotary servo base with Rotary Pendulum module
Figure 2 Rotary inverted pendulum conventions
Figure 3 Desired closed-loop pole locations
Figure 4 State-feedback control loop
Figure 5: s_rotpen_bal SIMULINK diagram used to simulate the state-feedback control
Figure 6: Balance control simulation
Figure 7. q_rotpen_bal_student SIMULINK diagram can be used to run balance controller
Figure 8. Experiment balance control response example
(Jeq+Jl)θ¨+Jlα¨+Beqθ˙=τ(1)(J_{eq} + J_l)\ddot{\theta} + J_l\ddot{\alpha} + B_{eq}\dot{\theta} = \tau \quad \quad \tag{1}(Jeq​+Jl​)θ¨+Jl​α¨+Beq​θ˙=τ(1)
Jlθ¨+Jlα¨+Blθ˙+Ksα=0(2)J_{l}\ddot{\theta} + J_l\ddot{\alpha} + B_{l}\dot{\theta} + K_s\alpha= 0 \quad \quad \tag{2} Jl​θ¨+Jl​α¨+Bl​θ˙+Ks​α=0(2)
BlB_lBl​
τ\tauτ
τ=ηgKgηmkt(Vm−Kgkmθ˙)Rm=C1Vm−C2θ˙\tau = \displaystyle\frac{\eta_gK_g\eta_mk_t(V_m - K_gk_m\dot\theta)}{R_m} = C_1V_m - C_2\dot\theta τ=Rm​ηg​Kg​ηm​kt​(Vm​−Kg​km​θ˙)​=C1​Vm​−C2​θ˙
θ¨=−(Beq+C2Jeq)θ˙+KsJeqα+C1JeqVm(3)\ddot{\theta} = -(\frac{B_{eq} + C_2}{J_eq})\dot{\theta} + \frac{K_s}{J_{eq}}\alpha + \frac{C_1}{J_{eq}}V_m \quad \quad \tag{3}θ¨=−(Je​qBeq​+C2​​)θ˙+Jeq​Ks​​α+Jeq​C1​​Vm​(3)
α¨=(Beq+C2Jeq)θ˙−Ks(Jeq+JlJeqJl)α−C1JeqVm(4){\ddot{\alpha}} = (\frac{B_{eq}+C_2}{J_{eq}}){\dot{\theta}} - K_s(\frac{J_{eq}+J_l}{J_{eq}J_l}){\alpha }- \frac{C_1}{J_{eq}}V_m \quad \quad \tag{4}α¨=(Jeq​Beq​+C2​​)θ˙−Ks​(Jeq​Jl​Jeq​+Jl​​)α−Jeq​C1​​Vm​(4)
x˙=Ax+Buy=Cx+Du\dot{x} = Ax + Bu \\ y = Cx + Dux˙=Ax+Buy=Cx+Du
x=[θ    α    θ˙    α˙]Tx=[\theta \;\; \alpha \;\; \dot{\theta} \;\; \dot{\alpha}]^Tx=[θαθ˙α˙]T
u=Vmu = V_mu=Vm​
A=[001000010KsJeq−(Beq+C2Jeq)00−Ks(Jeq+JlJeqJl)(Beq+C2Jeq)0](5)A = \begin{bmatrix} 0 &0 & 1 &0 \\ 0 &0 & 0 &1 \\ 0 &\frac{K_s}{J_{eq}} & -(\frac{B_{eq}+C_2}{J_{eq}}) &0 \\ 0 &-K_s(\frac{J_{eq}+J_l}{J_{eq}J_l}) & (\frac{B_{eq}+C_2}{J_{eq}}) & 0 \end{bmatrix} \quad \quad \tag{5}A=​0000​00Jeq​Ks​​−Ks​(Jeq​Jl​Jeq​+Jl​​)​10−(Jeq​Beq​+C2​​)(Jeq​Beq​+C2​​)​0100​​(5)
B=[00C1Jeq−C1Jeq](6)B = \begin{bmatrix} 0 \\ 0\\ \frac{C_1}{J_{eq}} \\ -\frac{C_1}{J_{eq}} \end{bmatrix} \quad \quad \tag{6}B=​00Jeq​C1​​−Jeq​C1​​​​(6)
C=[1000010000100001 ](7)C = \begin{bmatrix} 1 & 0& 0& 0\\ 0 & 1& 0& 0\\ 0 & 0& 1& 0\\ 0 & 0& 0& 1\ \end{bmatrix} \qquad \qquad \tag{7}C=​1000​0100​0010​0001 ​​(7)
D=[0000](8)D = \begin{bmatrix} 0\\ 0 \\0 \\ 0 \end{bmatrix} \qquad \qquad \tag{8}D=​0000​​(8)
′u′'u'′u′
xix_ixi​
i=1...ni = 1 . . . ni=1...n
T=[B    AB    A2B…An−1B]T=[B \;\; AB \;\;A^2B… A^{n−1}B]T=[BABA2B…An−1B]
rank(T)=nrank(T)=nrank(T)=n
xxx
uuu
J=∫0∞(xTQx+uTRu)dt(9)J= \int_0^\infty(x^TQx+ u^TRu)dt \qquad \qquad \tag{9} J=∫0∞​(xTQx+uTRu)dt(9)
Q=QTQ = Q^TQ=QT
R=RTR = R^TR=RT
QQQ
RRR
RRR
xxx
[θ    α    θ˙    α˙]T[\theta \;\; \alpha \;\; \dot{\theta} \;\; \dot{\alpha}]^T[θαθ˙α˙]T
uuu
VmV_mVm​
u=−Kxu = −Kxu=−Kx
x˙=Ax+B(−Kx)=(A−BK)x(10)\dot{x} = Ax+B(−Kx)=(A−BK)x \quad \quad \tag{10}x˙=Ax+B(−Kx)=(A−BK)x(10)
KKK
K=[kθ    kα    kθ˙    kα˙](11)K=[k_{\theta} \;\;k_{\alpha}\;\;k_{\dot{\theta}}\;\;k_{\dot{\alpha}}] \qquad \qquad \tag{11}K=[kθ​kα​kθ˙​kα˙​](11)
VmVmVm
RRR
QQQ
RRR
QQQ
RRR
∣xi∣≤ximax⁡  i=1,2,...,n      ∣uj∣≤ujmax⁡  j=1,2,...,m|x_i| \leq x_{i_{\max}} \; i = 1, 2, ..., n \; \; \; \\ |u_j| \leq u_{j_{\max}} \; j = 1, 2, ..., m∣xi​∣≤ximax​​i=1,2,...,n∣uj​∣≤ujmax​​j=1,2,...,m
Q=diag(1ximax⁡2)    i=1,2,...,n(12)R=diag(1ujmax⁡2)    j=1,2,...,m(13)Q=\displaystyle {diag\left (\frac{1}{x_{i_{\max}}^2}\right) \; \; i = 1, 2, ..., n} \quad \quad (12) \\ R = diag\left (\frac{1}{u_{j_{\max}}^2}\right) \; \; j = 1, 2, ..., m \quad \quad (13)Q=diag(ximax​2​1​)i=1,2,...,n(12)R=diag(ujmax​2​1​)j=1,2,...,m(13)
QQQ
RRR
RRR
QQQ
QQQ
uuu
JJJ
KKK
Q=[1θmax200001αmax200001θ˙max200001α˙max2 ](14)Q = \begin{bmatrix} \frac{1}{\theta_{max}^2} & 0& 0& 0\\ 0 & \frac{1}{\alpha_{max}^2}& 0& 0\\ 0 & 0& \frac{1}{\dot{\theta}_{max}^2}& 0\\ 0 & 0& 0& \frac{1}{\dot{\alpha}_{max}^2}\ \end{bmatrix} \qquad \qquad \tag{14}Q=​θmax2​1​000​0αmax2​1​00​00θ˙max2​1​0​000α˙max2​1​ ​​(14)
R=1Vm,max2(15)R = \frac{1}{V^2_{m, max}} \quad \quad (15)R=Vm,max2​1​(15)
QQQ
RRR
J=∫0∞(qθθ2+qαα2+qθ˙θ˙2+qα˙α˙2+RVm2)dt(16)J= ∫_0^\infty (q_{θ}\theta^2+q_{α}\alpha^2+ q_{\dot{θ}}{\dot{\theta}}^2+q_{\dot{α}}{\dot{\alpha}}^2+RV_m^2)dt \quad \quad \tag{16}J=∫0∞​(qθ​θ2+qα​α2+qθ˙​θ˙2+qα˙​α˙2+RVm2​)dt(16)
qθ=1θmax2q_\theta= \displaystyle\frac{1}{\theta_{max}^2}qθ​=θmax2​1​
qα=1αmax2q_\alpha= \displaystyle\frac{1}{\alpha_{max}^2}qα​=αmax2​1​
qθ˙=1θ˙max2q_{\dot{\theta}}= \displaystyle\frac{1}{\dot{\theta}_{max}^2}qθ˙​=θ˙max2​1​
qα˙=1α˙2q_{\dot{\alpha}}= \displaystyle\frac{1}{\dot{\alpha}^2}qα˙​=α˙21​
R=1Vm,max2R=\displaystyle\frac{1}{V_{m,max}^2}R=Vm,max2​1​
qiq_iqi​
VmV_mVm​
xix_ixi​
kik_iki​
qθq_{\theta}qθ​
kθk_{\theta}kθ​
θ\thetaθ
qiq_iqi​
kik_i ki​
RRR
VVV
JJJ
KKK
θdθ_dθd​
xxx
KKK
CCC
4×44×44×4
DDD
4×14×14×1
xd=[θd    0    0    0]Tx_d=[θ_d \;\; 0\;\; 0\;\;0]^Txd​=[θd​000]T
u=K(xd−x)u=K(x_d−x)u=K(xd​−x)
30°30°30°
ts≤0.5s t_s≤0.5sts​≤0.5s
PO≤5%PO≤5 \% PO≤5%
∣α∣max≤10°|α|_{max}≤10°∣α∣max​≤10°
∣Vm∣max≤10V |V_{m}|_{max}≤10 V∣Vm​∣max​≤10V
AAA
BBB
QQQ
RRR
0.05rad≤∣θmax∣≤0.1rad            ∣αmax∣≃0.1rad0.05 rad ≤|θ_{max}|≤0.1 rad \;\;\;\;\;\; |α_{max}|\simeq0.1 rad 0.05rad≤∣θmax​∣≤0.1rad∣αmax​∣≃0.1rad
∣θ˙max∣≃1rad/s            0.4rad/s≤∣α˙max∣≤0.6rad/s ∣\dot{θ}_{max}∣\simeq1rad/s \;\;\;\; \; \; 0.4rad/s≤|\dot{α}_{max}|≤0.6rad/s ∣θ˙max​∣≃1rad/s0.4rad/s≤∣α˙max​∣≤0.6rad/s
0.8V≤∣Vm,max∣≤1.2V0.8 V ≤ |V_{m,max}|≤1.2 V0.8V≤∣Vm,max​∣≤1.2V
Q≥0Q \ge 0Q≥0
R>0R > 0R>0
KKK
KKK
KKK
SSS
AAA
BBB
KKK
30°30\degree30°
θ\thetaθ
α\alphaα
VmV_mVm​
QQQ
RRR
θ\thetaθ
α\alphaα
VmV_mVm​
θ\thetaθ
θ˙\dot{\theta}θ˙
KKK
θ\thetaθ
α\alphaα
VmV_mVm​
θ\thetaθ
32KB
q_flex.zip
archive
Figure 1. State-feedback Control Loop (Note:CCC is4×44×44×4 identity matrix andDDD is4×14×14×1 column of zeros.)
AAA
Jpα¨−12mpgLpsin⁡α=12mpLpAcos⁡α(31)J_p \ddot{\alpha} - \frac{1}{2}m_pgL_p\sin{\alpha} = \frac{1}{2}m_pL_pA\cos{\alpha} \quad \quad (31)Jp​α¨−21​mp​gLp​sinα=21​mp​Lp​Acosα(31)
AAA
τ=mrLrA(32)\tau = m_rL_rA \quad \quad (32)τ=mr​Lr​A(32)
V(x)V(x)V(x)
V(x)>0∀ x≠0(33)V(x) > 0 \qquad \forall~x \neq 0 \quad \quad (33) V(x)>0∀ x=0(33)
V˙(x)<0∀ x≠0(34)\dot{V}(x) < 0 \qquad \forall~x \neq 0 \quad \quad (34) V˙(x)<0∀ x=0(34)
EEE
ErE_rEr​
V=12(E−Er)2(35)V = \frac{1}{2}\left( E-E_r \right )^2 \quad \quad (35)V=21​(E−Er​)2(35)
EEE
EKEE_{KE}EKE​
EPEE_{PE}EPE​
EKE=12Jpα˙2(36)E_{KE} = \frac{1}{2}J_p{\dot{\alpha}}^2 \quad \quad (36)EKE​=21​Jp​α˙2(36)
EPE=12mpgLp(cos⁡α+1)(37)E_{PE} = \frac{1}{2}m_pgL_p(\cos{\alpha} +1) \quad \quad (37)EPE​=21​mp​gLp​(cosα+1)(37)
E=EKE+EPE=12Jpα˙2+12mpgLp(cos⁡α+1)(38)E = E_{KE} + E_{PE} = \frac{1}{2}J_p{\dot{\alpha}}^2 + \frac{1}{2}m_pgL_p(\cos{\alpha} +1) \quad \quad (38)E=EKE​+EPE​=21​Jp​α˙2+21​mp​gLp​(cosα+1)(38)
Er=mpLpg(39)E_r = m_pL_pg \quad \quad (39)Er​=mp​Lp​g(39)
V˙=(E−Er)E˙(40)\dot{V} = \left( E-E_r \right ) \dot{E} \quad \quad (40)V˙=(E−Er​)E˙(40)
E˙=α˙(Jpα¨−12mpLpgsin⁡α)(41)\dot{E} = \dot{\alpha}\left( J_p \ddot{\alpha} - \frac{1}{2}m_pL_pg\sin{\alpha} \right ) \quad \quad (41)E˙=α˙(Jp​α¨−21​mp​Lp​gsinα)(41)
E˙=12mpLpAα˙cos⁡α(42)\dot{E} = \frac{1}{2}m_pL_pA\dot{\alpha}\cos{\alpha} \quad \quad (42)E˙=21​mp​Lp​Aα˙cosα(42)
V˙=(E−Er)E˙=12mpLp(E−Er)Aα˙cos⁡α(43)\dot{V} = \left( E - E_r \right) \dot{E} = \frac{1}{2}m_pL_p \left( E - E_r \right)A \dot{\alpha}\cos{\alpha} \quad \quad (43)V˙=(E−Er​)E˙=21​mp​Lp​(E−Er​)Aα˙cosα(43)
AAA
V˙<0\dot{V}<0V˙<0
AAA
A=−(E−Er)α˙cos⁡α(44)A = -\left( E - E_r \right) \dot{\alpha}\cos{\alpha} \quad \quad (44)A=−(E−Er​)α˙cosα(44)
V˙=−12mpLp[(E−Er)α˙cos⁡α]2(45)\dot{V} = -\frac{1}{2}m_pL_p \left [ \left( E - E_r \right) \dot{\alpha}\cos{\alpha} \right ]^2 \quad \quad (45)V˙=−21​mp​Lp​[(E−Er​)α˙cosα]2(45)
V˙<0\dot{V}<0V˙<0
EEE
ErE_rEr​
90∘<α<270∘90^{\circ}<\alpha<270^{\circ}90∘<α<270∘
α˙<0\dot{\alpha}<0α˙<0
A=−Amaxsign[(E−Er)α˙cos⁡α](46)A = -A_{\text{max}}\text{sign}\left [ \left( E - E_r \right) \dot{\alpha}\cos{\alpha} \right ] \quad \quad (46)A=−Amax​sign[(E−Er​)α˙cosα](46)
A=−satA,max(μ(E−Er)sign(α˙cos⁡α))(47)A = -\text{sat}_{A, \text{max}}(\mu \left( E-E_r \right ) \text{sign}(\dot{\alpha}\cos{\alpha})) \quad \quad (47)A=−satA,max​(μ(E−Er​)sign(α˙cosα))(47)
μ\muμ
τ=mrLrA(48)\tau = m_rL_rA \quad \quad (48)τ=mr​Lr​A(48)
τ=ηgKgηmktRm(Vm−Kgkmθ˙)(49)\tau = \frac{\eta_gK_g\eta_mk_t}{R_m}\left( V_m - K_gk_m\dot{\theta} \right ) \quad \quad (49)τ=Rm​ηg​Kg​ηm​kt​​(Vm​−Kg​km​θ˙)(49)
Vm=RmmrLrAηgKgηmkt+Kgkmθ˙(50)V_m = \frac{R_mm_rL_rA}{\eta_gK_g\eta_mk_t} + K_gk_m\dot{\theta} \quad \quad (50)Vm​=ηg​Kg​ηm​kt​Rm​mr​Lr​A​+Kg​km​θ˙(50)
A=−satA,max(μ(E−Er)sign(α˙cos⁡α))A = -\text{sat}_{A, \text{max}}(\mu \left( E-E_r \right ) \text{sign}(\dot{\alpha}\cos{\alpha}))A=−satA,max​(μ(E−Er​)sign(α˙cosα))
Vm={K(xd−x),if ∣α∣<ϵRmmrLrAηgKgηmkt+Kgkmθ˙,otherwise(51)V_m = \begin{cases} K(x_d - x), & \text{if}\ |\alpha| < \epsilon \\ \displaystyle \frac{R_mm_rL_rA}{\eta_gK_g\eta_mk_t} + K_gk_m\dot{\theta}, & \text{otherwise} \end{cases} \quad \quad (51)Vm​=⎩⎨⎧​K(xd​−x),ηg​Kg​ηm​kt​Rm​mr​Lr​A​+Kg​km​θ˙,​if ∣α∣<ϵotherwise​(51)
A=−satA,max(μ(E−Er)sign(α˙cos⁡α))A = -\text{sat}_{A, \text{max}}(\mu \left( E-E_r \right ) \text{sign}(\dot{\alpha}\cos{\alpha}))A=−satA,max​(μ(E−Er​)sign(α˙cosα))
ϵ\epsilonϵ
α\alphaα
μ\muμ
Figure 9. Force vector diagram
θ\thetaθ
Vm>0V_m>0Vm​>0

No.

Component

1

SRV02 Plant (Servo motor)

2

FLEXGAGE Module

3

FLEXGAGE Link

4

Strain Gauge

5

Strain Gauge Circuit

6

Thumbscrews

7

Sensor Connector

8

OFFSET Potentiometer

9

GAIN Potentiometer

LlL_lLl​
mlm_lml​
JlJ_lJl​
α\alphaα
VmV_mVm​
τ\tauτ
τ=ηgKgηmkt(Vm−Kgkmθ˙)Rm=C1Vm−C2θ˙(1.1)\tau=\displaystyle{\frac{\eta_g K_g\eta_mk_t(V_m-K_gk_m\dot{\theta})}{R_m}}=C_1V_m-C_2\dot{\theta} \qquad \qquad \qquad\tag{1.1}τ=Rm​ηg​Kg​ηm​kt​(Vm​−Kg​km​θ˙)​=C1​Vm​−C2​θ˙(1.1)
BeqB_{\rm eq}Beq​
JeqJ_{\rm eq}Jeq​
BlB_lBl​
KsK_sKs​
JlJ_lJl​

mlm_lml​

Mass of flexible link

0.065 kg0.065\ \mathrm{kg}0.065 kg

LlL_lLl​

Length of flexible link

0.419 m0.419 \ \mathrm{m}0.419 m

blb_lbl​

Width or breadth of flexible link

2.083×10−2 m2.083\times10^{-2} \ \mathrm{m}2.083×10−2 m

hlh_lhl​

Thickness of flexible link

8.128×10−4 m8.128\times10^{-4}\ \mathrm{m}8.128×10−4 m

EEE

Young’s modulus of flexible link

200 GPa 200 \ \mathrm{GPa}200 GPa

III

Area moment of inertia of link cross-section

9.32×10−13 m49.32\times10^{-13} \ \mathrm{m^{4}}9.32×10−13 m4

BeqB_{\rm eq}Beq​

High-gear viscous damping coefficient of SRV02

0.015 N.m/(rad/s)0.015\ \mathrm{N.m/(rad/s)}0.015 N.m/(rad/s)

JeqJ_{\rm eq}Jeq​

Equivalent high-gear moment of inertia of SRV02 (no load)

0.00208 kg.m−20.00208 \ \mathrm{kg.m^{-2}}0.00208 kg.m−2

RmR_mRm​

Motor armature resistance

2.6 Ω2.6 \ \mathrm{\Omega}2.6 Ω

ktk_tkt​

Motor torque constant

7.68×10−3 N.m7.68\times10^{-3}\ \mathrm{N.m}7.68×10−3 N.m

ηm\eta_mηm​

Motor efficiency

0.690.690.69

kmk_mkm​

Back-emf constant

7.68×10−3 V/(rad/s)7.68\times10^{-3}\ \mathrm{V/(rad/s)}7.68×10−3 V/(rad/s)

KgK_gKg​

High-gear total gearbox ratio

707070

ηg\eta_gηg​

Gearbox efficiency

0.900.900.90

BlB_lBl​

Viscous damping coefficient of flexible link

Determined from experiment

JlJ_lJl​

Moment of inertia of flexible link about pivoted end This is an inline equation: (13mlLl2 \frac{1}{3} m_l L_l^231​ml​Ll2​)

To be calculated

KsK_sKs​

Stiffness of flexible link

Determined from experiment

mmm

Mass per unit length of flexible link (mlLl\frac{m_l}{L_l} Ll​ml​​)

To be calculated

JeqJ_{\rm eq}Jeq​
JlJ_lJl​
JeqJ_{\rm eq}Jeq​
JlJ_lJl​
Jeqθ¨+Beqθ˙−Blα˙−Ksα=τ(1.2)J_{\rm eq}\ddot{\theta}+B_{\rm eq}\dot{\theta}-B_l\dot{\alpha}-K_s\alpha=\tau \qquad \qquad \qquad \tag{1.2}Jeq​θ¨+Beq​θ˙−Bl​α˙−Ks​α=τ(1.2)
Jlθ¨+Jlα¨+Blα˙+Ksα=0(1.3)J_l\ddot{\theta}+J_l\ddot{\alpha}+B_l\dot{\alpha}+K_s\alpha=0 \qquad \qquad \qquad \tag{1.3}Jl​θ¨+Jl​α¨+Bl​α˙+Ks​α=0(1.3)
Bla˙+KsαB_l\dot{a}+K_s\alphaBl​a˙+Ks​α
(Jeq+Jl)θ¨+Jlα¨+Beqθ˙=τ(1.4)(J_{\rm eq}+J_l)\ddot{\theta}+J_l\ddot{\alpha}+B_{\rm eq}\dot{\theta}=\tau \qquad \qquad \qquad \tag{1.4}(Jeq​+Jl​)θ¨+Jl​α¨+Beq​θ˙=τ(1.4)
Jlα¨+Jlθ¨+Blα˙+Ksα=0(1.5)J_l\ddot{\alpha}+J_l\ddot{\theta}+B_l\dot{\alpha}+K_s\alpha=0 \qquad \qquad \qquad \tag{1.5}Jl​α¨+Jl​θ¨+Bl​α˙+Ks​α=0(1.5)
θ{\theta}θ
α{\alpha}α
θ¨\ddot{\theta}θ¨
θ\thetaθ
Jlα¨+Blα˙+Ksα=0(1.6)J_l\ddot{\alpha}+B_l\dot{\alpha}+K_s\alpha=0 \qquad \qquad \qquad \tag{1.6}Jl​α¨+Bl​α˙+Ks​α=0(1.6)
α(0)=α0\alpha(0)=\alpha_0α(0)=α0​
α˙(0)=0\dot{\alpha}(0)=0α˙(0)=0
A(s)\displaystyle{ A(s)}A(s)
α(t)\displaystyle{ \alpha(t)}α(t)
A(s)=α0Jls2+BlJls+KsJl(1.7)\displaystyle{ A(s)={\frac{\displaystyle{\frac{\alpha_0}{J_l}}}{\displaystyle{s^2+\frac{B_l}{J_l}s+\frac{K_s}{J_l}}}}} \qquad \qquad \qquad \tag{1.7}A(s)=s2+Jl​Bl​​s+Jl​Ks​​Jl​α0​​​(1.7)
α(t)\displaystyle{ \alpha(t)}α(t)
α(t)\displaystyle{ \alpha(t)}α(t)
s2+2ζωns+ωn2s^2+2\zeta\omega_ns+\omega_n^2 s2+2ζωn​s+ωn2​
ζ\zetaζ
ωn\omega_nωn​
ωn2=KsJl(1.8)\displaystyle{\omega_n^2=\frac{K_s}{J_l}} \qquad \qquad \qquad \tag{1.8}ωn2​=Jl​Ks​​(1.8)
2ζωn=BlJl(1.9)\displaystyle{2\zeta\omega_n = \frac{B_l}{J_l}} \qquad \qquad \qquad \tag{1.9}2ζωn​=Jl​Bl​​(1.9)
JlJ_lJl​
(Jl=mlLl23)\displaystyle{(J_l=\frac{m_lL_l^2}{3})}(Jl​=3ml​Ll2​​)
δ=1n−1ln⁡O1On(1.10)\displaystyle{\delta=\frac{1}{n-1}\ln{\frac{O_1}{O_n}}} \qquad \qquad \qquad \tag{1.10}δ=n−11​lnOn​O1​​(1.10)
O1O_1O1​
OnO_nOn​
O1>OnO_1>O_nO1​>On​
ζ\displaystyle{\zeta}ζ
δ \displaystyle{\delta}δ
ζ=11+(2πδ)2(1.11)\displaystyle{\zeta=\frac{1}{\sqrt{1+(\displaystyle{\frac{2\pi}{\delta})^2}}}} \qquad \qquad \qquad \tag{1.11}ζ=1+(δ2π​)2​1​(1.11)
Tosc=tn−t1n−1(1.12)\displaystyle{T_{\rm osc}=\frac{t_n-t_1}{n-1}} \qquad \qquad \qquad \tag{1.12}Tosc​=n−1tn​−t1​​(1.12)
tnt_ntn​
nthnthnth
t1t_1t1​
nnn
ωd=2πTosc(1.13)\displaystyle{\omega_d=\frac{2\pi}{T_{\rm osc}}} \qquad \qquad \qquad \tag{1.13}ωd​=Tosc​2π​(1.13)
ωn=ωd1−ζ2(1.14)\displaystyle{\omega_n=\frac{\omega_d}{\sqrt{1-\zeta^2}}} \qquad \qquad \qquad \tag{1.14}ωn​=1−ζ2​ωd​​(1.14)
δ \displaystyle{\delta}δ
Tosc\displaystyle{T_{\rm osc}}Tosc​
δ \displaystyle{\delta}δ
Tosc\displaystyle{T_{\rm osc}}Tosc​
δ \displaystyle{\delta}δ
Tosc\displaystyle{T_{\rm osc}}Tosc​
δ \displaystyle{\delta}δ
Tosc\displaystyle{T_{\rm osc}}Tosc​
Jl J_lJl​
EI∂4Y(x,t)∂x4+m∂2Y(x,t)∂t2=q(x,t)(1.15)\displaystyle{EI\frac{\mathrm{\partial}^4Y(x,t)}{\mathrm{\partial }x^4}+m\frac{\partial ^2Y(x,t)}{\partial t^2}=q(x,t)} \qquad \qquad \qquad \tag{1.15}EI∂x4∂4Y(x,t)​+m∂t2∂2Y(x,t)​=q(x,t)(1.15)
EEE
III
Y(x,t)Y(x,t)Y(x,t)
yyy
xxx
ttt
ω\omegaω
mmm
m=ρAm=\rho Am=ρA
ρ\rhoρ
AAA
xxx
qqq
α\alphaα
α=∂Y∂x(1.16)\displaystyle{\alpha=\frac{\partial Y}{\partial x}} \qquad \qquad \qquad \tag{1.16}α=∂x∂Y​(1.16)
Y(x,t)=v(x)s(t)(1.17)Y(x,t)=v(x)s(t) \qquad \qquad \qquad \tag{1.17}Y(x,t)=v(x)s(t)(1.17)
q(x,t)=0q(x,t)=0q(x,t)=0
d4v(x)dx4s(t)+v(x)mEId2s(t)dt2=0(1.18)\displaystyle{\frac{\mathrm{d}^4 v(x)}{\mathrm{d}x^4}s(t)+v(x)\frac{m}{EI}\frac{\mathrm{d}^2s(t)}{\mathrm{d}t^2}=0} \qquad \qquad \qquad \tag{1.18}dx4d4v(x)​s(t)+v(x)EIm​dt2d2s(t)​=0(1.18)
d4v(x)dx4v(x)=−mEId2s(t)dt2s(t)(1.19)\displaystyle{\frac{\displaystyle{\frac{\mathrm{d}^4 v(x)}{\mathrm{d}x^4}}}{v(x)}=-\frac{m}{EI}\frac{\displaystyle{\frac{\mathrm{d}^2s(t)}{\mathrm{d}t^2}}}{s(t)}} \qquad \qquad \qquad \tag{1.19}v(x)dx4d4v(x)​​=−EIm​s(t)dt2d2s(t)​​(1.19)
xxx
ttt
β4\beta^4β4
d4v(x)dx4−β4v(x)=0(1.20)\displaystyle{\frac{\mathrm{d}^4v(x)}{\mathrm{d}x^4}-\beta^4v(x)=0} \qquad \qquad \qquad \tag{1.20}dx4d4v(x)​−β4v(x)=0(1.20)
d2s(t)dt2+mEIβ4s(t)=0(1.21)\displaystyle{\frac{\mathrm{d}^2s(t)}{\mathrm{d}t^2}+\frac{m}{EI}\beta^4s(t)=0} \qquad \qquad \qquad \tag{1.21}dt2d2s(t)​+EIm​β4s(t)=0(1.21)
v(x)v(x)v(x)
v(x)=asin⁡(βx)+bcos⁡(βx)+csinh⁡(βx)+dcosh⁡(βx)(1.22)v(x)=a\sin(\beta x)+b\cos(\beta x)+c\sinh(\beta x)+d\cosh(\beta x) \qquad \qquad \tag{1.22}v(x)=asin(βx)+bcos(βx)+csinh(βx)+dcosh(βx)(1.22)
a,b,ca,b,ca,b,c
ddd
s(t)=gsin⁡(ωt)+hcos⁡(ωt)(1.23)s(t)=g\sin(\omega t)+h\cos(\omega t) \qquad \qquad \qquad \tag{1.23}s(t)=gsin(ωt)+hcos(ωt)(1.23)
ω=EImβ2\omega=\displaystyle{\sqrt{\frac{EI}{m}}\beta^2}ω=mEI​​β2
ggg
hh h
Y(x=0,t)=0→v(x=0)=0Y(x=0, t)=0\to v(x=0)=0Y(x=0,t)=0→v(x=0)=0
∂Y∂x∣(x=0,t)=0→dvdx∣x=0=0\displaystyle{\left.\frac{\partial Y}{\mathrm{\partial} x}\right|_{(x=0,t)}=0\to \left.\frac{\mathrm{d}v}{\mathrm{d}x}\right|_{x=0}=0}∂x∂Y​​(x=0,t)​=0→dxdv​​x=0​=0
M(x=L,t)=0→EI∂2Y∂x2∣x=L,t=0→d2vdx2∣x=L=0\displaystyle{M(x=L,t)=0\to EI\left.\frac{\partial^2Y}{\partial x^2}\right|_{x=L,t}=0\to \left.\frac{\mathrm{d}^2v}{\mathrm{d}x^2}\right|_{x=L}=0}M(x=L,t)=0→EI∂x2∂2Y​​x=L,t​=0→dx2d2v​​x=L​=0
V(x=L,t)=0→−EI∂3Y∂x3∣(x=L,t)=0→d3vdx3∣(x=L)=0\displaystyle{V(x=L,t)=0\to -EI\left.\frac{\partial^3Y}{\partial x^3}\right|_{(x=L,t)}=0\to \left.\frac{\mathrm{d}^3v}{\mathrm{d}x^3}\right|_{(x=L)}=0}V(x=L,t)=0→−EI∂x3∂3Y​​(x=L,t)​=0→dx3d3v​​(x=L)​=0
MMM
VVV
x=0x=0x=0
v(x=0)=0→d=−bv(x=0)=0\to d=-bv(x=0)=0→d=−b
dvdx∣(x=0)=0→c=−a\displaystyle{\left.\frac{\mathrm{d}v}{\mathrm{d}x}\right|_{(x=0)}=0\to c=-a}dxdv​​(x=0)​=0→c=−a
v(x)=a[sin⁡(βx)−sinh⁡(βx)]+b[cos⁡(βx)−cosh⁡(βx)](1.24)v(x)=a[\sin(\beta x)-\sinh(\beta x)]+b[\cos(\beta x)-\cosh(\beta x)] \qquad \qquad \qquad \tag{1.24}v(x)=a[sin(βx)−sinh(βx)]+b[cos(βx)−cosh(βx)](1.24)
x=Lx=Lx=L
d2vdx2∣(x=L)=0→a[sin⁡(βL)+sinh⁡(βL)]+b[cos⁡(βL)+cosh⁡(βL)]=0\left.\frac{\mathrm{d}^2v}{\mathrm{d}x^2}\right|_{(x=L)}=0\to a[\sin(\beta L)+\sinh(\beta L)]+b[\cos(\beta L)+\cosh(\beta L)]=0dx2d2v​​(x=L)​=0→a[sin(βL)+sinh(βL)]+b[cos(βL)+cosh(βL)]=0
d3vdx3∣(x=L)=0→a[cos⁡(βL)+cosh⁡(βL)]−b[sin⁡(βL)−sinh⁡(βL)]=0\displaystyle{\left.\frac{\mathrm{d}^3v}{\mathrm{d}x^3}\right|_{(x=L)}=0\to a[\cos(\beta L)+\cosh(\beta L)]-b[\sin(\beta L)-\sinh(\beta L)]=0}dx3d3v​​(x=L)​=0→a[cos(βL)+cosh(βL)]−b[sin(βL)−sinh(βL)]=0
[sin⁡(βL)+sinh⁡(βL)cos⁡(βL)+cosh⁡(βL)cos⁡(βL)+cosh⁡(βL)−sin⁡(βL)+sinh⁡(βL)][ab]=0\displaystyle{\begin{bmatrix}\sin(\beta L)+\sinh(\beta L) & \cos(\beta L)+\cosh(\beta L)\\\cos(\beta L)+\cosh(\beta L) & -\sin(\beta L)+\sinh(\beta L)\end{bmatrix} \begin{bmatrix}a\\b\end{bmatrix}=0}[sin(βL)+sinh(βL)cos(βL)+cosh(βL)​cos(βL)+cosh(βL)−sin(βL)+sinh(βL)​][ab​]=0
det[sin⁡(βL)+sinh⁡(βL)cos⁡(βL)+cosh⁡(βL)cos⁡(βL)+cosh⁡(βL)−sin⁡(βL)+sinh⁡(βL)]=0\displaystyle{\mathrm{det}\begin{bmatrix}\sin(\beta L)+\sinh(\beta L) & \cos(\beta L)+\cosh(\beta L)\\\cos(\beta L)+\cosh(\beta L) & -\sin(\beta L)+\sinh(\beta L)\end{bmatrix}=0}det[sin(βL)+sinh(βL)cos(βL)+cosh(βL)​cos(βL)+cosh(βL)−sin(βL)+sinh(βL)​]=0
[sin⁡(βL)+sinh⁡(βL)][−sin⁡(βL)+sinh⁡(βL)]−[cos⁡(βL)+cosh⁡(βL)]2=0[\sin(\beta L)+\sinh(\beta L)][-\sin(\beta L)+\sinh(\beta L)]-[\cos(\beta L)+\cosh(\beta L)]^2=0[sin(βL)+sinh(βL)][−sin(βL)+sinh(βL)]−[cos(βL)+cosh(βL)]2=0
cos⁡(βL)cosh⁡(βL)=−1\cos(\beta L)\cosh(\beta L)=-1cos(βL)cosh(βL)=−1
βiL=1.875,4.694,7.855,... ...\beta_{i} L=1.875, 4.694, 7.855,...\space...βi​L=1.875,4.694,7.855,... ...
β1,2,3,...=1.875L,4.694L,7.855L,... ...\beta_{1,2,3,...}=\frac{1.875}{L},\frac{4.694}{L}, \frac{7.855}{L},...\space...β1,2,3,...​=L1.875​,L4.694​,L7.855​,... ...
vi(x)=[cosh⁡(βix)−cos⁡(βix)]+cos⁡(βiL)+cosh⁡(βiL)sin⁡(βiL)+sinh⁡(βiL)[sin⁡(βix)−sinh⁡(βix)](1.25)\displaystyle{v_i(x)=[\cosh(\beta _ix)-\cos(\beta_ix)]+\frac{\cos(\beta_iL)+\cosh(\beta_iL)}{\sin(\beta_iL)+\sinh(\beta_iL)}[\sin(\beta_ix)-\sinh(\beta_ix)] \qquad \qquad \qquad \tag{1.25}}vi​(x)=[cosh(βi​x)−cos(βi​x)]+sin(βi​L)+sinh(βi​L)cos(βi​L)+cosh(βi​L)​[sin(βi​x)−sinh(βi​x)](1.25)
ω=EImβ2\omega = \sqrt{\frac{EI}{m}}\beta^2ω=mEI​​β2
ωi\omega_iωi​
ωi=EImβi2,  i=1,2,3,... ...(1.26)\displaystyle{\omega_i=\sqrt{\frac{EI}{m}}\beta_i^2,\space\space i=1,2,3,...\space...} \qquad \qquad \qquad \tag{1.26}ωi​=mEI​​βi2​,  i=1,2,3,... ...(1.26)
ω1=EIm(1.875L)2\omega_1=\sqrt{\frac{EI}{m}}\left(\frac{1.875}{L}\right)^2ω1​=mEI​​(L1.875​)2
ω2=EIm(4.694L)2\omega_2=\sqrt{\frac{EI}{m}}\left(\frac{4.694}{L}\right)^2ω2​=mEI​​(L4.694​)2
ω3=EIm(7.855L)2\omega_3=\sqrt{\frac{EI}{m}}\left(\frac{7.855}{L}\right)^2ω3​=mEI​​(L7.855​)2
mmm
(m)(m)(m)
β1\beta_1β1​
β2\beta_2β2​
β1,2=1.875L,4.694L\beta_{1,2}=\frac{1.875}{L},\frac{4.694}{L}β1,2​=L1.875​,L4.694​
ω=EImβ2\omega = \sqrt{\frac{EI}{m}}\beta^2ω=mEI​​β2
β1,2\beta_{1,2}β1,2​
δ \displaystyle{\delta}δ
Tosc\displaystyle{T_{\rm osc}}Tosc​
ωd\omega_dωd​
ωn\omega_nωn​
ζ\zetaζ
KsK_sKs​
BlB_lBl​
δ \displaystyle{\delta}δ
Tosc\displaystyle{T_{\rm osc}}Tosc​
JlJ_lJl​

Number of peaks selected (n)

null
null

Time of peak 1 t1t_{1}t1​(s)

null
null

Time of peak n tnt_{n}tn​(s)

null
null

Magnitude of peak 1, O1O_{1}O1​

null
null

Magnitude of peak n, OnO_{n}On​

null
null

Time period Tosc\displaystyle{T_{\rm osc}}Tosc​ (Eq 1.12)

null
null

Logarithmic decrement δ \displaystyle{\delta}δ (Eq 1.10)

null
null

First

1

First

...

First

nnn

Second

1

Second

...

Second

nnn

load data.mat %data that requires to use FFT
dT = time(2)-time(1);
Fs = 1/dT;
L = length(output_alpha)-1;
f = Fs*(0:(L/2))/L;
Ya = fft(output_alpha);
Pa2 = abs(Ya/L);
Pa1 = Pa2(1:L/2+1);
Pa1(2:end-1) = 2*Pa1(2:end-1);
% Frequency Response (FFT)
plot(f,Pa1)
xlim([0 150])
xlabel('Frequency (Hz)')
ylabel('|Amplitude {\alpha}|')
title('Single-Sided Amplitude Spectrum of \alpha')
% Angular Deflection vs. Time
figure
plot(time,output_alpha)
xlabel('Time (s)')
ylabel('Deflection Angle, \alpha (deg)')
title('Flexible Link Angle vs Time')
28KB
FlexLink_FreeOsc_Q2_USB.slx
145KB
FlexLink_ExciteMode.mdl
Image Credit: Quanser
Figure 1. Rotary Flexible Link Setup
Figure 2. FLEXGAGE coupled to SRV02
Figure 3. Strain Gauge Closeup
Figure 4. Rotary Flexible Link Angles
Figure 5. Rotary Flexible Link Model
Figure 6. Free Oscillation Response
Figure 7. Free oscillations of flexible link
Figure 7. First three mode shapes of a uniform cantilever beam.

Old Lab 1 Model Validation

Model Validation Experiment

In this experiment, you will adjust the model parameters you found in the previous experiments to tune the transfer function. Our goal is to match the simulated system response with the parameters you found as closely as possible to the response of the actual system. To create a step input:

  1. Double-click on the Signal Generator block and ensure the following parameters are set: • Wave form: square • Amplitude: 1.0 • Frequency: 0.4 • Units: Hertz

  2. Set the Amplitude (V) slider gain to 1.0 V.

  3. Set the Offset (V) block to 1.5 V.

  4. Set the Simulation stop time to 5 seconds.

  5. Open the load shaft speed scope, Speed (rad/s), and the motor input voltage scope, V_m (V).

  6. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  7. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  8. The gears on the Rotary Servo Base Unit should be rotating in the same direction and alternating between low and high speeds and the scopes should be as shown in Figure 15 a) and b). Recall that the yellow trace is the measured load shaft rate and the purple trace is the simulated trace. By default, the steady-state gain and the time constant of the transfer function used in simulation are set to: K = 1 rad/s/V and = 0.1s. These model parameters do not accurately represent the system.

  9. Save wl data and name it as modeling_section#_Group#_K1tau01.

  10. Enter the command K = 1.25 in the MATLAB Command Window.

  11. Update the parameters used by the Transfer Function block in the simulation by updating diagram in the q_servo_modeling SIMULINK diagram. To update the diagram, from the Modeling tab, click Update Model. Alternatively, press Ctrl+D. Connect and run the SIMULINK model and observe how the simulation response changes. Remember we have increased K from 1 to 1.25.

  12. Save wl data and name it as modeling_section#_Group#_K125tau01.

  13. Enter the command tau = 0.2 in the MATLAB Command Window.

  14. Update the simulation again by updating diagram. Connect and run the SIMULINK model and observe how the simulation response changes. Remember we have increased from 0.1 to 0.2.

  15. Save wl data and name it as modeling_section#_Group#_K125tau02.

  16. Calculate the nominal values, and , using Eqs. 2.1, 2.26, 2.27, 2.28 and the specifications provided in and for the high-gear configuration. Note: Eq. 2.26 must be converted to the Laplace domain to obtain the transfer function, which should be simplified to resemble Eq. 2.1. This would yield the formulae to determine and . You may also refer to the lecture slides.

  17. Enter the nominal values, and , that were found in Step 16 in the MATALB Command Window. Update the parameters and examine how well the simulated response matches the measured one.

  18. Save wl data and name it as modeling_section#_Group#_K#tau#. If the calculations of the nominal values were done properly, then the model should represent the actual system quite well. However, there are always some differences between each servo unit and, as a result, the model can always be tuned to match the system better. Try varying the model parameters (different and values) until the simulated trace matches the measured response better. Enter these tuned values under the Model Validation section of . If the model parameters are changed, save the data for the final set of tuned parameters. Note: Tuning the model parameters can be done by manually changing the Servo Model Transfer Function block parameters OR by changing the K and tau parameters in the MATLAB Command Window and going to Simulation | Update Diagram in the SIMULINK model.

Gyroscope

This manual documents the modelling of a gyroscope for which an angular position controller using gimbal torque is developed. Finally, the controller is implemented on the hardware and evaluated.

Objective

The purpose of this experiment is to design a controller that maintains the direction of a gyroscope under base excitation. The controller can also be used to rotate the gyro platform to a desired orientation using the gyroscopic principle.

Equipment Required

Part A: Modeling

The Gyroscope Model

This experiment will be performed using the Model 750 Control Gyroscope. The system, shown in Fig. 3.1, consists of an electromechanical plant and a full complement of control hardware and software. The user interface to the system is via an easy-to-use PC-based environment that supports a broad range of controller specification, trajectory generation, data acquisition and plotting features. A picture of the setup including the DSP card and input/output electronics is shown in Fig. 3.2.

Description of the Gyroscope

The gyroscope consists of a high inertia brass rotor suspended in an assembly with four angular degrees of freedom, as seen in Fig. 3.3. The rotor spin torque is provided by a rare Earth magnet type DC motor (Motor #1), whose angular position is measured by an optical encoder (Encoder #1) with a resolution of 2,000 counts per revolution. The motor drives the rotor through a 10:3 gear reduction ratio, which amplifies both the torque and encoder resolution by this factor. The first transverse gimbal assembly (body C) is driven by another rare Earth magnet motor (Motor #2) to effect motion about Axis #2. The motor drives a 6.1:1 capstan to amplify the torque between the adjoining bodies C and B. A 1000 line encoder (Encoder #2) with 4x interpolation is mounted on the motor to provide feedback of the relative position between bodies C and B with resolution of 24,400 counts per revolution.

The subsequent gimbal assembly, body B, rotates with respect to body A about Axis #3. There is no active torque applied about this axis. A brake, which is actuated via a toggle switch on the Controller box, may be used to lock the relative position between bodies A and B and hence reduce the system's degrees of freedom. The relative angle between A and B is measured by Encoder #3 with a resolution of 16,000 counts per revolution. Finally, body A rotates without actively applied torque relative to the base frame (inertial ground) along Axis #4. The Axis #4 brake is controlled similar to the Axis #3 brake and the relative angle between body A and the base frame is measured by an optical encoder (Encoder #4) with a resolution of 16,000 counts per revolution.

Inertial switches or “g-switches” are installed on bodies A, B, and C to sense any over-speed condition in the gimbal assemblies. The switches are set to actuate at 2.1 g’s. For Axis #2, limit switches and mechanical stops are provided at the safe limit of travel. When any of these normally closed switches sense a high angular rate condition, they open and thereby cause a relay to turn off power to the controller box. When this power is lost, the fail-safe brakes (power-on-to-release type) at Axes #3 and #4 engage. Also, upon loss of power, the windings of Motor #1 and #2 have shorted, thereby causing electromechanical damping. Thus, all axes are actively slowed and stopped whenever an over-speed or over-travel condition is detected.

Metal slip rings are included at each gimbal axis to allow continuous angular motion. These low noise, low friction, slip rings pass all electrical signals including those of the motors, encoder, g-switches, limit switches, and brakes to the control box.

Mathematical Model of the Gyroscope

In the configuration used in the experiment, gimbal Axis #3 is locked ( = 0), so that bodies A and B become one and the same (see Fig. 3.4). The resulting plant is useful for demonstrations of gyroscopic torque action where the position and rate, and , may be controlled by rotating gimbal #2 while the rotor is spinning. Figure 3.5 shows the coordinate system used for this model.

Basic Equations

Figure 3.5 shows the definitions of the coordinate axes used for the model development. Let (x = A, B, C and D) denote the scalar moments of inertia respectively in the bodies A, B, C, and D. Referring to Fig. 3.5, the inertia matrices are given as follows:

The basic gyroscope equation can be written as:

where is the vector of applied torque. Referring to Fig. 3.5, the components of applied torque can be written as

where and are the applied torques about Axes #1 and #2, respectively (see Fig. 3.5).

The components of the angular momentum vector and the angular velocity vector can be written as

Substituting equations 3.2, 3.3 and 3.4 into Eq. 3.1 results in the following set of nonlinear equations:

Linearized Model

In this section, we proceed to linearize the nonlinear gyroscopic equations (Eq. 3.5) by imposing certain assumptions.

Assumptions

  1. The angle of rotation of the rotor disk D about the gimbal axis 2 is small.

  2. are small, where is the spin speed of the rotor disk D (rotational speed of the rotor) which is given as 400 RPM or 41.89 rad/sec.

Upon linearization (), we further obtain the following linearized equations:

In these equations, the rotor spin dynamics (Eq. 3.6) are decoupled from those of the second and fourth gimbals (Eqs. 3.7 and 3.8). Since the rotor speed may be independently controlled, the salient dynamics become those involving motion at the gimbal locations. The gimbal angular positions and are related to and as

Taking the Laplace transform of Eqs. 3.7, 3.8 and 3.9 and eliminating and from the resulting equations results in the following transfer functions for and :

Part B: Controller Design

Control System Overview

The objective is to design a controller for regulation and control of the angular position using the gimbal torque . This mimics the following problem: Given a spacecraft with a momentum gyro, we would like to regulate and control the spacecraft attitude () using the gimbal torque () of the gyroscope. In this lab, the position of Axis #4, , is controlled by torquing the Axis #2 motor. This is accomplished here with the use of a technique known as successive loop closure. First, a rate feedback loop around is closed to damp the nutation mode of the gyroscope. Subsequently, an outer loop is closed to control . The block diagram for this process can be seen in Figure 3.6.

The equations defining the numerators and denominators in the block diagram are as follows.

Note that the and shown in Fig. 3.6 represent measurements using encoders at Axes #2 and #4, respectively. The values and represent the encoder gains for Encoders #2 and #4, respectively. Finally, is a control effort gain and is the rotational speed of the rotor in rad/sec (given above). The numerical values of various parameters are given in Tables 1 through 3 in the next page.

System Parameters

Table 1: Gyroscope Inertia Values

Table 2: Encoder Gains

Table 3: Control Effort Gains

where the number 32 is called the firmware gain. The controller firmware multiplies the encoder and commanded position signals internally by 32. This is done for increasing the numerical precision. This multiplication is not performed on the plotted data. The constants used in the transfer functions are and not .

Specifications

  1. All closed-loop poles must be in the left half of the complex plane

  2. The peak time in response to a unit step command input must be less than 0.2 sec.

  3. The 2% settling time to a unit step command input must be less than 0.5 sec.

  4. For the outer loop, must be less than 6.0 and must be less than 0.4.

Procedure

  1. Select the inner loop derivative gain to be equal to 0.08.

  2. Open a new m-file and compute the transfer function using equations (3.12) through (3.14) and Fig. 3.6. Save your m-file.

  3. Use controlSystemDesigner or rltool in MATLAB (depending on the version) and select appropriate values for and to meet the given set of specifications. If needed, readjust the value. You need to meet the requirements in controlSystemDesigner/rltool. However, you may have to change them later in SIMULINK to ensure they work. Save the controlSystemDesigner/rltool figures and your gains. Make sure to use the consistent controller architecture in the controlSystemDesigner/rltool.

  4. Develop a SIMULINK diagram of the block diagram shown in Fig. 3.6 and save it for use in part C of the experiment. Use two separate transfer functions as shown in Fig 3.6.

  5. Obtain the SIMULINK response to a unit step command using the set of gains you have selected. Assess the SIMULINK step response using stepinfo() command. If the response does not meet the design requirements, then modify the gains until it does. Save the response, and make sure it proves you meet the requirements.

  6. Individually change each of the three gains {,} in three separate runs so that only one gain is ever altered at a time. Reduce and each by 50% and reduce by 25%. Obtain simulation response to the same unit step command used in the previous step and compare it with the simulation response for the nominal case by graphing them on the same plot. Observe the effect of , and on the response behavior of the closed-loop system.

  7. The TAs will need to see: Gains, controlSystemDesigner/rltool plots, SIMULINK diagram, SIMULINK response to a step command (proving peak and settling time requirements are met), and the 3 modified responses.

You must have your work checked out by one of the TAs before leaving the lab to get credit for your work.

Part C: Controller Implementation & Evaluation

Safety Briefing

Safety Note 1: In the event of an emergency, control effort should be immediately discontinued by pressing the red “OFF” button on the front of the control box.

Safety Note 2: Stay clear of and do not touch any part of the mechanism while the rotor is moving, while a trajectory is being executed, or before the active controller has been safety checked.

Safety Note 3: The rotor should never be operated at speeds above 825 RPM. The user should take precautions to assure that this limit is not exceeded. If this accidentally happens, hit "Abort Control" in the ECP software and re-initiate rotor.

Safety Note 4: Never leave the system unattended while the ECP control box is powered on.

Experimental Setup

These steps should be performed primarily by the TA, but the students should follow along to gain a deeper understanding of how the experiment works.

Functionality Test

This test ensures if everything is sound mechanically, electrically, and in the software.

  1. Hardware checks

    1. Ensure the rotor cover panel is secure.

    2. Switch on the ECP control box and disengage Axis 3 and Axis 4 brakes.

    3. Ensure all axes can turn freely with no significant friction felt by hand.

    4. Ensure the two Axis 2 limit switches function correctly (with rotor not turning) by checking auto-shutoff occurs when manually pressing each of them. Switch the ECP control box back on.

    5. Ensure Axis 3 and Axis 4 inertial switches function correctly (with rotor not turning) by aggressively turning the appropriate axis by hand to initiate auto-shutoff. Switch the ECP control box back on.

  2. Software checks

    1. Launch E2Usr32 - Model750, the ECP CMG control software, a shortcut for which can be found on the Desktop. Alternatively, the executable can be found at C:\Program Files (x86)\ECP Systems_MV\mv

    2. If the program doesn't launch, make sure it is being executed in Windows XP SP3 compatibility mode

    3. Go to Setup > Communications > PMAC 00 - PCIO - Plug and play > Test and check that the dialog confirms successful PMAC connection. If it does not, the PCI card is likely not seated in the PC correctly. Have the TA try wiggling the ribbon cable in the back of the PC to get a good connection and re-try communication check. If nothing works, have a TA contact the Lab Manager.

    4. If Apparatus is not listed as "C.M.G. Model 750" go to Utility > Download Controller Personality File and load "gyro20.pmc" from C:/Program Files (x86)/ECP Systems_MV/mv/.

    5. Load Configuration file "default.cfg" from C:\Program Files (x86)\ECP Systems_MV\mv.

    6. Go to Utility > Reset Controller and check the following values on the main screen have been set:

      1. Encoders 1/2/3/4 Pos: 0 COUNTS

      2. Control Loop Status: OPEN

      3. Motor 1 Status: OK

      4. Motor 2 Status: OK

      5. Servo Time Limit: OK

    7. Ensure the 4 encoders are reading correctly by manually turning each axis and watching the corresponding encoder counts value change on the main screen (you may want to zero the encoders prior to this step to see it more clearly). Note that Encoder 1 is the rotor, which is hard to move by hand since it is enclosed, so aggressively rotate Axis 3 to let the rotor inertia create some encoder position change.

Orientation setting

  1. With the ECP control box powered on, all brakes off, and flywheel not turning, roughly orient the gyroscope according to Figure 3.7 (as viewed from the front such that labels are the correct way up).

  2. Apply all brakes and turn off the ECP control box.

  3. Ensure Axis 3 is parallel with the platform base by using a spirit level or phone app, making small adjustments by hand (with the brakes on).

  4. Ensure Axis 2 is perpendicular to the platform base and Axis 3 by using the spirit level app of a phone app, making small adjustments by hand (with the brakes on).

  5. It is not critical where Axis 4 is located since the controller will be doing a relative angle maneuver.

Controller Setup

Configure Data Logging

  1. Go to the Data menu and click on Setup Data Acquisition.

  2. Be sure that the selected variables to log match those below. When finished, hit OK to exit this menu.

Initialize Rotor

After these steps, the rotor will be turning, causing a potential snag hazard. Ensure a safe distance between the gyroscope and all personnel. Never touch any part of the gyroscope.

The motor must never exceed 800 RPM!

  1. Switch on the ECP control box.

  2. Brake all axes so that the accelerating rotor does not cause the axes to move from the initialized positions:

    1. Set Axis #3 and Axis #4 on the ECP control box to ON.

    2. Set Axis #2 V-Brake on the ECP software main screen to ON.

  3. Click on the Command menu and then on Initialize Rotor Speed.

  4. Being careful not to make a typo, input 400 RPM and click OK. If you do accidentally input a speed higher than intended, click Abort Control on the main screen, go back to the Initialize Rotor Speed input and input the correct RPM.

  5. Once the rotor has reached the desired RPM, release Axis 2 and Axis 4 brakes. Axis 3 should remain braked throughout the entirety of the lab.

  6. Observe gyroscopic precession and nutation in open-loop using a ruler or similar object to perturb the system about Axis #4:

    1. Apply a constant torque to Axis #4 by pushing on the outer part of the frame. You should notice that the gyro rotates about Axis #2 at a constant angular rate. Contrast this with a constant angular acceleration that would have occurred if the rotor were not turning. This is known as gyroscopic precession.

    2. Apply a momentary torque to Axis #4 by sharply jabbing the outer part of the frame. You should notice that the gyro slightly "wobbles" about Axis #2. This is known as gyroscopic nutation. In the absence of damping from friction in the bearings and air resistance due to the angular motion, this wobble would last indefinitely.

    3. Return Axis #2 to its vertical position by torquing Axis #4.

Configure Control Algorithm

  1. Go to the Setup menu and clicking on Control Algorithm.

  2. Click the Load From Disk button and select the default controller file, GyroControl_Gimbal4_PID.alg. The original file can be found at C:\AE4610-ControlsLab\Gyro_Controller but, since this version is read-only, it should be loaded from a locally saved copy on the TA's login profile.

  3. Be sure that the sample period, , is 0.00884 seconds. is located both on the control algorithm screen and in the program itself, so be sure that both values are correct.

  4. Set the and gains to the values from your controller design in Part B.

    1. Check the values with a TA before entering them.

    2. Do not input magnitude of nor .

    3. Change values by clicking the Edit Algorithm button, editing the relevant section of code, and exiting the edit algorithm section by selecting Save Changes and Quit under the File menu.

    4. Retain the sign of each gain, only changing the magnitude from your calculations in Part B; and should be positive, whereas should be negative.

  5. Enable the algorithm by clicking Implement Algorithm.

  6. Click OK, and check that the Control Loop Status now reads CLOSED on the main screen.

Controller Evaluation

With the rotor initialized and the closed-loop controller active, you will now evaluate your calculated gains in three different trajectories.

Trajectory 1: Small Step Input

  1. Select the Command menu and then Trajectory 1.

  2. Select the Step Input and then click the Setup button. Enter the following parameters for this case:

    1. Step size = 200 counts.

    2. Dwell time = 1000 ms.

    3. 1 repetition.

  3. Hit OK, then OK again to leave the setup trajectory menus.

  4. Ensure the rotor is oriented vertically using the wooden ruler.

  5. Ensure all people are at a safe distance from the gyroscope.

  6. Go to the Command menu and click Execute. Make sure that both Normal Data Sampling and Execute Trajectory 1 Only are checked.

  7. Click the Run button. The input trajectory will be run on the gyroscope now. When the box on the screen says Upload Complete, click on the OK button.

  8. Plot and review the data:

    1. Go to the Plotting menu and select Setup Plot. Set Command Position 1 and Encoder 4 Position on the left axis and Control Effort 2 on the right axis. Click OK when finished to view the plot.

    2. If desired, zooming the plot can be accomplished by going to the Plotting menu and selecting Axis Scaling.

    3. Discuss the results, particularly the quality of your controller's response and how it may be improved, with your TAs. Given enough time at the end of the lab, you may return to this trajectory and see how gain changes may improve the controller's response.

  9. Save the data by clicking on Data > Export Raw Data.

Trajectory 2: Large Step Input

  1. Repeat steps 1-8 from Trajectory 1, but this time using the following trajectory settings:

    1. Step size = 1000 counts.

    2. Dwell time = 1000 ms.

    3. 1 repetition.

  2. Save the data by clicking on Data > Export Raw Data.

Trajectory 3: Ramp Input

The step response is useful for system characterization but is seldom used for an actual in-service trajectory because it is excessively harsh (high acceleration and jerk ("rate of change of acceleration")). A more common trajectory used for tracking applications is a ramp.

  1. Repeat steps 1-8 from Trajectory 1, this time using the following trajectory settings:

    1. Ramp input (Unidirectional Moves not checked).

    2. Distance = 6000 counts.

    3. Velocity = 2000 counts/sec.

    4. Dwell Time = 1000 ms.

    5. 2 repetitions.

  2. Save the data by clicking on Data > Export Raw Data.

  3. In addition to the previous plots, plot Control Effort 2 and Encoder 2 Velocity data. (This should be done in separate plots since the scaling of these two variables is greatly different.) Note the relatively close tracking and rapid accelerations at each end of the constant velocity sections. This would not be possible for the small actuator of Axis #2 acting on the massive assembly in a conventional fashion. By using gyroscopic control actuation and the associated transfer of momentum stored in the rotor, the high authority control is made possible.

Trajectory 1 Re-Run

Only if time permits at the end of your session, go back to Trajectory 1 and see if you can improve the controller's response by manually adjusting the gains using your intuition and knowledge of individual gain effects. This task is intended only to allow you an opportunity to get a real-life feel for the effect of gain changes, it will not be graded.

Analysis & Lab Report

  • Include an overview of the controller design from Part B.

  • Using the SIMULINK block diagram you have developed of Fig. 3.6 in Part B, simulate the system response for the same step and ramp commands you have used in Part C. Compare your simulated responses with the corresponding experimental results. What is the rise time and % overshoot in the experiment and simulation responses to the step command used?

Inverted Pendulum

This manual documents the modelling of an inverted pendulum, developing a full state feedback control using LQR to balance the unstable equilibrium and evaluatin the LQR on the hardware setup.

Introduction

Proportional (Derivative) Control Determined through LQR Analysis

This experiment will demonstrate the control of a system using full state feedback, where the control system is designed using the principles of Linear Quadratic Regulator (LQR) theory. This is an analysis technique that would be seen in more detail during advanced studies. You are not required to completely understand the derivation of the method itself. However, you should understand how to formulate the required matrices (Q and R) and why the overall goal (to minimize the cost, J) leads to the requirements on those matrices, as well as the reasoning behind the formulation of the cost equation, which serves as the purpose behind the method’s derivation.

Linear Quadratic Theory (LQR)

Consider the system

where is a state vector and is a control input vector. Therefore, and are matrices of dimensions and , respectively. Let us suppose that we wish to design a state-feedback controller

such that the closed-loop system

is stable. Here is a matrix of gains of dimensions . In achieving closed-loop stability, we wish to use as little control effort as possible. We also wish to avoid large overshoot of the trajectories during the transients. One way to achieve both of these objectives is to find a control law which minimizes the following quadratic cost

where and are weighing matrices of appropriate dimensions. In order for the previous problem to make sense we must ensure that the two terms in the integral are positive. The requirement that

for all vectors is satisfied if the matrix is positive semi-definite (all its eigenvalues are greater than or equal to zero). The requirement that

for all vectors is satisfied if the matrix is positive definite (all its eigenvalues are greater than zero). This optimization problem has a closed-form solution. The optimal gain matrix is given by

where the matrix is the positive definite solution of the following Algebraic Riccati Equation (ARE):

Example of a Simple Mass/Spring/Damper System

We will demonstrate the previous LQR design using a simple mass-spring-damper system as shown in Fig. 7.2. The equation of motion is

or in state-space form

where and . Let and . The system matrices are

Choose the weighting matrices as

The Riccati equation gives

Expanding, we obtain

Solving these equations, we get

or that

Notice that the solution matrix P is positive definite. Its eigenvalues are .

The optimal gain matrix is given by

The closed-loop system matrix is

and the eigenvalues are

The closed-loop system is stable.

Control of an Inverted Pendulum

Objective

The purpose of this experiment is to design a balance control using the principles of linear quadratic regulator (LQR) theory for an inverted pendulum mechanism.

Equipment Required

Introduction

In this lab, we demonstrate a control design using modern “state-space” methods. The plant consists of an inverted pendulum on a cart. The plant has two distinct equilibrium points of which one is stable and the other is unstable. In this experiment, we will show how the plant in its unstable configuration can be controlled using a suitable controller. The methodology used to design the control law is based on the linear quadratic regulator (LQR) theory. The inverted pendulum mechanism to be used in this lab is shown in Fig. 7.3.

Mathematical Model of the Inverted Pendulum Mechanism

Consider an inverted pendulum of mass and length connected on a sliding cart of mass as shown in Fig. 7.4.

The angle is measured from the up-right position. We can apply a force to the cart through the cartwheel motors. We wish to design a controller to balance the pendulum to the upright position . Note that the problem of balancing a pendulum is akin to the problem of stabilizing a rocket during ascent.

The equations of motion for the system can be easily derived using the free-body diagrams shown in Fig. 7.6 as follows (here we assume that the track on which the cart moves without sliding):

where is the moment of inertia about the pendulum's mass center given by .

This system has two equilibria which are and .

The first equilibrium corresponds to the down position (stable) and the second equilibrium corresponds to the upright position (unstable) of the pendulum. Linearizing the previous equations about the equilibrium of interest we obtain the following equations:

The input force in the above equations can be written in terms of the input voltage applied to the motor of the cart and the cart velocity as shown below.

First, we write the motor equation as

or

where

  • : voltage applied to motor (Volts)

  • : current in motor (Amp)

  • : back EMF constant (Volt/(rad/sec))

  • : gear ratio in motor gearbox

  • : motor armature resistance (Ohms)

  • : angular velocity of the wheel (rad/sec)

  • : cart velocity (m/sec)

  • : radius of motor pinion that meshes with the track (m)

The torque generated at the output of the motor is given by

where is the motor torque constant given by

where is the conversion factor from volt-amp to N-m given by

Thus, the force transmitted to the cart via the pinion is

and on substituting the values of

we get

Letting and , the input force F can be written as

Substitution of the above expression for F in the linearized equations results in

The above set of linear differential equations is of the form , where . We seek a linear control law of the form , where is a vector of gains.

Linear Quadratic Regulator (LQR) Design

The LQR formulation provides a linear control law

which minimizes the quadratic cost given by

for some user-defined matrices and . It is assumed that is positive semi-definite (all the eigenvalues are non-negative) and is positive definite (all the eigenvalues are positive). Here is the input voltage, given by

is the state vector, and given by

is the controller gain vector. Note that the input voltage is scalar and therefore, is also scalar. In practice, the weighting matrices and are chosen to be diagonal. A simple way for choosing and is the following (Bryson's rule):

Assuming the time-domain design specifications are:

one can choose

Further tuning of and may be required for improving the controller performance. Note that increasing means increasing the penalty on the control input (using less control effort). Similarly, increasing means increasing the penalty on the states (states reaching equilibrium position quickly and with less overshoot).

The block diagram of the experimental setup in the lab is shown in Fig. 7.7.

(Note: Conventional error signal shown, but )

where is position of the cart, is velocity of the cart, is angular position of the rod from the vertical, is angular velocity of the rod, and is a vector of feedback gains .

Controller Design Procedure

  1. Obtain the A and B matrices of the system using , and .

  2. Choose and based on the following:

    Assume that:

    No constraints on and . (They can go to infinity…)

    According to Bryson’s rule, this will result in the following and matrices:

    and

  3. Using the lqr command in MATLAB, calculate the optimal feedback gain vector K. The lqr command basically solves the Algebraic Ricatti Equation that you met earlier. >> [k,s,e] = lqr(A,B,Q,R);

  4. Compute the open-loop and closed-loop eigenvalues of the system and comment on the stability of the open and closed-loop systems.

  5. Compute the natural frequencies and damping ratios of the closed-loop system.

Controller Implementation and Evaluation

CAUTION: Always be ready to stop the experiment if the cart goes unstable. This can be done either by pressing the stop button in the Simulink or turning the power off.

  1. Turn the power on.

  2. Open the MATLAB and locate the file InvPendulum_LQR.mdl under the path C:\AE4610_Controls_Lab\Inverted_Pendulum and open it. This is the block diagram for this part of the experiment.

  3. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  4. Switch the Command Signal block to 0.

  5. Enter the gains you obtained in the corresponding gain blocks.

  6. Put the cart right in the middle of the track and hold up the pendulum fixed and straight. Do not release it until the controller is on.

  7. Double click on the scopes and open then.

  8. Press Connect button under Monitor & Tune and then press Start .

  9. Gently disturb the pendulum to see the effect of the controller and then stop the simulation.

  10. Switch the command signal to step input. It should make the cart to move 20 cm to the right after 10 seconds.

  11. Save the data with a descriptive name. DO NOT SAVE THE MODEL.

  12. Turn the POWER OFF

Analysis

  • Individual: Include the results from the controller design procedure Steps 1-5.

  • Group: Build a SIMULINK block diagram using Fig. 7.7 and obtain the simulated response to the same command input used in the experiment. Compare the simulated response with the experimental response and explain any differences between them.

Average the first 5 seconds of the experimental data to obtain initial conditions for your state-space block in SIMULINK

DC Motor

This manual documents the modeling of a DC motor followed by the design and simulation of a position control system for it. Finally, the controller is implemented on the hardware and evaluated.

Objective

This laboratory experiment is designed to give the students a clear understanding of a typical DC motor control system. DC motors are used in typical flight control systems to actuate various devices (ailerons, flaps, elevator, rudder, etc). The experiment is divided into three parts:

Part A deals with modeling of a DC motor.

Part B includes the design of a position control system for the motor.

Part C involves implementation and evaluation of the controller designed in Part B.

Part A: Modeling

Any control problem consists, in general, of three main phases: The first phase is modeling/system identification, the second phase is controller design, and the third phase is controller implementation, testing and evaluation. This part of the experiment involves the first phase, namely, system identification and modeling of a DC motor. Identification of a complex system can be very challenging; however, for some systems, it may be possible to find a simple model that is suitable for control design. The objective of Part A of this experiment is to find the parameters of the reduced model for the DC motor used in the lab. This process yields a transfer function description of the DC motor system that can be used to design a controller for the DC motor.

DC Motor

A picture of the DC motor set in the lab is shown in Fig. 2.1. Figure 2.2 is a schematic of a typical DC motor. The motor is made up of a rotor and a stator. The stator windings create a magnetic field of intensity . In a permanent magnet DC motor (of the same type used in the lab) the stator is made of magnetic material and there is no field winding.

The rotor is made up of a set of armature windings and a commutator. The commutator is used to energize an individual winding when that winding is perpendicular to the stator field. That causes the magnetic field of the armature to be always perpendicular to the field of the stator. This results in maximum torque for a given armature current. In general, the motor torque is proportional to the product of field intensities

The armature field intensity is proportional to the armature current . Hence, , and since the stator field intensity is constant, it follows that

where .

When the armature winding rotates in a magnetic field, a back voltage, (back electromotive force (EMF) voltage) is generated that is proportional to the rate of change of the flux passing through the winding, and hence, it is also proportional to the rotor speed. Therefore, it follows that

A schematic of the electrical and mechanical parts of the motor are shown in Fig. 2.2.

From the electric circuit of the armature we have

For the mechanical part of the motor we have

where

  • : armature inductance

  • : armature current

  • : armature resistance

  • : back EMF voltage

  • : voltage applied to the motor

  • : total inertial (rotor and load)

  • : motor torque

  • : disturbance torque

  • : damping coefficient due to friction

  • : angular velocity of the motor

The Laplace transform of (2.2) and (2.3) yields

and

and using (2.1) we get

Combining (2.4) and (2.5) and assuming negligible disturbance torque, one obtains that

Often, L ≈ 0 and B ≈ 0. In this case, the transfer function in (2.6) simplifies to

where,

Figure 2.3 below shows a block diagram representation of the DC motor system.

It is of interest to note that is related to . This can be shown by considering the power balance in steady state. The power input to the motor is

The power delivered to the shaft is

Equating the previous two expressions yields that . (Note that the above relationship is based on the assumption that the same units are used for both and .)

The transfer function for the DC motor as derived in (2.7) and as shown in Fig. 2.3 is

where

since

The DC gain of the system is calculated by evaluating (2.8) at . Hence

Thus, we have reduced the DC motor to a first-order system as shown in Fig. 2.4. The theoretical values of the DC gain and time constant () are given by (2.9) and (2.10). The DC gain and time constant values can also be determined experimentally, as shown in the next section.

First-Order System Response to a Step Input

The DC gain and the time constant value of the DC motor can be determined by subjecting the motor to a step voltage input. Typical first-order system response to a step input is illustrated in Fig. 2.5. The DC gain is obtained by dividing the steady-state value of the output by the magnitude of the input step. Recall that from the final value theorem

The time constant is the time at which the output reaches 63.2% of its steady-state value.

Procedure

  1. With the help of the TA, check and ensure that the Quanser QUARC software is linked to MATLAB. QUARC is the MATLAB plug-in that enables communication with the hardware interface boards manufactured by Quanser.

  2. In the MATLAB directory navigation bar, go to C:\Users\Public\AE4610\DC Motor\DCMotor. Locate the file DCMotor_OL.mdl under the Current Folder section and open it. This is the block diagram for this part of the experiment.

  3. To build the model, click down arrow on Monitor & Tune under Hardware tab and then Build for monitoring . This generates the controller code in the MATLAB window. If you encounter build issues, this is usually due to file permission conflicts caused by having multiple users share the same files. To resolve this, have the TA help you create a clean installation by deleting the DC Motor folder and unzipping the backed up "DC Motor - Unzip Me For Clean Install" folder (be sure to recover any stored data in the original folder before deleting).

  4. Open the scope Theta_dot.

  5. Turn on the power supply.

  6. For the braked position of the magnetic brake (1 position), choose 3 different input voltages (< 5 volts).

  7. Press Connect button under Monitor & Tune and then press Start . Run the motor with a step input of the selected input voltage for 10 seconds.

  8. Save the data by selecting all the data in the MATLAB window, right click and select Save as, go to the folder C:\Users\Public\AE4610\DC Motor\Lab Data<Your group number> and save the motor angular velocity data with different names. For example, DCMotor_OL_Data_3V.

  9. Repeat steps 8, 9 for all the three step inputs.

  10. Run the motor for 10 seconds for sinusoidal voltage input. Select the amplitude (< 5 volts) and frequency (< 5 rad/s). Save the data.

  11. Data will be uploaded on Canvas by the TA. DO NOT DELETE THE SIMULINK MODEL. Close Simulink and DO NOT SAVE.

Analysis

  1. Plot the measured angular velocity of the DC motor vs. time for each step input. From the plot, determine the time constant and the DC gain of the DC motor as described in the above section.

  2. Average the DC gain and time constant for the three different input voltages to get a single value of the DC gain and time constant.

  3. Build a SIMULINK model that represents the DC motor model obtained experimentally (see Fig. 2.4). Use the time constant and DC gain from Step 2.

  4. Simulate the sinusoidal input used in Step #11 of the Procedure in your SIMULINK model and compare the output with the experimental angular velocity obtained in the experiment. Plot the simulated and experimental angular velocity responses on the same plot. Make sure to label each response. Explain any differences in the responses (very briefly, in a couple of sentences).

Part B: Controller Design

Objective

The objective of Part B of the DC motor experiment is to design a position control system for the motor to meet a given set of specifications.

Equipment Required

Experiment Notes

Now that we have identified the time constant and the DC gain for the system in the modeling part of this experiment, the next step is to design a position control system in order to convert the given DC motor into a position servo. A classical PID controller will be used to control the position of the motor subject to a given set of specifications, for example, bandwidth, steady-state error requirements, etc.

Recall that the transfer function of the motor from to in (2.8) is approximated as

Proportional (P) Control

Since , where is the angular position of the motor, the transfer function from the applied voltage to the motor angular position is

where DC Gain of the motor.

The block diagram of a DC motor with a proportional controller is shown in Fig. 2.6. In this case, the controller transfer function () is a simple gain . From Fig. 2.6, the closed-loop transfer function from the commanded angular position to the actual angular position is given by

Comparing the above transfer function to the standard form for a second-order system, i.e.,

we notice that the proportional gain affects the natural frequency (and hence the bandwidth) of the closed-loop system.

Proportional-plus-Derivative (PD) Control

The block diagram of a DC motor with an inner loop angular rate (i.e., derivative) feedback and an outer loop angular position error (proportional) feedback is shown in Fig. 2.7. From Fig. 2.7, the closed-loop transfer function from the commanded angular position to the actual angular position is given by

Comparing the above transfer function with the standard form for a second-order system, we notice that the derivative gain affects the damping while the proportional gain affects the natural frequency of the closed-loop system.

Proportional-plus-Integral-plus-Derivative (PID) Control

The block diagram of a DC motor with an inner loop angular rate (i.e., derivative) feedback and an outer loop angular position error plus integral of angular position error (i.e., proportional plus integral) feedback is shown in Fig. 2.8.

From Fig. 2.8, the open-loop transfer function becomes

indicating that with integral feedback, the type of the system increases from 1 to 2 and hence, results in zero steady-state error to both ramp and step command inputs.

Sampling Time

The most important difference between analog and digital control is that digital systems operate using a clock. The timing of this clock and the number of operations necessary to implement a controller place a limit on how frequently the controller can access sensors, make calculations, and modify the control inputs. (In addition, other elements of the control system themselves may introduce an additional time delay. For this reason, the sampling time of the digital system is an important parameter.) Digital controllers, in general, will have a maximum . Increasing the further will make the closed-loop system unstable.

Design Specifications

The closed-loop DC motor system must meet the following specifications.

  1. Bandwidth frequency of at least 10 rad/sec (Bandwidth is an important measure of the frequency range over which the system output follows well the command signal. It is defined as the frequency at which the magnitude ratio is -3 dB in the closed-loop system frequency response plot. Sinusoidal inputs with frequencies less than the bandwidth frequency are tracked ‘reasonably well’ by the system.)

  2. Phase margin of at least 60 deg. (Gain and phase margins are stability margins to accommodate model variations. A flight control system actuator is typically subject to varying load, resulting in model variations. Hence, it is important to design a controller with sufficient stability margins to accommodate such variations and other effects such as wear with usage.)

  3. Zero steady-state error to both step and ramp commands.

Procedure

  1. Using the model you have obtained from the prelab, input the transfer function (equation (2.11)) into MATLAB.

  2. First consider a proportional controller, i.e., C = Kp. Input C = 1 into MATLAB.

  3. Run controlSystemDesigner(G,C) (you can alternatively run rltool(G,C) for versions R2020b and older). Select ‘New Plot -> New Step’ to launch the step response plot (if it is not automatically launched). In the time response plot, only the ‘closed loop: r to y' (blue plot) should be visible. Always do this in all the labs. Select ‘New Plot -> New Bode’ and choose the appropriate option to launch the closed-loop Bode plot. In the closed-loop Bode response window, select the magnitude plot only and readjust the magnitude plot limits to -5 dB and 0 dB under properties and limits. The bandwidth frequency (defined above) can be read from the closed-loop Bode plot. It may be useful to add a grid to the bode plot.

  4. In Control System Designer or rltool, select ‘Open-loop Bode’ under ‘Tuning Methods -> Bode Editor’. The phase margin (PM) of the system can be read off the open-loop bode plot.

  5. Change the controller gain by double-clicking ‘C’ under ‘Controllers and Fixed Blocks’ or by using your cursor on the root locus and check if all the design specifications can be met using a proportional controller, which would be optimal from a design standpoint. If not, at least select a value of such that bandwidth is more than 10 rad/sec. Save the root locus, open and closed-loop Bode, and time response plot. Save the gain that you used.

  6. Consider a proportional and derivative controller. In the compensator editor window under ‘C’, add a zero around –10. Using the cursor or manually input values, adjust the zero location of the controller and readjust the proportional gain (if necessary) such that, at least, the bandwidth and phase margin specifications are met. (Note that with a PD controller for this system, the open-loop transfer function is still of Type 1. Hence, the zero steady-state error specification for ramp input cannot be met with a PD controller.) Save the root locus, open and closed-loop Bode and time response plot. The compensator transfer function in Control System Designer or rltool in this step is of the form shown below. Use it to determine the gains and . Save these gains.

    IMPORTANT: What is the difference between Fig. 2.7 and the control structure that you now have in Control System Designer or rltool? They are not identical. is multiplied by the derivative of the error signal in Control System Designer or rltool, yet it is multiplied directly by in Fig. 2.7. Why is this acceptable when dealing with a step input? Is there a way to mimic this structure exactly in Control System Designer or rltool? (If you attempt to change it, make certain you modify the rest of these instructions carefully to achieve the correct results.)

  7. Consider a PID controller. Using and values you have obtained from the previous steps, edit the compensator (i.e. add poles and zeros to match the format below) to include integral feedback with the integral gain set to a small value (i.e., is roughly 0.05). The controller transfer function for this step is

  8. Readjust the proportional and derivative gains (if necessary, by modifying the zeros, not the overall gain, ) such that bandwidth and phase margin specs are met.

  9. Save the root locus plot, open and closed-loop system Bode plots, and time response plot as graphs. Also, save your gains (you must convert from the Control System Designer or rltool compensator format, back to our conventional gain representation – , , ).

  10. Using the controller you have designed, obtain the closed-loop transfer function and save your result. (Do this in MATLAB using the transfer function variables of and , or export the closed-loop transfer function from Control System Designer or rltool(T_r2y), using the ‘Export’.) (May be listed as ‘IOTransfer_r2y’). In MATLAB, change the exported state space into a transfer function using tf(IOTransfer_r2y)

  11. Obtain poles of the closed-loop system. Compute the natural frequency and damping of the dominant poles of the closed-loop system. You can do all this from your exported transfer function using the function damp(). Save your results.

  12. Construct a SIMULINK diagram using Fig. 2.8 as a guide. However, do not use a transfer function block for anything but the plant. (This allows you to modify your gains easily when necessary.) Include the controller gains from your design. Save your Simulink model for further use in Part C of the experiment.

  13. Run the responses to a unit ramp input first with a PD controller (by setting Ki = 0) and then with a PID controller (Ki = 0.05). Run the simulation for about 30 sec.

  14. Make comparison plots of ramp responses with PD and PID controllers (on the same plot) to show any differences between the two responses, especially in steady-state response (i.e., for t>>0). The difference can be more easily spotted by plotting the error variable (i.e. error between the commanded position and the actual position) for each controller. Save the comparison plot and error plot.

You must have your work checked out by one of the TAs before leaving the lab to get credit for your work.

Part C: Controller Implementation & Evaluation

Objectives

The objective of this part of the DC motor experiment is to implement the controller designed in part B and evaluate its performance.

Equipment Required

The following is a list of the required equipment to perform this experiment:

Controller Implementation

  1. With the help of the TA, check and ensure that the Quanser QUARC software is linked to MATLAB.

  2. In the MATLAB directory navigation bar, go to C:\Users\Public\AE4610\DC Motor\DCMotor. Locate the file DCMotor_CL.mdl under the Current Folder section and open it.

  3. P Controller Test: To understand the behaviour of a Proportional controller, implement a P controller by typing the values for and to 0 in the command window. Set as 10.

  4. To build the model, click down arrow on Monitor & Tune under Hardware tab and then Build for monitoring .

  5. Open the Theta Command block and make sure that the Final value is equal to 5/Kp. This will limit the input to the motor to be less than a preset limit of 5 volts.

  6. Open the scope Theta.

  7. Turn on the power supply.

  8. Press Connect button under Monitor & Tune and then press Start . Run the motor with a step input of the selected input voltage for 10 seconds.

  9. Save your data.

  10. PD Controller Test: By introducing a derivative gain (), notice how the system characteristics change. Set to 1 and to 2. Observe the behaviour and save the data.

  11. PID Controller: Open the controller block and change the current values of , and to match with your controller from Part B.

Controller Evaluation

  1. Make sure that the magnetic brake position of the DC motor is in braked position (Position 1). Run the motor with a step input of the selected input voltage for 10 seconds and save the data.

  2. Repeat Step 1 with the magnetic brake set in other positions (position 0 or 2). Save the data (i.e. filename “dccloopoffdesign”).

  3. Repeat Step 1 with the magnetic brake in the original position (position 1) and the sampling time set to 0.1 sec. To set the sampling time, you need to go to the block diagram file, choose “Simulation” -> “Model Configuration Parameters” -> “Solver”. Set the fixed step to 0.1 sec. (It should have been 0.01 previously.) Save the data (i.e. filename “dccloopslowsampling”).

  4. Email the data to yourself and delete the data files. DO NOT DELETE THE SIMULINK MODEL. Close Simulink and DO NOT SAVE.

Analysis

  1. Run a nominal case simulation using your SIMULINK model from Part B, setting the command input to the value you used during the experiment. Compare the simulation results with corresponding experimental results for the nominal case and explain any differences between those results.

  2. Compare the simulation results for the nominal case with the experimental results for the off-design case and explain any differences.

  3. Modify the SIMULINK model to include a zero-order hold block at the input (labeled as in Fig. 2.8) to the DC motor in order to account for the effect of the sampling time used in the experiment. (Note this is different from the quantization error introduced by the digital encoder in measuring the angular position). Save this block diagram for inclusion in your lab report.

  4. Run simulations with the zero-order hold set to 0.01 sec and 0.1 sec and save simulation outputs.

  5. Compare the simulation output with a zero-order hold of 0.01 sec to the nominal case experimental results and explain any differences between this comparison and your initial nominal case simulation/experimental comparison.

  6. Compare the simulation output with a zero-order hold of 0.1 sec to the slow sampling experimental results and explain any differences.

Lab Report

  • Include a brief synopsis of what you did in Part A, all the individual controller design work from Part B, and all your work from Part C, namely all of the plots and comparisons asked for. There is no need to repeat the lab manual, so do not spend time entering equations unless you directly used them at some point in your work.

  • Include the analysis questions from Part A.

  • Include the following in your Part C analysis section:

    • Effect of proportional controller gain on closed-loop system behavior

    • Effect of derivative controller gain on closed-loop system behavior

    • Effect of integral controller gain on closed-loop system behavior

    • Effect of sampling time on closed-loop system behavior

    • Controller performance in off-design conditions

3DOF Helicopter

This manual documents the modelling of a 3DOF helicopter mechanism, for which PID orientation controllers (pitch, roll and yaw) are developed. Finally, the controllers are implemented on the hardware.

Objective

The purpose of this experiment is to design an attitude controller for the 3-DOF helicopter mechanism and to test the controller using the real-time experimental setup.

Equipment Required

Part A: Modeling

Description of a 3-D Helicopter Mechanism

The 3-DOF helicopter mechanism used in this experiment is shown in Fig. 5.2. The 3-DOF helicopter consists of a base upon which an arm is mounted as shown in Fig. 5.4. The arm carries the helicopter body at one end and a counterweight at the other. It can pitch about a longitudinal axis as well as yaw about a vertical axis. Encoders mounted on these axes allow for measuring the pitch and the yaw of the arm. The helicopter body is mounted at the end of the arm as shown in Fig. 5.4. The helicopter body is free to roll about the arm. The roll angle is measured via a third encoder. Two motors with propellers mounted on the helicopter body can generate a force proportional to the voltage applied to the motors.

The force generated by the propellers can cause the helicopter body to lift off the ground. The purpose of the counterweight is to reduce the power requirements on the motors. All electrical signals to and from the arm are transmitted via a slip-ring with 8 contacts thus eliminating the possibility of tangled wires and reducing the amount of friction and loading about the moving axes.

Mathematical Model

Pitch

Consider the diagram in Fig. 5.5. For a zero roll angle, the pitching torque is controlled by the forces generated by the two propellers (i.e. ). The body will not rise until the total force is greater than the mass differential force

A sketch of the configuration in 3-D motion is shown in Fig. 5.6. Once the body is in the air with a roll angle (), the equation for pitch () is given by

where

  • : moment of inertia of the body about the pitching axis

  • : force constant of the motor/propeller combination

  • : distance from the pivot point (longitudinal axis) to the propellers

  • : distance from the pivot point (longitudinal axis) to the counterweight

  • : pitch angle measured in radians (positive in the direction indicated in Fig. 5.5)

  • : roll angle (see Fig. 5.6)

  • : voltage applied to the right motor resulting in force

  • : voltage applied to the left motor resulting in force

  • : Mass differential torque

Roll

Consider the diagram in Fig. 5.7. The rolling moment is controlled by the difference in the forces generated by the propellers. If the force generated by the right motor is higher than the force generated by the left motor, the helicopter body will roll to left (positive).

where

  • : mass moment of inertia of the body about the roll axis.

  • : distance from the roll axis to either motor.

  • : roll angle measured in radians.

Yaw

The only way to apply a force in the lateral direction is to roll the helicopter body. Assume that the body rolled to left (positive) by an angle (see Fig. 5.6). The horizontal component of the sum of the rotor forces will cause a torque about the yaw axis which results in a positive yaw acceleration.

​where

  • : moment of inertia of the body about the yaw axis.

  • : yaw rate in rad/sec.

Equations (5.2), (5.3) and (5.4) mean that the pitching acceleration is a function of the sum of the voltages applied to the motors, the rolling acceleration is a function of the difference in the voltages applied to the motors, and the yaw acceleration is a function of the roll angle.

Part B: Controller Design

Pitch Controller

The purpose is to design a controller to control the pitch angle of the helicopter by supplying the appropriate sum of voltage to the motors. We will assume the mass differential torque has been balanced by a constant thrust from the propellers. Assuming the roll angle to be small, we obtain the following linear system

where is the sum of the voltages applied to the motors. First, design a PD controller of the form

where is the commanded pitch angle. With this controller, the closed-loop transfer function for pitch is

The standard form for the transfer function of a second-order system is

Comparing Eq. (5.7) with Eq. (5.8), and for desired values of closed-loop pitching motion natural frequency () and damping ratio (), we obtain

We can also include an integral term in the controller (PID controller) to compensate for the mass differential torque . (Above we assumed that the helicopter was perfectly balanced, i.e., , but we need because it is not balanced in the actual experiment. Why don’t we balance it to make this easier? There is a very good reason for it.)

The controller is now

We will tune the integral gain using simulation of the nonlinear system with an initial guess of .

Roll Controller

The purpose is to design a controller to control the roll angle of the helicopter by supplying an appropriate difference of voltage to the motors. The open-loop axis equation of motion for roll is

where

We implement a PD controller of the form

where is the commanded roll angle. The resulting closed-loop transfer function is given by

Similar to the pitch controller, the roll controller gains are determined by comparing the closed-loop system transfer function Eq. (5.14) with the standard form of the transfer function of a second-order system of Eq. (5.8) to obtain

where and are respectively the desired natural frequency and damping ratio of the closed-loop rolling motion.

Yaw Controller

The purpose is to design a controller to control the yaw rate of the helicopter by commanding a roll angle. We will first assume that the configuration is in equilibrium, i.e., the sum of the rotor forces is nearly equal to the mass differential force . Note that we will later relax this assumption in the nonlinear simulation. With this assumption, the linearized equation for the yaw dynamics is given by

In order to achieve a desired yaw attitude rate , we design a PI controller that commands the desired roll angle based on a given yaw rate command, as follows:

We assume that roll response () follows the roll command () almost instantaneously (note that this assumption has certain implications on how we design roll and yaw control loops). Assuming , the resulting closed-loop transfer function is given by

The standard form for the transfer function of a first-order system is given by

Comparing Eq. (5.19) with Eq. (5.20), and for a desired value of closed-loop yaw rate response time constant, we obtain

Once the proportional gain is determined, we can add the integral term and tune the integral gain through nonlinear simulation of the system.

System Parameters

The following are the estimated parameter values for the 3-DOF Helicopter Mechanism.

Procedure

  1. Design a PID controller for the control of pitch attitude and a PD controller for the control of roll attitude using the system parameters given above. The closed-loop system must meet the following specifications for a step response:

    1. In pitch: 3 sec < peak time < 3.5 sec, 5% settling time < 5 sec

    2. In roll: 1.2 sec < peak time < 1.8 sec, 5% settling time < 2 sec

    Note: For a second-order system:

    Use the following steps to design the pitch and roll controller:

    First, pick a value for the peak time and settling time that falls within the above specifications (Note: It is probably a good idea to pick a peak time less than the settling time). Next, using the above equations, calculate the values of the natural frequency and damping . Use Eqs. (5.9) and (5.10) for determining the PD controller gains for the pitch controller. Similarly, use Eqs. (5.15) and (5.16) to determine the PD controller gains for the roll controller. Initially set the integral gain of the pitch controller to a default value of . We will adjust the integral gain later using nonlinear simulation of the system. At the end of Step 1, you should have five gains.

    Note: The roll controller is a PD controller, and does not have an integral gain.

  2. Assuming that the roll angle tracks instantaneously, design a PI controller for control of yaw rate . The closed-loop system must meet the following specification:

    In yaw rate response: 4 sec < rise time < 5 sec

    Note: For a first-order system, the rise time () is related to the time constant () by the following relation:

    Pay attention to the assumption above. The yaw controller works through commanding a roll angle, but for this initial design, we assume that the roll angle matches this command instantaneously.

    Select a value of rise time in the specified range and use Eq. (5.22) to determine the value of time constant (). Then use eq. (5.21) to determine the proportional gain . Use a default value of for the integral gain. We will adjust the integral gain later using nonlinear simulation of the system.

  3. Using Eqs. (5.5) and (5.6), build a SIMULINK model of the closed-loop system for the pitch PID controller and enter the gains you found. The design that you performed gave you values that should work well, but they are only an initial guess. You must implement them and test the response to ensure it meets the requirements, and modify the gains if necessary. Run a closed-loop response to a pitch attitude step command of 20 deg. Plot the response and verify that the response meets the given specifications. (Note: You can test the requirements with this command as well. You don’t have to use a unit step for testing, because this is a linear system.)

  4. Repeat the above process for roll (i.e., build a PD controller model in SIMULINK using Eqs. (5.12) and (5.13) and enter the gains you found. Test the roll controller using a roll attitude step command of 10 deg. Plot the response and verify that the response meets the given specifications.

  5. Develop the SIMULINK model for the yaw rate controller. This one is a little different because it does not command motor voltages directly, as the others did. Instead, for a given yaw rate, the controller commands a roll angle. Assume and use Eqs. (5.17) and (5.18) to build a SIMULINK model. Plot yaw rate and yaw attitude (this is integral of yaw rate) responses to a 10 second pulse yaw rate command of 10 deg/sec and verify that the response meets the given specification. If required, adjust the gains.

  6. We will now add nonlinear terms into the SIMULINK model that were not included as part of the initial system. The system was linearized because a linear system is easier to analyze and design. Now, you need to include two nonlinear terms, and , in your model to make it more realistic. Look specifically at pitch and yaw dynamics and consider how roll angle affects them. (Figure 5.6 should help you in this). Also, you need to include the mass differential torque as a constant input to the pitch dynamics. Further, you need to replace by in the yaw dynamics. The commanded roll attitude from the yaw controller becomes input to the roll controller, thus coupling the yaw and roll loops. The propeller force from the pitch controller is multiplied by and therefore becomes the input to the yaw dynamics. Likewise, the propeller force is multiplied by , and therefore becomes the input to the pitch dynamics.

  7. You need to use a unit step input for yaw rate and verify that your yaw controller meets the rise time requirement (adjust yaw gains if required). Then, design a pulse input of 10 deg/sec to simulate a yaw rate command given by the pilot. Integrate yaw rate to obtain yaw attitude. Determine the duration of the pulse input that is needed to achieve a 180 deg turn. This can be done through trial and error if you like. Plot the yaw rate and yaw attitude responses.

    Note: Since the pitch loop includes the constant mass differential torque, include several seconds (say 50-100 seconds) of simulation with zero commands initially so that the system reaches equilibrium by balancing the mass differential force using the propeller force. Adjust your pitch integral gain such that the system reaches equilibrium within ​the selected 50-100 seconds limit.

  8. Repeat step 7 while simultaneously commanding 20 degrees of pitch attitude and a 10 deg/sec yaw rate pulse of required duration to achieve a 180 deg turn. The input command should be implemented after the equilibrium has reached (in between 50-100 seconds).

  9. You need to complete the controller design prior to your lab. Also, you need to complete all simulations at home for inclusion in the group report. Make sure you have: all your gains listed, there should be 7 of them, the pitch angle response, the roll angle response, the yaw rate and angle response, and that all of the requirements are met for all of them, and what pulse duration was needed for the 180-degrees turn for the two cases of with zero pitch attitude and 20 deg pitch attitude.

Each of you must complete the controller design at home and have the gain values from your design with you when you go to the experiment lab in order to receive lab participation credit. Also, each of you must include your controller designs as part of the lab report to get credit for your work. Each of you must complete SIMULINK responses at home and include them in the group report to get credit for your work.

Part C: Controller Implementation and Evaluation

Running the Experiment

Always stay clear of the helicopter while running and catch it while stopping.

Experimental Setup

Check and ensure that the counterweight in the secondary arm is fixed in the furthest hole/position away from the rotors.

Pitch and Roll Control

  1. Turn the power on.

  2. Open the MATLAB and locate the file Helicopter_PitchRoll_PID.mdl under the path C:\AE4610_Controls_Lab\Helicopter and open it. This is the block diagram for this part of the experiment.

  3. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  4. Set the PID gains in the Pitch Controller and PD gains in the Roll Controller blocks in the Simulink diagram from Part B Step 3 and 4.

  5. Double click the Pitch Command block to open it and change the gain after the Pitch(step) input to 0.

  6. Double click the Roll Command block to open it and change the gain after the Roll(step) input to 0.

  7. Hold the helicopter in a level position before starting the experiment until the fans are in full power.

  8. Press Connect button under Monitor & Tune and then press Start . Check if the controller can maintain the attitude of the helicopter.

  9. Double click on the scopes and open them.

  10. Gently disturb the helicopter to see the effect of the controller.

  11. Double click the Pitch Command block to open it and change the gain after the Pitch(step) input to 1 and run the experiment from the level position.

  12. Save the data with a descriptive name such as pitch_command. After saving the data, clear the workspace using the clear command in MatLab window.

  13. Double click the Pitch Command block to open it and change the gain after the Pitch(step) input to 0.

  14. Double click the Roll Command block to open it and change the gain after the Pitch(step) input to 1 and run the experiment from the level position.

  15. Save the data with a descriptive name such as roll_command. After saving the data, clear the workspace using the clear command in MatLab window. Close the Simulink model. DO NOT SAVE THE MODEL.

Pitch, Roll, and Yaw Control

  1. Open the MATLAB and locate the file Helicopter_PitchRollYaw_PID.mdl under the path C:\AE4610_Controls_Lab\Helicopter and open it. This is the block diagram for this part of the experiment.

  2. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  3. Set the PID gains in the Pitch Controller, Roll Controller, and Yaw Rate Controller blocks in the Simulink diagram.

  4. Double click the Pitch Command block to open it and change the gain after the Pitch(step) input to 0.

  5. Double click the Yaw Rate Command block to open it and change the gain after the Yaw(step) inputs to 1.

  6. Hold the helicopter in a level position before starting the experiment until the fans are in full power.

  7. Press Connect button under Monitor & Tune and then press Start .

  8. Save the data with a descriptive name such as nonlinear_yaw. After saving the data, clear the workspace using the clear command in MatLab window.

  9. Turn the POWER OFF.

Analysis

  1. Compare the actual responses with the simulated responses from Part B. Comment on the differences in the responses.

  2. Give a reason why it is better to design a yaw rate controller instead of a yaw attitude controller.

  3. Comment on what one would expect if one were to design the yaw controller rise time to be of the same or less than that of the roll controller.

Group Lab Report

Include the controller designs, the SIMULINK block diagrams, and the responses from each member of the group clearly marked by the student’s name. Include a controller evaluation section and answer the analysis questions. Make certain that for the analysis, you compare the differences between experimental and simulation responses. There should be a lot to talk about, as this experiment has a lot of variables and non-linear influences. Discuss any discrepancies you observe and any logical reasons for why they exist.

Torsional Pendulum

This manual documents the modeling of a 2-DOF torsional pendulum, followed by the design of a collocated PD controller, and finally the controller implementation and evaluation on the hardware setup.

Objective

The objectives of this laboratory experiment are as follows:

  1. Identify the parameters of a multi-degree-of-freedom system.

  2. Demonstrate some key concepts associated with proportional plus derivative control for a two degree-of-freedom torsional mechanism.

  3. Implement a PD controller on a 2-disk (2 DOF) system where the feedback is based on the angular displacement of the lower disk. Such a scheme is referred to as collocated since the sensor output is directly coupled to the actuator input.

Implementing a suitable controller on a 2-disk (2 DOF) system, where the feedback is based on the angular displacement of the upper disk is referred to as non-collocated since the sensor output and the actuator input are at different locations. The addition of the spring and the second inertia to the rigid body single DOF increases the plant order by two and adds an oscillatory mode to the plant dynamics. This may be thought of, in a sense, as a dynamic disturbance to the rigid body plant (single DOF).

Equipment Required

Part A: Modeling

This part of the experiment involves the first phase – system identification and modeling of the torsional mechanism. This is performed by representing the mechanism as a combination of spring-mass-damper systems and determining the model parameters from the system response. The approach will be to indirectly measure the inertia, spring, and damping parameters by making measurements of the system response while set up in a pair of classical spring-mass configurations.

Electromechanical Plant

A schematic of the plant interconnection with the control computer is shown in Fig. 4.1-(b). The plant is shown in Fig. 4.1-(a). It consists of three disks supported by a torsionally flexible shaft which is suspended vertically on anti-friction ball bearings. The shaft is driven by a brushless servo motor connected via a rigid belt and pulley system with a 3:1 speed reduction ratio. An encoder located on the motor is used for commutation. This is the process by which the current is distributed to the motor coils. In order to commutate the motor, a sensor connected to the motor shaft is used to feedback the instantaneous rotor position. The encoder on the base of the shaft measures the angular displacement (in counts) which is converted to an angle of the lower disk . The second disk is connected to its encoder, which measures , by a belt/pulley with a 1:1 pulley ratio and similarly the third disk is connected to its encoder (which measures ) by a rigid belt/pulley with a 1:1 pulley ratio.

The plant may be placed in a variety of free and clamped configurations with 1, 2, and 3 degrees of freedom. For 1 and 2 DOF plants, the torsional spring constant may be halved by the choice of disk location. Changing configuration often requires removing or replacing inertia disks. Although these operations are straightforward, it is recommended that they are performed with care. The user may change inertia values by changing the number of masses and/or their location on a given disk.

In the following experimental procedure, we will identify the plant parameters and , where is the mass moment of inertia, is the torsional spring constant, and is the damping coefficient.

System Identification

Consider a one-DOF underdamped system model given by the second-order scalar differential equation

We will use the logarithmic decrement to estimate the damping ratio of the system. The solution of (4.1) is given by

where

The value of during two complete successive cycles is given by

where

Since

it follows that

Let the logarithmic decrement be given by

It follows then easily from (4.3) and (4.2) that

or that

Finally, if is known, an estimate for is given by

The previous procedure can be repeated also for the case when measurements are taken over non-successive cycles. To this end, notice that (see Fig. 4.2) and more generally, that

Therefore

where

The previous two equations give that

or that

Finally,

Loaded vs. Unloaded Disk

Assume that the natural frequency of the loaded disk is and the corresponding damping ratio is . Therefore,

where is the damped natural frequency for the loaded disk case (denoted by subscript ‘'). Similarly, for the unloaded disk case (subscript '') one has

Recall that

for the loaded and unloaded cases, respectively. Solving for and equating the resulting expressions yields

or that

From (4.7) and (4.2), the damping coefficient can be computed from

Experimental Procedures

  1. For model 205a, clamp the center disk using the 1/4” bolt, square nut, and clamp spacer as shown in Fig. 4.3. Only light torqueing on the bolt is necessary.

  2. Secure four 500g masses on the upper and lower disks. Verify that the masses are secured properly and that centerline of each mass is at a distance of 9.0 cm from the shaft centerline.

    Figure 4.3. Electromechanical plant model 205a

  3. Enter the program by clicking on the shortcut to 3D Torsion on the desktop and turn on the torsional mechanism.

  4. Enter File menu, choose Load Setting and select the file C:\Program Files (x86)\ECP Systems\cn\default.cfg.

  5. Choose the correct personality file by going to Utility menu and clicking on Download Controller Personality File. Download the file C:\Program Files (x86)\ECPSystems\cn\M205di6.pmc. This will implement ‘CLOSED’ Loop by default. Click on Abort Control at the lower right of the screen to ‘OPEN’ the loop.

  6. Enter the Control Algorithm box via the Setup menu and set Ts = 0.00442 second, then OK. Enter the Command menu, go to Trajectory and select Step, Setup. Select Open Loop Step and input a step size of 0 (zero), a duration of 4000 ms and 1 repetition. Exit to the Background Screen by consecutively selecting OK. This puts the controller board in a mode for acquiring 8 sec of data on command but without driving the actuator.

  7. Under Data menu, go to Setup Data Acquisition and select Encoder #1 and Encoder #3 as data to acquire and specify data sampling every 2 (two) servo cycles, i.e. every 2 Ts's. Select OK to exit. Select Zero Position from the Utility menu to zero the encoder positions.

  8. From the Command menu, select Execute. Prepare to manually displace the upper disk by approximately 20 deg. Exercise caution in displacing the inertia disk; displacements beyond 40 deg may damage and possibly break the flexible drive shaft. (Displacements beyond 25 deg will trip a software limit which disables the controller indicated by "Limit Exceeded" in the Controller Status box in the Background Screen. To reset, simply reselect Execute from the Command menu.) With the upper disk displaced approximately 20 deg (≤ 1000 encoder counts as read on the Background Screen display) in either direction, select Run from the Execute box and release the disk approximately 1 second later. The disk will oscillate and slowly attenuate while encoder data is collected to record this response. Select OK after data is uploaded.

  9. Under the Plotting menu, select Setup Plot and choose Encoder #3 position, and then select Plot Data from the Plotting menu. You will see the upper disk time response.

  10. Save the data by clicking on the Data menu and going to Export Raw Data.

  11. Remove the four masses from the third (upper) disk and repeat steps 8 through 10 for the unloaded disk. If necessary, repeat step 6 to reduce the execution (data sampling) duration.

  12. Repeat steps 8 through 11 for the lower disk, disk # 1. For the lower disk experiment, in step 9, you will need to remove Encoder #3 position and add Encoder #1 position to the plot set-up.

  13. Remember to switch off the system when you are done with your experiments.

Analysis

  1. Determine the damped natural frequency (in rad/sec) of the upper disk from the plot obtained for the upper disk when it is loaded with the 4 masses by choosing several consecutive cycles (for example, 5 to 10) in the amplitude range between 100 and 1000 counts (much smaller amplitude responses become dominated by nonlinear friction effects and do not reflect the salient system dynamics). This damped frequency for the loaded upper disk, , is related to the natural frequency for the loaded upper disk, , according to Eqn. (4.6), where the subscript ‘’ denotes the upper loaded disk.

  2. Measure the reduction from the initial cycle amplitude to the last cycle amplitude for the n cycles measured above. Using relationships associated with the logarithmic decrement and damping ratio, find the damping ratio and the natural frequency .

  3. Determine the damped frequency for the unloaded upper disk from the corresponding unloaded upper disk response of the Experimental Procedure. Repeat steps 1 and 2 of the Analysis to calculate the damping ratio and the natural frequency of the unloaded upper disk, where the ‘’ subscript denotes the upper unloaded disk.

  4. Obtain and from the plots of the lower disk response for the loaded and unloaded cases respectively, where the '' and '' subscripts denote loaded and unloaded disk cases respectively for the lower disk. How do these damping ratios compare with that for the upper disk?

  5. Use the following information pertaining to each mass piece to calculate the portion of each disk’s inertia attributable to the masses for the ‘’ (upper disk - loaded) and '' (lower disk - loaded) cases.

    • Mass (including bolt and nut): 500g (± 5g)

    • Diameter: 5.00 cm (± 0.02 cm)

    Calling the total inertia from these masses about the shaft centerline as , use the following relationships to solve for the unloaded upper disk inertia , and upper torsional shaft spring .

    Using and , find the damping coefficient with Eqn. 4.8.

  6. Repeat the procedure to find the lower unloaded disk inertia (), the spring constant of the lower torsional shaft () and the damping of the lower disk (). (Take the inertia contribution of the motor, belt, and pulleys to be = 0.0005 kg.m).

  7. Compare the damping ratios of the loaded and unloaded cases of upper and lower disks and report your observations.

Part B: Controller Design

This part of the experiment involves the second phase – the development of PD collocated control on the torsional mechanism. This is done by using the parameters determined from Part A to model the system and determining proportional and derivative gains for the controller using MATLAB based on the given design specifications.

The configuration of the torsional mechanism that will be used for controller design and evaluation is shown in Fig. 4.4.

In this configuration, the center disk is removed and two masses are added to both top and bottom disks.

Theoretical Background

Equations of Motion

This section provides time and Laplace domain expressions which are useful for linear control implementation and are used in the experiments described later. The most general form of the two degrees of freedom torsional system is shown in Fig. 4.5, where friction is idealized as being viscous.

It is important to note that the setup includes two small masses on each disk and the controller design will be done for this case. Hence, includes the mass moment of inertia of the lower disk (), the mass moment of inertia contribution from two masses () and the mass moment of inertia of the motor-belt-pulley system (), i.e., . Similarly, includes the mass moment of inertia of the upper disk () and the mass moment of inertia contribution from two masses (), i.e., . Additionally, is taken as while is taken as .

In Part A, represented the total mass moment of inertia contribution from four masses (added to each disk). In Part B and Part C, there is a contribution of mass moment of inertia from only two masses, so in this case, (as calculated in Part A) should be suitably modified and will be lower than earlier.

Using the free body diagram of the 2 DOF free-free case, shown in Fig. 4.6, and summing torques acting on , one obtains

where

  • = applied voltage

  • , gain that converts volts to torque in N-m, is calculated as follows (see Fig. 4.7):

where

  • , the Servo Amp gain = 2 amp/V

  • , the Servo Motor Torque constant = 0.1 N-m/amp

  • , the Drive Pulley ratio = 3 (N-m @ disk/N-m @ Motor)

    Thus, substituting these values in (4.10), we obtain = 0.6 N-m/V. Similarly, summing torques acting on

These may be expressed in a state-space realization as

where

Taking the Laplace transfer of the above equations and assuming zero initial conditions, we may solve for the transfer functions

where

In Figs. 4.5 and 4.6, is the resultant of the stiffness of the lower () and the upper () shaft in series. The values for the stiffness of the lower and the upper shaft are the stiffness parameters that you identified in Part A. Then, knowing that these shafts are in series, use the formula

to obtain the total stiffness. The block diagram of the closed-loop system with the PD controller is shown in Fig. 4.8. The gain is the hardware gain and is given by

where

  • , the DAC gain = 10V / 32,768 DAC counts

  • , the Servo Amp gain = approx. 2 (amp/V)

  • , the Servo Motor Torque constant = approx. 0.1 (N-m/amp)

  • , the Drive Pulley ratio = 3 (N-m @ Disc / N-m @ Motor)

  • , the Encoder gain = 16,000 pulses / 2π radians

  • , the Controller Software gain = 32 (controller counts / encoder or ref input counts)

The gains of the PD controller and are the free parameters that must be chosen to achieve specific performance objectives (rise time, overshoot, etc.). The plant transfer function

where is the lower disk displacement and is the input torque at the motor.

In this experiment, we consider PD control of a 2-disk system where the controlled output, , is of the lower disk. Such a scheme is referred to as collocated since the sensor output is rigidly coupled to the actuator input.

The addition of the spring and second inertia increases the plant order by two and adds an oscillatory mode to the plant dynamics. This may be thought of, in a sense, as a dynamic disturbance to the rigid body plant. The collocated PD control implemented here is the approach most commonly used in industry. It may be practically employed when there is flexibility between the actuator and some inertia, and the location of objective control being near the actuator. If the location of objective control is at the distant inertia, however, this method has its limitations.

The approach in this experiment will be to design the controller by interactively changing the PD gains and observing their effect on the physical system.

Specifications & Procedure

Specifications

  1. All closed-loop poles must be in the left half of the complex plane.

  2. The rise time to a unit step command input must be less than 0.4 sec (for ).

  3. The overshoot in response (for ) to a unit step command input must be less than 10% without excessive oscillation.

  4. must be less than 1.0 and must be greater than 0.02 but less than 0.1.

Procedure

  1. Open a new m-file and compute the transfer function using Eqn. 4.13. Save your m-file.

  2. Use controlSystemDesigner/rltool in MATLAB and select appropriate values for and to meet the given set of specifications. Start with an initial guess for the gains and adjust. You need to meet the requirements in controlSystemDesigner/rltool. Save the controlSystemDesigner/rltool figures and your gains. Make sure to use the consistent controller architecture in the controlSystemDesigner/rltool. This will be known as high gain controller.

  3. Compute the transfer function using Eqns. 4.13 and 4.14.

  4. Develop a SIMULINK diagram using the block diagram shown in Fig. 4.8 as reference and save it.

  5. Obtain the SIMULINK response of to a unit step command using the set of high gains (from Step 2) you have selected. Save the response, and make sure it proves you meet the requirements.

  6. Using the gains from the high gain controller as starting points in SIMULINK, iteratively reduce gains, until you obtain a well-behaved step response of with ≤ 10% overshoot (without excessive oscillation) and as fast a rise time as possible. Save these gains as a different set, which will correspond to a low gain controller and will be tested in Part C.

  7. Obtain the SIMULINK response of to a unit step command using the set of low gains (from Step 6) and compare it with the response from Step 5. Are the design specifications still satisfied?

  8. The TAs will need to see: Transfer functions, Gains, controlSystemDesigner/rltool plots, Simulink diagram, and Simulink response to a step command (proving overshoot and rise time requirements are met).

You must have your work checked out by one of the TAs before leaving the lab to get credit for your work.

Part C: Controller Implementation & Evaluation

Safety Briefing

Safety Note 1: The system's safety functions must be verified before each operational session. The system must be checked visually to verify that the disks, masses and connecting shaft all appear to be undamaged and securely fastened.

Safety Note 2: In the event of an emergency, control effort should be immediately discontinued by pressing the red "OFF" button on the front of the control box.

Safety Note 3: Stay clear of and do not touch any part of the mechanism while it is moving, while a trajectory is being executed or before the active controller has been safety checked.

Safety Note 4: Verify that the masses and inertia disks are secured as per he instructions prior to powering up the Control Box.

Safety Note 5: Never leave the system unattended while the Control Box is powered on.

Implementation

  1. Set up the system with two masses on the upper and lower disk as shown in Fig. 4.9. Ensure that the two masses are located along the hub split line of the disks. Observe that the middle disk has been removed.

  2. Enter the program by clicking on the shortcut to 3D Torsion on the desktop and turn on the torsional mechanism.

    Figure 4.9. Electromechanical plant model 205a configured for closed loop experiments

  3. Enter File menu, choose Load Setting and select the file C:\Program Files (x86)\ECP Systems\cn\default.cfg.

  4. Choose the correct personality file by going to Utility menu and clicking on Download Controller Personality File. Download the file C:\Program Files (x86)\ECPSystems\cn\M205di6.pmc.

  5. Enter the Control Algorithm box under Setup and ensure that the sample period, Ts, is 0.00442 second and select Continuous Time Control. Select Pl + Velocity Feedback (this is the return path derivative form) and Setup Algorithm. Enter the high gain values Kp and Kd determined earlier (Ki = 0) and select OK. Check the values with a TA before entering them. Do not input magnitude of Kp > 1.0 nor Kd > 0.2 and Kd < 0.02. Ts is located both on the control algorithm screen and in the program itself, so be sure that both values are correct. The algorithm can now be implemented by selecting Implement Algorithm, then OK.

  6. First, displace the lower disk with a light, non-sharp object (e.g., a plastic ruler) to verify stability prior to touching the plant. Similarly, displace the upper disk and observe the response. Note the difference in their stiffness.

Evaluation

  1. Go to the Data menu and click on Setup Data Acquisition. Check that data is gathered every 5 servo cycles. Be sure that the Commanded Position, Encoder 1 Position and Encoder 3 Position are all located in the Selected Items box. If they are not, add them to that list by selecting them in the Possible Choices box and then clicking on the Add Item button. When finished, hit OK to exit this menu.

  2. Prepare the input for the system by selecting the Command menu and then Trajectory. Uncheck the box Unidirectional Moves. Select the Step -> Setup -> Closed loop Step Input. Enter the following parameters for this case: step size, 1000 counts; dwell time, 5000 ms; 1 repetition. When finished, hit OK, then OK again to leave the setup trajectory menus.

  3. Go to the Utility menu and click Zero Position. Go to the Command menu and click Execute. Then click the Run button. The input trajectory will be run on the torsional mechanism now. When the box on the screen says Upload Complete, click on the OK button.

  4. After data collection has finished, go to the Plotting menu and select Setup Plot. Set Command Position and Encoder 1 Position on the left axis. Click on the Plot Data button when finished. This will generate a plot of the data from the executed trajectory. If desired, zooming the plot can be accomplished by going to the Plotting menu and selecting Axis Scaling. Similarly, obtain the plot of Encoder 3 position.

  5. Save the data by clicking on the Data menu and going to Export Raw Data.

  6. Repeat Steps 5-11 using the low gain controller values determined in Part B. How does the physical stiffness of the setup compare with the high gain controller?

  7. Remember to SWITCH OFF the system when you are done with your experiments.

Analysis

  1. Compare the steady-state error values of the high gain controller as well as low gain controller response of obtained in the experiment and explain any difference.

  2. Simulate the system response for the same step command you have used in the lab experiment. Compare your simulated responses with the corresponding experimental results for both and . What is the rise time and % overshoot in the experiment and simulation responses to the step command used (only for )? Explain the cause for any difference.

  3. Using controlSystemDesigner/rltool, determine the gain margin (GM) and phase margin (PM) of the closed-loop system of the controller for the high gain controller as well as the low gain controller.

Quadcopter

Introduction

Objective

This experiment will introduce students to the basic principles for controlling the flight of a small quadcopter, the CrazyFlie 2.1. Weighting only 27 grams and having 9.2 cm of length and width, is a “nanoquad” which has rapidly become one of the preferred platforms for quadcopter research.

In Part A, students will adjust the gains of a PID controller to follow autonomously a waypoint maneuver. In Part B, the students will interact with the obstacle avoidance capabilities of the quadcopter.

Equipment Required

Background

We define the body frame of a quadrotor with the X, Y and Z axes shown below in Figure 8.1, with roll angle about the x-axis, pitch angle about the y-axis, and yaw angle about the z-axis. There are different ways of attaching a reference frame to a quadcopter, Figure 8.1 shows the convention which is consistent with Crazyflie quadrotor’s source code.

A quadrotor has four sources of thrust and torque with its four rotors. As seen below in Figure 8.2, adjacent rotors rotate in opposite directions. In Figure 8.2, if the output of motors 1 & 2 are increased and motors 3 & 4 are decreased, the quadrotor can maintain an equal amount of total thrust while creating a roll moment. If the output of motors 1 & 4 are increased and motors 2 & 3 are decreased, the quadrotor can maintain an equal amount of total thrust while creating a pitch moment. If the output of motors 1 & 3 are increased and the output of motors 2 & 4 are decreased, the quadcopter will develop a yawing moment. This arrangement of the rotors enables full control of a quadrotor in 3D space.

Flow Deck

The Flow Deck consists of a laser sensor that measures distance to the ground and a low-resolution camera called optical flow sensor which measures movement parallel to the ground. Together these sensors allow the CrazyFlie to interpret its movement in horizontal and vertical directions.

Note that the laser distance sensor will return the minimum distance to any object within its detection range as depicted in Figure 8.3. During the quadcopter’s operation, it may mistake an object (like a box lying on the ground) as the actual ground, try to maintain a certain distance over the false ground, and therefore suddenly and unexpectedly accelerate upwards. In order to avoid that the flight area must be cleared out before the flight tests.

Multi-ranger Deck

The Multi-ranger Deck uses five laser sensors to measure the distance in the front/back/left/right/up direction. This enables the CrazyFlie to detect proximity to objects up to four meters away. This allows CrazyFlie to avoid obstacles.

Part A: Position PID Controller Tuning

Four PID controllers work together to facilitate position control of the CrazyFlie. The outermost position controller, the controller we will be tuning in this part of the lab, takes the target position as reference, and calculates a target linear velocity to be sent to the velocity controller. The velocity controller takes target linear velocity as reference, and calculates a target roll/pitch angle to be sent to the attitude controller, which uses the target roll/pitch angle as reference and calculate target roll/pitch rate (angular velocity). Finally, the innermost rate controller takes the target roll/pitch rate as reference, and directly controls the motors to generate moment in X/Y axis to achieve desired angular rates. In this lab, we will vary the PID gains for the outmost position controller and treat the inner controllers as a black box. We shall use the following PID controller gains as a starting point.

Table 2. Initial PID Gains

Recall that the current altitude is measured with the laser distance sensor, which reports the distance to the closest obstacle within the cone shaped detection range (Figure 8.3). Therefore, if the CrazyFlie is too close to a wall or a surface, the height reading may not be accurate. Also, note that the area of the cone increases with altitude.

To see the effect the PID gains have on vehicle performance, we will command the quadrotor to follow a set of waypoints, each time with different PID gains.

We shall use lab8_part1_pid.py to control the CrazyFlie quadrotor. The program allows the user to set the PID gains for the position and velocity controllers. Upon execution, the program instructs the quadrotor to take off, follow the selected set of waypoints, and land, while recording the quadrotor’s position throughout the experiment.

There are two sections of the program you may want to change:

1) Waypoints

The waypoints are given in reference to the world coordinate frame, which is aligned with the vehicle body frame when the program is executed. X is aligned with forward direction, Y with the leftward direction, and Z points upward.

You may change target waypoints to your liking, but make sure:

2) PID Gains

This is the part of the code where you can change the PID gains.

You should read the code to make sure you understand what to expect. After the program is finished, a log would be generated with the name lab8_log.npy. Make sure you change the name of this file before running the next experiment, otherwise it would be overwritten.

To view the log, run lab8_part1_plot.py. If you have changed the name of the log, edit the following line in lab8_part1_plot.py to read the correct log.

You should see the following figures (3D plot appears as the first figure is closed):

Using these graphs, you will need to compare control performance with different gains in your lab report. Use the following gains for your experiments:

  • Gain Set #1: Nominal Gain in Table 2

  • Gain Set #2: Higher

  • Gain Set #3: Higher

Table 3 Gain Set #2

Table 4 Gain Set #3

Procedure

  1. Change PID gains to gain set #1

  2. Run python3 lab8_part1_plot.py

  3. Change log name, view log

  4. Change PID gains to gain set #2

  5. Run python3 lab8_part1_plot.py

  6. Change log name, view log

  7. Change PID gains to gain set #3

  8. Run python3 lab8_part1_plot.py

  9. Change log name, view log

  10. Compare three logs, discuss the difference, and explain how each gain affects the outcome

Part B: Obstacle Avoidance Using a Distance Sensor

This part of the experiment will examine the obstacle avoidance for a small quadcopter. Obstacle avoidance is becoming increasingly important in small drone applications. This lab will use the quadrotor’s proximity sensor to detect objects in front of the drone. The concept can be extended to detect objects on all sides.

The addition of obstacle avoidance capabilities is essential for indoor quadrotor flight. While the piloting of the quadrotor is the inner-loop control, the obstacle avoidance can be considered the outer-loop control, overriding the pilot’s inputs to prevent a collision.

The proximity sensor must be used in conjunction with an appropriate obstacle avoidance algorithm that is relevant to the flight conditions and scenario. In the case of this lab, the quadrotor will be not be allowed to come within 40 cm of the object in front of it. A minimum distance of 40 cm should therefore always be maintained. The quadrotor will set a velocity in the direction opposite to the incoming object. As another example, an algorithm could also be created to maintain proximity to a nearby object, i.e., maintaining a distance of 40 cm away from a target. This type of algorithm would be useful in swarm or teammate following applications.

For this experiment, we will try to mimic static obstacles and incoming obstacles. To mimic static obstacles, we place an obstacle within the safety margin and see how the vehicle reacts to it. For an incoming obstacle, we move the obstacle closer to the vehicle and see how the vehicle reacts.

The file lab8_part2_push.py. contains the following two functions:

1) is_close

This function determines whether there is an obstacle within the given minimum distance.

2) main

Review carefully the code listed above, for discussion in the final report. To land the CrazyFlie, slowly put your hand on top of the vehicle.

Procedure

  1. Place the CrazyFlie in the center of the floor mat and away from any other objects.

  2. Open lab8_part2_push.py

  3. Make sure the MIN_DISTANCE is set to 0.4 meters.

  4. Make sure the VELOCITY is set to 0.5 m/s.

  5. Run lab8_part2_push.py:

    python3 lab8_part2_push.py

  6. The CrazyFlie should reach a steady hover before interfering. Place your hand or a flat object in front of the push sensor and observe as the CrazyFlie maintains a minimum distance of 0.2 m from the incoming object. Make observations regarding the return to steady state hover.

  7. Try to imitate a static obstacle with your hand or object, commanding the CrazyFlie to maintain the minimum distance.

  8. Save the position data.

  9. Try to imitate an incoming obstacle with an object moving slower than 0.5m/s.

  10. Save the position data.

  11. Try to imitate an incoming obstacle with an object moving faster than 0.5m/s. Do not hit the vehicle!

  12. Save the position data.

  13. Close everything. DO NOT SAVE THE CHANGES.

Analysis & Lab Report

Part A

  • Plot all data sets and discuss the differences. You can directly import csv file into Matlab for plotting. Your plots should look like example plots shown in Figure 8.4.

  • Discuss and explain your observations of the hover performance of the Crazyflie flight very close to the ground.

  • Discuss the impact of increasing the proportional and derivative gains on the waypoint controller performance.

Part B

  • Plot all datasets and include a brief discussion on your experimental observations and the plotted results.

  • Discuss the observed vehicle response to stationary versus moving obstacles.

  • Discuss any important changes to the obstacle avoidance algorithm in lab8_part2_push.py you would suggest for it to be useful for flying through a field of stationary and moving obstacles.

A. System Identification (Week 1) last check

Introduction

The Quanser Aero Experiment can be configured as a conventional dual-rotor helicopter, as shown in Figure 1. The front rotor that is horizontal to the ground predominantly affects the motion about the pitch axis while the back or tail rotor mainly affects the motion about the yaw axis (about the shaft).

The tail rotor in helicopters is also known as the anti-torque rotor because it is used to reduce the torque that the main rotor generates about the yaw. Without this, the helicopter would be difficult to stabilize about the yaw axis. Because the rotors on the Quanser Aero Experiment are the same size and equidistant from each other, the tail rotor also generates a torque about the pitch axis. As a result, both the front and back/tail rotors generate a torque on each other.

Background

Equations of Motion

The free-body diagram of the Quanser Aero Experiment is illustrated in Figure 2.

The following conventions are used for the modeling:

  • The helicopter is horizontal and parallel with the ground when the pitch angle is zero, i.e., .

  • The pitch angle increases positively, , when the front rotor is moved upwards and the body rotates clockwise (CW) about the Y axis.

  • The yaw angle increases positively, , when the body rotates counter-clockwise (CCW) about the Z axis.

  • Pitch increases, , when the front rotor voltage is positive .

  • Yaw increases, , when the back (or tail) rotor voltage is positive, .

When voltage is applied to the pitch motor, , the speed of rotation results in a force, that acts normal to the body at a distance from the pitch axis. The rotation of the propeller generates a torque about the pitch rotor motor shaft which is in turn seen about the yaw axis. Thus, rotating the pitch propeller does not only cause motion about the pitch axis but also about the yaw axis. As described earlier, that is why conventional helicopters include a tail, or anti-torque, rotor to compensate for the torque generated about the yaw axis by the large, main rotor.

Similarly, the yaw motor causes a force that acts on the body at a distance from the yaw axis as well as a torque about the pitch axis.

The equations of motion can be approximated after neglecting reaction torques from the rotors:

​

where the torques acting on the pitch and yaw axes are

​

The parameters used in the EOMs above are:

  • : the total moment of inertia about the pitch axis

  • : the damping about the pitch axis

  • : the stiffness about the pitch axis

  • : the total moment of inertia about the yaw axis

  • : the damping about the pitch axis

  • : torque thrust gain from the pitch rotor

  • : torque thrust gain from the yaw rotor

  • : cross-torque thrust gain acting on the pitch from the yaw rotor

  • : cross-torque thrust gain acting on the yaw from the pitch rotor

  • : voltage applied to the pitch rotor

  • : voltage applied to the yaw rotor motor

The total moment of inertia acting about the pitch and yaw axes are

Expressing the rotor as a single-point mass, the inertia acting about the pitch or yaw axis from a single rotor is . Modeling the helicopter body as a cylinder rotating about its center, the inertia is . Finally, the forked yoke that rotates about the yaw axis can be approximated as a cylinder rotating about its center as well and expressed as . Evaluating the moment of inertia using the parameters listed in the Quanser Aero Experiment User Manual gives:

First-Order Response

The step response of a first-order transfer function

where K is the DC or steady-state gain and τ is the time constant as illustrated in Figure 3. This is for a system with and .

To obtain the time constant from the response, find the time it takes to reach or 63% of its final steady-state value:

The time constant is , where is the start time of the step and is the time it takes to reach 63% of the final value, as illustrated in Figure 3.

To find the time constant from first-order response from an impulse (or short step) as depicted in Figure 4, find the time it takes for the response to reach or 37% of its final steady-state value.

In this case we need to find

and the time constant is

Second-Order Response

The free-oscillatory equation of motion of a second-order system is described by

is shown in Figure 4. Assuming the initial conditions , the Laplace transform of Equation (9) is

The prototype second-order equation is defined

where is the damping ratio and is the natural frequency. Equating the characteristic equation in Equation (10) to this gives

​

Finding the Natural Frequency

The period of the oscillations in a system response can be found using the equation

where is the time of the oscillation, is the time of the first peak, and is the number of oscillations considered. From this, the damped natural frequency (in radians per second) is

and the undamped natural frequency is

Finding the Damping Ratio

The damping ratio of a second-order system can be found from its response. For a typical second-order underdamped system, the subsidence ratio (i.e. decrement ratio) is defined as

where is the peak of the first oscillation and is the peak of the oscillation. Note that > , as this is a decaying response. The damping ratio can then be found using

Estimating the Viscous Damping Coefficients

The viscous damping coefficients acting about the pitch and yaw axes, and in Equation (1) and Equation (2), can be found from the free-oscillation response. The free-oscillation response about the pitch and about the yaw are different, however.

Pitch Axis: By locking the yaw axis (using the Allen key supplied), this allows us to focus on the 1 DOF pitch-only system. Apply a short step voltage to mimic an impulse and get the free-oscillation response of the pitch. Remark that the impulse response is second-order free-oscillation response. The resulting 1 DOF pitch-only equations of motion is

Taking its Laplace transform gives

Assuming the initial velocity is zero, , and solving for position we get

The pitch free-oscillation transfer function matches the prototype second-order transfer function in Equation (10) Based on the measured damping ratio and natural frequency of the response, the friction (or stiffness) of the system is

and the viscous damping is

Yaw Axis: The 1 DOF yaw-only equations of motion is

In terms of angular rate, the equation becomes

where . Taking its Laplace transform

and solving for the speed we get

The yaw free-oscillation transfer function matches the prototype first-order transfer function in Equation (7). Based on the measured time constant of the response, its damping can be found with

Estimating the Thrust Parameters

By locking the yaw axis, this allows us to focus on the 1 DOF pitch-only system, i.e., eliminating any motion introduced in the yaw axis when applying a voltage to the pitch rotor. The equations of motion for the 1-DOF actuated system is

Solving for the thrust gain we get

Remark that this is the thrust torque gain parameter. To force thrust gain would be , where is the distance between the helicopter pivot and the center of the pitch rotor. Similarly, to find the thrust gain acting on the yaw axis only system, lock the pitch axis, and apply a voltage to the tail rotor. This system is represented by

or,

where is the angular rate of the yaw axis. The yaw torque thrust gain is

The cross-torque thrust parameters, and in Equation (3) and (4), represent the coupling between the axes. To find the cross-torque acting on the pitch axis from a torque applied to the tail rotor, unlock both pitch and yaw axes such that it is free to move in 2 DOF, apply a voltage to the tail rotor, and examine the response of the pitch. The equations representing these dynamics when , are

Putting this in terms of angular rate, , and solving for the gain we get

Similarly, to identify the cross-torque gain parameter that is generated about the yaw axis from a pitch torque (i.e. voltage applied to the front rotor), we have the equation

and the gain can be found using

Week 1: System Identification

Experimental Steps for Finding System Parameters

First download the zip file below and extract it in the desktop:

1. Finding Pitch Damping, and pitch trust gain

1) Lock the yaw axis to enable motions about the pitch axis only. (place the allen key to lock yaw axis and make sure that the pitch axis is free to rotate, loosen two screws)

2) Open the q_aero_free_osc_response_pitch SIMULINK file.

3) Select a (-20) V impulse

4) Select simulation time 30 sec.

5) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

6) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

7) Copy aero_pitch_free_osc_rsp.mat to your folder. Data is saved in following order: 1: Time (s) 2: Pitch input (V) 3: Pitch position (rad) 4: Pitch speed (rad/s)

8) Close the SIMULINK model. DO NOT SAVE THE CHANGE

3. Finding Yaw Damping ,

1) Unlock the yaw axis

2) Lock the pitch axis

3) Open the q_aero_free_osc_response_yaw SIMULINK file.

4) Apply an impulse of 20V to the tail rotor

5) Select simulation time 10 sec.

6) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

7) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

8) Copy aero_yaw_free_osc_rsp.mat to your folder Data is saved in following order: 1: Time (s) 2: Yaw input (V) 3: Yaw position (rad) 4: Yaw speed (rad/s) 5: Yaw acceleration (rad/s^2)

9) Close the SIMULINK model. DO NOT SAVE THE CHANGE.

4. Finding Yaw thrust gain,

1) Open the q_aero_step_response_yaw SIMULINK file.

2) Select a step voltage 15V

3) Select simulation time 40 sec.

4) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

5) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

6) Copy aero_yaw_step_rsp.mat to your folder Data is saved in following order: 1: Time 2: Yaw input (V) 3: Yaw position (rad) 4: Yaw Speed (rad/s)

7) Close the SIMULINK model. DO NOT SAVE THE CHANGE.

5. Identifying the cross-torque gain parameter

1) Unlock both the pitch and yaw axes to enable the full 2 DOF motion.

2) Open the q_aero_step_response_pitch_from_yaw SIMULINK file.

3) Select yaw step voltage to 12V and pitch to 0V.

4) Select simulation time 40 sec.

5) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

6) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

A pitch up motion must be seen due to torque from the tail rotor.

7) Copy aero_pitch_from_yaw_step_rsp.mat to your folder Data is saved in following order: 1: Time (s) 2: Yaw input (V) 3: Pitch Position (rad) 4: Pitch Speed (rad/s)

8) Close the SIMULINK model. DO NOT SAVE THE CHANGE.

6. Identifying the cross-torque gain parameter

1) Open the q_aero_step_response_yaw_from_pitch SIMULINK file.

2) Select pitch step voltage to 12V and yaw to 0V.

3) Select simulation time 40 sec.

4) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

5) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

A yaw motion must be seen due to torque from front motor.

6) Copy aero_yaw_from_pitch_step_rsp.mat to your folder Data is saved in following order: 1: Time (s) 2: Pitch input (V) 3: Yaw Position (rad) 4: Yaw Speed (rad/s)

7) Close the SIMULINK model. DO NOT SAVE THE CHANGE.

Analysis (should be done before week 2 and Controller design)

  1. Find the natural frequency and damping ratio from the impulse response of the pitch axis (HINT: first find the peaks and use equation 16, 17, and 18). Then find the stiffness and viscous damping coefficient about the pitch axis (Hint: equation 22,23).

  2. Find the time constant from the yaw pulse response and obtain the damping . Use First-order impulse decaying response. To find the time constant, examine the decaying response that starts at an initial maximum speed and settle down to 0 rad/s (use equation 8b). If data obtained does not fully shows the 37% try estimate the value by curve fitting.

  3. Find the thrust and cross-torque thrust gain parameters by performing discrete derivative to peak values or from the steady state of step response.

Problem Set

Important instructions for Lab 0 report: There is no need to prepare Lab 0 report using the specified lab report format. Just do it as homework, individually. Prepare your report using a word processor, convert it into a PDF file, and submit your work as a single PDF file on Canvas by the deadline. Begin each problem on a new sheet and answer the problems in order. Make sure to do the following: (i) Include all your work for each problem. If not, your work will not be graded and you will receive a zero. (ii) In each plot, include figure label, axes labels with units, legend, etc. (iii) Use a text font of at least 10 in all your plots and SIMULINK diagrams. (iv) Use different line types in case of multiple lines in the same plot and use a legend to clearly identify individual lines. (v) Include your MATLAB scripts and SIMULINK block diagrams in your report.

MATLAB & SIMULINK

It is critical that you read following two pdf files to know how to use MATLAB and SIMULINK to perform well in this course.

Problem 1 (10 points)

The longitudinal dynamic model of a Boeing 747 aircraft flying at a speed 870 ft/s is obtained as

where u change in flight speed expressed as a fraction of the equilibrium speed (non- dimensional) change in angle of attack from trim, rad q pitch rate, rad/sec change in pitch attitude from trim, rad change in elevator deflection from trim, rad

To Input this to MATLAB, type or copy and paste the following commands:

Answer the following questions:

For Problem 1, a printout of your MATLAB script with the answers written in the script using comments is acceptable. Attach the plots that have been asked.

(i) Find the eigenvalues and eigenvectors of the system matrix. (1 point)

In MATLAB, use [V,D] = eig(A)to return diagonal matrix D of eigenvalues and matrix V whose columns are the corresponding right eigenvectors, so that A*V = V*D.

(ii) Obtain the transfer function between the pitch attitude and the elevator control input. (2 points)

In MATLAB, use [num,den]=ss2tf(A,B,C,D). num is the numerator of the transfer function, and den is the denominator. Then, to get a Transfer function, type G1=tf(num,den).

(iii) Obtain the poles of the transfer function of part (ii). Compare the poles of the transfer function with the eigenvalues of part (i). (2 points)

There are several ways to do this. One way is by typing zpk(G1). You get a transfer function in gain/zeroes/poles format. You can also type [z, p, k] = zpkdata(G1), which gives vectors containing zeroes (z), poles (p) and gains (k). Another is using the function pzmap(). Type ‘help pzmap’ to learn how it works.

(iv) Compute the damping ratios, natural frequencies, damped frequencies and time periods of the individual modes. (2 points)

There are several ways to get these values from eigenvalues (or alternatively from poles) of the system. Alternatively, you may use the ‘damp’ command in MATLAB. Use help to figure out how to use the damp command.

(v) Using the transfer function of part (ii), obtain frequency response plots (Bode plots). (1 point)

Type bode(G1). You get the Bode plot.

(vi) Plot the pitch attitude and pitch rate responses to a step elevator input of 0.02 rad. (2 points)

Remember that the C matrix of the system used so far implied that θ is the only output. To plot the response of both q and θ, C should be modified to: C= [0 0 1 0; 0 0 0 1]. Then, D becomes [0 ; 0]. Now, the new system can be defined by: G3 = ss(A,B,C,D) . Then, get the response to a step input of 0.02 rad using step(0.02*G3).

Problem 2 (10 points)

​Consider the following block diagram of a feedback control system:

Given

design a lead compensator

such that the phase margin is 60, the gain margin is not less than 10 dB, and the static velocity error constant Kv is 0.75. Your final answer should have the desired values of K, a and b. Plot the unit step response of the closed-loop system.

Note that the velocity error constant (refer to AE3531 notes) is defined as

Hence, for selected values of a and b, the value of K is determined using the specified value of the velocity error constant.

Input the transfer functions G and C to MATLAB by typing: G=tf( [1] , [1 3 2 0] ) C=3*tf( [1 0.5] , [1 1] ) Alternatively, the following commands can be used. s=tf(‘s’) G=1/(s*(s+1)*(s+2)) C=3*(s+0.5)/(s+1)

Note that arbitrary initial values of and were chosen. The value of was chosen so as to meet the specified value of the velocity error constant.

Launch the Control System Designer using:

controlSystemDesigner(G,C) [all MATLAB versions]

or

rltool(G,C) [only MATLAB R2020b or older].

Under the Control System tab, select "Tuning Methods", and subsequently choose the "Bode Editor" located under the "Graphical Tuning" section. Then, in the field "Select Response to Edit", choose "LoopTransfer_C" which corresponds to the open-loop transfer function and click "Plot". You should see in front of you, the root locus, and the Bode plot. If you double-click on ‘C’ in the controllers and fixed blocks, a small window will open with the controller transfer function.

Now try adjusting the pole and zero locations of the compensator C on the Bode plot so as to meet the specified values of phase and gain margins. Note that the Control System Designer uses the controller transfer function in the form , which is displayed on the screen. When you change the locations of the pole and zero of the controller (using the cursor), you will observe that the gain and phase margins change in the Bode plot. Adjust the pole and zero locations to achieve the required design criteria. Once the desired criteria are achieved, you will need to convert the Control System Designer compensator C which is of the form to the form to get (you could also check these from the "Preview" tab when "C" is selected from the "Controllers And Fixed Blocks" tab). To plot the closed-loop system response to step input (if it does not automatically open when Control System Designer is launched), go to the "Data Browser" window, and under "Responses", click on "IOTransfer_r2y". Then, right-click on it and select "plot" -> "step". Alternatively, you can go to the "Analysis" section in the top menu bar, click on "New Plot" and select "New Step". Then, in the "Select Response to Plot" field, choose "IOTransfer_r2y" and click "Plot".

Print the Bode, root locus, and time response plots.

Problem 3 (10 points)

An engineering laboratory has presented a plan to operate an Earth-orbiting satellite that is to be controlled from a ground station. A block diagram of the proposed system is shown in the figure. It takes T seconds for the signal to reach the spacecraft from the ground station and an identical delay for the return signal. The proposed ground-based controller is a proportional-derivative (PD) controller. Assume no transmission delay (i.e., T=0), and design a controller to the following specifications: (i) percent overshoot of 8% to a unit step input, and (ii) time to peak roughly at 2 sec to a unit step input. Compute the closed loop system damping ratio and natural frequency and phase margin with the controller in the loop but assuming a zero transmission time delay. Estimate the amount of allowable time delay for a stable system from the phase margin calculation.

Similar to Problem 2, launch Control System Designer, with , and , using an arbitrary value for, for example

Note that the Delay blocks reduce to unity at this point. In Control System Designer, choose "IOTransfer_r2y". To plot the step response, right-click on "IOTransfer_r2y" and choose "plot" -> "step". A step response will be plotted. You can right-click on the graph, and choose “Characteristics” -> “Peak Response” to read the peak value (and thus the percent overshoot) and time to peak directly off the graph.

Now adjust the value of the gain and (i.e., zero location of the controller) to achieve the required design criteria. Print the root locus and the time response plot. To find the closed-loop system poles, click on the purple squares on the root locus plot and at the bottom of the window, you will see pole location, damping ratio, and frequency. Find the phase margin of the system with the controller (still assuming no transmission delay) from the “Open Loop Bode” plot of the system. The maximum allowable time delay if there is just one time delay present can be calculated by the formula: Time delay = Phase margin in rad/Gain crossover frequency. The gain crossover frequency can be read off the Bode plot. With two time delay blocks, the maximum allowable time is reduced to half of its value with one time delay block.

Problem 4 (10 points)

Consider the differential equation given by:

A SIMULINK model for this system is given in the following figure:

Using the figure as a guide, create your own Simulink model. For , , plot the position and the velocity over the time interval [0, 25] sec for the following cases. (i) r(t) is a unit step input, and zero initial conditions

(ii) r(t) is zero,

(iii) r(t) is zero,

(iv) r(t) is a sinusoidal input of amplitude of 3 and frequency of 2 rad/s, i.e., and .

Note that the output of the first integrator is the velocity , and the output of the second integrator is the position . To start a new model in SIMULINK, simply choose “File” ->“New”->”Model” from the MATLAB menu. To output position and velocity, use the ’To Workspace’ block to export the data to MATLAB. The ‘To Workspace’ block can be found in the “Sinks” group. Remember to change the data type to array by double-clicking the block. The data can then be plotted against time (the tout variable) in MATLAB. Alternatively, you can also use ‘Scope’ from the “Sinks” group to create plots on the screen, and then use ‘print figure’ under ‘File’ in the ‘Scope’ menu. You can use the figure menu to include x-label, y-label, legend, etc.

Problem 5 (10 points)

The following differential equation describes the dynamics of a system:

where ​ is the system output, and is the control input. It is required to implement a proportional plus derivative controller (PD controller) with control law of the form

Draw a SIMULINK block diagram for this system with as the input and as the output.

Use

Simulate the closed-loop system response to the following command inputs of :

(a) pulse input of unit magnitude and pulse width of 2 seconds starting at s.

(b) step input of magnitude 2 starting at s.

Print out your SIMULINK diagram, command input plots and response plots.

Substitute the given control law into the dynamic model of the system and use the resulting equation to create your SIMULINK model.

Problem 6 (10 points)

Develop the following block diagram in SIMULINK. The “Zero Order Hold” block accounts for the sampling time in digital control systems. Run the simulation for a sampling time of 0.2, 0.5, 0.8, 1.5 and 2 seconds, for a period of 30 sec. Plot these 5 graphs superimposed on the same axis. What is the effect of sampling time on system response?

Problem 7 (20 points)

Refer to question 1 for the state space matrices A and B as well as the defined state vector. You will need to determine the C and D matrices as needed. Using SIMULINK, create a conventional proportional controller for a pitch angle command system, using a gain of , i.e., . Simulate the response over a time range of to . Use a pitch angle pulse command input of magnitude of rad, pulse width of and the pulse starting at and ending at . Create plots of pitch angle command , pitch attitude and altitude () versus time.

Note that climb rate () is related to and by the following linearized equation: The flight speed V equals 870 ft/sec for this problem. With angle of attack () and pitch attitude () as outputs, obtain C and D matrices. Since there are two outputs in this problem, C is a 2x4 matrix and D is a 2x1 matrix. Use the Demux block to get and pitch attitude . To simulate a pulse input, combine step and negative step with a delay in starting times between them equaling the pulse width. Use the following SIMULINK diagram as a guide to creating your own SIMULINK model for this problem.

Show the SIMULINK model, C and D matrices, a plot of pitch attitude command and pitch attitude response (both on the same plot) versus time and a plot of climb rate response versus time. You should only need the following blocks in SIMULINK: step input, sum, gain, state space, demux and workspace blocks.

Problem 8 (20 points)

Your task is to design a position controller for a spacecraft. The spacecraft has a mass of 4000 kg, and you can idealize it as a point mass. There is a thruster on each axis, 3 perpendicular axes total. These thrusters allow both pushing and pulling forces (this way we don’t need 6). You can directly control how much thrust is applied to each thruster, positive or negative, in units of Newtons, where positive thrust will move the spacecraft in the positive axis direction. The thrust F = 1000u, where u is the thruster input (the input to your plant). Design a position controller using feedback from your IPS (interstellar position system), which outputs in units of meters. (Assume that when you start using your controller you will reset the system to output a value of 0m on each axis.) Use a PD controller.

i) First, do this by creating a state space model of your system. You should assume that the spacecraft’s IPS system is perfect, and simulate its output through the use of the state variables that you define. Remember that the only information the IPS provides is displacement. (Output from your plant should not include velocities.) You will need to show the A, B, C, and D matrices that you create. You will put this model into SIMULINK using the SS block.

First, obtain the equations of motion. With X, Y, Z as inertial position and U, V, W as inertial velocity components, then

​where is the spacecraft mass and are the total external force components along the inertial X, Y, Z axes, respectively. If only forces acting on the spacecraft are the forces from the thrusters, then

​where and are the control inputs to the thrusters. The above set of equations can be rearranged as

​By defining the state vector as

​the control vector as

and the output vector as

obtain the A, B, C and D matrices needed in the SS block of your SIMULINK model.

ii) Create your control system in SIMULINK. (You can only use variables that the IPS provides, or functions of those variables, as feedback to the control system. For now, assume that you can take the derivative of these variables, but note that in general taking the derivative of experimental digital variables is a BAD thing!) Then use it to determine gains that work. (You don’t have to optimize your gains, we will do that during the semester in lab, just pick something that gives a decent response. You may test your model using a step input on each axis if you wish.)

Use the mux block to combine into the control vector u needed as input to the SS block. Likewise, use demux block to obtain position components X, Y, Z from the output vector y of the SS block.

iii) Next, simulate your control system for the following hypothetical situation. During a trip through interstellar space, an enemy ship intercepts your path and locks on with a tractor beam. Their ship has matched your velocity and is located at (-100, -200, -100), in meters, with respect to you. The tractor beam is pulling your ship towards theirs with 5000 N of force. Your response to this attack is to reposition your ship at coordinates (10, 5, 4) to get out of their firing path. (Assume that your movement won’t change the tractor beam orientation enough to matter. Remember that in interstellar space speed is relative, so it doesn’t matter how fast you were originally moving, and that your original position at the time of attack is the origin of your coordinate system.)

You need to turn in your simulation responses for each axis, include both the command input and the response on the same plot. Also, turn in your SIMULINK model, with labels, and all state space matrices, with the state, control, and output vectors defined, as well as any gains that you used. (Do not use the PID block in SIMULINK, ever. You should use the following blocks: state space, summation, constant source, step input, output to workspace, gain, mux, and demux.)

Note that for this case, the external forces considered in (i) need to be modified to include the force from the tractor beam. The magnitude of the force from the tractor beam is given as a constant equal to 5000 N with its direction aligned with the line-of-sight at the start of the simulation, i.e., the line joining the spacecraft position coordinates at t=0, i.e., the origin, and the position of the ship located at (-100, -200, -100). Then the external forces become

​The force from the tractor beam can be included in the SIMULINK as a bias to your control inputs, which are proportional to forces, by amounts that represent the effect of the tractor beam, so that you do not have to modify your original model. Your SIMULINK diagram should basically have three copies of the same control system. Include the force bias term for each loop separately (Important Note: Do not use a vector representation to solve this problem). An example of the x-position loop is shown in the following figure:

Appendix

B. Control Design & Implementation (Week 2)

Controller Design

Background

Linear State-Space Representation

Given the linear state-space equations: and , we define the state for the Quanser Aero Experiment as

the output vector as

and the control variables as

where and are the pitch and yaw angles, respectively, and and are the motor voltages applied to the pitch and yaw rotors (i.e. the main and tail rotors). Using the equations of motion in Equations (1) and (2), the state-space matrices are

​

In this section, a state-feedback controller is designed to regulate the pitch and yaw angles of the Quanser Aero Experiment to desired angles. Using the previous state-space model, we can find a control gain based on the coupled dynamics to stabilize the system. The control gains are computed using Linear-Quadratic Regulator (LQR) theory. The general state-feedback control is illustrated in Figure 11. The state-feedback controller is defined

where is the state defined in Equation (38)

is the reference command (or setpoint) state with the desired pitch and yaw angles, and , and

is the control input where is the front/pitch motor voltage and is the tail/yaw motor voltage.

Linear Quadratic Regulator (LQR) optimization can be used for finding the control gain parameters of the Quanser Aero Experiment flight control. Given the state-space representation, the LQR algorithm computes a control law to minimize the performance criterion or cost function:

The design matrices and hold the penalties on the deviations of state variables from their setpoint and the control actions, respectively. When an element of is increased, therefore, the cost function increases the penalty associated with any deviations from the desired setpoint of that state variable, and thus the specific control gain will be larger. When the values of the matrix are increased, a larger penalty is applied to the aggressiveness of the control action, and the control gains are uniformly decreased.

Since there are four states , , and two control variables, . The setpoint, (Equation 43) is given above the control strategy used to minimize cost function J is thus given by

Designing an LQR Controller

Various control software already has LQR optimization routines that can be used to generate the state feedback control gain . In order for the closed-loop response to satisfy certain time-domain specifications, the closed-loop system is typically simulated using its dynamic model, in software, first. This is an iterative process. By adjusting the weighting matrices and and then running the simulation, we can find a control that satisfies the user's requirements. Further, we must ensure that the control signal is smooth (i.e. does not chatter) and does not surpass the limits of the actuator.

LQR Control Design and Simulation

LQR is used to find the state-feedback control gain ( is matrix) that will stabilize the Quanser Aero Experiment to the user's desired pitch and yaw angles. Our desired closed-loop response should match the following specifications. Use MATLAB command K = lqr(A,B,Q,R) to obtain gain, , matrix.

Desired closed-loop response specifications for pitch

  1. Steady-state error: pitch ≤ 2 , yaw ≤ 2 .

  2. Peak time: ≤ 2 s.

  3. Percent Overshoot: ≤ 7.5%.

  4. No actuator saturation: ≤ 24V and ≤ 24V .

The state-space matrices derived in Equation (41) are entered in the State-Space block in SIMULINK and the control gain is set to the MATLAB variable K.

Running the closed-loop state-feedback LQR simulation

  1. Using parameters from Part A, obtain state-space matrices of the system neglecting coupling effect.

  2. Design , and . To start with try with following , and . Q = diag([200 75 0 0 ]); R = 0.01*eye(2,2); K = lqr(A,B,Q,R)

  3. Build the SIMULINK model of the system

  4. Simulate the closed-loop response of the system with pitch-only command: . (Make sure to change deg to rad in SIMULINK)

  5. Simulate the closed-loop response of the system with yaw only command: . (Make sure to change deg to rad in SIMULINK)

  6. Simulate the closed-loop response of the system with pitch and yaw command: and . (Make sure to change deg to rad in SIMULINK)

  7. Check whether your controller meets the desired specifications.

  8. If it fails to meet the specifications, tune and/or to meet the specifications

  9. Save the data and plot the closed-loop system response for pitch and yaw

  10. Now, use system matrices with coupling effect and use the controller without coupling

  11. Repeat steps 4-6

  12. The closed-loop response in this step does not have to meet the desired specifications

  13. Now, design , and with the coupling effect

  14. Build the SIMULINK model of the system

  15. Repeat steps 4-6

  16. Check whether your controller meets the desired specifications.

  17. If it fails to meet the specifications, tune and/or to meet the specifications

  18. Save the data and plot the closed-loop system response for pitch and yaw

Things to check

Analysis

  1. What happened when you neglect the coupling effect?

  2. Is there any systematic way to design and ?

Controller Implementation

In this section, the state-feedback control is implemented on the Quanser Aero Experiment using the q_aero_2dof_lqr_control SIMULINK diagram shown in Figure 12 with QUARC.

Download the file into the quanser_aero folder that was used for Week 1.

Desired Closed-Loop Response Specifications

  1. Steady-state error: pitch ≤ 2 , yaw ≤ 2 .

  2. Peak time: ≤ 2 s.

  3. Percent Overshoot: ≤ 7.5%.

  4. No actuator saturation: ≤ 24V and ≤ 24V .

Running the closed-loop state-feedback LQR simulation

Neglecting Coupling Effect

Pitch Command Only

  1. Unlock both pitch and yaw axes to enable the full 2 DOF motion.

  2. Open q_aero_2dof_lqr_control SIMULINK file.

  3. Use the gain obtained in Part B. neglecting the coupling effect.

  4. Use pitch command (10 deg) only by changing Amp_y to zero.

  5. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  6. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  7. Copy aerolqrrsp.mat to your own folder and rename it as nocouple_pitch_only.

  8. Examine the obtained closed-loop response and see if it matches the desired specifications.

Yaw Command Only

  1. Use a yaw command (45 deg) only by changing Amp_p to zero.

  2. Run SIMULINK

  3. Copy aero_lqr_rsp.mat to your own folder and rename it as nocouple_yaw_only.

  4. Examine the obtained closed-loop response and see if it matches the desired specifications

Both Yaw and Pitch

  1. Use both pitch and yaw command

  2. Run SIMULINK

  3. Copy aerolqrrsp.mat to your own folder and rename it as nocouple_pitch_yaw.

  4. Examine the obtained closed-loop response and see if it matches the desired specifications

With Coupling Effect

  1. Use the gain obtained in Part B. with the coupling effect.

  2. Repeat above Pitch Only, Yaw Only and both Yaw and Pitch runs and rename the files as couple_####_###.

  3. Close the Simulink. DO NOT SAVE THE CHANGE!

Analysis Question

  1. Did your controller successfully meet the specs? If not, why?

  2. How does the coupling affect the performance of the controller?

  3. How can we improve the controller?

A. System Identification

Introduction

The Quanser Aero Experiment can be configured as a conventional dual-rotor helicopter, as shown in Figure 1. The front rotor that is horizontal to the ground predominantly affects the motion about the pitch axis while the back or tail rotor mainly affects the motion about the yaw axis (about the shaft).

The tail rotor in helicopters is also known as the anti-torque rotor because it is used to reduce the torque that the main rotor generates about the yaw. Without this, the helicopter would be difficult to stabilize about the yaw axis. The rotors on the Quanser Aero Experiment are the same size and equidistant from each other, the tail rotor also generates a torque about the pitch axis. As a result, both the front and back/tail rotors generate torques on each other.

Background

Pitch Stiffness

The Quanser 2D AERO is designed with its mass distribution well balanced from the front and back rotors such that its center of gravity is at the mid-point between the two rotors. However, a vertical offset of the cg location is included to result in pitch stiffness from the pendulum effect as depicted in the Figure.

The system is in static equilibrium when it is horizontal and parallel to the ground with zero pitch angle. Any change in pitch angle gives rise to a restoring moment from the pendulum effect given by restoring pitch moment due to pitch angle change =

Equations of Motion

The free-body diagram of the Quanser Aero Experiment is illustrated in Figure 2.

The following conventions are used for the modeling:

  • The helicopter is horizontal and parallel with the ground when the pitch angle is zero, i.e., .

  • The pitch angle increases positively, , when the front rotor is moved upwards and the body rotates clockwise (CW) about the Y axis.

  • The yaw angle increases positively, , when the body rotates counter-clockwise (CCW) about the Z axis.

  • Pitch increases, , when the front rotor voltage is positive .

  • Yaw increases, , when the back (or tail) rotor voltage is positive, .

When voltage is applied to the pitch motor, , the speed of rotation results in a force, that acts normal to the body at a distance from the pitch axis. The rotation of the propeller generates a torque about the pitch rotor motor shaft which is in turn seen about the yaw axis. Thus, rotating the pitch propeller does not only cause motion about the pitch axis but also about the yaw axis. As described earlier, that is why conventional helicopters include a tail, or anti-torque, rotor to compensate for the torque generated about the yaw axis by the large, main rotor.

Similarly, the yaw motor causes a force that acts on the body at a distance from the yaw axis as well as a torque about the pitch axis.

The equations of motion can be approximated as:

​

where the torques acting on the pitch and yaw axes are

​

The parameters used in the EOMs above are:

  • : the total moment of inertia about the pitch axis

  • : the damping about the pitch axis

  • : the stiffness about the pitch axis

  • : the total moment of inertia about the yaw axis

  • : the damping about the pitch axis

  • : torque thrust gain from the pitch rotor

  • : torque thrust gain from the yaw rotor

  • : cross-torque thrust gain acting on the pitch from the yaw rotor

  • : cross-torque thrust gain acting on the yaw from the pitch rotor

  • : voltage applied to the pitch rotor

  • : voltage applied to the yaw rotor motor

The total moment of inertia acting about the pitch and yaw axes are

Expressing the rotor as a single-point mass, the inertia acting about the pitch or yaw axis from a single rotor is . Modeling the helicopter body as a cylinder rotating about its center, the inertia is . Finally, the forked yoke that rotates about the yaw axis can be approximated as a cylinder rotating about its center as well and expressed as . Evaluating the moment of inertia using the parameters listed in the Quanser Aero Experiment User Manual gives:

First-Order Response

The step response of a first-order transfer function

where K is the DC or steady-state gain and τ is the time constant as illustrated in Figure 3. This is for a system with and .

To obtain the time constant from the response, find the time it takes to reach or 63% of its final steady-state value:

The time constant is , where is the start time of the step and is the time it takes to reach 63% of the final value, as illustrated in Figure 3.

To find the time constant from first-order response from an impulse (or short step) as depicted in Figure 4, find the time it takes for the response to reach 37% of its initial pulse response.

In this case we need to find

and the time constant is

Second-Order Response

The free-oscillatory equation of motion of a second-order system is described by

is shown in Figure 4. Assuming the initial conditions , the Laplace transform of Equation (9) is

The prototype second-order equation is defined

where is the damping ratio and is the natural frequency. Equating the characteristic equation in Equation (10) to this gives

​

Finding the Natural Frequency

The period of the oscillations in a system response can be found using the equation

where is the time of the oscillation, is the time of the first peak, and is the number of oscillations considered. From this, the damped natural frequency (in radians per second) is

and the undamped natural frequency is

Finding the Damping Ratio

The damping ratio of a second-order system can be found from its response. For a typical second-order underdamped system, the subsidence ratio (i.e. decrement ratio) is defined as

where is the peak of the first oscillation and is the peak of the oscillation. Note that > , as this is a decaying response. The damping ratio can then be found using

Estimating the Viscous Damping Coefficients

The viscous damping coefficients acting about the pitch and yaw axes, and in Equation (1) and Equation (2), can be found from the free-oscillation response. The free-oscillation response about the pitch and about the yaw are different, however.

Pitch Axis: By locking the yaw axis (using the Allen key supplied), this allows us to focus on the 1 DOF pitch-only system. Apply a short step voltage to mimic an impulse and get the free-oscillation response of the pitch. Remark that the impulse response is second-order free-oscillation response. The resulting 1 DOF pitch-only equations of motion is

Taking its Laplace transform gives

Assuming the initial velocity is zero, , and solving for position we get

The pitch free-oscillation transfer function matches the prototype second-order transfer function in Equation (10) Based on the measured damping ratio and natural frequency of the response, the friction (or stiffness) of the system is

and the viscous damping is

Yaw Axis: The 1 DOF yaw-only equations of motion is

In terms of angular rate, the equation becomes

where . Taking its Laplace transform

and solving for the speed we get

The yaw free-oscillation transfer function matches the prototype first-order transfer function in Equation (7). Based on the measured time constant of the response, its damping can be found with

Estimating the Thrust Parameters

By locking the yaw axis, this allows us to focus on the 1 DOF pitch-only system, i.e., eliminating any motion introduced in the yaw axis when applying a voltage to the pitch rotor. The equations of motion for the 1-DOF actuated system is

Solving for the thrust gain we get

Remark that this is the thrust torque gain parameter. To force thrust gain would be , where is the distance between the helicopter pivot and the center of the pitch rotor. Similarly, to find the thrust gain acting on the yaw axis only system, lock the pitch axis, and apply a voltage to the tail rotor. This system is represented by

or,

where is the angular rate of the yaw axis. The yaw torque thrust gain is

The cross-torque thrust parameters, and in Equation (3) and (4), represent the coupling between the axes. To find the cross-torque acting on the pitch axis from a torque applied to the tail rotor, unlock both pitch and yaw axes such that it is free to move in 2 DOF, apply a voltage to the tail rotor, and examine the response of the pitch. The equations representing these dynamics when , are

Putting this in terms of angular rate, , and solving for the gain we get

Similarly, to identify the cross-torque gain parameter that is generated about the yaw axis from a pitch torque (i.e. voltage applied to the front rotor), we have the equation

and the gain can be found using

A. System Identification

Experimental Steps for Finding System Parameters

First download the zip file below and extract it in the desktop:

1. Finding Pitch Damping,

1) Lock the yaw axis to enable motions about the pitch axis only. (place the allen key to lock yaw axis and make sure that the pitch axis is free to rotate, loosen two screws)

2) Open the q_aero_free_osc_response_pitch SIMULINK file.

3) Impulse of -20V for 1.5s.

4) Select simulation time 30 sec.

5) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

6) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

7) Copy aero_pitch_free_osc_rsp.mat to your folder. Data is saved in following order: 1: Time (s) 2: Pitch input (V) 3: Pitch position (rad) 4: Pitch speed (rad/s) 5: Pitch acceleration (rad/s^2)

8) Close the SIMULINK model. DO NOT SAVE THE CHANGE

2. Finding Pitch thrust gain,

1) Open the q_aero_step_response_pitch SIMULINK file.

2) Select a step voltage 24V, (amplitude to 24)

3) Select simulation time 30 sec.

4) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

5) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

6) Copy aero_pitch_step_rsp.mat to your folder. Data is saved in following order: 1: Time 2: Pitch input (V) 3: Pitch position (rad) 4: Pitch Speed (rad/s)

7) Close the SIMULINK model. DO NOT SAVE THE CHANGE.

3. Finding Yaw Damping ,

1) Unlock the yaw axis

2) Lock the pitch axis

3) Open the q_aero_free_osc_response_yaw SIMULINK file.

4) Apply an impulse of 20V to the tail rotor for 1s.

5) Select simulation time 10 sec.

6) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

7) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

8) Copy aero_yaw_free_osc_rsp.mat to your folder Data is saved in following order: 1: Time (s) 2: Yaw input (V) 3: Yaw position (rad) 4: Yaw speed (rad/s) 5: Yaw acceleration (rad/s^2)

9) Close the SIMULINK model. DO NOT SAVE THE CHANGE.

4. Finding Yaw thrust gain,

1) Open the q_aero_step_response_yaw SIMULINK file.

2) Select a step voltage 15V

3) Select simulation time 60 sec.

4) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

5) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

6) Copy aero_yaw_step_rsp.mat to your folder Data is saved in following order: 1: Time 2: Yaw input (V) 3: Yaw position (rad) 4: Yaw Speed (rad/s)

7) Close the SIMULINK model. DO NOT SAVE THE CHANGE.

5. Identifying the cross-torque gain parameter

1) Unlock both the pitch and yaw axes to enable the full 2 DOF motion.

2) Open the q_aero_step_response_pitch_from_yaw SIMULINK file.

3) Select yaw step voltage to 12V and pitch to 0V.

4) Select simulation time 40 sec.

5) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

6) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

A pitch up motion must be seen due to torque from the tail rotor.

7) Copy aero_pitch_from_yaw_step_rsp.mat to your folder Data is saved in following order: 1: Time (s) 2: Yaw input (V) 3: Pitch Position (rad) 4: Pitch Speed (rad/s)

8) Close the SIMULINK model. DO NOT SAVE THE CHANGE.

6. Identifying the cross-torque gain parameter

1) Open the q_aero_step_response_yaw_from_pitch SIMULINK file.

2) Select pitch step voltage to 12V and yaw to 0V.

3) Select simulation time 40 sec.

4) To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

5) Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

A yaw motion must be seen due to torque from front motor.

6) Copy aero_yaw_from_pitch_step_rsp.mat to your folder Data is saved in following order: 1: Time (s) 2: Pitch input (V) 3: Yaw Position (rad) 4: Yaw Speed (rad/s)

7) Close the SIMULINK model. DO NOT SAVE THE CHANGE.

Analysis

  1. Find the natural frequency and damping ratio from the impulse response of the pitch axis (HINT: first find the peaks and use equation 16, 17, and 18). Then find the stiffness and viscous damping coefficient about the pitch axis (Hint: equation 22,23).

  2. Find the time constant from the yaw pulse response and obtain the damping . Use First-order impulse decaying response. To find the time constant, examine the decaying response that starts at an initial maximum speed and settle down to 0 rad/s (use equation 8b). If data obtained does not fully shows the 37% of try estimate the value by curve fitting.

  3. Find the thrust and cross-torque thrust gain parameters

Hint: can be obtained by using MATLAB function diff(psi_dot)/h, where h is sampling time. Compute by using the psi_ddot(start:end), psi_dot(start:end) and V_psi(start:end) from start to end of step input. Do matrix division and you should get one value.

Rotary Gyro

81KB
Lab 4 Rubric.pdf
pdf
[u˙α˙q˙θ˙]=[−0.0220.0020−0.037−0.084−0.39210−0.087−1.56−0.53600010][uαqθ]+[0−0.021−1.2090]δe\begin{bmatrix} \dot{u} \\ \dot{\alpha} \\ \dot{q} \\ \dot{\theta} \end{bmatrix} = \begin{bmatrix} -0.022 & 0.002 & 0 &-0.037\\ -0.084& -0.392 & 1 & 0\\ -0.087&-1.56&-0.536&0\\ 0&0&1&0 \end{bmatrix} \begin{bmatrix} u \\ \alpha \\ q\\ \theta \end{bmatrix} + \begin{bmatrix} 0\\-0.021\\-1.209\\0 \end{bmatrix} \delta_e​u˙α˙q˙​θ˙​​=​−0.022−0.084−0.0870​0.002−0.392−1.560​01−0.5361​−0.037000​​​uαqθ​​+​0−0.021−1.2090​​δe​
α\alphaα
θ\thetaθ
δe\delta_eδe​
A = [-0.022 0.002 0 -0.037; -0.084 -0.392 1 0; -0.087 -1.56 -0.536 0 ; 0 0 1 0] 
B = [ 0; -0.021; -1.209; 0] 
C = [0 0 0 1] % Note: This selects pitch attitude as output
D = 0
G(s)=1s(s+1)(s+2)G(s) = \displaystyle{\frac{1}{s(s+1)(s+2)}} G(s)=s(s+1)(s+2)1​
C(s)=Ks+as+bb>a>0C(s) = K \frac{s+a}{s+b} \qquad \quad b > a >0 C(s)=Ks+bs+a​b>a>0
°°°
s−1 \mathrm{s}^{-1}s−1
Kv=lim⁡s→0 sG(s)C(s)=Ka2bK_v = \lim_{s \to 0}~sG(s)C(s) = \displaystyle\frac{Ka}{2b}Kv​=lims→0​ sG(s)C(s)=2bKa​
a=0.5a = 0.5a=0.5
b=1b = 1b=1
K=3K = 3K=3
K1(τ1s+1)/(τ2s+1)K_1 (\tau_1 s +1)/(\tau_2 s +1)K1​(τ1​s+1)/(τ2​s+1)
K1(τ1s+1)/(τ2s+1)K_1 (\tau_1 s +1)/(\tau_2 s +1) K1​(τ1​s+1)/(τ2​s+1)
K(s+a)/(s+b)K (s+a)/(s+b)K(s+a)/(s+b)
K,a, and bK, a,~\text{and}~bK,a, and b
G(s)=1/s2G(s) = 1/ s^2G(s)=1/s2
C(s)=Kd(s+Kp/Kd)C(s) = K_d(s+K_p / K_d)C(s)=Kd​(s+Kp​/Kd​)
Kp/KdK_p/K_dKp​/Kd​
Kp/Kd=1.K_p/K_d = 1.Kp​/Kd​=1.
KdK_dKd​
Kp/KdK_p/K_dKp​/Kd​
x¨(t)+cx˙(t)+kx(t)=r(t)\ddot{x}(t) + c\dot{x}(t) + kx(t) = r(t)x¨(t)+cx˙(t)+kx(t)=r(t)
c=3c=3c=3
k=10k=10k=10
x(0)=1,x˙(0)=0x(0) = 1, \dot{x}(0) = 0x(0)=1,x˙(0)=0
x(0)=0,x˙(0)=1x(0) = 0, \dot{x}(0) = 1x(0)=0,x˙(0)=1
r(t)=3sin⁡(2t),r(t) = 3\sin(2t), r(t)=3sin(2t),
x(0)=0,x˙(0)=0x(0) = 0, \dot{x}(0) = 0x(0)=0,x˙(0)=0
(x˙)(\dot{x})(x˙)
(x)(x)(x)
x¨=u\ddot{x} = ux¨=u
xxx
uuu
u=−Kp(x−xc)−Kdx˙u = -K_p (x - x_c) - K_d\dot{x}u=−Kp​(x−xc​)−Kd​x˙
xcx_cxc​
xxx
Kp=10, and Kd=3.K_p=10,\text{ and } K_d =3.Kp​=10, and Kd​=3.
xcx_cxc​
t=1t = 1t=1
t=1t = 1t=1
(θ)(\theta)(θ)
−2-2−2
δe=−2(θc−θ)\delta_e = -2(\theta_c - \theta)δe​=−2(θc​−θ)
000
100s100 s100s
(θc)(\theta_c)(θc​)
0.10.10.1
10s10s10s
t=5st = 5st=5s
t=15st = 15st=15s
(θc)(\theta_c)(θc​)
(θ)(\theta)(θ)
hhh
h˙\dot{h}h˙
α\alphaα
θ\thetaθ
h˙=V(θ−α)\dot{h} = V(\theta -\alpha)h˙=V(θ−α)
α\alphaα
θ\thetaθ
α\alphaα
θ\thetaθ
X˙=UY˙=VZ˙=WmU˙=FXmV˙=FYmW˙=FZ\begin{align*} \dot{X} = U \\ \dot{Y} = V \\ \dot{Z} = W \\ m\dot{U} = F_X \\ m\dot{V} = F_Y \\ m\dot{W} = F_Z \end{align*}X˙=UY˙=VZ˙=WmU˙=FX​mV˙=FY​mW˙=FZ​​
mmm
FX,FY,FZF_X,F_Y,F_ZFX​,FY​,FZ​
FX=1000 uXFY=1000 uYFZ=1000 uZ\begin{align*} F_X = 1000\,u_X \\ F_Y = 1000\,u_Y \\ F_Z = 1000\,u_Z \end{align*} FX​=1000uX​FY​=1000uY​FZ​=1000uZ​​
uX,uYu_X, u_YuX​,uY​
uZu_ZuZ​
[X˙Y˙Z˙U˙V˙W˙]=[000100000010000001000000000000000000][XYZUVW]+[0000000001000/m0001000/m0001000/m][uXuYuZ]\begin{bmatrix} \dot{X} \\ \dot{Y} \\ \dot{Z} \\ \dot{U} \\ \dot{V} \\ \dot{W} \end{bmatrix} = \begin{bmatrix} 0&0&0&1&0&0 \\ 0&0&0&0&1&0 \\ 0&0&0&0&0&1 \\ 0&0&0&0&0&0 \\ 0&0&0&0&0&0 \\ 0&0&0&0&0&0 \end{bmatrix} \begin{bmatrix} X\\Y\\Z\\U\\V\\W \end{bmatrix} + \begin{bmatrix} 0&0&0\\0&0&0\\0&0&0\\ {1000}/{m} &0&0\\ 0 &{1000}/{m}&0\\ 0 &0&{1000}/{m} \end{bmatrix} \begin{bmatrix} u_X\\u_Y\\u_Z \end{bmatrix}​X˙Y˙Z˙U˙V˙W˙​​=​000000​000000​000000​100000​010000​001000​​​XYZUVW​​+​0001000/m00​00001000/m0​000001000/m​​​uX​uY​uZ​​​
xxx
x=[XYZUVW]Tx = \begin{bmatrix} X&Y&Z&U&V&W \end{bmatrix} ^Tx=[X​Y​Z​U​V​W​]T
uuu
u=[uXuYuZ]Tu = \begin{bmatrix} u_X&u_Y&u_Z \end{bmatrix} ^Tu=[uX​​uY​​uZ​​]T
yyy
y=[XYZ]Ty = \begin{bmatrix} X&Y&Z \end{bmatrix} ^T y=[X​Y​Z​]T
uX,uY,uZu_X,u_Y,u_ZuX​,uY​,uZ​
Fx=1000 uX+−100×5000(100)2+(200)2+(100)2Fy=1000 uY+−200×5000(100)2+(200)2+(100)2Fz=1000 uZ+−100×5000(100)2+(200)2+(100)2F_x = 1000\,u_X + \displaystyle{\frac{-100 \times 5000}{\sqrt{ (100)^2+ (200)^2+(100)^2 } }} \\[8pt] F_y = 1000\,u_Y + \frac{-200\times 5000}{\sqrt{(100)^2+ (200)^2+(100)^2 }} \\[8pt] F_z = 1000\,u_Z + \frac{-100\times 5000}{\sqrt{(100)^2+ (200)^2+(100)^2 } }Fx​=1000uX​+(100)2+(200)2+(100)2​−100×5000​Fy​=1000uY​+(100)2+(200)2+(100)2​−200×5000​Fz​=1000uZ​+(100)2+(200)2+(100)2​−100×5000​
75KB
Helpful MATLAB Stuff.pdf
pdf
577KB
SIMULINK Tutorial.pdf
pdf

Aero LQR

τ\tauτ
τ\tauτ
KKK
τ\tauτ
KKK
τ\tauτ
KKK
τ\tauτ
KKK
τ\tauτ
Table A.1
Table A.2
Table B.2
Figure 15 Simulation done with default model parameters: K = 1 and τ\tauτ = 0.1Save wl data and name it something like modeling_section#_Group#_K1tau01.
ω3\omega_3ω3​
q4q_4q4​
ω4\omega_4ω4​
Ix,Jx,KxI_x, J_x, K_xIx​,Jx​,Kx​
IA,IB,IC,IDI^A, I^B, I^C, I^DIA,IB,IC,ID
IA=[IA000JA000KA],IB=[IB000JB000KB],IC=[IC000JC000KC],ID=[ID000JD000KD]I^A = \begin{bmatrix} I_A &0 &0 \\ 0 &J_A &0 \\ 0 &0 &K_A \end{bmatrix}, I^B = \begin{bmatrix} I_B &0 &0 \\ 0 &J_B &0 \\ 0 &0 &K_B \end{bmatrix}, I^C = \begin{bmatrix} I_C &0 &0 \\ 0 &J_C &0 \\ 0 &0 &K_C \end{bmatrix}, I^D = \begin{bmatrix} I_D &0 &0 \\ 0 &J_D &0 \\ 0 &0 &K_D \end{bmatrix}IA=​IA​00​0JA​0​00KA​​​,IB=​IB​00​0JB​0​00KB​​​,IC=​IC​00​0JC​0​00KC​​​,ID=​ID​00​0JD​0​00KD​​​
T⃗=ddtH⃗=H⃗˙+ω⃗F×H⃗(3.1)\vec{T} = \frac{d}{dt}\vec{H} = \dot{\vec{H}} + \vec{\omega}_F \times \vec{H} \tag{3.1}T=dtd​H=H˙+ωF​×H(3.1)
T⃗\vec{T}T
T⃗=[T2T10](3.2)\vec{T} = \begin{bmatrix} T_2 \\ T_1 \\ 0 \end{bmatrix} \tag{3.2}T=​T2​T1​0​​(3.2)
T1T_1T1​
T2T_2T2​
H⃗\vec{H}H
ω⃗F\vec{\omega}_FωF​
H⃗=[(ID+IC)ω2JDω1(ID+KA+KB+KC)ω4](3.3)\vec{H} = \begin{bmatrix} (I_D + I_C) \omega_2 \\ J_D \omega_1 \\ (I_D + K_A + K_B + K_C) \omega_4 \end{bmatrix} \tag{3.3}H=​(ID​+IC​)ω2​JD​ω1​(ID​+KA​+KB​+KC​)ω4​​​(3.3)
ω⃗F=[ω20ω4](3.4)\vec{\omega}_F = \begin{bmatrix} \omega_2 \\ 0 \\ \omega_4 \end{bmatrix} \tag{3.4}ωF​=​ω2​0ω4​​​(3.4)
T1=JDω˙1+(IC+ID)ω2ω4 − (ID+KA+KB+KC)ω2ω4T2=(IC+ID)ω˙2 − JDω1ω40=(ID+KA+KB+KC)ω˙4+JDω1ω2(3.5)T_1 = J_D\dot{\omega}_1 + (I_C + I_D)\omega_2\omega_4 \space \boldsymbol{-} \space (I_D + K_A + K_B + K_C)\omega_2\omega_4 \\ T_2 = (I_C + I_D)\dot{\omega}_2 \space \boldsymbol{-} \space J_D\omega_1\omega_4 \\ 0 = (I_D + K_A + K_B + K_C)\dot{\omega}_4 + J_D\omega_1\omega_2 \tag{3.5} T1​=JD​ω˙1​+(IC​+ID​)ω2​ω4​ − (ID​+KA​+KB​+KC​)ω2​ω4​T2​=(IC​+ID​)ω˙2​ − JD​ω1​ω4​0=(ID​+KA​+KB​+KC​)ω˙4​+JD​ω1​ω2​(3.5)
ω2Ω,ω4Ω\displaystyle{\frac{\omega_2}{\Omega}, \frac{\omega_4}{\Omega}}Ωω2​​,Ωω4​​
Ω=ω1\Omega =\omega_1Ω=ω1​
ω2ω4≈0,ω1ω4≈Ωω4,ω1ω2≈Ωω2\omega_2\omega_4 \approx 0, \omega_1\omega_4 \approx \Omega\omega_4, \omega_1\omega_2 \approx \Omega \omega_2ω2​ω4​≈0,ω1​ω4​≈Ωω4​,ω1​ω2​≈Ωω2​
T1 − JDω˙1=0(3.6)T_1 \space \boldsymbol{-} \space J_D\dot{\omega}_1 = 0 \tag{3.6}T1​ − JD​ω˙1​=0(3.6)
T2+JDΩω4 − (IC+ID)ω˙2=0(3.7)T_2 + J_D\Omega\omega_4 \space \boldsymbol{-} \space (I_C + I_D)\dot{\omega}_2 = 0 \tag{3.7}T2​+JD​Ωω4​ − (IC​+ID​)ω˙2​=0(3.7)
JDΩω2+(ID+KA+KB+KC)ω˙4=0(3.8)J_D\Omega\omega_2 + (I_D + K_A + K_B + K_C)\dot{\omega}_4 = 0 \tag{3.8}JD​Ωω2​+(ID​+KA​+KB​+KC​)ω˙4​=0(3.8)
q2q_2q2​
q4q_4q4​
ω2\omega_2ω2​
ω4\omega_4ω4​
q2˙=ω2  and  q4˙=ω4(3.9)\dot{q_2} = \omega_2 \space \space \text{and} \space \space \dot{q_4} = \omega_4 \tag{3.9}q2​˙​=ω2​  and  q4​˙​=ω4​(3.9)
ω2\omega_2ω2​
ω4\omega_4ω4​
q4(s)/T2(s)q_4(s)/T_2(s)q4​(s)/T2​(s)
q2(s)/T2(s)q_2(s)/T_2(s)q2​(s)/T2​(s)
G4(s)=q4(s)T2(s)=−JDΩ(IC+ID)(ID+KA+KB+KC)s3+Ω2JD2s(3.10)G_4(s) = \frac{q_4(s)}{T_2(s)} = \frac{ \boldsymbol{-}J_D \Omega}{(I_C + I_D)(I_D + K_A + K_B+K_C)s^3 +\Omega ^2 J^2_D s} \tag{3.10}G4​(s)=T2​(s)q4​(s)​=(IC​+ID​)(ID​+KA​+KB​+KC​)s3+Ω2JD2​s−JD​Ω​(3.10)
G2(s)=q2(s)T2(s)=(ID+KA+KB+KC)s(IC+ID)(ID+KA+KB+KC)s3+Ω2JD2s(3.11)G_2(s) = \frac{q_2(s)}{T_2(s)} = \frac{(I_D + K_A + K_B + K_C)s}{(I_C + I_D)(I_D+K_A + K_B + K_C)s^3 + \Omega^2J^2_D s} \tag{3.11}G2​(s)=T2​(s)q2​(s)​=(IC​+ID​)(ID​+KA​+KB​+KC​)s3+Ω2JD2​s(ID​+KA​+KB​+KC​)s​(3.11)
q4q_4q4​
T2T_2T2​
q4q_4q4​
T2T_2T2​
q4q_4q4​
ω2\omega_2ω2​
q4q_4q4​
D(s)=(IC+ID)(ID+KA+KB+KC)s3+Ω2JD2s(3.12)D(s) = (I_C + I_D)(I_D + K_A + K_B + K_C)s^3 + \Omega^2J_D^2s \tag{3.12}D(s)=(IC​+ID​)(ID​+KA​+KB​+KC​)s3+Ω2JD2​s(3.12)
N2=ke2ku2(ID+KA+KB+KC)s(3.13)N_2 = k_{e_2}k_{u_2}(I_D + K_A + K_B + K_C)s \tag{3.13}N2​=ke2​​ku2​​(ID​+KA​+KB​+KC​)s(3.13)
N4=−ke4ku2ΩJD(3.14)N_4 = \boldsymbol{-} k_{e4}k_{u2}\Omega J_D \tag{3.14}N4​=−ke4​ku2​ΩJD​(3.14)
q2q_2q2​
q4q_4q4​
ke2k_{e2}ke2​
ke4k_{e4}ke4​
ku2k_{u2}ku2​
Ω\OmegaΩ

Body

Inertia Element

Value (kg - m^2)

A

KAK_AKA​

0.067

B

IBI_BIB​

0.012

JBJ_BJB​

0.012

KBK_BKB​

0.03

C

ICI_CIC​

0.0092

JCJ_CJC​

0.023

KCK_CKC​

0.022

D

IDI_DID​

0.015

JDJ_DJD​

0.027

Axis i

Output/Rev kˉ\bar{k}kˉ (counts/rev)

Gain kˉei=kˉ/(2π)\bar{k}_{ei} = \bar{k}/(2\pi)kˉei​=kˉ/(2π) (counts/rad)

1

6667

1061

2

24400

3883

3

16000

2547

4

16000

2547

Gain

Value (N/count)

ku1k_{u1}ku1​

1.28 E-05

ku2k_{u2}ku2​

9.07 E-05

kei=kˉei∗32k_{ei} = \bar{k}_{ei} * 32kei​=kˉei​∗32
N2,N4N_2, N_4N2​,N4​
keik_{ei}kei​
kˉei\bar{k}_{ei}kˉei​
kpk_pkp​
kdk_dkd​
kvk_vkv​
q4(s)/ri(s)q_4(s)/r_i(s)q4​(s)/ri​(s)
kpk_pkp​
kdk_dkd​
kvk_vkv​
kp,kdk_p, k_dkp​,kd​
kvk_vkv​
kpk_pkp​
kdk_dkd​
kvk_vkv​
kp,kdk_p, k_dkp​,kd​
kvk_vkv​
TsT_sTs​
TsT_sTs​
kv,kpk_v, k_pkv​,kp​
kdk_dkd​
kp>6.0\bm{k_p > 6.0}kp​>6.0
kd>0.4\bm{k_d > 0.4}kd​>0.4
kvk_vkv​
kdk_dkd​
kpk_pkp​
Image credit: NASA
Figure 3.1: The Model 750 Control Moment Gyroscope
Figure 3.2: The Gyroscope Control System Setup
Figure 3.3: Control Moment Gyroscope Apparatus
Figure 3.4: Gimbal # 3 Locked, All Others Free
Figure 3.5: Coordinate Frame Definitions
Figure 3.6: Successive Loop Closure Control Scheme
Figure 3.7: Initial gyroscope orientation as viewed from the front (labels the correct way up)
X˙=AX+BU(7.1)\dot{X}=AX+BU \tag{7.1}X˙=AX+BU(7.1)
XXX
UUU
m×1m \times1m×1
AAA
BBB
n×nn\times nn×n
n×mn\times mn×m
U=−KX(7.2)U=-KX \tag{7.2}U=−KX(7.2)
X˙=(A−BK)X(7.3)\dot{X}=(A-BK)X \tag{7.3}X˙=(A−BK)X(7.3)
KKK
m×nm\times nm×n
J=∫0∞(XTQX+UTRU)dt(7.4)J=\int_{0}^\infty(X^TQX+U^TRU) dt \tag{7.4}J=∫0∞​(XTQX+UTRU)dt(7.4)
QQQ
RRR
XTQX≥0(7.5)X^TQX\geq0 \tag{7.5}XTQX≥0(7.5)
XXX
QQQ
UTRU>0(7.6)U^TRU>0 \tag{7.6}UTRU>0(7.6)
UUU
RRR
KKK
K=R−1BTP(7.7)K=R^{-1}B^TP \tag{7.7}K=R−1BTP(7.7)
n×nn\times nn×n
PPP
0=ATP+PA−PBR−1BTP+Q(7.8)0=A^TP+PA-PBR^{-1}B^TP+Q \tag{7.8}0=ATP+PA−PBR−1BTP+Q(7.8)
mx¨+cx˙+kx=Fm\ddot{x}+c\dot{x}+kx=Fmx¨+cx˙+kx=F
[x˙1x˙2]=[01−km−cm][x1x2]+[01m]F\begin{bmatrix} \dot{x}_1 \\[1ex] \dot{x}_2 \end{bmatrix} = \begin{bmatrix} 0 & 1 \\[1ex] -\frac{k}{m} & -\frac{c}{m} \end{bmatrix} \begin{bmatrix} x_1 \\[1ex] x_2 \end{bmatrix} + \begin{bmatrix} 0 \\[1ex] \frac{1}{m} \end{bmatrix}F[x˙1​x˙2​​]=[0−mk​​1−mc​​][x1​x2​​]+[0m1​​]F
x1=xx_1=xx1​=x
x2=x˙x_2=\dot{x}x2​=x˙
m=1, k=2m=1,\space k=2m=1, k=2
c=1c=1c=1
A=[01−2−1],B=[01]A = \begin{bmatrix} 0 & 1 \\[1ex] -2 & -1 \end{bmatrix}, \qquad B = \begin{bmatrix} 0 \\[1ex] 1 \end{bmatrix}A=[0−2​1−1​],B=[01​]
Q=[12004],R=1Q = \begin{bmatrix} 12 & 0 \\[1ex] 0 & 4 \end{bmatrix}, \qquad R = 1Q=[120​04​],R=1
[0 ⁣ ⁣00 ⁣ ⁣0] ⁣= ⁣[0 ⁣ ⁣−21 ⁣ ⁣−1] ⁣[p11 ⁣ ⁣p12p21 ⁣ ⁣p22] ⁣+ ⁣[p11 ⁣ ⁣p12p21 ⁣ ⁣p22] ⁣[0 ⁣ ⁣1−2 ⁣ ⁣−1] ⁣− ⁣[p11 ⁣ ⁣p12p21 ⁣ ⁣p22] ⁣[ ⁣01] ⁣[0 ⁣ ⁣1] ⁣[p11 ⁣ ⁣p12p21 ⁣ ⁣p22] ⁣+ ⁣[12 ⁣ ⁣00 ⁣ ⁣4]\begin{bmatrix} 0 \! & \! 0 \\[0.5ex] 0 \! & \! 0 \end{bmatrix} \! = \! \begin{bmatrix} 0 \! & \! -2 \\[0.5ex] 1 \! & \! -1 \end{bmatrix} \! \begin{bmatrix} p_{11} \! & \! p_{12} \\[0.5ex] p_{21} \! & \! p_{22} \end{bmatrix} \! + \! \begin{bmatrix} p_{11} \! & \! p_{12} \\[0.5ex] p_{21} \! & \! p_{22} \end{bmatrix} \! \begin{bmatrix} 0 \! & \! 1 \\[0.5ex] -2 \! & \! -1 \end{bmatrix} \! - \! \begin{bmatrix} p_{11} \! & \! p_{12} \\[0.5ex] p_{21} \! & \! p_{22} \end{bmatrix} \! \begin{bmatrix} \! 0 \\[0.5ex] 1 \end{bmatrix} \! \begin{bmatrix} 0 \! & \! 1 \end{bmatrix} \! \begin{bmatrix} p_{11} \! & \! p_{12} \\[0.5ex] p_{21} \! & \! p_{22} \end{bmatrix} \! + \!\begin{bmatrix} 12 \! & \! 0 \\[0.5ex] 0 \! & \! 4 \end{bmatrix}[00​00​]=[01​−2−1​][p11​p21​​p12​p22​​]+[p11​p21​​p12​p22​​][0−2​1−1​]−[p11​p21​​p12​p22​​][01​][0​1​][p11​p21​​p12​p22​​]+[120​04​]
p122+4p12−12=0p11−2p22−p12−p12p22=0p222−2p12+2p22−4=0p_{12}^2+4p_{12}-12=0\\[5pt] p_{11}-2p_{22}-p_{12}-p_{12}p_{22}=0\\[5pt] p_{22}^2-2p_{12}+2p_{22}-4=0p122​+4p12​−12=0p11​−2p22​−p12​−p12​p22​=0p222​−2p12​+2p22​−4=0
p11=10,p12=2,p22=2p_{11}=10, \quad p_{12}=2, \quad p_{22}=2p11​=10,p12​=2,p22​=2
P=[10222]P=\begin{bmatrix} 10 & 2\\ 2 & 2 \end{bmatrix}P=[102​22​]
λ1,2=10.472, 1.528\lambda_{1,2}=10.472,\space1.528λ1,2​=10.472, 1.528
K=R−1BTPK=[01][10222]=[22]K=R^{-1}B^TP\\[5pt] K=\begin{bmatrix} 0 & 1 \end{bmatrix} \begin{bmatrix} 10 & 2 \\ 2 & 2 \end{bmatrix} = \begin{bmatrix} 2 & 2 \end{bmatrix}K=R−1BTPK=[0​1​][102​22​]=[2​2​]
A−BK=[01−4−3]A-BK=\begin{bmatrix} 0&1\\ -4 & -3 \end{bmatrix}A−BK=[0−4​1−3​]
λ1,2=−1.5±i1.323.\lambda_{1,2}=-1.5\pm i1.323.λ1,2​=−1.5±i1.323.
mpm_pmp​
2lp2l_p2lp​
mcm_cmc​
θ\thetaθ
θ=0\theta=0θ=0
(mp+mc)x¨+mpθ¨lpcos⁡(θ)−mpθ˙2lpsin⁡(θ)=Fmplpcos⁡(θ)x¨+Iθ¨+mpθ¨lp2−mpglpsin⁡(θ)=0\begin{equation} \tag{7.9} \begin{aligned}(m_p+m_c)\ddot{x} + m_p\ddot{\theta}l_p\cos(\theta) -m_p\dot{\theta}^2l_p\sin(\theta) &= F \\[5pt] m_pl_p\cos(\theta)\ddot{x} + I\ddot{\theta} + m_p\ddot{\theta}l_p^2 - m_pgl_p\sin(\theta) &= 0 \end{aligned} \end{equation}(mp​+mc​)x¨+mp​θ¨lp​cos(θ)−mp​θ˙2lp​sin(θ)mp​lp​cos(θ)x¨+Iθ¨+mp​θ¨lp2​−mp​glp​sin(θ)​=F=0​​(7.9)​
III
I=mplp23I=\cfrac{m_pl_p^2}{3}I=3mp​lp2​​
(x˙=x¨=θ˙=θ¨=0)(\dot{x}=\ddot{x}=\dot{\theta}=\ddot{\theta}=0)(x˙=x¨=θ˙=θ¨=0)
(xe1,θe1)=(0,π)(x_{e1},\theta_{e1})=(0,\pi)(xe1​,θe1​)=(0,π)
(xe2,θe2)=(0,0)(x_{e2}, \theta_{e2})=(0,0)(xe2​,θe2​)=(0,0)
(0,0)(0, 0)(0,0)
ddt[xθx˙θ˙]=[001000010−3mpgmp+4mc0003(mp+mc)g(mp+4mc)lp00][xθx˙θ˙]+[004mp+4mc−3(mp+4mc)lp]F(7.10) \frac{d}{dt} \begin{bmatrix} x \\[1ex] \theta \\[1ex] \dot{x} \\[1ex] \dot{\theta} \end{bmatrix} = \begin{bmatrix} 0 & 0 & 1 & 0 \\[1ex] 0 & 0 & 0 & 1 \\[1ex] 0 & -\cfrac{3m_pg}{m_p+4m_c} & 0 & 0 \\[1ex] 0 & \cfrac{3(m_p+m_c)g}{(m_p+4m_c)l_p} & 0 & 0 \end{bmatrix} \begin{bmatrix} x \\[1ex] \theta \\[1ex] \dot{x} \\[1ex] \dot{\theta} \end{bmatrix} + \begin{bmatrix} 0 \\[1ex] 0 \\[1ex] \cfrac{4}{m_p+4m_c} \\[1ex] -\cfrac{3}{(m_p+4m_c)l_p} \end{bmatrix}F \tag{7.10}dtd​​xθx˙θ˙​​=​0000​00−mp​+4mc​3mp​g​(mp​+4mc​)lp​3(mp​+mc​)g​​1000​0100​​​xθx˙θ˙​​+​00mp​+4mc​4​−(mp​+4mc​)lp​3​​​F(7.10)
FFF
VVV
x˙\dot{x}x˙
V=ImRm+KmKgωg=ImRm+KmKgx˙rV=I_mR_m+K_mK_g\omega_g=I_mR_m+K_mK_g\frac{\dot{x}}{r}V=Im​Rm​+Km​Kg​ωg​=Im​Rm​+Km​Kg​rx˙​
Im=VRm−KmKgRmx˙r(7.11)I_m=\frac{V}{R_m}-\frac{K_mK_g}{R_m}\frac{\dot{x}}{r} \tag{7.11}Im​=Rm​V​−Rm​Km​Kg​​rx˙​(7.11)
VVV
ImI_mIm​
KmK_mKm​
KgK_gKg​
RmR_mRm​
ωg\omega_gωg​
x˙\dot{x}x˙
rrr
Tm=KtKgIm(7.12)T_m=K_tK_gI_m \tag{7.12}Tm​=Kt​Kg​Im​(7.12)
KmK_mKm​
Kt=kKm(7.13)K_t=k K_m \tag{7.13}Kt​=kKm​(7.13)
kkk
k=1.3558 N−m/s/(volt−amp)k = 1.3558 \mathrm{~N-m/s/(volt-amp)}k=1.3558 N−m/s/(volt−amp)
F=Tmr=KtKgVrRm−KtKgKmKgRmx˙r2=kKmKgVrRm−k(KmKg)2Rmx˙r2(7.14)F=\frac{T_m}{r}=\frac{K_tK_gV}{rR_m}-\frac{K_tK_gK_mK_g}{R_m}\frac{\dot{x}}{r^2}=\frac{kK_mK_gV}{rR_m}-\frac{k(K_mK_g)^2}{R_m}\frac{\dot{x}}{r^2} \tag{7.14}F=rTm​​=rRm​Kt​Kg​V​−Rm​Kt​Kg​Km​Kg​​r2x˙​=rRm​kKm​Kg​V​−Rm​k(Km​Kg​)2​r2x˙​(7.14)
Km=0.00767 volt−amp/rad/s,Kg=3.7k=1.3558 N−m/s/(volt−amp),r=0.00635 m,Rm=2.6 ohmsK_m=0.00767~ \mathrm{volt-amp/rad/s},\quad K_g=3.7 \\ k=1.3558~\mathrm{N-m/s/(volt-amp)},\quad r=0.00635~\mathrm{m},\quad R_m=2.6\space \mathrm{ohms}Km​=0.00767 volt−amp/rad/s,Kg​=3.7k=1.3558 N−m/s/(volt−amp),r=0.00635 m,Rm​=2.6 ohms
F=2.3305V−10.4152x˙(7.15)F=2.3305V-10.4152\dot{x} \tag{7.15}F=2.3305V−10.4152x˙(7.15)
a1=2.3305a_1=2.3305a1​=2.3305
a2=10.4152a_2=10.4152a2​=10.4152
F=a1V−a2x˙(7.16)F=a_1V-a_2\dot{x} \tag{7.16}F=a1​V−a2​x˙(7.16)
ddt[xθx˙θ˙]=[001000010−3mpgmp+4mc−4a2mp+4mc003(mp+mc)g(mp+4mc)lp3a2(mp+4mc)lp0][xθx˙θ˙]+[004a1mp+4mc−3a1(mp+4mc)lp]F(7.17)\frac{d}{dt} \begin{bmatrix} x \\[1ex] \theta \\[1ex] \dot{x} \\[1ex] \dot{\theta} \end{bmatrix} = \begin{bmatrix} 0 & 0 & 1 & 0 \\[1ex] 0 & 0 & 0 & 1 \\[1ex] 0 & -\cfrac{3m_pg}{m_p+4m_c} & -\cfrac{4a_2}{m_p+4m_c} & 0 \\[3ex] 0 & \cfrac{3(m_p+m_c)g}{(m_p+4m_c)l_p} & \cfrac{3a_2}{(m_p+4m_c)l_p} & 0 \end{bmatrix} \begin{bmatrix} x \\[1ex] \theta \\[1ex] \dot{x} \\[1ex] \dot{\theta} \end{bmatrix} + \begin{bmatrix} 0 \\[1ex] 0 \\[1ex] \cfrac{4a_1}{m_p+4m_c} \\[3ex] -\cfrac{3a_1}{(m_p+4m_c)l_p} \end{bmatrix}F \quad \tag{7.17}dtd​​xθx˙θ˙​​=​0000​00−mp​+4mc​3mp​g​(mp​+4mc​)lp​3(mp​+mc​)g​​10−mp​+4mc​4a2​​(mp​+4mc​)lp​3a2​​​0100​​​xθx˙θ˙​​+​00mp​+4mc​4a1​​−(mp​+4mc​)lp​3a1​​​​F(7.17)
X˙=AX+BV\dot{X}=AX+BVX˙=AX+BV
X=[x, θ, x˙, θ˙]⊤X=[x,~\theta,~ \dot{x},~\dot{\theta}]^\topX=[x, θ, x˙, θ˙]⊤
V=−KXV=-KXV=−KX
KKK
1×41 \times 41×4
V=−KX(7.18)V=-KX \tag{7.18}V=−KX(7.18)
J=∫0∞(XTQX+VTRV)dt(7.19)J=\int_0^{\infty}(X^T QX+V^T RV) dt \tag{7.19}J=∫0∞​(XTQX+VTRV)dt(7.19)
Q=QTQ=Q^TQ=QT
R=RTR=R^TR=RT
QQQ
RRR
VVV
XXX
X=[xθx˙θ˙](7.20)X=\begin{bmatrix} x\\[1ex] \theta \\[1ex] \dot{x} \\[1ex] \dot{\theta} \end{bmatrix} \tag{7.20}X=​xθx˙θ˙​​(7.20)
KKK
K=[k1  k2  k3  k4](7.21)K = [ k_1 ~~ k_2 ~~ k_3 ~~ k_4] \tag{7.21}K=[k1​  k2​  k3​  k4​](7.21)
VVV
RRR
QQQ
RRR
QQQ
RRR
∣V∣≤Vˉ,∣Xi∣≤Xiˉ|V|\leq\bar{V}, \quad|X_i|\leq\bar{X_i}∣V∣≤Vˉ,∣Xi​∣≤Xi​ˉ​
R=1Vˉ2,Q=diag(1Xˉi2)(7.22)R=\frac{1}{\bar{V}^2},\quad Q=\mathrm{diag} \left(\frac{1}{\bar{X}_i^2} \right) \tag{7.22}R=Vˉ21​,Q=diag(Xˉi2​1​)(7.22)
RRR
QQQ
RRR
QQQ
u=−KΔX,ΔX=X−XCu=-K\Delta X, \Delta X=X-X_Cu=−KΔX,ΔX=X−XC​
xxx
x˙\dot{x}x˙
θ\thetaθ
θ˙\dot{\theta}θ˙
KKK
K=[k1 k2 k3 k4]K = [ k_1 ~ k_2 ~ k_3 ~ k_4]K=[k1​ k2​ k3​ k4​]
mp=0.21 kg, mc=0.815 kgm_p=0.21\space kg,\space m_c=0.815\space kgmp​=0.21 kg, mc​=0.815 kg
lp=0.305 ml_p=0.305\space mlp​=0.305 m
Q≥0Q\geq0Q≥0
R>0R>0R>0
0.4m≤∣xmax∣≤0.5m0.4m\leq|x_{max}|\leq0.5m0.4m≤∣xmax​∣≤0.5m
π6rad≤∣θmax∣≤π4rad\frac{\pi}{6}rad\leq|\theta_{max}|\leq\frac{\pi}{4}rad6π​rad≤∣θmax​∣≤4π​rad
6 volts≤∣Vmax∣≤10 volts6\space volts\leq|V_{max}|\leq10\space volts6 volts≤∣Vmax​∣≤10 volts
x˙max⁡\dot{x}_{\max}x˙max​
θ˙max\dot{\theta}_{max}θ˙max​
QQQ
RRR
Q=[400001.62110000000000]Q= \begin{bmatrix} 4 & 0&0&0 \\ 0&1.6211&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \end{bmatrix}Q=​4000​01.621100​0000​0000​​
R=[0.01]R= [0.01]R=[0.01]
Figure 7.1: Inverted pendulum mechanism [Image source: https://grabcad.com/library/inverted-pendulum-1]
Figure 7.2: A simple mass / spring / damper system
Figure 7.3: Inverted Pendulum mechanism in the lab
Figure 7.4: Inverted pendulum mechanism
Figure 7.5: Powered rocket during ascent
Figure 7.6: Free Body Diagrams
Fig 7.7: Block diagram of the experimental set-up
Φf\Phi _fΦf​
Φa\Phi _aΦa​
Tm=k1ΦfΦaT_m = k_1 \Phi _f \Phi_aTm​=k1​Φf​Φa​
iai_aia​
Φa=k2ia\Phi _a = k_2i_aΦa​=k2​ia​
Φf\Phi_fΦf​
Tm=Kmia(2.1)T_m = K_mi_a \tag{2.1}Tm​=Km​ia​(2.1)
Km=k1Φfk2K_m = k_1\Phi_f k_2Km​=k1​Φf​k2​
VbV_bVb​
Vb=KbωV_b = K_b\omegaVb​=Kb​ω
Vm=Ldiadt+Ria+Vb(2.2)V_m = L\frac{di_a}{dt} + Ri_a + V_b \tag{2.2}Vm​=Ldtdia​​+Ria​+Vb​(2.2)
Tm−Td−Bω=Jdωdt(2.3)T_m - T_d - B\omega = J\frac{d\omega}{dt} \tag{2.3}Tm​−Td​−Bω=Jdtdω​(2.3)
LLL
iai_aia​
RRR
VbV_bVb​
VmV_mVm​
JJJ
TmT_mTm​
TdT_dTd​
BBB
ω\omegaω
Vm(s)=(sL+R)ia(s)+Vb(s)=(sL+R)ia(s)+Kbω(s)(2.4)V_m(s) = (sL + R)i_a(s) + V_b(s) = (sL + R)i_a(s) + K_b\omega(s) \tag{2.4}Vm​(s)=(sL+R)ia​(s)+Vb​(s)=(sL+R)ia​(s)+Kb​ω(s)(2.4)
Tm(s)−Bω(s)−Td(s)=sJω(s)(2.5)T_m(s) - B\omega(s) - T_d(s) = sJ\omega(s) \tag{2.5}Tm​(s)−Bω(s)−Td​(s)=sJω(s)(2.5)
Kmia(s)−Td(s)=(sJ+B)ω(s)K_mi_a(s) - T_d(s) = (sJ + B)\omega(s)Km​ia​(s)−Td​(s)=(sJ+B)ω(s)
ω(s)Vm(s)=Km(R+Ls)(B+Js)+KmKb\frac{\omega(s)}{V_m(s)} = \frac{K_m}{(R+Ls)(B+Js) + K_mK_b}Vm​(s)ω(s)​=(R+Ls)(B+Js)+Km​Kb​Km​​
ω(s)Vm(s)=KmLJs2+(LB+JR)s+RB+KmKb(2.6)\frac{\omega(s)}{V_m(s)} = \frac {K_m} {LJs^2 + (LB + JR)s + RB + K_m K_b} \tag{2.6}Vm​(s)ω(s)​=LJs2+(LB+JR)s+RB+Km​Kb​Km​​(2.6)
ω(s)Vm(s)=KmJRs+KmKb=1/Kbτms+1(2.7)\frac{\omega(s)}{V_m(s)} = \frac{K_m}{JRs + K_mK_b} = \frac{1/K_b}{\tau_m s + 1} \tag{2.7}Vm​(s)ω(s)​=JRs+Km​Kb​Km​​=τm​s+11/Kb​​(2.7)
τm=JRKmKb is the time constant of this first-order system.\tau_m = \frac{JR}{K_mK_b} \space \text{is the \textbf{time constant} of this first-order system.} τm​=Km​Kb​JR​ is the time constant of this first-order system.
KmK_m Km​
KbK_bKb​
Pin=Vbia=KbωiaP_{in} = V_bi_a = K_b\omega i_aPin​=Vb​ia​=Kb​ωia​
Pout=Tmω=KmωiaP_{out} = T_m\omega = K_m \omega i_aPout​=Tm​ω=Km​ωia​
Km=KbK_m = K_bKm​=Kb​
PinP_{in}Pin​
PoutP_{out}Pout​
ω(s)Vm(s)=KmJRs+KmKb=1/Kbτms+1(2.8)\frac{\omega (s)}{V_m(s)} = \frac{K_m}{JRs + K_mK_b} = \frac{1/K_b}{\tau_m s +1} \tag{2.8}Vm​(s)ω(s)​=JRs+Km​Kb​Km​​=τm​s+11/Kb​​(2.8)
τm=JRKb2(2.9)\tau_m = \frac{JR}{K_b^2} \tag{2.9}τm​=Kb2​JR​(2.9)
Km=KbK_m = K_bKm​=Kb​
s=0s = 0s=0
DC Gain=1Kb [(rad/sec) / volt](2.10)\text{DC} \space \text{Gain} = \frac{1}{K_b} \space \text{[(rad/sec) / volt]} \tag{2.10}DC Gain=Kb​1​ [(rad/sec) / volt](2.10)
τm\tau_mτm​
yss=lim⁡t→∞y(t)=lim⁡s→0sY(s)y_{ss} = \lim_{t \to \infty}y(t) = \lim_{s \to 0}sY(s)yss​=t→∞lim​y(t)=s→0lim​sY(s)
τm\tau_mτm​
VmV_mVm​
ω\omegaω
ω(s)Vm(s)=1/Kbτms+1\frac{\omega(s)}{V_m(s)} = \frac{1/K_b}{\tau _m s +1}Vm​(s)ω(s)​=τm​s+11/Kb​​
θ˙=ω\dot{\theta} = \omegaθ˙=ω
θ\thetaθ
G(s)=θ(s)Vm(s)=1/Kbs(τms+1)=As(τms+1)(2.11)G(s) = \frac{\theta (s)}{V_m (s)} = \frac{1/K_b}{s(\tau _ms + 1)} = \frac{A}{s(\tau _ms+1)} \tag{2.11}G(s)=Vm​(s)θ(s)​=s(τm​s+1)1/Kb​​=s(τm​s+1)A​(2.11)
A=1/Kb=A = 1/K_b = A=1/Kb​=
HHH
KPK_PKP​
θc\theta_cθc​
θ\thetaθ
θ(s)θc(s)=AKpτms2+s+AKp=AKpτms2+1τms+AKpτm\frac{\theta(s)}{\theta_c(s)} = \frac{AK_p}{\tau_m s^2 + s + AK_p} = \frac{\cfrac{AK_p}{\tau_m}}{s^2 + \cfrac{1}{\tau_m}s + \cfrac{AK_p}{\tau_m}}θc​(s)θ(s)​=τm​s2+s+AKp​AKp​​=s2+τm​1​s+τm​AKp​​τm​AKp​​​
θ(s)θc(s)=ωn2s2+2ζωns+ωn2\frac{\theta(s)}{\theta_c(s)} = \frac{\omega_n^2}{s^2 + 2\zeta \omega_n s + \omega_n^2}θc​(s)θ(s)​=s2+2ζωn​s+ωn2​ωn2​​
KpK_pKp​
θc\theta_cθc​
θ\thetaθ
θ(s)θc(s)=AKpτms2+(1+AKd)s+AKp=AKpτms2+(1+AKd)τms+AKpτm\frac{\theta(s)}{\theta_c(s)} = \frac{AK_p}{\tau_m s^2 + (1 + AK_d)s + AK_p} = \frac{\cfrac{AK_p}{\tau_m}}{s^2 + \cfrac{(1 + AK_d)}{\tau_m}s + \cfrac{AK_p}{\tau_m}}θc​(s)θ(s)​=τm​s2+(1+AKd​)s+AKp​AKp​​=s2+τm​(1+AKd​)​s+τm​AKp​​τm​AKp​​​
KdK_dKd​
KpK_pKp​
GHGHGH
GH=(Kps+Ki)sA(τms+1+AKd)1sGH = \frac{(K_ps+K_i)}{s} \frac{A}{(\tau_ms+1+AK_d)}\frac{1}{s}GH=s(Kp​s+Ki​)​(τm​s+1+AKd​)A​s1​
TsT_sTs​
TsT_sTs​
TsT_sTs​
G(s)G(s)G(s)
KpK_pKp​
KpK_pKp​
GCGCGC
KpK_pKp​
KdK_dKd​
KdK_dKd​
Θ\ThetaΘ
ω\omegaω
KpK_pKp​
KdK_dKd​
KiK_iKi​
KiK_iKi​
KpK_pKp​
KdK_dKd​
KiK_iKi​
GGG
CCC
KdK_dKd​
KiK_iKi​
KpK_pKp​
KdK_dKd​
KpK_pKp​
KdK_dKd​
KpK_pKp​
KdK_dKd​
KiK_iKi​
VmV_mVm​
Figure 2.1: The instrumented DC motor experiment used in this lab
Figure 2.2: Schematic of a typical DC motor.
Figure 2.3: Block diagram of the DC motor
Figure 2.4: Simplified block diagram of a DC motor.
Figure 2.5: Typical First Order System Response for a Step Input
Figure 2.6: Closed-loop block diagram for the position control of a DC motor using a proportional controller
Figure 2.7: Closed-loop block diagram for the position control of a DC motor using a proportional-plus-derivative (PD) controller.
Figure 2.8: Closed-loop block diagram for the position control of the DC motor using a proportional-plus-Integral-plus-derivative (PID) controller
Fl+FrF_l+F_rFl​+Fr​
Fs=Fl+FrF_s = F_l+F_rFs​=Fl​+Fr​
FgF_gFg​
Fg=lamhg−lwmwgla(5.1)F_g = \frac{l_am_hg-l_wm_wg}{l_a} \tag{5.1}Fg​=la​la​mh​g−lw​mw​g​(5.1)
ϕ\phiϕ
θ\thetaθ
Jθθ¨=laFs−laFg=la(Fl+Fr)cos⁡ϕ−laFgJθθ¨=Kfla(Vl+Vr)cos⁡ϕ−Tg=KflaVscos⁡ϕ−Tg\begin{equation} \tag{5.2} \begin{aligned} J_{\theta} \ddot{\theta} & = l_a F_s - l_a F_g = l_a(F_l+F_r)\cos\phi - l_a F_g \\ J_{\theta}\ddot{\theta} &= K_f l_a(V_l+V_r)\cos\phi - T_g \\ &= K_f l_a V_s \cos\phi - T_g \end{aligned} \end{equation}Jθ​θ¨Jθ​θ¨​=la​Fs​−la​Fg​=la​(Fl​+Fr​)cosϕ−la​Fg​=Kf​la​(Vl​+Vr​)cosϕ−Tg​=Kf​la​Vs​cosϕ−Tg​​​(5.2)​
JθJ_{\theta}Jθ​
KfK_fKf​
lal_ala​
lwl_wlw​
θ\thetaθ
ϕ\phiϕ
VrV_rVr​
FrF_rFr​
VlV_lVl​
FlF_lFl​
TgT_gTg​
=laFg= l_a F_g=la​Fg​
Jϕϕ¨=Frlh−Fllh=Kflh(Vr−Vl)=KflhVd\begin{equation} \tag{5.3} \begin{aligned} J_\phi\ddot{\phi} &= F_rl_h-F_ll_h \\ &= K_fl_h(V_r-V_l) \\ &= K_fl_hV_d \end{aligned} \end{equation}Jϕ​ϕ¨​​=Fr​lh​−Fl​lh​=Kf​lh​(Vr​−Vl​)=Kf​lh​Vd​​​(5.3)​
JϕJ_\phiJϕ​
lhl_hlh​
ϕ\phiϕ
ϕ\phiϕ
Jψr˙=la(Fl+Fr)sin⁡ϕ=Kfla(Vl+Vr)sin⁡ϕ=KflaVssin⁡ϕ\begin{equation} \tag{5.4} \begin{aligned} J_{\psi} \dot{r} & = l_a(F_l+F_r)\sin\phi \\ &= K_f l_a(V_l+V_r)\sin\phi \\ &= K_f l_a V_s \sin\phi \end{aligned} \end{equation}Jψ​r˙​=la​(Fl​+Fr​)sinϕ=Kf​la​(Vl​+Vr​)sinϕ=Kf​la​Vs​sinϕ​​(5.4)​
JψJ_\psiJψ​
rrr
Jθθ¨=Kfla(Vr+Vl)=KflaVs(5.5)J_{\theta}\ddot{\theta} = K_fl_a(V_r+V_l)=K_fl_aV_s \tag{5.5}Jθ​θ¨=Kf​la​(Vr​+Vl​)=Kf​la​Vs​(5.5)
Vs=(Vr+Vl)V_s=(V_r+V_l)Vs​=(Vr​+Vl​)
Vs=−Kθp(θ−θc)−Kθdθ˙(5.6)V_s =-K_{\theta p}(\theta-\theta_c)-K_{\theta d}\dot{\theta} \tag{5.6}Vs​=−Kθp​(θ−θc​)−Kθd​θ˙(5.6)
θc\theta_cθc​
θ(s)θc(s)=KflaKθps2Jθ+KflaKθds+KflaKθp=KflaKθpJθs2+KflaKθdJθs+KflaKθpJθ(5.7)\frac{\theta(s)}{\theta_c(s)} = \frac{K_f l_a K_{\theta p}}{s^2J_\theta+K_fl_aK_{\theta d}s+K_fl_aK_{\theta p}} = \frac{\cfrac{K_fl_aK_{\theta p}}{J_{\theta}}}{s^2+\cfrac{K_fl_aK_{\theta d}}{J_{\theta}}s+\cfrac{K_fl_aK_{\theta p}}{J_{\theta}}} \tag{5.7}θc​(s)θ(s)​=s2Jθ​+Kf​la​Kθd​s+Kf​la​Kθp​Kf​la​Kθp​​=s2+Jθ​Kf​la​Kθd​​s+Jθ​Kf​la​Kθp​​Jθ​Kf​la​Kθp​​​(5.7)
Standard 2nd order TF form=ωn2s2+2ζωns+ωn2(5.8)\text{Standard }\mathrm{2^{nd}}\text{ order TF form} = \frac{\omega_n^2}{s^2+2\zeta\omega_ns+\omega_n^2} \tag{5.8}Standard 2nd order TF form=s2+2ζωn​s+ωn2​ωn2​​(5.8)
ωnθ\omega_{n\theta}ωnθ​
ζθ\zeta_\thetaζθ​
KflaKθpJθ=ωnθ2→Kθp=Jθωnθ2Kfla(5.9)\frac{K_fl_aK_{\theta p}}{J_\theta} = \omega_{n\theta}^2 \qquad \to \qquad K_{\theta p}=\frac{J_\theta\omega_{n\theta}^2}{K_fl_a} \tag{5.9}Jθ​Kf​la​Kθp​​=ωnθ2​→Kθp​=Kf​la​Jθ​ωnθ2​​(5.9)
KflaKθdJθ=2ζθωnθ→Kθd=Jθ(2ζθωnθ)Kfla(5.10)\frac{K_fl_aK_{\theta d}}{J_\theta} = 2\zeta_\theta \omega_{n\theta} \qquad \to \qquad K_{\theta d}=\frac{J_\theta(2\zeta_\theta\omega_{n\theta})}{K_fl_a} \tag{5.10}Jθ​Kf​la​Kθd​​=2ζθ​ωnθ​→Kθd​=Kf​la​Jθ​(2ζθ​ωnθ​)​(5.10)
TgT_gTg​
Tg=0T_g = 0Tg​=0
KiK_iKi​
Vs=−Kθp(θ−θc)−Kθdθ˙−Kθi∫(θ−θc)dt(5.11)V_s =-K_{\theta p}(\theta-\theta_c)-K_{\theta d}\dot{\theta}-K_{\theta i}\int(\theta-\theta_c)dt \tag{5.11}Vs​=−Kθp​(θ−θc​)−Kθd​θ˙−Kθi​∫(θ−θc​)dt(5.11)
KθiK_{\theta i}Kθi​
Kθi=0.01KθpK_{\theta i}=0.01K_{\theta p}Kθi​=0.01Kθp​
Jϕϕ¨=Kflh(Vr−Vl)=KflhVd(5.12)J_\phi\ddot{\phi}=K_fl_h(V_r-V_l)=K_fl_hV_d \tag{5.12}Jϕ​ϕ¨​=Kf​lh​(Vr​−Vl​)=Kf​lh​Vd​(5.12)
Vd=(Vr−Vl)V_d = (V_r-V_l)Vd​=(Vr​−Vl​)
Vd=−Kϕp(ϕ−ϕc)−Kϕdϕ˙(5.13)V_d = -K_{\phi p}(\phi-\phi_c)-K_{\phi d}\dot{\phi} \tag{5.13}Vd​=−Kϕp​(ϕ−ϕc​)−Kϕd​ϕ˙​(5.13)
ϕc\phi_cϕc​
ϕ(s)ϕc(s)=KflhKϕps2Jϕ+KflhKϕds+KflhKϕp(5.14)\frac{\phi(s)}{\phi_c(s)} = \frac{K_fl_hK_{\phi p}}{s^2J_\phi+K_fl_hK_{\phi d}s+K_fl_hK_{\phi p}} \tag{5.14}ϕc​(s)ϕ(s)​=s2Jϕ​+Kf​lh​Kϕd​s+Kf​lh​Kϕp​Kf​lh​Kϕp​​(5.14)
KflhKϕpJϕ=ωnϕ2→Kϕp=Jϕωnϕ2Kflh(5.15)\frac{K_fl_hK_{\phi p}}{J_\phi} = \omega_{n\phi}^2 \qquad \to \qquad K_{\phi p}=\frac{J_\phi\omega_{n\phi}^2}{K_fl_h} \tag{5.15}Jϕ​Kf​lh​Kϕp​​=ωnϕ2​→Kϕp​=Kf​lh​Jϕ​ωnϕ2​​(5.15)
KflhKϕdJϕ=2ζϕωnϕ→Kϕd=Jϕ(2ζϕωnϕ)Kflh(5.16)\frac{K_fl_hK_{\phi d}}{J_\phi} = 2\zeta_\phi\omega_{n\phi} \qquad \to \qquad K_{\phi d}=\frac{J_\phi(2\zeta_\phi\omega_{n\phi})}{K_fl_h} \tag{5.16}Jϕ​Kf​lh​Kϕd​​=2ζϕ​ωnϕ​→Kϕd​=Kf​lh​Jϕ​(2ζϕ​ωnϕ​)​(5.16)
ωnϕ\omega_{n\phi}ωnϕ​
ζϕ\zeta_\phiζϕ​
Fl+FrF_l+F_rFl​+Fr​
FgF_gFg​
Jψr˙=Fglaϕ(5.17)J_\psi\dot{r}=F_gl_a\phi \tag{5.17}Jψ​r˙=Fg​la​ϕ(5.17)
rcr_crc​
ϕc\phi_cϕc​
ϕc=−Krp(r−rc)−Kri∫(r−rc)dt(5.18)\phi_c=-K_{rp}(r-r_c)-K_{ri}\int(r-r_c)dt \tag{5.18}ϕc​=−Krp​(r−rc​)−Kri​∫(r−rc​)dt(5.18)
ϕ\phiϕ
ϕc\phi_cϕc​
Kri=0K_{ri} = 0Kri​=0
r(s)rc(s)=FglaKrpJψs+FglaKrp(5.19)\frac{r(s)}{r_c(s)}=\frac{F_gl_aK_{rp}}{J_\psi s+F_gl_aK_{rp}} \tag{5.19}rc​(s)r(s)​=Jψ​s+Fg​la​Krp​Fg​la​Krp​​(5.19)
Standard TF of 1st Order System=1τs+1(5.20)\text{Standard TF of }\mathrm{1^{st}}\text{ Order System} = \frac{1}{\tau s+1} \tag{5.20}Standard TF of 1st Order System=τs+11​(5.20)
τ=JψFglaKrp→Krp=JψFglaτ(5.21)\tau = \frac{J_\psi}{F_gl_aK_{rp}} \qquad \to \qquad K_{rp}=\frac{J_\psi}{F_gl_a\tau} \tag{5.21}τ=Fg​la​Krp​Jψ​​→Krp​=Fg​la​τJψ​​(5.21)
(Kri=0.01Krp)\left(K_{ri}=0.01K_{rp}\right)(Kri​=0.01Krp​)
KriK_{ri}Kri​
Jθ=1.1 kg−m2Jϕ=0.0469 kg−m2Jψ=1.1 kg−m2la=0.63 mlh=0.18 mKf=0.0784 N/VoltFg=0.63 N\begin{equation*} \begin{aligned} J_\theta &= 1.1 \mathrm{~kg-m^2}\\ J_\phi &= 0.0469 \mathrm{~kg-m^2}\\ J_\psi &= 1.1 \mathrm{~kg-m^2}\\ l_a &= 0.63 \mathrm{~m}\\ l_h &= 0.18 \mathrm{~m} \\ K_f &= 0.0784 \mathrm{~N/Volt}\\ F_g &= 0.63 \mathrm{~N} \end{aligned} \end{equation*}Jθ​Jϕ​Jψ​la​lh​Kf​Fg​​=1.1 kg−m2=0.0469 kg−m2=1.1 kg−m2=0.63 m=0.18 m=0.0784 N/Volt=0.63 N​​
θ\thetaθ
ϕ\phiϕ
Peak time=π(1−ζ2)ωn5% Settling time=3ζωn\text{Peak time} =\cfrac{\pi}{(\sqrt{1-\zeta^2})\omega_n} \qquad \qquad \text{5\% Settling time} = \cfrac{3}{\zeta\omega_n}Peak time=(1−ζ2​)ωn​π​5% Settling time=ζωn​3​
ωn\omega_nωn​
ζ\zetaζ
Kθi=0.01KθpK_{\theta i} = 0.01K_{\theta p}Kθi​=0.01Kθp​
rrr
trt_rtr​
τ\tauτ
τ\tauτ
KrpK_{rp}Krp​
Kri=0.01KrpK_{r i} = 0.01K_{r p}Kri​=0.01Krp​
ϕ=ϕc\phi=\phi_cϕ=ϕc​
sin⁡(ϕ)\sin(\phi)sin(ϕ)
cos⁡(ϕ)\cos(\phi)cos(ϕ)
FgF_gFg​
FsF_sFs​
FsF_sFs​
sin⁡ϕ\sin\phisinϕ
Fssin⁡(ϕ)F_s\sin(\phi)Fs​sin(ϕ)
FsF_sFs​
cos⁡(ϕ)\cos(\phi)cos(ϕ)
Fscos⁡(ϕ)F_s\cos(\phi)Fs​cos(ϕ)
KθiK_{\theta i}Kθi​
Figure 5.1: 3-DOF Helicopter when running [Image credit: Lehigh University]
Figure 5.2: 3-DOF helicopter mechanism in the lab
Figure 5.3: Schematic of 3-DOF helicopter mechanism
Figure 5.4: Main parts of the 3-DOF helicopter mechanism (looking from the back and top)
Figure 5.5: Pitching moment calculation
Figure 5.6. Sketch of the configuration in 3-D motion.
Figure 5.7: Rolling moment calculation (as seen looking from the front)
θ1\theta_1θ1​
θ3\theta_3θ3​
θ1\theta_1θ1​
J1J_1J1​
J2J_2J2​
θ2\theta_2θ2​
J3J_3J3​
θ3\theta_3θ3​
k1k_1k1​
J1, J3, k1, c1J_1,\space J_3,\space k_1,\space c_1J1​, J3​, k1​, c1​
c3c_3c3​
JJJ
kkk
ccc
Jθ¨+cθ˙+kθ=0(4.1)J \ddot{\theta} + c\dot{\theta} +k\theta = 0 \tag{4.1}Jθ¨+cθ˙+kθ=0(4.1)
θ(t)=Θe−ζωntcos⁡(ωdt+ϕ)\theta(t) = \Theta e^{-\zeta \omega_n t}\cos(\omega_d t + \phi)θ(t)=Θe−ζωn​tcos(ωd​t+ϕ)
2ζωn=cJ,ωn=kJ,ωd=ωn1−ζ2(4.2)2\zeta \omega_n = \frac{c}{J}, \qquad \omega_n = \sqrt{\frac{k}{J}}, \qquad \omega_d = \omega_n \sqrt{1-\zeta^2} \tag{4.2}2ζωn​=Jc​,ωn​=Jk​​,ωd​=ωn​1−ζ2​(4.2)
θ\thetaθ
θ(t1)=Θe−ζωnt1cos⁡(ωdt1+ϕ)\theta(t_1) = \Theta e^{-\zeta \omega_nt_1}\cos(\omega_d t_1 + \phi)θ(t1​)=Θe−ζωn​t1​cos(ωd​t1​+ϕ)
θ(t2)=Θe−ζωnt2cos⁡(ωdt2+ϕ)\theta(t_2) = \Theta e^{-\zeta \omega_n t_2}\cos(\omega_d t_2 + \phi)θ(t2​)=Θe−ζωn​t2​cos(ωd​t2​+ϕ)
t2=Td+t1, with Td=2πωdt_2 = T_d + t_1, \space \text{with} \space T_d = \frac{2\pi}{\omega_d}t2​=Td​+t1​, with Td​=ωd​2π​
cos⁡(ωdt2+ϕ)=cos⁡(2π+ωdt1+ϕ)=cos⁡(ωdt1+ϕ)\cos(\omega_dt_2 + \phi) = \cos(2\pi + \omega_dt_1 + \phi) = \cos(\omega_dt_1 + \phi)cos(ωd​t2​+ϕ)=cos(2π+ωd​t1​+ϕ)=cos(ωd​t1​+ϕ)
θ(t1)θ(t2)=e−ζωnt1e−ζωn(t1+Td)=eζωnTd(4.3)\frac{\theta(t_1)}{\theta(t_2)} = \frac{e^{-\zeta \omega_n t_1}}{e^{-\zeta \omega_n (t_1+T_d)}} = e^{\zeta \omega_n T_d} \tag{4.3}θ(t2​)θ(t1​)​=e−ζωn​(t1​+Td​)e−ζωn​t1​​=eζωn​Td​(4.3)
δ\deltaδ
δ=ln⁡θ(t1)θ(t2)\delta = \ln\frac{\theta(t_1)}{\theta(t_2)}δ=lnθ(t2​)θ(t1​)​
δ=ζωnTd=ζωn2πωn1−ζ2\delta = \zeta\omega_nT_d = \zeta\omega_n\frac{2\pi}{\omega_n \sqrt{1-\zeta^2}}δ=ζωn​Td​=ζωn​ωn​1−ζ2​2π​
δ=2πζ1−ζ2=(2πωd)(cJ)(4.4)\delta = \frac{2\pi\zeta}{\sqrt{1-\zeta^2}} = \left(\frac{2\pi}{\omega_d}\right) \left(\frac{c}{J}\right) \tag{4.4}δ=1−ζ2​2πζ​=(ωd​2π​)(Jc​)(4.4)
δ\deltaδ
ζ\zetaζ
ζ=δ(2π)2+δ2\zeta = \frac{\delta}{\sqrt{(2\pi)^2 + \delta^2}}ζ=(2π)2+δ2​δ​
t3=t1+2Tdt_3 = t_1 + 2T_dt3​=t1​+2Td​
tm=t1+mTdt_m = t_1 +mT_dtm​=t1​+mTd​
θ(t1)θ(tm+1)=θ(t1)θ(t2)θ(t2)θ(t3)⋯⋯θ(tm)θ(tm+1)\frac{\theta(t_1)}{\theta(t_{m+1})} = \frac{\theta(t_1)}{\theta(t_2)}\frac{\theta(t_2)}{\theta(t_3)} \cdots \cdots \frac{\theta(t_m)}{\theta(t_{m+1})}θ(tm+1​)θ(t1​)​=θ(t2​)θ(t1​)​θ(t3​)θ(t2​)​⋯⋯θ(tm+1​)θ(tm​)​
θ(ti)θ(ti+1)=eζωnTd,i=1,…,m\frac{\theta(t_i)}{\theta(t_{i+1})} = e^{\zeta\omega_nT_d}, \quad i = 1, \ldots, mθ(ti+1​)θ(ti​)​=eζωn​Td​,i=1,…,m
θ(t1)θ(tm+1)=(eζωnTd)m=emζωnTd\frac{\theta(t_1)}{\theta(t_{m+1})} = (e^{\zeta\omega_nT_d})^m = e^{m\zeta\omega_nT_d}θ(tm+1​)θ(t1​)​=(eζωn​Td​)m=emζωn​Td​
ln⁡(θ(t1)θ(t2))=mζωnTd=mδ\ln\left(\frac{\theta(t_1)}{\theta(t_2)}\right) = m \zeta \omega_n T_d = m \deltaln(θ(t2​)θ(t1​)​)=mζωn​Td​=mδ
δ=1mln⁡(θ(t1)θ(tm+1))\delta = \frac{1}{m} \ln\left(\frac{\theta(t_1)}{\theta(t_{m+1})}\right)δ=m1​ln(θ(tm+1​)θ(t1​)​)
ωnℓ\omega_{n_\ell}ωnℓ​​
ζℓ\zeta_\ellζℓ​
ωnℓ=ωdℓ1−ζℓ2,ζℓ=δℓ(2π)2+δℓ2(4.5)\omega_{n_\ell} = \frac{\omega_{d_\ell}}{\sqrt{1-\zeta_\ell^2}}, \qquad \zeta_\ell = \frac{\delta_\ell}{\sqrt{(2\pi)^2 + \delta_\ell^2}} \tag{4.5}ωnℓ​​=1−ζℓ2​​ωdℓ​​​,ζℓ​=(2π)2+δℓ2​​δℓ​​(4.5)
ωdℓ\omega_{d_\ell}ωdℓ​​
ℓ\ellℓ
uuu
ωnu=ωdu1−ζu2,ζu=δu(2π)2+δu2(4.6)\omega_{n_u} = \frac{\omega_{d_u}}{\sqrt{1-\zeta_u^2}}, \qquad \zeta_u = \frac{\delta_u}{\sqrt{(2\pi)^2 + \delta_u^2}} \tag{4.6}ωnu​​=1−ζu2​​ωdu​​​,ζu​=(2π)2+δu2​​δu​​(4.6)
ωnl2=kJm+J,ωnu2=kJ\omega_{n_l}^2 = \frac{k}{J_m+J}, \qquad \omega_{n_u}^2 = \frac{k}{J}ωnl​2​=Jm​+Jk​,ωnu​2​=Jk​
kkk
ωnl2(Jm+J)=ωnu2J\omega_{n_l}^2 (J_m + J) = \omega_{n_u}^2Jωnl​2​(Jm​+J)=ωnu​2​J
J=Jmωnl2ωnu2−ωnl2(4.7)J = \frac{J_m\omega_{n_l}^2}{\omega_{n_u}^2 - \omega_{n_l}^2} \tag{4.7}J=ωnu​2​−ωnl​2​Jm​ωnl​2​​(4.7)
c=2ζuJωnu(4.8)c = 2\zeta_uJ\omega_{n_u} \tag{4.8}c=2ζu​Jωnu​​(4.8)
ωdUℓ\omega_{d_{U\ell}}ωdUℓ​​
ωnUℓ\omega_{n_{U\ell}}ωnUℓ​​
UℓU\ellUℓ
X0X_0X0​
XnX_nXn​
ζUl\zeta_{Ul}ζUl​
ωnUℓ\omega_{n_{U\ell}}ωnUℓ​​
ωdUu\omega_{d_{Uu}}ωdUu​​
ζUu\zeta_{Uu}ζUu​
ωnUu\omega_{n_{Uu}}ωnUu​​
UuUuUu
ωnLℓ, ωnLu, ζLℓ\omega_{n_{L\ell}}, \space \omega_{n_{Lu}}, \space \zeta_{L\ell}ωnLℓ​​, ωnLu​​, ζLℓ​
ζLu\zeta_{Lu}ζLu​
LℓL\ellLℓ
LuLuLu
UℓU\ellUℓ
LℓL\ellLℓ
JmJ_mJm​
JUJ_UJU​
kUk_UkU​
ωnUl2=kUJm+JU and ωnUu2=kUJU\omega_{n_{Ul}}^2= \displaystyle\frac{k_U}{J_m + J_U} \quad \text{ and } \quad \omega_{n_{Uu}}^2 = \frac{k_U}{J_U}ωnUl​2​=Jm​+JU​kU​​ and ωnUu​2​=JU​kU​​
ζUu\zeta_{Uu}ζUu​
ωnUu\omega_{n_{Uu}}ωnUu​​
cUc_UcU​
JLJ_LJL​
kLk_LkL​
cLc_LcL​
Jmotor-belt-pulleysJ_{\text{motor-belt-pulleys}}Jmotor-belt-pulleys​
2^22
J1J_1J1​
JLJ_LJL​
JmJ_mJm​
JmbpJ_{\text{mbp}}Jmbp​
J1=JL+Jm+JmbpJ_1 = J_L + J_m+J_{\text{mbp}}J1​=JL​+Jm​+Jmbp​
J3J_3J3​
JUJ_UJU​
JmJ_mJm​
J3=JU+JmJ_3 = J_U+J_mJ3​=JU​+Jm​
c1c_1c1​
cLuc_{Lu}cLu​
c3c_3c3​
cUuc_{Uu}cUu​
JmJ_mJm​
JmJ_mJm​
J1J_1J1​
J1θ¨1+c1θ˙1+k1θ1−k1θ3=T(t)(4.9)J_1\ddot{\theta}_1 +c_1\dot{\theta}_1+k_1\theta_1-k_1\theta_3=T(t) \tag{4.9}J1​θ¨1​+c1​θ˙1​+k1​θ1​−k1​θ3​=T(t)(4.9)
T(t)=kVTVT(t) = k_{VT}VT(t)=kVT​V
VVV
kVTk_{VT}kVT​
kVT=ka⋅kt⋅kp(4.10)k_{VT} = k_a \cdot k_t \cdot k_p \tag{4.10}kVT​=ka​⋅kt​⋅kp​(4.10)
kak_aka​
ktk_tkt​
kpk_pkp​
kVTk_{VT}kVT​
J3J_3J3​
J3θ¨3+c3θ˙3+k1θ3−k1θ1=0(4.11)J_3\ddot{\theta}_3+c_3\dot{\theta}_3+k_1\theta_3-k_1\theta_1=0 \tag{4.11}J3​θ¨3​+c3​θ˙3​+k1​θ3​−k1​θ1​=0(4.11)
x˙=Ax+BT(t)\dot{x} = Ax + BT(t)x˙=Ax+BT(t)
x=[θ1θ3θ˙1θ˙3],A=[00100001−k1J1k1J1−c1J10k1J3−k1J30−c3J3],B=[001J10](4.12)x = \begin{bmatrix} \theta_1 \\ \theta_3 \\ \dot{\theta}_1 \\ \dot{\theta}_3 \end{bmatrix}, \qquad A = \begin{bmatrix} 0 &0 &1 &0 \\ 0 &0 &0 &1 \\ -\frac{k_1}{J_1} &\frac{k_1}{J_1} &-\frac{c_1}{J_1} &0\\ \frac{k_1}{J_3} &-\frac{k_1}{J_3} &0 &-\frac{c_3}{J_3} \end{bmatrix}, \qquad B = \begin{bmatrix} 0 \\ 0 \\ \frac{1}{J_1} \\ 0 \end{bmatrix} \tag{4.12}x=​θ1​θ3​θ˙1​θ˙3​​​,A=​00−J1​k1​​J3​k1​​​00J1​k1​​−J3​k1​​​10−J1​c1​​0​010−J3​c3​​​​,B=​00J1​1​0​​(4.12)
θ1(s)T(s)=(J3s2+c3s+k1)D(s)(4.13)\frac{\theta_1(s)}{T(s)} = \frac{(J_3s^2+c_3s+k_1)}{D(s)} \tag{4.13}T(s)θ1​(s)​=D(s)(J3​s2+c3​s+k1​)​(4.13)
θ3(s)T(s)=k1D(s)(4.14)\frac{\theta_3(s)}{T(s)} = \frac{k_1}{D(s)} \tag{4.14}T(s)θ3​(s)​=D(s)k1​​(4.14)
D(s)=J1J3s4+(c1J3+c3J1)s3+(J1k1+J3k1+c1c3)s2+(c1k1+c3k1)s(4.15)D(s) = J_1J_3s^4 + (c_1J_3+c_3J_1)s^3 + (J_1k_1+J_3k_1+c_1c_3)s^2 + (c_1k_1+c_3k_1)s \tag{4.15}D(s)=J1​J3​s4+(c1​J3​+c3​J1​)s3+(J1​k1​+J3​k1​+c1​c3​)s2+(c1​k1​+c3​k1​)s(4.15)
k1k_1k1​
kLk_LkL​
kUk_UkU​
k1=kLkUkL+kUk_1 = \frac{k_Lk_U}{k_L+k_U}k1​=kL​+kU​kL​kU​​
khwk_{\text{hw}}khw​
khw=kc⋅ka⋅kt⋅kp⋅ke⋅ksk_{\text{hw}} = k_c \cdot k_a \cdot k_t \cdot k_p \cdot k_e \cdot k_skhw​=kc​⋅ka​⋅kt​⋅kp​⋅ke​⋅ks​
kck_ckc​
kak_aka​
ktk_tkt​
kpk_pkp​
kek_eke​
ksk_sks​
KpK_pKp​
KdK_dKd​
Gp(s)=n(s)d(s)=θ1(s)T(s)G_p(s) = \frac{n(s)}{d(s)} = \frac{\theta_1(s)}{T(s)}Gp​(s)=d(s)n(s)​=T(s)θ1​(s)​
θ1\theta_1θ1​
TTT
θ1\theta_1θ1​
θ1\theta_1θ1​
θ1\theta_1θ1​
KpK_pKp​
KdK_dKd​
θ1(s)/T(s)\theta_1(s)/T(s)θ1​(s)/T(s)
KpK_pKp​
KdK_dKd​
θ3(s)/θ1(s)\theta_3(s)/\theta_1(s)θ3​(s)/θ1​(s)
θ1\theta_1θ1​
θ3\theta_3θ3​
θ1\theta_1θ1​
θ1\theta_1θ1​
θ1\theta_1θ1​
θ3\theta_3θ3​
θ1\theta_1θ1​
Image source: https://www.phywe.com/en/torsional-vibrations-and-torsion-modulus.html
Figure 4.1. Experimental control system
Figure 4.2. Calculation of the logarithmic decrement
Figure 4.4. Configuration of the torsional mechanism used for controller design and evaluation
Figure 4.5. Free-free two DOF torsional plant
Figure 4.6. Free body diagram of the lower disk (left) and upper disk (right)
Figure 4.7. Computing the gain k_VT
Figure 4.8. Closed-loop block diagram of the torsional plant with a PD controller - collocated control

Initial PID Gains

X-Axis

Y-Axis

Z-Axis

kpk_pkp​

2.0

2.0

2.0

kdk_dkd​

0.2

0.2

0.2

kpk_pkp​
kdk_dkd​

Initial PID Gains

X-Axis

Y-Axis

Z-Axis

kpk_pkp​

3.0

3.0

3.0

kdk_dkd​

0.2

0.2

0.2

Initial PID Gains

X-Axis

Y-Axis

Z-Axis

kpk_pkp​

2.0

2.0

2.0

kdk_dkd​

0.5

0.5

0.5

Figure 8.1. Quadrotor Body Frame Axes
Figure 8.2 Quadrotor Propeller Direction. Note: Does NOT represent actual configuration.
Figure 8.3 Cone Shape of the Crazyflie Height Sensing.
Figure 8.4 Example plots generated by lab8_part1_plot.py
θ=0\theta=0θ=0
θ˙(t)>0\dot{\theta}(t)>0θ˙(t)>0
ψ˙(t)>0\dot{\psi}(t)>0ψ˙​(t)>0
θ˙>0\dot{\theta}>0θ˙>0
Vθ>0V_\theta>0Vθ​>0
ψ˙>0\dot{\psi}>0ψ˙​>0
Vψ>0V_{\psi}>0Vψ​>0
VθV_\thetaVθ​
FθF_\thetaFθ​
rθr_\thetarθ​
FψF_\psiFψ​
rψr_\psirψ​
JθJ_\thetaJθ​
DθD_\thetaDθ​
KθK_\thetaKθ​
JψJ_{\psi}Jψ​
DψD_{\psi}Dψ​
KθθK_{\theta\theta}Kθθ​
KψψK_{\psi\psi}Kψψ​
KθψK_{\theta\psi}Kθψ​
KψθK_{\psi\theta}Kψθ​
VθV_\thetaVθ​
VψV_\psiVψ​
Jprop=mpropr2J_{\rm prop}=m_{\rm prop}r^2Jprop​=mprop​r2
J=mbodyLbody212J=m_{\rm body} \displaystyle \frac{L^2_{\rm body}}{12}J=mbody​12Lbody2​​
Jyoke=myokeryoke22J_{\rm yoke}=m_{\rm yoke}\displaystyle \frac{r^2_{yoke}}{2}Jyoke​=myoke​2ryoke2​​
Jθ=0.0219 kg⋅m2J_\theta=0.0219 \space \rm kg \cdot m^2Jθ​=0.0219 kg⋅m2
Jψ=0.0220 kg⋅m2J_\psi=0.0220\space \rm kg \cdot m^2Jψ​=0.0220 kg⋅m2
K=1K = 1K=1
τ=0.05\tau = 0.05τ=0.05
1−e−11-e^{-1}1−e−1
τ=t1−t0\tau=t_1-t_{0 }τ=t1​−t0​
t0t_0t0​
t1t_1t1​
e−1e^{-1}e−1
τ=t1−t0\tau=t_1-t_{0 }τ=t1​−t0​
α(0−)=α0\alpha(0-)=\alpha_0α(0−)=α0​
ζ\zetaζ
ωn\omega_nωn​
tnt_ntn​
nthn^{th}nth
t1t_1t1​
nnn
O1O_1O1​
OnO_nOn​
nthn^{th}nth
O1O_1O1​
OnO_nOn​
DθD_\thetaDθ​
DψD_\psiDψ​
θ˙(0−)=0\dot{\theta}(0^-)=0θ˙(0−)=0
ωψ(t)=ψ˙(t)\omega_\psi(t)=\dot{\psi}(t)ωψ​(t)=ψ˙​(t)
Kθθ/rpK_{\theta\theta}/r_pKθθ​/rp​
rpr_prp​
ωψ=ψ˙\omega_\psi=\dot\psiωψ​=ψ˙​
KθψK_{\theta\psi}Kθψ​
KψθK_{\psi\theta}Kψθ​
Vθ=0V_\theta=0Vθ​=0
ωp=θ˙\omega_p=\dot\thetaωp​=θ˙
DθD_{\theta} Dθ​
KθθK_{\theta\theta}Kθθ​
DψD_{\psi}Dψ​
KψψK_{\psi\psi}Kψψ​
KθψK_{\theta\psi}Kθψ​
KψθK_{\psi\theta}Kψθ​
DψD_\psiDψ​
Kθθ,Kψψ,Kθψ,KψθK_{\theta\theta}, K_{\psi\psi}, K_{\theta\psi}, K_{\psi\theta}Kθθ​,Kψψ​,Kθψ​,Kψθ​
177KB
quanser_aero.zip
archive
Fig. 1: Quanser Aero Experiment
Fig. 2: Simple free-body diagram of Quanser Aero Experiment
Fig. 3.a : First-order step response
Figure 3.b: First-order impulse decaying response
Fig. 4: Free Oscillation Response
Fig. 7: Sample free response about yaw
Fig. 8: Sample yaw Step Response
Fig. 9: Sample Pitch Step Response from Yaw Voltage
Fig. 10: Sample Yaw Step Response from Pitch Voltage
x˙=Ax+Bu\dot{x}=Ax+Bux˙=Ax+Bu
y=Cx+Duy=Cx+Duy=Cx+Du
θ\thetaθ
ψ\psiψ
VθV_\thetaVθ​
VψV_\psiVψ​
KKK
xxx
θd\theta_dθd​
ψd\psi_dψd​
VθV_\thetaVθ​
VψV_\psiVψ​
uuu
QQQ
RRR
QQQ
RRR
Q∈R4×4Q\in \mathbb{R}^{4\times 4}Q∈R4×4
R∈R2×2R\in\mathbb{R}^{2\times 2}R∈R2×2
xdx_dxd​
KKK
QQQ
RRR
uuu
KKK
KKK
2×42\times 4 2×4
KKK
esse_{\rm ss}ess​
deg⁡\degdeg
esse_{\rm ss}ess​
deg⁡\degdeg
tpt_{\rm p}tp​
PO\rm POPO
∣Vψ∣|V_\psi|∣Vψ​∣
∣Vθ∣|V_\theta|∣Vθ​∣
Q,RQ,RQ,R
KKK
QQQ
RRR
KKK
θd=10 deg⁡\theta_d=10\space \degθd​=10 deg
ψd=45 deg⁡\psi_d=45 \space \degψd​=45 deg
θd=10 deg⁡\theta_d= 10\space \degθd​=10 deg
ψd=45 deg\psi_d = 45 \space \rm degψd​=45 deg
QQQ
RRR
Q,RQ,RQ,R
KKK
QQQ
RRR
QQQ
RRR
esse_{\rm ss}ess​
deg⁡\degdeg
esse_{\rm ss}ess​
deg⁡\degdeg
tpt_{\rm p}tp​
POPOPO
∣Vψ∣|V_\psi|∣Vψ​∣
∣Vθ∣|V_\theta|∣Vθ​∣
KKK
KKK
22KB
q_aero_2dof_lqr_control.slx
Fig. 11: Model used to acquire free-oscillation response about pitch
Fig. 12: SIMULINK model used to run LQR controller
θb\theta_bθb​
−MbgDmsin⁡(θb)≈−MbgDmθb-M_bgD_m \sin(\theta_b)\approx -M_bgD_m \theta_b−Mb​gDm​sin(θb​)≈−Mb​gDm​θb​
θ=0\theta=0θ=0
θ˙(t)>0\dot{\theta}(t)>0θ˙(t)>0
ψ˙(t)>0\dot{\psi}(t)>0ψ˙​(t)>0
θ˙>0\dot{\theta}>0θ˙>0
Vθ>0V_\theta>0Vθ​>0
ψ˙>0\dot{\psi}>0ψ˙​>0
Vψ>0V_{\psi}>0Vψ​>0
VθV_\thetaVθ​
FθF_\thetaFθ​
rθr_\thetarθ​
FψF_\psiFψ​
rψr_\psirψ​
JθJ_\thetaJθ​
DθD_\thetaDθ​
KθK_\thetaKθ​
JψJ_{\psi}Jψ​
DψD_{\psi}Dψ​
KθθK_{\theta\theta}Kθθ​
KψψK_{\psi\psi}Kψψ​
KθψK_{\theta\psi}Kθψ​
KψθK_{\psi\theta}Kψθ​
VθV_\thetaVθ​
VψV_\psiVψ​
Jprop=mpropr2J_{\rm prop}=m_{\rm prop}r^2Jprop​=mprop​r2
J=mbodyLbody212J=m_{\rm body} \displaystyle \frac{L^2_{\rm body}}{12}J=mbody​12Lbody2​​
Jyoke=myokeryoke22J_{\rm yoke}=m_{\rm yoke}\displaystyle \frac{r^2_{yoke}}{2}Jyoke​=myoke​2ryoke2​​
Jθ=0.0219 kg⋅m2J_\theta=0.0219 \space \rm kg \cdot m^2Jθ​=0.0219 kg⋅m2
Jψ=0.0220 kg⋅m2J_\psi=0.0220\space \rm kg \cdot m^2Jψ​=0.0220 kg⋅m2
K=1K = 1K=1
τ=0.05\tau = 0.05τ=0.05
1−e−11-e^{-1}1−e−1
τ=t1−t0\tau=t_1-t_{0 }τ=t1​−t0​
t0t_0t0​
t1t_1t1​
τ=t1−t0\tau=t_1-t_{0 }τ=t1​−t0​
α(0−)=α0\alpha(0-)=\alpha_0α(0−)=α0​
ζ\zetaζ
ωn\omega_nωn​
tnt_ntn​
nthn^{th}nth
t1t_1t1​
nnn
O1O_1O1​
OnO_nOn​
nthn^{th}nth
O1O_1O1​
OnO_nOn​
DθD_\thetaDθ​
DψD_\psiDψ​
θ˙(0−)=0\dot{\theta}(0^-)=0θ˙(0−)=0
ωψ(t)=ψ˙(t)\omega_\psi(t)=\dot{\psi}(t)ωψ​(t)=ψ˙​(t)
Kθθ/rpK_{\theta\theta}/r_pKθθ​/rp​
rpr_prp​
ωψ=ψ˙\omega_\psi=\dot\psiωψ​=ψ˙​
KθψK_{\theta\psi}Kθψ​
KψθK_{\psi\theta}Kψθ​
Vθ=0V_\theta=0Vθ​=0
ωp=θ˙\omega_p=\dot\thetaωp​=θ˙
DθD_{\theta}Dθ​
KθθK_{\theta\theta}Kθθ​
DψD_{\psi}Dψ​
KψψK_{\psi\psi}Kψψ​
KθψK_{\theta\psi}Kθψ​
KψθK_{\psi\theta}Kψθ​
DψD_\psiDψ​
y0y_0y0​
Kθθ,Kψψ,Kθψ,KψθK_{\theta\theta}, K_{\psi\psi}, K_{\theta\psi}, K_{\psi\theta}Kθθ​,Kψψ​,Kθψ​,Kψθ​
ωψ˙\dot{\omega_\psi} ωψ​˙​
KψψK_{\psi\psi}Kψψ​
KψψK_{\psi\psi}Kψψ​
196KB
Aero.zip
archive
Fig. 1: Quanser Aero Experiment
Figure: Pendulum effect creating pitch stiffness due to vertical offset of cg from pitch pivot.
Fig. 2: Simple free-body diagram of Quanser Aero Experiment
Fig. 3.a : First-order step response
Figure 3.b: First-order impulse decaying response
Fig. 4: Free Oscillation Response
Fig. 5: Sample free-oscillation response about pitch
Fig. 6: Sample Pitch Step Response
Fig. 7: Sample free response about yaw
Fig. 8: Sample yaw Step Response
Fig. 9: Sample Pitch Step Response from Yaw Voltage
Fig. 10: Sample Yaw Step Response from Pitch Voltage

A. System Identification

Introduction

The Quanser Aero Experiment can be configured as a conventional dual-rotor helicopter, as shown in Figure 1a. The front rotor that is horizontal to the ground predominantly affects the motion about the pitch axis while the back or tail rotor mainly affects the motion about the yaw axis (about the vertical shaft).

Fig. 1a: Quanser Aero Experiment

The tail rotor in helicopters is also known as the anti-torque rotor because it is used to reduce the torque that the main rotor generates about the yaw. Without this, the helicopter would be difficult to stabilize about the yaw axis. The rotors on the Quanser Aero Experiment are the same size and equidistant from the vertical shaft, the tail rotor also generates a torque about the pitch axis. As a result, both the front and back/tail rotors generate torques on each other.

Background

Pitch Stiffness

The Quanser 2D AERO is designed with its mass distribution well balanced from the front and back rotors such that its center of gravity is at the mid-point between the two rotors. However, a vertical offset of the cg location is included to result in pitch stiffness from the pendulum effect as depicted in Figure 1b.

Figure 1b: Pendulum effect creating pitch stiffness due to vertical offset of cg from pitch pivot.

The system is in static equilibrium when it is horizontal and parallel to the ground with zero pitch angle. Any change in pitch angle θb\theta_bθb​ gives rise to a restoring moment from the pendulum effect given by restoring pitch moment due to pitch angle change = −MbgDmsin⁡(θb)≈−MbgDmθb-M_bgD_m \sin(\theta_b)\approx -M_bgD_m \theta_b−Mb​gDm​sin(θb​)≈−Mb​gDm​θb​

Equations of Motion

The free-body diagram of the Quanser Aero Experiment is illustrated in Figure 2.

Fig. 2: Simple free-body diagram of Quanser Aero Experiment

The following conventions are used for the modeling:

  • The helicopter is horizontal and parallel with the ground when the pitch angle is zero, i.e., θ=0\theta=0θ=0 .

  • The pitch angle increases positively, θ(t)>0\theta(t)>0θ(t)>0 , when the front rotor is moved upwards and the body rotates clockwise (CW) about the Y axis.

  • The yaw angle increases positively, ψ(t)>0\psi(t)>0ψ(t)>0 , when the body rotates counter-clockwise (CCW) about the Z axis.

  • Pitch increases, θ>0\theta>0θ>0 , when the front rotor voltage is positive Vθ>0V_\theta>0Vθ​>0 .

  • Yaw increases, ψ>0\psi>0ψ>0 , when the back (or tail) rotor voltage is positive, Vψ>0V_{\psi}>0Vψ​>0 .

When voltage is applied to the pitch motor, VθV_\thetaVθ​ , the speed of rotation results in a force, FpF_pFp​ that acts normal to the body at a distance rpr_prp​ from the pitch axis as shown in Figure 2. The rotation of the propeller generates a torque about the pitch rotor motor shaft which is in turn seen about the yaw axis. Thus, rotating the pitch propeller does not only cause motion about the pitch axis but also about the yaw axis. As described earlier, that is why conventional helicopters include a tail, or anti-torque, rotor to compensate for the torque generated about the yaw axis by the large, main rotor.

Similarly, the yaw motor causes a force FyF_yFy​ that acts on the body at a distance ryr_yry​ from the yaw axis as well as a torque about the pitch axis as shown in Figure 2.

The equations of motion can be approximated as:

For pitch axis:

θ¨+2ζθωnθθ˙+ωnθ2θ=Tθ(1)\ddot{\theta} + 2\zeta_\theta\omega_{n_\theta} \displaystyle \dot{\theta} + \omega_{n_\theta}^2 \theta = \Tau_{\theta} \qquad \qquad \tag{1}θ¨+2ζθ​ωnθ​​θ˙+ωnθ​2​θ=Tθ​(1)

For yaw axis:

ψ¨+1τψψ˙=Tψ(2)\ddot{\psi}+ \frac{1}{\tau_\psi} \dot{\psi}=\Tau_\psi \qquad \qquad \tag{2}ψ¨​+τψ​1​ψ˙​=Tψ​(2)

where the torques acting on the pitch and yaw axes are

Tθ=K‾θθVθ+K‾θψVψ(3)\Tau_{\theta} = \overline{K}_{\theta \theta} V_{\theta} + \overline{K}_{\theta \psi} V_{\psi} \qquad \qquad \tag{3}Tθ​=Kθθ​Vθ​+Kθψ​Vψ​(3)
Tψ=K‾ψθVθ+K‾ψψVψ(4)\Tau_\psi = \overline{K}_{\psi \theta} V_{\theta} + \overline{K}_{\psi \psi} V_{\psi} \qquad \qquad \tag{4}Tψ​=Kψθ​Vθ​+Kψψ​Vψ​(4)

The parameters used in the EOMs above are:

  • ζθ\zeta_\thetaζθ​ : the damping ratio of the pitch dynamics

  • ωnθ\omega_{n_\theta}ωnθ​​ : the natural frequency of the pitch dynamics

  • τψ\tau_{\psi}τψ​ : the time constant of the yaw dynamics

  • K‾θθ\overline{K}_{\theta\theta}Kθθ​ : normalized torque thrust gain from the pitch rotor (normalized by JθJ_{\theta}Jθ​)

  • K‾ψψ\overline{K}_{\psi\psi}Kψψ​ : normalized torque thrust gain from the yaw rotor (normalized by JψJ_{\psi}Jψ​)

  • K‾θψ\overline{K}_{\theta\psi}Kθψ​ : normalized cross-torque thrust gain acting on the pitch from the yaw rotor (normalized by JθJ_{\theta}Jθ​)

  • K‾ψθ\overline{K}_{\psi\theta}Kψθ​ : normalized cross-torque thrust gain acting on the yaw from the pitch rotor (normalized by JψJ_{\psi}Jψ​)

  • VθV_\thetaVθ​ : voltage applied to the pitch rotor motor

  • VψV_\psiVψ​ : voltage applied to the yaw rotor motor

  • JθJ_\thetaJθ​ : the total moment of inertia about the pitch axis

  • JψJ_{\psi}Jψ​ : the total moment of inertia about the yaw axis

First-Order Response

The step response of a first-order transfer function

Y(s)=τy(0)+KU(s)τs+1(7)Y(s) = \displaystyle \frac{\tau y(0)+KU(s)}{\tau s+1} \qquad \qquad \tag{7}Y(s)=τs+1τy(0)+KU(s)​(7)

where y(0) is the initial condition, K is the DC or steady-state gain, and τ is the time constant as illustrated in Figure 3. Figure 3 is for a system with y(0) = 0, K=1K = 1K=1 rad/V and τ=0.05\tau = 0.05τ=0.05 sec.

To obtain the time constant from the response, find the time it takes to reach 1−e−11-e^{-1}1−e−1or 63.2% of its final steady-state value:

y(t1)=y1=(1−e−1)(yss−y0)+y0(8)y(t_1)=y_1=(1-e^{-1})(y_{\rm ss}-y_0) +y_0 \qquad \qquad \tag{8}y(t1​)=y1​=(1−e−1)(yss​−y0​)+y0​(8)

The time constant is τ=t1−t0\tau=t_1-t_{0 }τ=t1​−t0​, where t0t_0t0​ is the start time of the step and t1t_1t1​ is the time it takes to reach 63.2% of the final value, as illustrated in Figure 3.

Fig. 3 : First-order step response

Second-Order Response

The general equation of motion of a second-order system with input u(t) is described by

α¨+2ζωnα˙+ωn2α=u(t)(9)\ddot{\alpha} + 2\zeta\omega_n\dot{\alpha} + \omega_n^2\alpha = u(t) \qquad \qquad \tag{9}α¨+2ζωn​α˙+ωn2​α=u(t)(9)

Assuming the initial conditions α(0−)=α0\alpha(0-)=\alpha_0α(0−)=α0​ and α˙(0−)=0\dot\alpha(0-)=0α˙(0−)=0, the Laplace transform of Equation (9) is

α(s)=(s+2ζωn)α0+U(s)s2+2ζωns+ωn2(10)\alpha(s)=\displaystyle{\frac{(s+2\zeta\omega_n)\alpha_0 +U(s)}{s^2+2\zeta\omega_ns+\omega_n^2}} \qquad \qquad \tag{10}α(s)=s2+2ζωn​s+ωn2​(s+2ζωn​)α0​+U(s)​(10)

The characteristic equation from Equation (10) is obtained as,

s2+2ζωns+ωn2=0(11)s^2+2\zeta\omega_ns+\omega_n^2 = 0 \qquad \qquad \tag{11}s2+2ζωn​s+ωn2​=0(11)

where ζ\zetaζ is the damping ratio and ωn\omega_nωn​ is the natural frequency.

The typical response of an underdamped second order system to a step input with zero initial conditions is shown in Figure 4. The natural frequency and damping ratio can be obtained from transient response using Figure 4 as follows:

Finding the Natural Frequency

The period of the oscillations in a system response can be found using the equation

Tosc=tn−t1n−1(12)T_{\rm osc}=\displaystyle\frac{t_n-t_1}{n-1} \qquad \qquad \tag{12}Tosc​=n−1tn​−t1​​(12)

where tnt_ntn​ is the time of the nthn^{th}nth peak, t1t_1t1​ is the time of the first peak, and nnn is the number of oscillations considered. From this, the damped natural frequency (in radians per second) is

ωd=2πTosc(13)\omega_d=\displaystyle \frac{2\pi}{T_{\rm osc}} \qquad \qquad \tag{13}ωd​=Tosc​2π​(13)

and the undamped natural frequency is

ωn=ωd1−ζ2(14)\omega_n=\displaystyle\frac{\omega_d}{\sqrt{1-\zeta^2}} \qquad \qquad \tag{14}ωn​=1−ζ2​ωd​​(14)

Finding the Damping Ratio

The damping ratio of a second-order system can be found from the transient response to a step input. For a typical second-order underdamped system, the subsidence ratio (i.e. decrement ratio) is defined as

δ=1n−1ln⁡O1On(15)\delta = \displaystyle\frac{1}{n-1}\ln\frac{O_1}{O_n} \qquad \qquad \tag{15}δ=n−11​lnOn​O1​​(15)
Fig. 4: Step Response of an underdamped second order system.

where O1O_1O1​ is the peak magnitude of the first oscillation and OnO_nOn​ is the peak magnitude of the nthn^{th}nth oscillation. Note that O1O_1O1​ > OnO_nOn​ , as this is a decaying response. The damping ratio can then be found using

ζ=δ4π2+δ2(16)\zeta= \displaystyle\frac{\delta}{\sqrt{4\pi^2+\delta^2}} \qquad \qquad \tag{16}ζ=4π2+δ2​δ​(16)

Estimating the Damping Ratio, Natural Frequency and Time Constant

The damping ratio and the natural frequency of the pitch axis, ζθ\zeta_\thetaζθ​ and ωnθ\omega_{n_\theta}ωnθ​​ in Equation (1) can be found from the oscillatory portion of the step response.

Pitch Axis: Apply a voltage only to the pitch rotor motor and get the system response in the pitch axis. The resulting second-order equation of motion is

θ¨+2ζθωnθθ˙+ωnθ2θ=K‾θθVθ(t)(17)\ddot{\theta} + 2\zeta_\theta\omega_{n_\theta} \displaystyle \dot{\theta} + \omega_{n_\theta}^2 \theta = \overline{K}_{\theta\theta}V_{\theta}(t) \qquad \qquad \tag{17}θ¨+2ζθ​ωnθ​​θ˙+ωnθ​2​θ=Kθθ​Vθ​(t)(17)

Taking its Laplace transform gives

θ(Θ(s)s2−sθ(0−)−θ˙(0−))+2ζθωnθ(Θ(s)−θ(0−))+ωnθ2Θ(s)=K‾θθVθ(s)(18)\theta\left(\Theta(s)s^2-s\theta(0^-)-\dot{\theta}(0^-)\right)+2\zeta_\theta\omega_{n_\theta}\left(\Theta(s)-\theta(0^-)\right)+\omega_{n_\theta}^2\Theta(s)=\overline{K}_{\theta\theta}V_{\theta}(s) \qquad \tag{18}θ(Θ(s)s2−sθ(0−)−θ˙(0−))+2ζθ​ωnθ​​(Θ(s)−θ(0−))+ωnθ​2​Θ(s)=Kθθ​Vθ​(s)(18)

Assuming the initial velocity is zero, θ˙(0−)=0\dot{\theta}(0^-)=0θ˙(0−)=0, and solving for position we get

Θ(s)=(s+2ζθωnθ)θ(0−)+K‾θθVθ(s)s2+2ζθωnθs+ωnθ2(19)\Theta(s)=\displaystyle\frac{(s+2\zeta_\theta \omega_{n_\theta})\theta(0^-) +\overline{K}_{\theta\theta}V_{\theta}(s)}{s^2+2\zeta_\theta \omega_{n_\theta}s+\omega^2_{n_\theta}}\qquad \qquad \tag{19}Θ(s)=s2+2ζθ​ωnθ​​s+ωnθ​2​(s+2ζθ​ωnθ​​)θ(0−)+Kθθ​Vθ​(s)​(19)

The pitch step response transfer function matches the standard second-order transfer function in Equation (10). Thus, the damping ratio and natural frequency of the pitch axis can be determined from the pitch step response or alternatively from free response to an initial pitch disturbance.

Yaw Axis: The yaw-only equation of motion by applying a voltage input only to the yaw rotor motor is

ψ¨+1τψψ˙=K‾ψψVψ(t)(20)\ddot{\psi}+ \frac{1}{\tau_\psi} \dot{\psi}= \overline{K}_{\psi\psi}V_\psi(t) \qquad \qquad \tag{20}ψ¨​+τψ​1​ψ˙​=Kψψ​Vψ​(t)(20)

In terms of angular rate, the equation becomes

ω˙ψ(t)+1τψωψ(t)=K‾ψψVψ(t)(21)\dot\omega_\psi(t)+\frac{1}{\tau_\psi}\omega_\psi(t)=\overline{K}_{\psi\psi}V_\psi(t) \qquad \qquad \tag{21}ω˙ψ​(t)+τψ​1​ωψ​(t)=Kψψ​Vψ​(t)(21)

where ωψ(t)=ψ˙(t)\omega_\psi(t)=\dot{\psi}(t)ωψ​(t)=ψ˙​(t) . Taking its Laplace transform

(Ωψ(s)s−ωψ(0−))+1τψΩψ(s)=K‾ψψVψ(s)(22)(\Omega_\psi(s)s-\omega_\psi(0^-))+\frac{1}{\tau_\psi}\Omega_\psi(s)= \overline{K}_{\psi\psi}V_\psi(s)\qquad \qquad \tag{22}(Ωψ​(s)s−ωψ​(0−))+τψ​1​Ωψ​(s)=Kψψ​Vψ​(s)(22)

and solving for the speed we get

Ωψ(s)=ωψ(0−)+K‾ψψVψ(s)s+1τψ=(ωψ(0−)+K‾ψψVψ(s))τψτψs+1(23)\Omega_\psi(s)=\displaystyle \frac{\omega_\psi(0^-)+\overline{K}_{\psi\psi}V_\psi(s)}{ s+\displaystyle \frac{1}{\tau_\psi}} = \displaystyle \frac{(\omega_\psi(0^-)+\overline{K}_{\psi\psi}V_\psi(s))\tau_\psi}{ \tau_\psi s+1} \qquad \qquad \tag{23}Ωψ​(s)=s+τψ​1​ωψ​(0−)+Kψψ​Vψ​(s)​=τψ​s+1(ωψ​(0−)+Kψψ​Vψ​(s))τψ​​(23)

The yaw transfer function matches the first-order transfer function in Equation (7). Thus, the time constant of the yaw axis can be determined from the yaw step response or alternatively from the yaw response to a yaw rate disturbance.

Estimating the Thrust Parameters

A) Estimating K‾θθ\overline{K}_{\theta\theta}Kθθ​

Providing step input only in the pitch axis (applying a voltage to the pitch rotor motor) allows us to focus on the pitch-only system. Plugging Vθ≠0V_\theta \neq 0Vθ​=0 and Vψ=0V_\psi=0Vψ​=0 in Equation (1), the equation of motion for the pitch axis is

θ¨+2ζθωnθθ˙+ωnθ2θ=K‾θθVθ(t)(24)\ddot{\theta} + 2\zeta_\theta\omega_{n_\theta} \dot{\theta} + \omega_{n_\theta}^2 \theta = \overline{K}_{\theta \theta} V_{\theta}(t) \qquad \qquad \tag{24}θ¨+2ζθ​ωnθ​​θ˙+ωnθ​2​θ=Kθθ​Vθ​(t)(24)

Solving for the normalized thrust gain we get

K‾θθ=θ¨+2ζθωnθθ˙+ωnθ2θVθ(t)(25)\overline{K}_{\theta\theta}=\displaystyle \frac{\ddot{\theta} + 2\zeta_\theta\omega_{n_\theta} \dot{\theta} + \omega_{n_\theta}^2 \theta}{V_\theta(t)} \qquad \qquad \tag{25}Kθθ​=Vθ​(t)θ¨+2ζθ​ωnθ​​θ˙+ωnθ​2​θ​(25)

Remark that this is the normalized thrust torque gain parameter. The normalized force thrust gain would be K‾θθ/rp\overline{K}_{\theta\theta}/r_pKθθ​/rp​, where rpr_prp​is the distance between the helicopter pivot and the center of the pitch rotor. Steady State Method: By focusing on the steady-state portion of the system response to a step voltage input to the pitch rotor motor, and neglecting the θ¨\ddot{\theta}θ¨ and θ˙\dot{\theta}θ˙ (zero at steady-state), the normalized thrust gain is obtained as

K‾θθ=ωnθ2θssVθ(26)\overline{K}_{\theta\theta}=\displaystyle \frac{ \omega_{n_\theta}^2 \theta_{ss}}{V_\theta} \qquad \qquad \tag{26}Kθθ​=Vθ​ωnθ​2​θss​​(26)

where VθV_\thetaVθ​ is the magnitude of the voltage input to the pitch rotor motor.

Discrete Derivative Method: The thrust gain parameter can be obtained as

K‾θθ=ΔΩθΔt+2ζθωnθΔΩθVθ(27)\overline{K}_{\theta\theta} =\frac{\frac{\Delta \Omega_\theta}{\Delta t} + 2 \zeta_\theta \omega_{n_\theta} \Delta \Omega_\theta}{V_\theta} \qquad \qquad \tag{27}Kθθ​=Vθ​ΔtΔΩθ​​+2ζθ​ωnθ​​ΔΩθ​​(27)

where Ωθ=θ˙\Omega_\theta = \dot{\theta}Ωθ​=θ˙ and Δt\Delta tΔt is the difference between the time instance when the step input is given tstept_{\text{step}}tstep​ and a time instance slightly above tstept_{\text{step}}tstep​, i.e., t=tstep+t = t_{\text{step}}^+t=tstep+​. Thus we can find the normalized pitch thrust gain from the measured pitch rate and derived acceleration (discrete-derivative of pitch rate).

B) Estimating K‾ψψ\overline{K}_{\psi\psi}Kψψ​

Similarly, to find the normalized thrust gain acting on the yaw axis system, apply a voltage to the tail rotor motor. Plugging Vθ=0V_\theta = 0Vθ​=0 and Vψ≠0V_\psi \neq 0Vψ​=0 in Equation (1), the equation of motion for the yaw axis is

ψ¨+1τψψ˙=K‾ψψVψ(28)\ddot{\psi}+ \frac{1}{\tau_\psi} \dot{\psi}=\overline{K}_{\psi\psi}V_\psi \qquad \qquad \tag{28}ψ¨​+τψ​1​ψ˙​=Kψψ​Vψ​(28)

or,

ω˙ψ+1τψωψ=K‾ψψVψ(29)\dot\omega_\psi+\frac{1}{\tau_\psi} \omega_\psi=\overline{K}_{\psi\psi}V_\psi \qquad \qquad \tag{29}ω˙ψ​+τψ​1​ωψ​=Kψψ​Vψ​(29)

where ωψ=ψ˙\omega_\psi=\dot\psiωψ​=ψ˙​ is the angular rate of the yaw axis. The normalized yaw torque thrust gain is

K‾ψψ=ω˙ψ+1τψωψVψ(30)\overline{K}_{\psi\psi}=\displaystyle\frac{\dot\omega_\psi+\displaystyle \frac{1}{\tau_\psi} \omega_\psi}{V_\psi} \qquad \qquad \tag{30}Kψψ​=Vψ​ω˙ψ​+τψ​1​ωψ​​(30)

Steady State Method: At steady-state condition, and neglecting the ω˙ψ\dot{\omega}_\psiω˙ψ​ (zero at steady-state), the normalized thrust gain is obtained as

K‾ψψ=1τψωψssVψ(31)\overline{K}_{\psi\psi}=\displaystyle\frac{\displaystyle \frac{1}{\tau_\psi} \omega_{\psi_{ss}}}{V_\psi} \qquad \qquad \tag{31}Kψψ​=Vψ​τψ​1​ωψss​​​(31)

where VψV_\psiVψ​is the magnitude of the step voltage input to the yaw rotor motor.

Discrete Derivative Method: The thrust gain parameter can be obtained as

K‾ψψ=ΔΩψΔt+1τψΔΩψVψ(32)\overline{K}_{\psi\psi} =\frac{\frac{\Delta \Omega_\psi}{\Delta t} + \frac{1}{\tau_{\psi}}\Delta \Omega_\psi}{V_\psi}\qquad \qquad \tag{32}Kψψ​=Vψ​ΔtΔΩψ​​+τψ​1​ΔΩψ​​(32)

where Ωψ=ψ˙\Omega_\psi = \dot{\psi}Ωψ​=ψ˙​ and Δt\Delta tΔt is the difference between the time instance when the step input is given tstept_{\text{step}}tstep​ and a time instance slightly above tstept_{\text{step}}tstep​, i.e., t=tstep+t = t_{\text{step}}^+t=tstep+​. Thus we can find the normalized yaw thrust gain from the measured yaw rate and derived acceleration (discrete-derivative of yaw rate).

C) Estimating K‾θψ\overline{K}_{\theta\psi}Kθψ​ and K‾ψθ\overline{K}_{\psi\theta}Kψθ​

The normalized cross-torque thrust parameters, K‾θψ\overline{K}_{\theta\psi}Kθψ​and K‾ψθ\overline{K}_{\psi\theta}Kψθ​ in Equation (3) and (4), represent the coupling between the axes. The cross-torque acting on the pitch axis from a torque applied to the tail rotor motor, can be found by appling a voltage to the tail rotor motor, and examining the response of the pitch. The equations representing these dynamics when Vθ=0V_\theta=0Vθ​=0 and Vψ≠0V_\psi \neq 0Vψ​=0, are

θ¨+2ζθωnθθ˙+ωnθ2θ=K‾θψVψ(33)\ddot{\theta} + 2\zeta_\theta\omega_{n_\theta} \dot{\theta} + \omega_{n_\theta}^2 \theta = \overline{K}_{\theta \psi} V_{\psi} \qquad \qquad \tag{33}θ¨+2ζθ​ωnθ​​θ˙+ωnθ​2​θ=Kθψ​Vψ​(33)

Similarly to identify the cross-torque acting on the yaw axis from a torque applied to the pitch rotor motor, apply a voltage to the pitch rotor motor, and examine the response of the yaw. The equations representing these dynamics when Vθ≠0V_\theta \neq 0Vθ​=0 and Vψ=0V_\psi=0Vψ​=0 , are

ψ¨+1τψψ˙=K‾ψθVθ(34)\ddot{\psi}+ \frac{1}{\tau_\psi} \dot{\psi}=\overline{K}_{\psi\theta}V_\theta \qquad \qquad \tag{34}ψ¨​+τψ​1​ψ˙​=Kψθ​Vθ​(34)

Estimating K‾θψ\overline{K}_{\theta\psi}Kθψ​ and K‾ψθ\overline{K}_{\psi\theta}Kψθ​ are out of scope of this lab. The values of these parameters are provided in the Analysis section.

System Identification

Experimental Steps for Finding System Parameters

First download the zip file below and extract in your group folder. The experiment data is automatically generated in the folder MATLAB is opened to.

111KB
Aero_Lab2.zip
archive

1) Pitch Motor Voltage Impulse

  1. Unlock the pitch axis. Lock the yaw axis.

  2. Open the pitch_impulse SIMULINK file.

  3. Set the amplitude gain block to 18. This applies a pulse input of -18 V for 1.5 sec in the pitch axis.

  4. Select simulation time 30 sec.

  5. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  6. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  7. Copy aero_pitch_impulse.mat to your folder.

  8. If the data is not smooth/clean, repeat steps 3-7 with a different pulse voltage.

  9. Close the SIMULINK model. DO NOT SAVE THE CHANGE.

Data is saved in following order: 1: Time 2: Pitch motor input (V) 3: Pitch Angle (rad) 4: Pitch Speed (rad/s)

Pitch impulse response

2) Pitch Motor Voltage Step

  1. Lock the yaw axis.

  2. Open the pitch_step SIMULINK file.

  3. Apply a step input in the pitch axis. If your setup is Aero1, apply 18 V. If your setup is Aero2, apply 14 V.

  4. Select simulation time 100 sec.

  5. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  6. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

    Note: Pitch angle has to reach steady state i.e. constant pitch angle, or you may have to increase simulation time. If steady state has reached, you can end simulation earlier.

  7. Copy aero_pitch_step.mat to your folder.

  8. If the data is not smooth/clean, repeat steps 3-7 with a different step voltage.

  9. Close the SIMULINK model. DO NOT SAVE THE CHANGE.

Data is saved in following order: 1: Time 2: Pitch motor input (V) 3: Pitch Angle (rad) 4: Pitch Speed (rad/s)

Pitch step response

3) Yaw Motor Voltage Step

  1. Unlock the yaw axis. Lock the pitch axis.

  2. Open the yaw_step SIMULINK file.

  3. Apply a step input in the yaw axis. If your setup is Aero1, pick a voltage in the range 15-20 V. If your setup is Aero2, pick a voltage in the range 10-11.5 V.

  4. Select simulation time 100 sec.

  5. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  6. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start . Note: Pitch angle has to reach steady state i.e. constant pitch angle, or you may have to increase simulation time. If steady state has reached, you can end simulation earlier.

  7. Copy aero_yaw_step.mat to your folder.

  8. If the data is not smooth/clean, repeat steps 3-7 with a different step voltage.

  9. Close the SIMULINK model. DO NOT SAVE THE CHANGE.

Data is saved in following order: 1: Time 2: Yaw motor input (V) 3: Yaw Angle (rad) 4: Yaw Speed (rad/s)

Yaw step response for Aero1 setup.

Analysis

55KB
Aero_Pitch_SystemID.mlx
MATLAB script to find , and
47KB
Aero_Yaw_SystemID.mlx
MATLAB script to find and
  1. The cross-torque thrust parameters are K‾θψ=0.0959\overline{K}_{\theta\psi} = 0.0959Kθψ​=0.0959 Nm/V, K‾ψθ=−0.1227\overline{K}_{\psi\theta} = -0.1227Kψθ​=−0.1227 Nm/V. These will be required for Controller Design.

  2. From the pitch response due to pitch motor impulse input, find the natural frequency and damping ratio

    • Hint: Use equations 12-16

    • You can also use the above-attached Aero_Pitch_SystemID.mlx script to find ωn\omega_nωn​ and ζ\zetaζ . Complete the lines marked with TODO.

    • Fill the corresponding values in Table B.1

  3. From the pitch response due to pitch motor step input find the normalized thrust gain K‾θθ\overline{K}_{\theta\theta}Kθθ​, using both the steady state method and discrete derivative method.

    • Hint: For the steady-state method, use equation 26 and for the discrete derivative method, use equation 27.

    • You can also use the above-attached Aero_Pitch_SystemID.mlx script to find K‾θθ\overline{K}_{\theta\theta}Kθθ​. Complete the lines marked with TODO.

    • Fill in the values in Table B.2.

  4. From the yaw speed response due to yaw motor step input find the time constant and normalized thrust gain K‾ψψ\overline{K}_{\psi\psi}Kψψ​

    • Hint: For time constant. use equation 8. For K‾ψψ\overline{K}_{\psi\psi}Kψψ​, use equation 31 for the steady-state method and use equation 32 for the discrete derivative method.

    • You can use the above-attached Aero_Yaw_SystemID.mlx script to find τ\tauτ and K‾ψψ\overline{K}_{\psi\psi}Kψψ​. Complete the lines marked with TODO.

    • Fill the respective values in Table B.1 and Table B.2.

Table B.1

System ID Parameters
Value

Table B.2

Thrust Gain Parameters
Steady State Method
Discrete Derivative Method

Results for Report

  1. Equations used for calculating ωn\omega_nωn​, ζ\zetaζ, τ\tauτ, K‾θθ,K‾ψψ\overline{K}_{\theta\theta},\overline{K}_{\psi\psi}Kθθ​,Kψψ​.

  2. Table B.1 and Table B.2.

Questions for Report

  1. The given value of K‾θψ\overline{K}_{\theta\psi}Kθψ​ is positive and K‾ψθ\overline{K}_{\psi\theta}Kψθ​ is negative for our setup (see Step 1 of Analysis section). Why?

  2. Compare the normalized thrust gains obtained from the steady-state method and discrete derivative method and explain any differences.

C. Position Control (Week 2)

1 Background

1.1 Desired Position Control Response

The block diagram shown in Figure 16 is a general unity feedback system with a compensator (controller) C(s)C(s)C(s) and a transfer function representing the plant, P(s)P(s)P(s). The measured output, Y(s)Y(s)Y(s), is supposed to track the reference signal R(s)R(s)R(s) and the tracking has to match certain desired specifications.

Figure 16. Unity feedback system

The output of this system can be written as:

Y(s)=C(s)P(s)(R(s)−Y(s))(3.1)Y (s) = C(s)P(s) (R(s) - Y (s)) \qquad \qquad \qquad \tag{3.1}Y(s)=C(s)P(s)(R(s)−Y(s))(3.1)

By solving for Y(s)Y(s)Y(s), we can find the closed-loop transfer function:

Y(s)R(s)=C(s)P(s)1+C(s)P(s)(3.2)\frac{Y(s)}{R(s)} = \frac{C(s)P(s)}{1 + C(s)P(s)} \qquad \qquad \qquad \tag{3.2}R(s)Y(s)​=1+C(s)P(s)C(s)P(s)​(3.2)

Recall in the Integration laboratory experiment, the Rotary Servo Base Unit voltage-to-speed transfer function was derived. To find the voltage-to-position transfer function, we can put an integrator (1/s)(1/s)(1/s) in series with the speed transfer function (effectively integrating the speed output to get position). Then, the resulting open-loop voltage-to-load gear position transfer function becomes:

P(s)=Ks(τs+1)(3.3)P(s) = \frac{K}{s(\tau s + 1)} \qquad \qquad \qquad \tag{3.3}P(s)=s(τs+1)K​(3.3)

As you can see from this equation, the plant is a second-order system. In fact, when a second-order system is placed in series with a proportional compensator in the feedback loop as in Figure 16, the resulting closed-loop transfer function can be expressed as:

Y(s)R(s)=ωn2s2+2ζωns+ωn2(3.4)\frac{Y(s)}{R(s)} = \frac{\omega_n^2}{s^2 + 2\zeta \omega_n s + \omega_n^2} \qquad \qquad \qquad \tag{3.4}R(s)Y(s)​=s2+2ζωn​s+ωn2​ωn2​​(3.4)

where ωn\omega_nωn​ is the natural frequency and ζ\zetaζ is the damping ratio. This is called the standard second-order transfer function. Its response depends on the values of ωn\omega_nωn​ and ζ\zetaζ.

1.1.1 Peak Time and Overshoot

Consider a second-order system as shown in Equation 3.4 subject to a step input given by

R(s)=R0s(3.5)R(s) = \frac{R_0}{s} \qquad \qquad \qquad \tag{3.5}R(s)=sR0​​(3.5)

with a step amplitude of R0=1.5R_0 = 1.5R0​=1.5. The system response to this input is shown in Figure 17, where the red trace is the response (output), y(t)y(t)y(t), and the blue trace is the step input r(t)r(t)r(t).

The maximum value of the response is denoted by the variable ymaxy_{\text{max}}ymax​ and it occurs at a time tmaxt_{\text{max}}tmax​. The initial value of the response is denoted as y0y_0y0​. For a response similar to Figure 17, the percent overshoot is found using

PO=100(ymax−R0)R0(3.6)\text{PO} = \frac{100 (y_{\text{max}} - R_0)}{R_0} \qquad \qquad \qquad \tag{3.6}PO=R0​100(ymax​−R0​)​(3.6)
Figure 17. Standard second-order step response.

From the initial step time, t0t_0t0​, the time it takes for the response to reach its maximum value is

tp=tmax−t0(3.7)t_p = t_{\text{max}} - t_0 \qquad \qquad \qquad \tag{3.7}tp​=tmax​−t0​(3.7)

This is called the peak time of the system.

In a second-order system, the amount of overshoot depends solely on the damping ratio parameter and it can be calculated using the equation

PO=100e(−πζ1−ζ2)(3.8)\text{PO} = 100 e^{\left(-\frac{\pi \zeta}{\sqrt{1 - \zeta^2}}\right)} \qquad \qquad \qquad \tag{3.8}PO=100e(−1−ζ2​πζ​)(3.8)

The peak time depends on both the damping ratio and natural frequency of the system and it can be derived as:

tp=πωn1−ζ2(3.9)t_p = \frac{\pi}{\omega_n \sqrt{1 - \zeta^2}} \qquad \qquad \qquad \tag{3.9}tp​=ωn​1−ζ2​π​(3.9)

Generally speaking, the damping ratio affects the shape of the response while the natural frequency affects the speed of the response.

1.1.2 Steady State Error

Steady-state error is illustrated in the ramp response given in Figure 18 and is denoted by the variable esse_{\text{ss}}ess​. It is the difference between the reference input and output signals after the system response has settled. Thus, for a time ttt when the system is in steady-state, the steady-state error equals

ess=rss(t)−yss(t)(3.10)e_{\text{ss}} = r_{\text{ss}}(t) - y_{\text{ss}}(t) \qquad \qquad \qquad \tag{3.10}ess​=rss​(t)−yss​(t)(3.10)

where rss(t)r_{\text{ss}}(t)rss​(t) is the value of the steady-state input and yss(t)y_{\text{ss}}(t)yss​(t) is the steady-state value of the output.

We can find the error transfer function E(s)E(s)E(s) in Figure 16 in terms of the reference R(s)R(s)R(s), the plant P(s)P(s)P(s), and the compensator C(s)C(s)C(s). The Laplace transform of the error is

E(s)=R(s)−Y(s)(3.11)E(s) = R(s) - Y (s) \qquad \qquad \qquad \tag{3.11}E(s)=R(s)−Y(s)(3.11)

Solving for Y(s)Y (s)Y(s) from Equation 3.3 and substituting it in Equation 3.11 yields

E(s)=R(s)1+C(s)P(s)(3.12)E(s) = \frac{R(s)}{1 + C(s)P(s)} \qquad \qquad \qquad \tag{3.12}E(s)=1+C(s)P(s)R(s)​(3.12)
Figure 18. Steady-state error in ramp response.

We can find the steady-state error of this system using the final-value theorem:

ess=lim⁡s→0sE(s)(3.13)e_{\text{ss}} = \lim_{s \to 0} sE(s) \qquad \qquad \qquad \tag{3.13}ess​=s→0lim​sE(s)(3.13)

In this equation, we need to substitute the transfer function for E(s)E(s)E(s) from Equation 3.12. The E(s)E(s)E(s) transfer function requires, R(s)R(s)R(s), C(s)C(s)C(s) and P(s)P(s)P(s). For simplicity, let C(s)=1C(s) = 1C(s)=1 as a compensator. The P(s)P(s)P(s) and R(s)R(s)R(s) were given by equations Equation 3.3 and Equation 3.5, respectively. Then, the error becomes:

E(s)=R(s)s(1+Ks(τs+1))(3.14)E(s) = \frac{R(s)}{s\left(1 + \frac{K}{s(\tau s + 1)}\right)} \qquad \qquad \qquad \tag{3.14}E(s)=s(1+s(τs+1)K​)R(s)​(3.14)

Applying the final-value theorem gives

ess=R0(lim⁡s→0(τs+1)sτs2+s+K)(3.15)e_{\text{ss}} = R_0\left(\lim_{s \to 0} \frac{(\tau s+1)s}{\tau s^2 + s + K}\right) \qquad \qquad \qquad \tag{3.15}ess​=R0​(s→0lim​τs2+s+K(τs+1)s​)(3.15)

When evaluated, the resulting steady-state error due to a step response is

ess=0(3.16)e_{\text{ss}} = 0 \qquad \qquad \qquad \tag{3.16}ess​=0(3.16)

Based on this zero steady-state error for a step input, we can conclude that the Rotary Servo Base Unit is a Type 1 system.

1.1.3 Time-Domain Control Specifications

The desired time-domain specifications for controlling the position of the Rotary Servo Base Unit load shaft are:

ess=0(3.17)e_{\text{ss}} = 0 \qquad \qquad \qquad \tag{3.17}ess​=0(3.17)
tp=0.20 s(3.18)t_p = 0.20 ~\text{s} \qquad \qquad \qquad \tag{3.18}tp​=0.20 s(3.18)

and

PO=5.0%(3.19)\text{PO} = 5.0 \% \qquad \qquad \qquad \tag{3.19}PO=5.0%(3.19)

Thus, when tracking the load shaft reference, the transient response should have a peak time less than or equal to 0.20 seconds, an overshoot less than or equal to 5%, and the steady-state response should have no error.

1.2 PD Controller Design

1.2.1 Closed Loop Transfer Function

The proportional-derivative (PD) compensator to control the position of the Rotary Servo Base Unit has the following structure

Vm(t)=kp(θd(t)−θl(t))−kd(ddtθl(t))(3.20)V_m(t) = k_p(\theta_d(t) - \theta_l(t)) - k_d \left(\frac{d}{dt} \theta_l(t)\right) \qquad \qquad \qquad \tag{3.20}Vm​(t)=kp​(θd​(t)−θl​(t))−kd​(dtd​θl​(t))(3.20)

where kpk_pkp​ is the proportional control gain, kdk_dkd​ is the derivative control gain, θd(t)\theta_d(t)θd​(t) is the setpoint or reference load shaft angle, θl(t)\theta_l(t)θl​(t) is the measured load shaft angle, and Vm(t)V_m(t)Vm​(t) is the Rotary Servo Base Unit motor input voltage. The block diagram of the PD control is given in Figure 19.

This is a variation of the classic PD control where the D-term is in the feedback path as opposed to in the forward path.

Figure 19. Block diagram of Rotary Servo Base Unit PD position control.

We need to find the closed-loop transfer function Θl(s)/Θd(s)\Theta_l(s)/\Theta_d(s)Θl​(s)/Θd​(s) for the closed-loop position control of the Rotary Servo Base Unit. Taking the Laplace transform of Equation 3.20 gives

Vm(s)=kp(Θd(s)−Θl(s))−kdsΘl(s)(3.21)V_m(s) = k_p(\Theta_d(s) - \Theta_l(s)) - k_d s \Theta_l(s) \qquad \qquad \qquad \tag{3.21}Vm​(s)=kp​(Θd​(s)−Θl​(s))−kd​sΘl​(s)(3.21)

From the Plant block in Figure 19 and Equation 3.3, we can write

Θl(s)Vm(s)=Ks(τs+1)(3.22)\frac{\Theta_l(s)}{V_m(s)} = \frac{K}{s(\tau s + 1)} \qquad \qquad \qquad \tag{3.22}Vm​(s)Θl​(s)​=s(τs+1)K​(3.22)

Substituting Equation 3.21 into Equation 3.22 and solving for Θl(s)/Θd(s)\Theta_l(s)/\Theta_d(s)Θl​(s)/Θd​(s) gives the Rotary Servo Base Unit position closed-loop transfer function as:

Θl(s)Vm(s)=Kkpτs2+(1+Kkd)s+Kkp(3.23)\frac{\Theta_l(s)}{V_m(s)} = \frac{K k_p}{\tau s^2 + (1 + K k_d)s + K k_p} \qquad (3.23)Vm​(s)Θl​(s)​=τs2+(1+Kkd​)s+Kkp​Kkp​​(3.23)

1.2.2 Controller Gain Limits

In control design, a factor to be considered is saturation. This is a nonlinear element and is represented by a saturation block as shown in Figure 20. In a system like the Rotary Servo Base Unit, the computer calculates a numeric control voltage value. This value is then converted into a voltage, Vdac(t)V_{\text{dac}}(t)Vdac​(t), by the digital-to-analog converter of the data-acquisition device in the computer. The voltage is then amplified by a power amplifier by a factor of KaK_aKa​. If the amplified voltage, Vamp(t)V_{\text{amp}}(t)Vamp​(t), is greater than the maximum output voltage of the amplifier or the input voltage limits of the motor (whichever is smaller), then it is saturated (limited) at VmaxV_{\text{max}}Vmax​. Therefore, the input voltage Vm(t)V_m(t)Vm​(t) is the effective voltage being applied to the Rotary Servo Base Unit motor.

The limitations of the actuator must be taken into account when designing a controller. For instance, the voltage entering the Rotary Servo Base Unit motor should never exceed

Vmax=10.0V(3.24)V_{\text{max}} = 10.0 V \qquad \qquad \qquad \tag{3.24}Vmax​=10.0V(3.24)
Figure 20. Actuator saturation.

1.2.3 Ramp Steady State Error Using PD Control

From our previous steady-state analysis, we found that the closed-loop Rotary Servo Base Unit system is a Type 1 system. In this section, we will investigate the steady-state error due to a ramp input when using PD controller.

Given the following ramp setpoint (input)

R(s)=R0s2(3.25)R(s) = \frac{R_0}{s^2} \qquad \qquad \qquad \tag{3.25} R(s)=s2R0​​(3.25)

we can find the error transfer function by substituting the Rotary Servo Base Unit closed-loop transfer function in Equation 3.23 into the formula given in Equation 3.11. Using the variables of the Rotary Servo Base Unit, this formula can be rewritten as E(s)=Θd(s)−Θl(s)E(s) = \Theta_d(s) - \Theta_l(s)E(s)=Θd​(s)−Θl​(s). After rearranging the terms we find:

E(s)=Θd(s)s(τs+1+Kkd)τs2+s+Kkp+Kkds(3.26)E(s) = \frac{\Theta_d(s) s(\tau s + 1 + K k_d)}{\tau s^2 + s + K k_p + K k_ds } \qquad \qquad \qquad \tag{3.26}E(s)=τs2+s+Kkp​+Kkd​sΘd​(s)s(τs+1+Kkd​)​(3.26)

Substituting the input ramp transfer function Equation 3.25 into the Θd(s)\Theta_d(s)Θd​(s) variable gives

E(s)=R0(τs+1+Kkd)s(τs2+s+Kkp+Kkds)(3.27)E(s) = \frac{R_0(\tau s + 1 + K k_d)}{s(\tau s^2 + s + K k_p + K k_ds)} \qquad \qquad \qquad \tag{3.27}E(s)=s(τs2+s+Kkp​+Kkd​s)R0​(τs+1+Kkd​)​(3.27)

1.3 PID Controller Design

Adding integral control can help eliminate steady-state error. The proportional-integral-derivative (PID) algorithm to control the position of the Rotary Servo Base Unit is shown in Figure 1.6. The motor voltage will be generated by the PID according to:

Vm(t)=kp(θd(t)−θl(t))+ki∫(θd(t)−θl(t))dt−kd(ddtθl(t))(3.28)V_m(t) = k_p(\theta_d(t) - \theta_l(t)) +k_i \int (\theta_d(t) - \theta_l(t))dt - k_d \left(\frac{d}{dt} \theta_l(t)\right) \qquad \qquad \qquad \tag{3.28}Vm​(t)=kp​(θd​(t)−θl​(t))+ki​∫(θd​(t)−θl​(t))dt−kd​(dtd​θl​(t))(3.28)

where kpk_pkp​ is the proportional control gain, kik_iki​ is the integral gain, kdk_dkd​ is the derivative control gain, θd(t)\theta_d(t)θd​(t) is the setpoint or reference load shaft angle, θl(t)\theta_l(t)θl​(t) is the measured load shaft angle, and Vm(t)V_m(t)Vm​(t) is the Rotary Servo Base Unit motor input voltage.

This is a variation of the standard PID control with the D-term in the feedback path as opposed to the feedforward path.

We need to find the closed-loop transfer function Θl(s)/Θd(s)\Theta_l(s)/\Theta_d(s)Θl​(s)/Θd​(s) for the closed-loop position control of the Rotary Servo Base Unit. Taking the Laplace transform of Equation 3.28 gives

Vm(s)=(kp+kis)(Θd(s)−Θl(s))−kdsΘl(s)(3.29)V_m(s) = \left(k_p + \frac{k_i}{s}\right)(\Theta_d(s) - \Theta_l(s)) - k_d s \Theta_l(s) \qquad \qquad \qquad \tag{3.29}Vm​(s)=(kp​+ski​​)(Θd​(s)−Θl​(s))−kd​sΘl​(s)(3.29)

From the Plant block in Figure 21 and Equation 3.3, we can write

Θl(s)Vm(s)=K(τs+1)s(3.30)\frac{\Theta_l(s)}{V_m(s)} = \frac{K}{(\tau s + 1)s} \qquad \qquad \qquad \tag{3.30}Vm​(s)Θl​(s)​=(τs+1)sK​(3.30)
Figure 21. Block diagram of PID Rotary Servo Base Unit position control.

Substituting Equation 3.29 into Equation 3.30 and solving for Θl(s)/Θd(s)\Theta_l(s)/\Theta_d(s)Θl​(s)/Θd​(s) gives the Rotary Servo Base Unit position closed-loop transfer function as:

Θl(s)Θd(s)=K(kps+ki)τs3+(1+Kkd)s2+Kkps+Kki(3.31)\frac{\Theta_l(s)}{\Theta_d(s)} = \frac{K (k_p s + k_i)}{\tau s^3 + (1 + K k_d)s^2 + K k_p s + K k_i} \qquad \qquad \qquad \tag{3.31}Θd​(s)Θl​(s)​=τs3+(1+Kkd​)s2+Kkp​s+Kki​K(kp​s+ki​)​(3.31)

1.3.1 Ramp Steady-State Error using PID Controller

To find the steady-state error of the Rotary Servo Base Unit for a ramp input under the control of the PID substitute the closed-loop transfer function from Equation 3.31 into Equation 3.11

E(s)=Θd(s)s2(τs+1+Kkd)τs3+s2+Kkps+Kki+Kkds2(3.32)E(s) = \frac{\Theta_d(s) s^2(\tau s + 1 + K k_d)}{\tau s^3 + s^2 + K k_p s + K k_i + K k_d s^2} \qquad \qquad \qquad \tag{3.32}E(s)=τs3+s2+Kkp​s+Kki​+Kkd​s2Θd​(s)s2(τs+1+Kkd​)​(3.32)

Then, substituting the reference ramp transfer function Equation 3.25 into the Θd(s)\Theta_d(s)Θd​(s) variable gives

E(s)=R0(τs+1+Kkd)s(τs3+s2+Kkps+Kki+Kkds2)(3.33)E(s) = \frac{R_0(\tau s + 1 + K k_d)}{s(\tau s^3 + s^2 + K k_p s + K k_i + K k_d s^2)} \qquad \qquad \qquad \tag{3.33}E(s)=s(τs3+s2+Kkp​s+Kki​+Kkd​s2)R0​(τs+1+Kkd​)​(3.33)

1.3.2 Integral Gain Design

It takes a certain amount of time for the output response to track the ramp reference with zero steady-state error. This is called the settling time and it is determined by the value used for the integral gain.

In steady-state, the ramp response error is constant. Therefore, to design an integral gain the velocity compensation (the V signal) can be neglected. Thus, we have a PI controller left as:

Vm(t)=kp(θd(t)−θl(t))+ki∫(θd(t)−θl(t))dt(3.34)V_m(t) = k_p(\theta_d(t) - \theta_l(t)) +k_i \int (\theta_d(t) - \theta_l(t))dt \qquad \qquad \qquad \tag{3.34}Vm​(t)=kp​(θd​(t)−θl​(t))+ki​∫(θd​(t)−θl​(t))dt(3.34)

When in steady-state, the expression can be simplified to

Vm(t)=kpess+ki∫0tiessdt(3.35)V_m(t) = k_p e_{\text{ss}} + k_i \int_0^{t_i} e_{\text{ss}} dt \qquad \qquad \qquad \tag{3.35}Vm​(t)=kp​ess​+ki​∫0ti​​ess​dt(3.35)

where the variable tit_iti​ is the integration time.

2 Pre-Lab Questions

Do problems 1 - 7

  1. Calculate the maximum overshoot of the response (in radians) given a step setpoint of 45 deg and the overshoot specification given in Section 1.1.3. Hint: By substituting ymax=θ(tp)y_{\text{max}} = \theta(t_p)ymax​=θ(tp​) and step setpoint R0=θd(t)R_0 = \theta_d(t)R0​=θd​(t) into Equation 3.6, we can obtain θ(tp)=θd(t)(1+PO100)\theta(t_p) = \theta_d(t) \left(1 + \frac{\text{PO}}{100} \right)θ(tp​)=θd​(t)(1+100PO​). Recall that the desired response specifications include 5% overshoot.

  2. The Rotary Servo Base Unit closed-loop transfer function was derived in Equation 3.23 in Section 1.2.1. Find the control gains kpk_pkp​ and kdk_dkd​ in terms of ωn\omega_nωn​ and ζ\zetaζ. Hint: Remember the standard second-order system equation.

  3. Calculate the minimum damping ratio and natural frequency required to meet the specifications given in Section 1.1.3.

  4. Based on the nominal Rotary Servo Base Unit model parameters, KKK and τ\tauτ, found in the Modeling laboratory experiment, calculate the control gains needed to satisfy the time-domain response requirements given in Section 1.1.3. (Use K=1.53K = 1.53K=1.53 rad/(Vs) and τ=0.0217\tau = 0.0217τ=0.0217) (Need answers from Q2 and Q3)

  5. In the PD controlled system, for a reference step of π/4\pi/4π/4 (i.e. 45 deg step) starting from θl(t)=0\theta_l(t) = 0θl​(t)=0 position, calculate the maximum proportional gain that would lead to providing the maximum voltage to the motor. Ignore the derivative control (kd=0k_d = 0kd​=0). Can the desired specifications be obtained based on this maximum available gain and what you calculated in Question 4? (Need answer from Q4)

  6. For the PD controlled closed-loop system, find the steady-state error and evaluate it numerically given a ramp with a slope of R0=3.36R_0 = 3.36R0​=3.36 rad/s. Use the control gains found in Question 4. (Need answer from Q4)

  7. What should the integral gain kik_iki​ be so that when the Rotary Servo Base Unit is supplied with the maximum voltage of Vmax=10V_{\text{max}} = 10Vmax​=10V it can eliminate the steady-state error calculated in Question 6 in 1 second? (Need answers from Q4 and Q6) Hint: Start from Equation 3.35 and use ti=1t_i = 1ti​=1, Vm(t)=10V_m(t) = 10Vm​(t)=10, the kpk_pkp​ you found in Question 4 and esse_{\text{ss}}ess​ found in Question 6. Remember that esse_{\text{ss}}ess​ is constant.

↓↓↓ In Lab Exercise ↓↓↓

The main goal of this laboratory is to explore position control of the Rotary Servo Base Unit load shaft using PD and PID controllers. In this laboratory, you will conduct the following experiments:

  1. Step response with PD controller,

  2. Ramp response with PD controller, and

  3. Ramp response with PID controller.

In each experiment, you will first simulate the closed-loop response of the system. Then, you will implement the controller using the Rotary Servo Base Unit hardware and software to compare the real response to the simulated one.

Position Control MATLAB/SIMULINK Files

57KB
PositionControl_files.zip
archive

3.1 Step Response using PD Controller

3.1.1 Simulation

First, you will simulate the closed-loop response of the Rotary Servo Base Unit with a PD controller to step input. Our goals are to confirm that the desired response specifications in an ideal situation are satisfied and to verify that the motor is not saturated. Then, you will explore the effect of using a high-pass filter, instead of a direct derivative, to create the velocity signal in the controller.

Simulation Setup

The s_servo_pos_cntrl SIMULINK diagram shown in Figure 22 will be used to simulate the closed-loop position control response with the PD and PID controllers. The Rotary Servo Base Unit Model uses a Transfer Fcn block from the SIMULINK library. The PID Control subsystem contains the PID controller detailed in Section 1.3. When the integral gain is set to zero, it essentially becomes a PD controller.

Figure 22. Simulink model used to simulate the Rotary Servo Base Unit closed-loop position response.
  1. Download the PositionControl_files.zip and extract the files to the desktop.

  2. Open the setup_servo_pos_cntrl.m file to open the setup script for the position control Simulink models.

  3. Replace the default model parameters (K and tau) with the values calculated from the Modelling section in the setup script.

  4. Run the script, which will generate the model parameters, specifications, and default PID gains. Note: The calculated PID gains are all set to zero by default and they need to be changed over the course of the experiment.

Simulation: Closed-loop Response with PD Controller

  1. Enter the proportional and derivative control gains found in Pre-Lab Question 4 in the Matlab command window as kp and kd.

  2. Set the integral gain to 0 in the Matlab window, denoted as ki.

  3. To generate a step reference, ensure the Signal Generator is set to the following:

    • Signal type = square

    • Amplitude = 1

    • Frequency = 0.4 Hz

  4. In the Simulink diagram, set the Amplitude (rad) gain block to 0.4 (rad) to generate a step with an amplitude of 45.8 degrees (i.e. square wave goes between ±0.4\pm0.4±0.4 which results in a step amplitude of 0.8 rad).

  5. Set the Manual Switch such that the velocity of the motor load shaft is fed back directly.

  6. Open the servo position Position (rad) scope and the motor input voltage Vm (V) scope.

  7. Start the simulation. By default, the simulation runs for 5 seconds. The scopes should be displaying responses similar to Figure 23a and Figure 23b. Note that in the theta_l (rad) scope, the yellow trace is the setpoint position while the purple trace is the simulated position (generated by the Rotary Servo Base Unit Model block). This simulation is called the Ideal PD response as it uses the PD compensator with the derivative block.

    Figure 23. Simulated PD control response using direct derivative
  8. After each simulation run, each scope automatically saves its response to a variable in the MATLAB workspace. That is, the Position (rad) scope saves its response to the variable called data_pos and the Vm (V) scope saves its data to the data_vm variable. The data_pos variable has the following structure: data_pos(:,1) is the time vector, data_pos(:,2) is the setpoint, and data_pos(:,3) is the simulated angle. For the data_vm variable, data_vm(:,1) is the time and data_vm(:,2) is the simulated input voltage.

  9. Save Vm and data_pos data and name it suitably (e.g. posnctrl_section#_Group#_step). Result: Generate a MATLAB figure showing the Ideal PD position response and the ideal input voltage.

  10. Measure the steady-state error, the percent overshoot and the peak time of the simulated response. Result: Does the response satisfy the specifications given in Section 1.1.3? Hint: You can use the Cursor Measurements tool in the Simulink scopes or save the data and use MATLAB function : stepinfo().

Simulation: Using a Filtered Derivative

When implementing a controller on actual hardware, it is generally not advised to take the direct derivative of a measured signal. Any noise or spikes in the signal becomes amplified and gets multiplied by a gain and fed into the motor which may lead to damage. To remove any high-frequency noise components in the velocity signal, a low-pass filter is placed in series with the derivative, i.e. taking the high-pass filter of the measured signal. However, as with a controller, the filter must also be tuned properly. In addition, the filter has some adverse effects (ex. filter could add some delays to the system).

  1. Set the Manual Switch block to the down position to enable the derivative and filter.

  2. Start the simulation. The response in the scopes should still be similar to Figure 23a and Figure 23b. This simulation is called the Filtered PD response as it uses the PD controller with the high-pass filter block. Result: Generate a MATLAB figure showing the Filtered PD position and input voltage responses.

  3. Measure the steady-state error, peak time, and percent overshoot. Result: Are the specifications still satisfied without saturating the actuator? Recall that the peak time and percent overshoot should not exceed the values given in Section 1.1.3. Discuss the changes from the ideal response. Hint: The difference in the response is minor. Make sure you use Cursor Measurements tool in the Simulink scope to take precise measurements.

3.1.2 Experiment

In this experiment, we will control the angular position of the Rotary Servo Base Unit load shaft, i.e. the disc load, using the PD controller. Measurements will then be taken to ensure that the specifications are satisfied.

Experimental Setup

The q_servo_pos_cntrl SIMULINK diagram shown in Figure 24 is used to implement the position control experiments. The Rotary Servo Interface - Position subsystem contains QUARC blocks that interface with the DC motor and sensors of the Rotary Servo Base Unit system, as discussed in the Integration laboratory experiment. The PID Control subsystem implements the PID controller detailed in Section 1.3, except a low-pass filter is placed in series with the derivative to remove the noise.

Figure 24. Simulink/QUARC model used with to run the PID position controller on the Rotary Servo Base Unit.
  1. From the extracted files, open q_servo_pos_cntrl Simulink file.

  2. Configure DAQ: Double-click on the HIL Initialize block in the Rotary Servo Interface subsystem (which is located inside the Rotary Servo Interface - Position subsystem) Simulink diagram and ensure it is configured for the DAQ device that is installed in your system (e.g. Q2-USB).

  3. Open setup_servo_pos_cntrl.m file and run the script.

Experiment

  1. Enter the proportional and derivative control gains found in Pre-Lab Question 4.

  2. Set Signal Type in the Signal Generator block to square to generate a step reference.

  3. Set the Amplitude (rad) gain block to 0.4 to generate a step with an amplitude of 45.8 degrees.

  4. Open the load shaft position scope, Position (rad), and the motor input voltage scope, Vm (V).

  5. Build the model by clicking on the down arrow on Monitor & Tune under the Hardware tab and then select Build for monitoring . This compiles the Simulink diagram.

  6. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start to begin running the controller. The scopes should display responses similar to Figure 25a and Figure 25b.

    Figure 25. PD control response on Rotary Servo Base Unit
  7. When a suitable response is obtained, click on the Stop button in the SIMULINK diagram toolbar to stop running the code. As in the s_servo_pos_cntrl SIMULINK diagram, when the controller is stopped each scope automatically saves its response to a variable in the MATLAB workspace. Thus the theta_l (rad) scope saves its response to the data_pos variable and the Vm (V) scope saves its data to the data_vm variable.

  8. Save the data in the MATLAB workspace with a suitable name. Result: Generate a MATLAB figure showing the PD position response and its input voltage.

  9. Measure the steady-state error, the percent overshoot, and the peak time of the Rotary Servo Base Unit load gear. Result: Does the response satisfy the specifications given in Section 1.1.3?

  10. Click the Stop button on the SIMULINK diagram toolbar to stop the experiment.

3.2 Ramp Response using PD Controller

3.2.1 Simulation

In this simulation, the goal is to verify that the system with the PD controller can meet the zero steady-state error specification without saturating the motor.

Similar to the Step Response experiment in Section 3.1, in this experiment you need to use the s_servo_pos_cntrl Simulink diagram shown in Figure 22 in Section 3.1.1 again.

  1. Clear the workspace and run the setup_servo_pos_cntrl.m script in MATLAB.

  2. Enter the proportional and derivative control gains found in Pre-Lab Question 4 and set the integral gain to 0.

  3. Set the Signal Generator parameters to the following to generate a triangular reference (which corresponds to a ramp input):

    • Signal Type = triangle

    • Amplitude = 1

    • Frequency = 0.8 Hz

  4. Setting the frequency to 0.8 Hz will generate an increasing and decreasing ramp signal with the same slope used in the Pre-Lab Question 6. The slope is calculated from the Triangular Waveform amplitude, Amp, and frequency, f, using the expression: R0=4 Amp fR_0 = 4~\text{Amp~f}R0​=4 Amp f

  5. In the SIMULINK diagram, set the Amplitude (rad) gain block to π/3\pi/3π/3.

  6. Inside the PID Control subsystem, set the Manual Switch to the down position so that the High-Pass Filter block is used.

  7. Open the load shaft position scope, Position (rad), and the motor input voltage scope, Vm (V).

  8. Start the simulation. The scopes should display responses similar to Figure 26a and Figure 26b.

    Figure 26. Simulated ramp response using PD control
  9. Save the data in the workspace using a suitable name. Result: Generate a MATLAB figure showing the Ramp PD position response and its corresponding input voltage trace.

  10. Measure the steady-state error. Result: Compare the simulation measurement with the steady-state error calculated in Pre-Lab Question 6.

3.2.2 Experiment

In this experiment, we will control the angular position of the Rotary Servo Base Unit load shaft, i.e. the disc load, using a PD controller. The goal is to examine how well the system can track a triangular (ramp) position input. Measurements will then be taken to ensure that the specifications are satisfied.

As in the Step Response experiment in Section 3.1, in this experiment, you also need to use the q_servo_pos_cntrl SIMULINK diagram shown in Figure 24 to implement the position control experiments.

  1. Clear the workspace and run the setup_servo_pos_cntrl.m script in MATLAB.

  2. Enter the proportional and derivative control gains found in Pre-Lab Question 4.

  3. Set the Signal Generator parameters to the following to generate a triangular reference (i.e. ramp reference):

    • Signal Type = triangle

    • Amplitude = 1

    • Frequency = 0.8 Hz

  4. In the Simulink diagram, set the Amplitude (rad) gain block to π/3\pi/3π/3.

  5. Open the load shaft position scope, Position (rad), and the motor input voltage scope, Vm (V).

  6. Build the model by clicking on the down arrow on Monitor & Tune under the Hardware tab and then select Build for monitoring .

  7. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start to begin running the controller. The scopes should display responses similar to Figure 27a and Figure 27b.

    Figure 27. Ramp response using PD control on Rotary Servo Base Unit
  8. Save the data in the workspace using a suitable name. Result: Generate a MATLAB figure showing the Ramp PD position response and its corresponding input voltage trace.

  9. Measure the steady-state error. Result: Compare it with the steady-state error calculated in Pre-Lab Question 6.

3.3 Ramp Response with No Steady-State Error

Design an experiment to see if the steady-state error can be eliminated when tracking a ramp input. First, simulate the response, then implement it using the Rotary Servo Base Unit system.

  1. How can the PD controller be modified to eliminate the steady-state error in the ramp response? State your hypothesis and describe the anticipated cause-and-effect leading to the expected result. Hint: Look through Section 1.

  2. List the independent and dependent variables of your proposed controller. Explain their relationship.

  3. Your proposed controller, like the PD compensator, is a model-based controller. This means that the control gains generated are based on a mathematical representation of the system. Given this, list the assumptions you are making in this control design. State the reasons for your assumptions.

  4. Give a brief, general overview of the steps involved in your experimental procedure for two cases: (1) Simulation, and (2) Experimental implementation. Note: In case of time constraints, follow the same steps for Simulation as per Section 3.2.1 and Experiment as per Section 3.2.2, except the value of ki (i.e., ki ≠\ne= 0).

  5. For each case, generate a Matlab figure showing the position response of the system and its corresponding input voltage.

  6. In each case, measure the steady-state error.

  7. For each case comment on whether the steady-state specification given in Section 1.1.3 was satisfied without saturating the actuator.

4 Results for the Report

  1. Pre-lab calculations.

  2. Model parameters (KKK and τ\tauτ) and controller gains (kpk_pkp​, kdk_dkd​ and kik_iki​) implemented during the In-Lab Simulations and Experiments.

  3. Response plots from In-Lab Simulations and Experiments (Section 3.1.1: Step 9, Step 2; Section 3.1.2: Step 8; Section 3.2.1: Step 9; Section 3.2.2: Step 8; Section 3.3: Step 5).

  4. Corresponding measured peak time, percent overshoot and steady-state error for the response plots mentioned above (Section 3.1.1: Step 10, Step 3; Section 3.1.2: Step 9; Section 3.2.1: Step 10; Section 3.2.2: Step 9; Section 3.3: Step 6). Note: Peak time and percent overshoot are required only for step response simulation and experiment, not ramp response.

  5. Answer all the questions asked in all the In-Lab simulations and experiments (Section 3.1.1: Step 10, Step 3; Section 3.1.2: Step 9; Section 3.2.1: Step 10; Section 3.2.2: Step 9; Section 3.3: Steps 1, 2, 3 and 7).

A. Integration (Week 1)

There are two pre-lab calculations (Integration and Modelling) that need to be done before coming for the Lab 1 Week 1 lab session. Please write it down on paper with any necessary work. Failure to do pre-lab will result in points deduction for lab report.

1. QUANSER Rotary Servo Base

The Quanser Rotary Servo Base Unit rotary servo plant, shown below, consists of a DC motor that is encased in a solid aluminum frame and equipped with a planetary gearbox. The motor has its own internal gearbox that drives external gears. The Rotary Servo Base Unit is equipped with two sensors: a potentiometer and an encoder. The potentiometer and the encoder sensors measure the angular position of the load gear using different methods.

Figure 1 Rotary Servo Base
ID
Component
ID
Component

1

Top plate

12

Encoder

2

Bottom plate

13

Ball-bearing block

3

Posts

14

Motor

4

Motor pinion gear: 72-teeth (low-gear)

15

Motor Gearbox

5

Load gear: 72 teeth (low-gear)

16

Motor connector

6

Potentiometer gear

17

Encoder connector

7

Anti-backlash springs

18

Potentiometer connector

8

Load shaft (i.e. output shaft)

19

Bar inertial load

9

Motor pinion gear: 24-teeth (high-gear)

20

Disc inertial load

10

Load gear: 120-teeth (high-gear)

21

Thumb screws

11

Potentiometer

2. Components & Sensors

a) DC Motor

The Rotary Servo Base Unit incorporates a Faulhaber Coreless DC Motor model 2338S006 and is shown in Figure 1c with ID #9. This is a high-efficiency, low-inductance motor that can obtain a much faster response than a conventional DC motor.

b) Potentiometer

A rotary potentiometer, or pot, is a manually controlled variable resistor. See the example shown below. It typically consists of an exposed shaft, three terminals (A, W, and B), an encased internal resistive element shaped in a circular pattern, and a sliding contact known as a wiper. By rotating the shaft, the internal wiper makes contact with the resistive element at different positions, causing a change in resistance when measured between the centre terminal (W) and either of the side terminals (A or B). The total resistance of the potentiometer can be measured by clamping a multimeter to terminals A and B.

Figure 2 Potentiometer

A schematic diagram of the voltage dividing characteristic of a potentiometer is illustrated below. By applying a known voltage between terminals A and B (VABV_{AB}VAB​), voltage is divided between terminals AW and WB where:

VAB=VAW+VWBV_{AB} = V_{AW} + V_{WB}VAB​=VAW​+VWB​
Figure 3 Schematic diagram of the voltage dividing characteristic of a rotary potentiometer.

When connected to an external shaft, a rotary potentiometer can measure absolute angular displacement. By applying a known voltage to the outside terminals of the pot, we can determine the position of the sensor based on the output voltage VAWV_{AW}VAW​ or VWBV_{WB}VWB​ which will be directly proportional to the position of the shaft. One of the advantages of using a potentiometer as an absolute sensor is that after a power loss, position information is retained since the resistance of the pot remains unchanged. While pots are an effective way to obtain a unique position measurement, caution must be used since their signal output may be discontinuous. That is, after a few revolutions potentiometers may reset their signal back to zero. Another disadvantage of most pots is that they have physical stops that prevent continuous shaft rotation.

c) Encoders

An incremental optical encoder is a relative angular displacement sensor that measures angular displacement relative to a previously known position. Unlike an absolute encoder, an incremental encoder does not retain its position information upon power loss. An incremental encoder outputs a series of pulses that correlate to the relative change in angular position. Encoders are commonly used to measure the angular displacement of rotating load shafts. The information extracted from an incremental encoder can also be used to derive instantaneous rotational velocities.

Figure 4 Output of an incremental encoder showing signals A and B when rotating in a clockwise manner.

An incremental optical encoder typically consists of a coded disk, an LED, and two photo sensors. The disk is coded with an alternating light and dark radial pattern causing it to act as a shutter. As shown schematically above, the light emitted by the LED is interrupted by the coding as the disk rotates around its axis. The two photo sensors (A and B) positioned behind the coded disk sense the light emitted by the LED. The process results in A and B signals, or pulses, in four distinct states: (1) A off, B on; (2) A off, B off; (3) A on, B off; (4) A on, B on. Encoders that output A and B signals are often referred to as quadrature encoders since the signals are separated in phase by 90◦. The resolution of an encoder corresponds to the number of light or dark patterns on the disk and is given in terms of pulses per revolution, or PPR. In order to make encoder measurements, you need to connect the encoder to a counter to count the A and B signals. Then use a decoder algorithm to determine the number of counts and direction of rotation. Three decoding algorithms are used: X1, X2, X4.

X1 Decoder: When an X1 decoder is used, only the rising or falling edge of signal A is counted as the shaft rotates. When signal A leads signal B, the counter is incremented on the rising edge of signal A. When signal B leads signal A, the counter is decremented on the falling edge of signal A. Using an X1 decoder, a 1,024 PPR encoder will result in a total of 1,024 counts for every rotation of the encoder shaft. X2 Decoder: When an X2 decoder is used, both the rising and falling edges of signal A are counted as the shaft rotates. When signal A leads signal B, the counter is incremented on both the rising and falling edge of signal A. When signal B leads signal A, the counter is decremented on both the rising and falling edges of signal A. Using an X2 decoder, a 1,024 PPR encoder will generate a total of 2,048 counts for every rotation of the encoder shaft. X4 Decoder: When an X4 algorithm is used, both the rising and falling edges of both signals A and B are counted. Depending on which signal leads, the counter will either increment or decrement. An X4 decoder generates four times the number of counts generated by an X1 decoder resulting in the highest resolution among the three types of decoders. Using an X4 decoder, a 1,024 PPR encoder will generate a total of 4,096 counts for every rotation of the encoder shaft.

The angular resolution of an encoder depends on the encoder’s pulses per revolution (PPR) and the decoding algorithm used:

Δθ=2πN×PPR(1.1)\Delta \theta = \frac{2\pi}{N\times PPR} \qquad \qquad \qquad \tag{1.1}Δθ=N×PPR2π​(1.1)

where N = 1, 2, or 4 corresponds to X1, X2, and X4 decoders respectively

Figure 5 Comparison of the number of counts generated by the X1, X2, and X4 decoding algorithms

3. Velocity Estimation

While encoders are typically used for measuring angular displacement, they can also measure rotational speeds. The velocity can be found by taking the difference between consecutive angle measurements

ω(k)=θ(k)−θ(k−1)h\omega (k) = \frac{\theta(k) - \theta(k-1)}{h}ω(k)=hθ(k)−θ(k−1)​

​where θ(k)\theta(k)θ(k) represents the kthk^{th}kth position measurement sample and hhh is the sampling interval of the control software. The resolution or ripple in the velocity measurement is given by

Δω=Δθh(1.2)\Delta\omega = \frac{\Delta \theta}{h} \qquad \qquad \qquad \tag{1.2} Δω=hΔθ​(1.2)

ω\omegaω is rotational speed (rad/s) and Δθ\Delta \thetaΔθ is the resolution of the encoder given in Equation 1.1, and hhh is the sampling interval. Note that the ripple velocity increases when the sampling period decreases.

4. Filtering the Velocity Signal

In practice, determining rotational speeds by means of derivation of the discontinuous encoder output often results in signal noise. The ripple in the velocity signal due to sampling can be reduced by filtering. Applying a first-order low-pass filter to the measured velocity signal

Yf(s)Y=1Tf(s)+1\frac{Y_f(s)}{Y} = \frac{1}{T_f(s) + 1}YYf​(s)​=Tf​(s)+11​

​where YYY is the measured signal, YfY_fYf​ is the filtered signal, and TfT_fTf​ is the filter time constant. Low-pass filters are also often represented in terms of cutoff frequency ωf\omega_fωf​:

Yf(s)Y=ωfs+ωf\frac{Y_f(s)}{Y} = \frac{\omega_f}{s+\omega_f}YYf​(s)​=s+ωf​ωf​​

where ωf=1/Tf\omega_f = 1 / T_fωf​=1/Tf​ . The low-pass filter attenuates the high-frequency components of the signal higher than the cut-off frequency specified, i.e. passes signal with frequencies ω≤ωf.\omega \leq \omega_f .ω≤ωf​.

Rearranging the filter transfer function above,

sTfYf(s)+Yf(s)=Y(s)sT_fY_f(s) + Y_f(s) = Y(s)sTf​Yf​(s)+Yf​(s)=Y(s)

we can represent the filtering using the differential equation

Tfdyf(t)dt+yf(t)=y(t)T_f \frac{dy_f(t)}{dt} + y_f(t) = y(t)Tf​dtdyf​(t)​+yf​(t)=y(t)

​The derivative can be approximated by the difference between the currently measured sample, yf(t)y_f(t)yf​(t), and the previous sample, yf(t−h)y_f(t − h)yf​(t−h):

Tfyf(t)−yf(t−h)h+yf(t)=y(t)T_f\frac{y_f(t) - y_f(t-h)}{h}+y_f(t) = y(t)Tf​hyf​(t)−yf​(t−h)​+yf​(t)=y(t)

​Solving for yf(t)y_f(t)yf​(t),

yf(t)=TfTf+hyf(t−h)+hTf+hy(t)(1.3)y_f(t) = \frac{T_f}{T_f + h}y_f(t-h)+\frac{h}{T_f + h}y(t) \qquad \qquad \qquad \tag{1.3}yf​(t)=Tf​+hTf​​yf​(t−h)+Tf​+hh​y(t)(1.3)

Thus the high-frequency error is reduced by a factor of h/(Tf+h)h/(T_f + h)h/(Tf​+h). The ripple in the filtered velocity signal caused by the encoder is

Δyf(t)=hTf+hΔθh(1.4)\Delta y_f(t) = \frac{h}{T_f + h} \frac{\Delta \theta}{h} \qquad \qquad \qquad \tag{1.4}Δyf​(t)=Tf​+hh​hΔθ​(1.4)

Note: Filtering does add dynamics to the signal, i.e. small delay, as given by the term TfTf+hyf(t−h)\frac{T_f}{T_f + h}y_f (t-h)Tf​+hTf​​yf​(t−h) in Equation 1.3.

5. Encoder Counter Wrapping

Encoder counters on data acquisition (DAQ) devices have a rated number of bits, n. For example, a DAQ with an 8-bit signed counter has a range between −128 and +127 (i.e. −27-2^{7}−27 and 27−12^7-127−1). When the encoder counts go beyond this range, the measured counts from the DAQ ends up wrapped. Consider the following example. If the encoder is measuring 100 counts, then the DAQ counter will output 100 (no wrapping). However, if the encoder is measuring 150 counts, then the 8-bit signed counter will read (150+128)mod  256 − 128=−106(150+128) \mod 256 ~ − ~128 = −106(150+128)mod256 − 128=−106 counts. Thus the encoder wraps and causes a discontinuity. This can be very problematic in closed-loop feedback control. The QUARC software includes an Inverse Modulus block that unwraps the counter signal and keeps a continuous signal. For more information, see the Inverse Modulus block in the QUARC documentation.

Pre-lab (before lab start)

Do Problem 1 ~ 5

  1. Given that the Rotary Servo Base Unit rotary encoder has 1024 PPR and the quadrature decoding is used in the DAQ, what is the resolution of the encoder?

  2. What is the sensor gain for the rotary potentiometer that converts voltage measured into load gear angle (in radians)? Sensor Gain is used to convert output signal to desired output unit. For the potentiometer the output ranges from -5V to +5V. In this case, the sensor gain converts voltage into corresponding radians. Information: the rotary potentiometer on the Rotary Servo Base Unit outputs ±5 V over 352 deg.

  3. Assuming the DAQ device you are using has a 16-bit signed encoder counter. What is the counter range and how does that affect the measuring encoder signal?

  4. Find the velocity estimation ripple of the Rotary Servo Base Unit when the sampling interval is 0.01 s, 0.002 s, and 0.001 s. How does increasing the sampling rate (i.e., decreasing the sampling interval) affect the ripple?

  5. A low-pass filter with a time constant of Tf=0.01T_f = 0.01Tf​=0.01 is used in the velocity estimator and the sampling of the control runs at h=0.001h = 0.001h=0.001s. Evaluate the ripple in the velocity with this filter.

↓↓↓ In Lab Exercise ↓↓↓

Experiment

We have tried a simple SIMULINK model diagram of the Rotary Servo Base with encoder and potentiometer reading from Lab 0 QLabs. This time we will build a SIMULINK model from scratch to read the motor velocity using actual equipment.

Follow the steps and build the SIMULINK model below:

Figure 6 SIMULINK model

Follow these steps to read the motor velocity:

30KB
q_servo_vel_direct.slx
  1. First, download and open q_servo_vel_direct.slx Simulink model.

  2. Configure the model to apply a 0.4 Hz square wave voltage signal going between 0.5V and 2.5V.

  3. Change the simulation time to 5 seconds from Simulation tab, stop time.

  4. Go to Modelling tab and open modelling setting. Check that sample time is set to 0.002s and check that solver is set to ode1 (euler).

  5. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  6. Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .

  7. The velocity measurement using a direct derivative will be noisy. After the SIMULINK has run for 5 seconds and stopped, measure the velocity ripple (peak to peak within ripple). You can use the Cursor Measurements tool in the Scope for more accurate measurements. Result: compare the measured ripple to the calculation made in Pre-Lab Q4 with sampling interval of 0.002s. Save the speed data (wl) to plot in the report. Name the file such as integration_sampletime0.002s.

    Sample velocity estimate usign direct derivative when running at 500 Hz

  8. Increase the control loop rate of the QUARC controller by decreasing the sampling interval to 0.001 s, i.e. increasing the sampling rate to 1 kHz. Build, Connect and run the Simulink. Once SIMULINK has run for 5 seconds and stopped, examine the change in the ripple velocity measurement. Result: compare the measured ripple to the calculation made in Pre-lab Q4 with sampling interval of 0.001s. Save the speed data (wl) to plot in the report. Name the file such as integration_sampletime0.001s.

  9. Run the controller for a minute or two (stop time to inf). Depending on the data acquisition device you are using (e.g. Q2-USB or Q8-USB), you may notice a spike or discontinuity that occurs in the velocity estimation, as shown below (once the discontinuity occurs stop the simulation) : This encoder wrapping is due to the range of the DAQ encoder counter. To remove the wrapping and maintain a continuous signal, use the QUARC Inverse Modulus block before Encoder: count to rad block. Build, connect and run your QUARC controller and ensure the signal is now continuous (i.e. no spike occurs). Note : The Inverse Modulus block should be added to the output of the HIL Read Encoder and set to the 2n2^n2n where n is the bits of the DAQ encoder counter. Quanser Q2-USB has 16-bit encoder counter and Quanser Q8-USB has 24-bit encoder counter.

    Save the speed data (wl) to plot in the report. Name the file such as integration_wrapping.

  10. Add a low-pass filter with a time constant of Tf=0.01T_f = 0.01Tf​=0.01s using the Simulink Transfer Fcn block. This translate into having a filter with a cutoff frequency of 1/0.01 = 100 rad/s. Run it for 5 seconds.

    Save the speed data (wl) to plot in the report. Name the file such as integration_lowpass.

    Result: Compare the velocity estimation using the direct derivative with filtering. How much noise does the filter remove? Is this in-line with the ripple velocity calculated in Pre-lab Q5? Result: Attach the response of the filtered velocity estimate and the Simulink model you designed.

Results For Report

  1. Pre-lab calculations.

  2. Complete SIMULINK block diagram with low-pass filter.

  3. Response plots from In-Lab Experiment Step 7,8,9 and 10. Comparison between measured and calculated values.

  4. Answer all the questions asked in the In-Lab experiment.

B. Control Design

Objective

The objective of this experiment is to design a position control system for the Quanser Aero system in the 2 DOF configuration. The angular position controller should meet the following specifications:

Design Specifications

  1. Steady-state error to a step command input: (a) = 0 deg (b) = 0 deg

  2. Peak time of response to a step command input: (a) ≤ 2s (b) ≤ 2s

  3. Percent Overshoot of response to a step command input: (a) ≤ 7.5% (b) ≤ 7.5%

  4. No actuator saturation: (a) ≤ 24V (b) ≤ 24V

Refer to the lecture note on control design.

Download Matlab Script

Download the setup aero file below and fill in the system parameters, control parameters and other necessary values to store in the MATLAB workspace. Use these variables in building Simulink so it is easier for you to put values. Make sure to check your values with TAs before running Simulink.

Controller Design

We will start our controller design by considering first the decoupled system. In this case, the Multiple-Input Multiple-Output (MIMO) system is represented as two separate Single-Input Single-Output (SISO) systems.

The pitch dynamics of the 2D Aero system is a Type 0 system, i.e., no pole at the origin. As such, we will select the PID controller structure for the pitch control design, which will meet the specification of zero steady-state error to a step command input. The yaw dynamics of the 2D Aero system is a Type 1 system, i.e., there is one pole at the origin. As such, we will select the PD controller structure for the yaw control design, which will meet the specification of zero steady-state error to a step command input.

  1. Choose appropriate values for and in both pitch and yaw axes satisfying the design specifications.

  2. For these selected values of and within the design specs, compute the desired values of damping ratio and natural frequency using the following equations:

  3. Using the aforementioned desired values of and and the system parameters calculated in part A, compute the proportional gain and the derivative gain individually for pitch and yaw controllers as follows: Note: Let subscript represent open-loop (actual system parameters), and subscript represent closed-loop (desired parameters). Pitch: Yaw: Note: In the above calculations, use the normalized thrust gains obtained using the steady-state method.

  4. Add an integral term, , to the pitch controller. Choose to be a value in the range of . Caution: Integral feedback, while improving steady-state response, introduces lag. Large values of integral gain, while reducing damping, can lead to loss of stability of the closed loop system.

  5. Initially, set the feedforward gains ( and ) to 0, i.e., ff_py = 0 and ff_yp = 0 in the MATLAB code. Eventually, you will choose appropriate values for the feedforward gains such that the coupling effect is minimized. For example, choose in Figure 1, to cancel the torque from the pitch rotor, i.e. , Likewise, choose to cancel the torque from the yaw rotor, i.e. , Feedforward controller minimizes the coupling effects. Use Figure 1 as a reference for how to add the two feedforward paths.

Simulation Modelling and Evaluation

  1. Create a SIMULINK model of the system. (a) Create subsystem blocks representing the plant. Figure 2 shows separate pitch and yaw plants. Note: Plants account for coupling (see Figures 3(a) and 3(b)). (b) Create subsystem blocks representing the decoupled pitch and yaw controllers. Figure 2 shows the input/output structure of these blocks. (c) Using the completed subsystem blocks, finish the diagram of the closed-loop system. Make sure to include pitch and yaw inputs, saturation blocks, and appropriate outputs. Use scopes and To Workspace blocks so that reference, output, and response signals can be tracked. (Make sure to maintain consistency between deg and rad in SIMULINK) (d) Set the sampling time to Fixed-step of step-size 0.002s in Modeling -> Model Settings.

Decoupled Dynamics with Decoupled Controller

First consider simulation validation of your controller using decoupled dynamics and decoupled controller (i.e., no feedforward between pitch and yaw channels). 1. Set the values of in the pitch plant Simulink block and in the yaw plant Simulink block. This will remove the coupling effects between pitch and yaw dynamics. 2. Set the integral gain of the pitch controller . 3. Simulate the closed loop system response with yaw-only command: and . Save the data. 4. Check whether your controller meets the desired specifications for the yaw command. Since decoupled system dynamics are used in this step, you will likely see a close match between your simulation results and the desired specifications. 5. Set the integral gain of the pitch controller of (refer to Step 4 of ). 6. Simulate the closed loop system response with pitch-only command: and . Save the data. 7. Check if your pitch controller meets all the desired specifications. If it fails to meet the and specifications, relax the specifications and/or tune the pitch PID controller gains to try to meet the specifications. Save the tuned results.

Coupled Dynamics without Feedforward Controller

Next, consider the simulation evaluation of the feedback controller for the system with coupled dynamics. 1. Set the values of in the pitch plant Simulink block and in the yaw plant Simulink block to the . This accounts for the coupled dynamics. 2. Simulate the closed-loop response of the system with pitch-only command: and . Save the data. 3. Simulate the closed-loop response of the system with yaw-only command: and . Save the data. 4. Simulate the closed-loop response of the system with simultaneous pitch and yaw commands: and . Save the data.

Coupled Dynamics with Feedforward Controller

  1. Set the feedforward gains and based on Eqs. 1 and 2 (marked as ff_py and ff_yp in the MATLAB code). These gains are different from the normalized cross-thrust torque gains that you set to make the coupled dynamics.

  2. Simulate the closed-loop response of the system with pitch-only command: and . Save the data.

  3. Simulate the closed-loop response of the system with yaw-only command: and . Save the data.

  4. Simulate the closed-loop response of the system with simultaneous pitch and yaw commands: and . Save the data.

Results for Report

(A) Simulation Modelling

Include a screenshot of the complete SIMULINK model (block diagram). In addition, include the following subsystem block diagram screenshots:

  • Pitch and Yaw plants

  • Pitch and Yaw controllers

(B) Simulation Evaluation

i)

  1. Mention the chosen design specifications values (Step 1 of ).

  2. Mention the final yaw PD gains (Step 3).

  3. Yaw-only command case: State if the design specifications were met, either including figures with design specs marked (Step 3) OR including a table with the , , and values recorded from the response (Step 4).

  4. Mention the final tuned pitch PID gains (Step 7).

  5. Pitch-only command case: State if the design specifications were met, either including figures with design specs marked (Step 7) OR including a table with the , , and values recorded from the response (Step 7).

ii)

  1. Pitch-only command case: Plot the pitch and yaw data (commanded angles, simulation responses and motor input voltages) for pitch-only command (Step 2) and check if the design specifications were met in pitch.

  2. Yaw-only command case: Plot the pitch and yaw data (commanded angles, simulation responses and motor input voltages) for yaw-only command (Step 3) and check if the design specifications were met in yaw.

  3. Pitch and yaw combined case: State if the design specifications were met, either including figures with design specs marked (Step 4) OR including a table with the , , , , , , and values recorded from the responses (Step 4).

Note: It is possible that specifications are not met due to coupling between pitch and yaw dynamics.

ii)

  1. Mention the feedforward gain values.

  2. Pitch-only command case: Plot the pitch and yaw data (commanded angles, simulation responses and motor input voltages) for pitch-only command (Step 2) and check if the design specifications were met in pitch.

  3. Yaw-only command case: Plot the pitch and yaw data (commanded angles, simulation responses and motor input voltages) for yaw-only command (Step 3) and check if the design specifications were met in yaw.

  4. Pitch and yaw combined case: State if the design specifications were met, either including figures with design specs marked (Step 4) OR including a table with the , , , , , , and values recorded from the responses (Step 4).

Questions for Report

  1. How does accounting for the coupling affect the performance of the controller? (a) What happens when you neglect the coupling effect (in simulation)? (b) What is a physical explanation for the coupling effect?

  2. Why a PID controller is used for the pitch and a PD controller for the yaw?

  3. Estimate gain and phase margins of the closed loop systems individually with your pitch and yaw controllers. Hint: Use the margin command in MATLAB. Gain and phase margins

Rotary Gyro

Introduction

The objective of this experiment is to design a controller that maintains the direction of the gyroscope module while the top base plate is rotated relative to the bottom base plate. While the disk spins, the SRV02 is used to apply the correct amount of counter torque and maintain the gyroscope heading in the event of disturbances (i.e., rotation of the bottom support plate).

Gyroscopes are used in many different platforms, e.g., airplanes, large marine ships, submarines, and satellites.

In the next sections, we will develop a model of the gyroscope device from first principles in order to obtain a transfer function of the plant, which we will later use in a control scheme. To do so, however, we need some preliminaries on angular momentum and the gyroscopic effect.

Part 0: Preliminaries

Angular Momentum

Let's consider an rigid body of mass , moving with any general motion in space. Assume that the axes x-y-z are attached to the body with origin at its center of mass . Now, let be a mass element of the body situated by position vector with respect to the center of mass .

Given the body's linear velocity (i.e., the velocity of its center of mass) and its angular velocity , the total angular momentum of the body with respect to the center of mass is given as

The first term is since the integral by definition of the center of mass. By using the triple product rule for the cross product in the second term, it can be shown that

where is the inertia tensor of the body about the center of mass .

Time Rate of Change of Angular Momentum

Now, since the body's reference frame is rotating, the derivative of the total angular momentum about the center of mass can be written as

where is the time derivative of the angular momentum as seen in the rotating x-y-z frame. We can view the term as the part due to the change in magnitude of and the second term as the part due to the change in direction of . By virtue of the Newton-Euler equation, we have

and we notice that either a change in magnitude of the angular moment or a change in direction of the angular momentum generates a torque. Inversely, a torque can generate a change in either magnitude or direction of the angular momentum, depending about which axis it is applied.

Gimbaling Gyroscope

Assume now that the total angular momentum of the gimbaling gyroscope is given by

where is the angular velocity of the gyro module and ​ is the angular velocity of the flywheel, is the inertia tensor of the gyro module - without the flywheel - and ​ is the inertia tensor of the flywheel.

Assuming that the deflection of the flywheel gimbal axis is small and slow, we now have that, when expressed in the rotating frame of the flywheel gimbal coordinates,

and

Further assuming that the rotary base motor has achieved steady-state (, ), and that the flywheel's velocity is constant (i.e. ), we have that

Assuming that the gimbal frame is aligned with the principal axes of he gyro module assembly and ignoring the contribution of the wheel inertia to the principal moment of inertia about the vertical axis of the gyro module, then the second term is 0, and we are left with the equations

corresponds to the torque due to the gyroscopic effect and will be hereon denoted as ​. We will further neglect the second equation pertaining to the vertical axis torque by assuming that is typically small.

Part 1: Modeling

1.1 Servo Model

The Servo Base Unit (SRV02) open-loop transfer function is given by

where is the load gear position and​ is the applied motor voltage. The system steady-state gain and time constant are given by:

​and

1.2 Gyroscope Gain

Consider the simplified model shown in Figure 1.1.

The inertial disc, flywheel, spins at a relatively constant velocity, . When the base rotates at a speed of , the resulting gyroscopic torque about the sensitive axis is​

where ​​is the angular momentum of the flywheel and ​ is its moment of inertia. The springs mounted on the gyroscope counteract the gyroscopic torque, ​, by the following amount

​where ​is the rotational stiffness of the springs.

Given that the spring torque equals the gyroscopic torque, ​, we can equate equations (1.2) and (1.3) to obtain the expression

Assume that the base speed is proportional to the deflection angle through the gain ​, then

By examining equations (1.4) and (1.5), we find the gyroscopic sensitivity gain is given by

Thus, the deflection angle can be used to measure , the rotation rate of the platform relative to the base, without a direct measurement.​ NOTE: the dynamics in the sensitive axis (i.e., deflection axis) are ignored. A more complete model would include these dynamics as the transfer function ​.

1.3 Joint Stiffness

The two springs affecting the sensitive axis are shown in Figure 1.2. The stiffness at the axis of rotation is derived in the following fashion. Assume the springs have a spring constant ​and an un-stretched length ​. The length of the springs at the normal position, i.e. ​, is given by ​. If the axis is rotated by an angle ​, then the two forces about the sensitive axis are given by (for a small ​)

​and

The spring torque about the pivot due to the two forces is

​The rotational stiffness is given by

Part 2: Control design

2.1 Desired Position Control

The block diagram shown in Figure 2.1 is a general unity feedback compensator with compensator (controller) and a transfer function representing the plant​, . The measured output , is supposed to track the reference and the tracking has to match certain desired specifications.

The output of the system can be written as

By solving for ​ we get the closed-loop transfer function

​When a second-order system is placed in series with a proportional compensator in the feedback loop as in Figure 1.2, the resulting closed-loop transfer function can be expressed as

where ​ is the natural frequency and ​ is the damping ratio. This is called the standard second order transfer function. Its response properties depend on the values of ​ and ​.

2.2 Control Specifications

The desired time-domain specifications for stabilizing the gyroscope are:

or 3Hz, and

2.3 Gyro PD Controller

To stabilize the heading of the gyroscope, we will develop a Proportional-Derivative (PD) controller depicted in Figure 2.2.

Assuming that the support plate (and servo) rotates relative to the base by the angle (not measured)​ and that the gyro module rotates relative to the servo module by the angle (measured)​, the total rotation angle of the gyro module relative to the base plate can be expressed by

​We want to design a controller that maintains the gyro heading, i.e. keeps ​, independent of ​ and we can only use the measurement from the gyro sensor, ​. In other terms, we want to stabilize the system such that ​. Differentiating equation (2.4) gives

​Given that ​ and the gyro gain definition in equation (1.5), this becomes

Taking the Laplace and solving for ​, we get

Introducing the new variable ​ such that

which is the integral of the deflection angle, the gyro transfer function can be changed into the form

Add the SRV02 dynamics given in Section 1.1 into ​ to introduce our control variable to get

Adding the PD control

​and solving for we obtain the closed-loop transfer function

​

Pre-lab Questions

  1. Find the steady-state speed of the flywheel, ​, given the motor equation

​where is the nominal current, ​ is the nominal voltage, ​ is the motor resistance, and ​ is the back-emf constant.

2. Find the value of the gyroscope sensitivity gain, . The flywheel moment of inertia is . The radius and spring stiffness parameters, are respectively and .

3. The closed-loop transfer function was found in equation (2.6). Find the PD control gains, ​ and ​, in terms of and . (HINT: Remember the standard second-order system equation).

4. Based on the nominal SRV02 model parameters, and ​ given in Section 1.1, calculate the control gains needed to satisfy the time-domain response requirements given in Section 2.2.

Part 3: Experiment Procedure

3.1 Control Implementation

In this section, the gyroscopic control developed in Section 2.3 is implemented on the actual system. The goal is to see if the gyro module can maintain its heading when a disturbance is added by the user, i.e., the base plate is rotated.

The q_gyro Simulink diagram shown in Figure 3.1 is used to run the PD control on the Quanser Rotary Gyroscope system. The SRV02 Gyroscope subsystem contains QUARC blocks that interface with the DC motor and sensors of the system.

0. Download the experiment files:

  1. Verify that the amplifier is turned ON and the disc is rotating. Ask TA if there's an issue.

  2. Run the setup_gyro.m script

  3. Open the q_gyro simulink diagram.

  4. Make sure the Manual Switch is set to downward position to enable the PD control.

  5. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  6. Press Connect button under Monitor & Tune and Press Start .

  7. While the system is running, manually rotate the bottom base plate about 45 degrees. The GYRO module should be maintaining its heading. Verify your response by viewing the scopes in your experiment and comparing against the provided scope examples.

  8. Stop the controller once you have obtained a representative response.

  9. Plot the responses from the theta (deg), alpha (deg), and Vm (V) scopes in a MATLAB figure. The response data is saved in variables data_theta , data_alpha, data_vm.

  10. Start the controller again, but this time with the Manual Switch set in the upward position, which turns off the PD controller.

  11. Rotate the bottom base plate by the same amount as previously done, in an attempt to reproduce the motion as previously executed.

  12. Plot the responses.

  13. Examine how the GYRO module responds when you rotate the base plate. Does this make sense? Explain the result when the PD control is ON and OFF. Based on your observations, explain what the PD control is actually doing and how it relates to gyroscopes.

Directives for Report

  1. Briefly describe the main goal of the experiment

  2. Briefly describe the experimental procedure in steps 7 and 9 of section 3.

  3. Briefly describe the experimental procedure in step 11 and 12 of section 3.

  4. Provide results of plots for step 9 and step 12 of section 3.

  5. Explain the effect of having the PD control on and off.

  6. Briefly explain how does this relate to an actual gyroscope system?

C. Controller Implementation

Background

In this section, the controller design from section B is implemented on the physical Quanser Aero hardware. We desire to reproduce the simulation results from the controller design section. The performance specifications are identical. Download Part C Aero.zip file and unzip to your folder containing the Control Design setup MATLAB script.

Experiments

1. Pitch Controller (1DOF)

  1. Unlock pitch axis and lock yaw axis.

  2. Open q_aero_2dof_PID.slx.

  3. Set pitch controller PID gains to the values obtained in Step 7 of the section under in . If variables are in the workspace, you may directly put gain values into the variables.

  4. Set yaw controller PD gains and feedforward controller gains to 0.

  5. Apply a pitch-only command ( , ).

  6. Run SIMULINK: To build the model, click down arrow on Monitor & Tune under Hardware tab and then Build for monitoring . This generates the controller code. Click Connect button under Monitor & Tune and then click Start .

  7. GET DATA OUT!!! and save it as pitch_only.mat.

2. Yaw Controller (1DOF)

  1. Unlock yaw axis and lock pitch axis.

  2. Implement yaw PD controller using the gains tested in Step 3 of the section under in .

  3. Set pitch controller PID gains and feedforward controller gains to 0.

  4. Apply a pitch-only command ( , ).

  5. Run SIMULINK.

  6. GET DATA OUT!!! and save it as yaw_only.mat.

3. Pitch and Yaw Controllers without Feedforward Control (2DOF)

  1. Unlock both pitch and yaw axes to enable the full 2 DOF motion.

  2. Implement the PID and PID gains in pitch and yaw controllers respectively. Set feedforward gains to zero.

  3. Apply simultaneous pitch and yaw commands ( , ).

  4. Run SIMULINK.

  5. GET DATA OUT!!! and save it as pitch_yaw.mat.

4. Pitch and Yaw Controllers with Feedforward Control (2DOF)

  1. Set the feedforward gains to the values in Step 1 of the section under in .

  2. Repeat the pitch+yaw experiment with simultaneous pitch and yaw commands ( , ).

  3. Save data as ff_pitch_yaw.mat.

  4. Close SIMULINK. DO NOT SAVE THE CHANGES!

For all the experiments, the data is saved in the following order:

  1. Time (s)

  2. Voltage input to pitch rotor motor or (V)

  3. Voltage input to yaw rotor motor or (V)

  4. Pitch command angle (deg)

  5. Yaw command angle (deg)

  6. Pitch angle response (deg)

  7. Yaw angle response (deg)

  8. Pitch speed (rad/s)

  9. Yaw speed (rad/s)

Results for Report

Note: Some results require simulation response. This would require running a simulation using your SIMULINK model from using the parameter values determined in . The command input will be identical to the step input implemented during the experiment.

(A) Decoupled Pitch Controller

  1. Plot and compare the experimental results obtained for the with the corresponding :

    • Pitch command, pitch experimental response and pitch simulation response (one figure)

    • Voltage input to pitch rotor motor experiment and simulation results (one figure)

  2. Explain any differences between the experimental and simulation results.

(B) Decoupled Yaw Controller

  1. Plot and compare the experimental results obtained for the with the corresponding :

    • Yaw command, yaw experimental response and yaw simulation response (one figure)

    • Voltage input to yaw rotor motor experiment and simulation results (one figure)

  2. Explain any differences between the experimental and simulation results.

(C) Combined Pitch and Yaw Controllers without Feedforward Control

  1. Plot and compare the experimental results obtained for the with the corresponding :

    • Pitch command, pitch experimental response and pitch simulation response (one figure)

    • Yaw command, yaw experimental response and yaw simulation response (one figure)

    • Pitch rotor motor voltage experiment and simulation results (one figure)

    • Yaw rotor motor voltage experiment and simulation results (one figure)

  2. Explain any differences between the experimental and simulation results.

(D) Combined Pitch and Yaw Controllers with Feedforward Control

  1. Plot and compare the experimental results obtained for the with the corresponding :

    • Pitch command, pitch experimental response and pitch simulation response (one figure)

    • Yaw command, yaw experimental response and yaw simulation response (one figure)

    • Pitch rotor motor voltage experiment and simulation results (one figure)

    • Yaw rotor motor voltage experiment and simulation results (one figure)

  2. Explain any differences between the experimental and simulation results.

Questions for Report

  1. How does introducing feedforward gains affect the response of system? (i.e. compare pitch and yaw response without feedforward control with the responses with feedforward).

  2. Did your controller successfully meet the specifications while running on the Quanser Aero hardware? If not, why?

ess,pitche_{ss, pitch}ess,pitch​
ess,yawe_{ss, yaw}ess,yaw​
tp,pitcht_{p, pitch}tp,pitch​
tp,yawt_{p, yaw}tp,yaw​
POpitchPO_{pitch}POpitch​
POyawPO_{yaw}POyaw​
∣Vθ∣|V_\theta|∣Vθ​∣
∣Vψ∣|V_\psi|∣Vψ​∣
POPOPO
tpt_ptp​
POPOPO
tpt_ptp​
ζ\zetaζ
ωn\omega_nωn​
PO=(e−ζπ1−ζ2)∗100%PO = \left(e^{ \frac{-\zeta \pi}{\sqrt{1 - \zeta^2}}}\right)*100\%PO=(e1−ζ2​−ζπ​)∗100%
tp=πωdt_p = \displaystyle \frac{\pi}{\omega_d}tp​=ωd​π​
ωd=ωn1−ζ2\omega_d = \omega_n \sqrt{1 - \zeta^2}ωd​=ωn​1−ζ2​
ζ\zetaζ
ωn\omega_nωn​
KpK_pKp​
KdK_dKd​
op\text{op}op
cp\text{cp}cp
Kp=ωncl2−ωnop2K‾θθK_p = \displaystyle \frac{\omega_{n_\text{cl}}^2 - \omega_{n_\text{op}}^2}{\overline{K}_{\theta \theta}}Kp​=Kθθ​ωncl​2​−ωnop​2​​
Kd=2ζclωncl−2ζopωnopK‾θθK_d = \displaystyle \frac{2 \zeta_{\text{cl}} \omega_{n_\text{cl}} - 2 \zeta_{\text{op}} \omega_{n_\text{op}}}{\overline{K}_{\theta \theta}}Kd​=Kθθ​2ζcl​ωncl​​−2ζop​ωnop​​​
Kp=ωncl2K‾ψψK_p = \displaystyle \frac{\omega_{n_\text{cl}}^2}{\overline{K}_{\psi \psi}}Kp​=Kψψ​ωncl​2​​
Kd=2ζclωncl−1τopK‾ψψK_d = \displaystyle \frac{2 \zeta_{\text{cl}} \omega_{n_\text{cl}} - \displaystyle \frac{1}{\tau_{\text{op}}}}{\overline{K}_{\psi \psi}}Kd​=Kψψ​2ζcl​ωncl​​−τop​1​​
KiK_iKi​
KiK_iKi​
1%−10%1\%-10\%1%−10%
KpK_pKp​
Kθ−to−ψK_{\theta-to-\psi}Kθ−to−ψ​
Kψ−to−θK_{\psi-to-\theta}Kψ−to−θ​
Kθ−to−ψK_{\theta-to-\psi}Kθ−to−ψ​
Kθ−to−ψ=−K‾ψθK‾ψψ(1)K_{\theta-to-\psi} = \displaystyle - \frac{\overline{K}_{\psi\theta}}{\overline{K}_{\psi\psi}} \qquad \qquad (1)Kθ−to−ψ​=−Kψψ​Kψθ​​(1)
Kψ−to−θK_{\psi-to-\theta}Kψ−to−θ​
Kψ−to−θ=−K‾θψK‾θθ(2)K_{\psi-to-\theta} = \displaystyle - \frac{\overline{K}_{\theta\psi}}{\overline{K}_{\theta\theta}} \qquad \qquad (2)Kψ−to−θ​=−Kθθ​Kθψ​​(2)
K‾θψ=0\overline{K}_{\theta\psi} = 0Kθψ​=0
K‾ψθ=0\overline{K}_{\psi\theta} = 0Kψθ​=0
Ki=0K_i = 0Ki​=0
θd=0°\theta_d = 0 \degreeθd​=0°
ψd=30°\psi_d = 30 \degreeψd​=30°
Ki≈1%−10%K_i \approx 1\% - 10\%Ki​≈1%−10%
KpK_pKp​
θd=10°\theta_d = 10 \degreeθd​=10°
ψd=0°\psi_d = 0 \degreeψd​=0°
POPOPO
tpt_ptp​
K‾θψ\overline{K}_{\theta\psi} Kθψ​
K‾ψθ\overline{K}_{\psi\theta}Kψθ​
θd=10°\theta_d = 10 \degreeθd​=10°
ψd=0°\psi_d = 0 \degreeψd​=0°
θd=0°\theta_d = 0 \degreeθd​=0°
ψd=30°\psi_d = 30 \degreeψd​=30°
θd=10°\theta_d = 10 \degreeθd​=10°
ψd=30°\psi_d = 30 \degreeψd​=30°
Kθ−to−ψK_{\theta-to-\psi}Kθ−to−ψ​
Kψ−to−θK_{\psi-to-\theta}Kψ−to−θ​
θd=10°\theta_d = 10 \degreeθd​=10°
ψd=0°\psi_d = 0 \degreeψd​=0°
θd=0°\theta_d = 0 \degreeθd​=0°
ψd=30°\psi_d = 30 \degreeψd​=30°
θd=10°\theta_d = 10 \degreeθd​=10°
ψd=30°\psi_d = 30 \degreeψd​=30°
POψPO_{\psi}POψ​
tpψt_{p_\psi}tpψ​​
essψe_{ss_\psi}essψ​​
max⁡∣Vψ∣\max |V_\psi|max∣Vψ​∣
POθPO_{\theta}POθ​
tpθt_{p_\theta}tpθ​​
essθe_{ss_\theta}essθ​​
max⁡∣Vθ∣\max |V_\theta|max∣Vθ​∣
POθPO_{\theta}POθ​
tpθt_{p_\theta}tpθ​​
essθe_{ss_\theta}essθ​​
max⁡∣Vθ∣\max |V_\theta|max∣Vθ​∣
POψPO_{\psi}POψ​
tpψt_{p_\psi}tpψ​​
essψe_{ss_\psi}essψ​​
max⁡∣Vψ∣\max |V_\psi|max∣Vψ​∣
POθPO_{\theta}POθ​
tpθt_{p_\theta}tpθ​​
essθe_{ss_\theta}essθ​​
max⁡∣Vθ∣\max |V_\theta|max∣Vθ​∣
POψPO_{\psi}POψ​
tpψt_{p_\psi}tpψ​​
essψe_{ss_\psi}essψ​​
max⁡∣Vψ∣\max |V_\psi|max∣Vψ​∣
928KB
Lab2 Lecture_2D AERO System ID and control.pdf
pdf
705B
setup_aero_ctrl_design.zip
archive
Controller Design
estimated values from Part A: System Identification
Decoupled Dynamics with Decoupled Controller
Controller Design
Coupled Dynamics without Feedforward Controller
Coupled Dynamics with Feedforward Controller
Figure 1: Feedforward controller architecture
Figure 2: Controller, saturation, and Plant blocks from the SIMULINK diagram.
Figure 3(a): Pitch plant Simulink block
Figure 3(b): Yaw plant Simulink block
ωnθ\omega_{n_\theta}ωnθ​​
ζθ\zeta_\thetaζθ​
τψ\tau_\psiτψ​
K‾θθ\overline{K}_{\theta\theta}Kθθ​
K‾ψψ\overline{K}_{\psi\psi}Kψψ​
ωn\omega_nωn​
ζ\zetaζ
K‾θθ\overline{K}_{\theta\theta}Kθθ​
τ\tauτ
K‾ψψ\overline{K}_{\psi\psi}Kψψ​
BBB
mmm
GGG
dm\mathrm{d}mdm
ρ\bm{\rho}ρ
GGG
v\bm{v}v
ω\bm{\omega}ω
GGG
L=v×∫Bρdm+∫Bρ×(ω×ρ)dm.\bm{L} = \bm{v}\times \int_B \bm{\rho}\mathrm{d}m + \int_{B} \bm{\rho} \times \left(\bm{\omega}\times\bm{\rho}\right)\mathrm{d}m.L=v×∫B​ρdm+∫B​ρ×(ω×ρ)dm.
0\bm{0}0
∫Bρ dm=0\int_B \bm{\rho}\, \mathrm{d}m = \bm{0}∫B​ρdm=0
L=∫Bρ×(ω×ρ)dm=∫B(ρ⊤ρI3−ρρ⊤)dm ω=Jω\bm{L} = \int_{B} \bm{\rho} \times \left(\bm{\omega}\times\bm{\rho}\right)\mathrm{d}m = \int_{B} (\bm{\rho}^\top \bm{\rho} \mathrm{I}_3 -\bm{\rho}\bm{\rho}^\top) \mathrm{d}m \, \bm{\omega} = \bm{J}\bm{\omega}L=∫B​ρ×(ω×ρ)dm=∫B​(ρ⊤ρI3​−ρρ⊤)dmω=Jω
JJJ
3×33\times33×3
GGG
GGG
ddt(L)=L˙+ω×L\frac{\mathrm{d}}{\mathrm{d}t} \left(\bm{L}\right) = \dot{\bm{L}} + \bm{\omega} \times \bm{L}dtd​(L)=L˙+ω×L
L˙\dot{\bm{L}}L˙
L˙\dot{\bm{L}}L˙
L\bm{L}L
ω×L\bm{\omega}\times\bm{L}ω×L
L\bm{L}L
τ=ddt(L)=L˙+ω×L\bm{\tau} = \frac{\mathrm{d}}{\mathrm{d}t}\left(\bm{L}\right) = \dot{\bm{L}} + \bm{\omega} \times \bm{L}τ=dtd​(L)=L˙+ω×L
L=(Jg+Jf)ωg+Jfωf\bm{L} = (\bm{J}_g + \bm{J}_f) \bm{\omega}_g + \bm{J}_f \bm{\omega}_fL=(Jg​+Jf​)ωg​+Jf​ωf​
ωg \bm{\omega}_g ωg​
ωf \bm{\omega}_f ωf​
Jg \bm{J}_g Jg​
Jf \bm{J}_f Jf​
ωg=[00ωb+θ˙l]\bm{\omega}_g = \begin{bmatrix}0\\ 0 \\ \omega_b + \dot{\theta}_l\end{bmatrix}ωg​=​00ωb​+θ˙l​​​
ωf=[ωf00].\bm{\omega}_f = \begin{bmatrix}\omega_f \\ 0 \\ 0\end{bmatrix}.ωf​=​ωf​00​​.
θ˙l=0 \dot{\theta}_l = 0 θ˙l​=0
θ¨l=0 \ddot{\theta}_l = 0 θ¨l​=0
ω˙f=0 \dot{\omega}_f = 0ω˙f​=0
τ=(Jg+Jf)ω˙g+ωg×(Jg+Jf)ωg+ωg×Jfωf\bm{\tau} = (\bm{J}_g + \bm{J}_f)\dot{\bm{\omega}}_g + \bm{\omega}_g\times (\bm{J}_g + \bm{J}_f)\bm{\omega}_g + \bm{\omega}_g \times \bm{J}_f \bm{\omega_f} τ=(Jg​+Jf​)ω˙g​+ωg​×(Jg​+Jf​)ωg​+ωg​×Jf​ωf​
τ2=ωbJfωf\tau_2 = \omega_bJ_f\omega_fτ2​=ωb​Jf​ωf​
τ3=Jgω˙b\tau_3 = J_g \dot{\omega}_bτ3​=Jg​ω˙b​
τ2 \tau_2 τ2​
τg \tau_g τg​
ω˙b≈0 \dot{\omega}_b\approx 0 ω˙b​≈0
P(s)=Θl(s)Vm(s)=Ks(τs+1)(1.1)P(s) = \frac{\Theta_l(s)}{V_m(s)}=\frac{K}{s(\tau s + 1)}\qquad\qquad \tag{1.1}P(s)=Vm​(s)Θl​(s)​=s(τs+1)K​(1.1)
Θl(s)=L[θl(t)]\Theta_l(s) = \mathcal{L}[\theta_l(t)]Θl​(s)=L[θl​(t)]
Vm(s)=L[vm(t)]V_m(s) = \mathcal{L}[v_m(t)]Vm​(s)=L[vm​(t)]
K=1.53 rad/s/VK=1.53\, \mathrm{rad/s/V}K=1.53rad/s/V
τ=0.0486 s.\tau = 0.0486 \, \mathrm{s}.τ=0.0486s.
ωf \omega_f ωf​
ωb \omega_b ωb​
τg=ωbLf(1.2)\tau_g=\omega_b L_f\qquad \qquad \tag{1.2}τg​=ωb​Lf​(1.2)
Lf=Jfωf L_f=J_f\omega_f Lf​=Jf​ωf​
Jf J_f Jf​
τg \tau_g τg​
τs=Krα(1.3)\tau_s = K_r \alpha \qquad \qquad \tag{1.3}τs​=Kr​α(1.3)
Kr K_r Kr​
τs=τg \tau_s = \tau_g τs​=τg​
Krα=ωbJfωf.(1.4)K_r \alpha = \omega_b J_f \omega_f. \qquad \qquad \tag{1.4}Kr​α=ωb​Jf​ωf​.(1.4)
Gg G_g Gg​
ωb=Ggα.(1.5)\omega_b = G_g \alpha. \qquad \qquad \tag{1.5}ωb​=Gg​α.(1.5)
Gg=ωbα=KrJfωf.(1.6)G_g = \frac{\omega_b}{\alpha} = \frac{K_r}{J_f \omega_f}. \qquad \qquad \tag{1.6}Gg​=αωb​​=Jf​ωf​Kr​​.(1.6)
α\alphaα
ωb \omega_b ωb​
α(s)/ωb(s) \alpha (s) / \omega_b (s) α(s)/ωb​(s)
KsK_s Ks​
LuL_u Lu​
α=0 \alpha = 0α=0
LLL
α \alpha α
α \alpha α
F1=KsΔL1=Ks(L−Lu−αR)F_1 = K_s \Delta L_1 = K_s (L-L_u - \alpha R)F1​=Ks​ΔL1​=Ks​(L−Lu​−αR)
F2=KsΔL2=Ks(L−Lu+αR)F_2 = K_s \Delta L_2 = K_s (L-L_u + \alpha R)F2​=Ks​ΔL2​=Ks​(L−Lu​+αR)
τs=R(F2−F1)=2R2Ksα\tau_s = R(F_2 - F_1) = 2 R^2 K_s \alphaτs​=R(F2​−F1​)=2R2Ks​α
Kr=τsα=2R2Ks.(1.7)K_r = \frac{\tau_s}{\alpha} = 2 R^2 K_s. \qquad \qquad \tag{1.7}Kr​=ατs​​=2R2Ks​.(1.7)
C(s) C(s) C(s)
P(s) P(s) P(s)
Y(s) Y(s) Y(s)
R(s) R(s) R(s)
Y(s)=C(s)P(s)(R(s)−Y(s)).Y(s) = C(s)P(s)(R(s) - Y(s)).Y(s)=C(s)P(s)(R(s)−Y(s)).
Y(s) Y(s) Y(s)
Y(s)R(s)=C(s)P(s)1+C(s)P(s).\frac{Y(s)}{R(s)} = \frac{C(s)P(s)}{1 + C(s) P(s)}.R(s)Y(s)​=1+C(s)P(s)C(s)P(s)​.
Y(s)C(s)=ωn2s2+2ζωns+ωn2,(2.1)\frac{Y(s)}{C(s)} = \frac{\omega_n^2}{s^2+2\zeta\omega_n s+\omega_n^2}, \qquad \qquad \tag{2.1}C(s)Y(s)​=s2+2ζωn​s+ωn2​ωn2​​,(2.1)
ωn \omega_n ωn​
ζ \zeta ζ
ωn \omega_n ωn​
ζ \zeta ζ
ωn=6π rad/s(2.2)\omega_n = 6\pi \,\mathrm{rad/s} \qquad \qquad \tag{2.2} ωn​=6πrad/s(2.2)
ζ=0.7.(2.3)\zeta = 0.7. \qquad \qquad \tag{2.3}ζ=0.7.(2.3)
γ \gamma γ
θl \theta_l θl​
η=γ+θl(2.4)\eta = \gamma + \theta_l \qquad \qquad \tag{2.4}η=γ+θl​(2.4)
η=0 \eta = 0 η=0
γ \gamma γ
α \alpha α
η˙→0\dot{\eta}\rightarrow 0 η˙​→0
η˙=γ˙+θ˙l\dot{\eta} = \dot{\gamma} + \dot{\theta}_lη˙​=γ˙​+θ˙l​
η˙=ωb \dot{\eta} = \omega_b η˙​=ωb​
Ggα=γ˙+θ˙lG_g \alpha = \dot{\gamma} + \dot{\theta}_lGg​α=γ˙​+θ˙l​
α(s)/s \alpha(s)/s α(s)/s
α(s)s=1Gg(γ(s)+Θl(s))\frac{\alpha(s)}{s} = \frac{1}{G_g} ( \gamma(s) + \Theta_l (s))sα(s)​=Gg​1​(γ(s)+Θl​(s))
ϵ(s) \epsilon (s) ϵ(s)
ϵ(s)=α(s)s\epsilon (s) = \frac{\alpha(s)}{s}ϵ(s)=sα(s)​
ϵ(s)=1Gg(γ(s)+Θl(s))\epsilon(s) = \frac{1}{G_g} (\gamma(s) + \Theta_l(s))ϵ(s)=Gg​1​(γ(s)+Θl​(s))
Θl(s) \Theta_l(s) Θl​(s)
Vm(s) V_m(s) Vm​(s)
ϵ(s)=1Gg(γ(s)+Ks(sτ+1)Vm(s))(2.5)\epsilon (s) = \frac{1}{G_g}\left(\gamma(s) + \frac{K}{s(s\tau + 1) }V_m(s)\right)\qquad \qquad \tag{2.5}ϵ(s)=Gg​1​(γ(s)+s(sτ+1)K​Vm​(s))(2.5)
Vm(s)=−(kp+kds)ϵ(s)V_m(s) = - (k_p + k_d s)\epsilon (s)Vm​(s)=−(kp​+kd​s)ϵ(s)
ϵ(s)/γ(s) \epsilon(s) / \gamma(s) ϵ(s)/γ(s)
ϵ(s)γ(s)=s(sτ+1)Ggτs2+(Kkd+Gg)s+Kkp.(2.6)\frac{\epsilon (s)}{\gamma (s)} = \frac{s(s\tau +1)}{G_g \tau s^2 + (K k_d + G_g)s + K k_p}.\qquad \qquad \tag{2.6}γ(s)ϵ(s)​=Gg​τs2+(Kkd​+Gg​)s+Kkp​s(sτ+1)​.(2.6)
ωf \omega_f ωf​
vg,m=ig,mRg,m+kg,mωfv_{g,m}= i_{g,m}R_{g,m} + k_{g,m}\omega_fvg,m​=ig,m​Rg,m​+kg,m​ωf​
ig,m=0.23 A i_{g,m} = 0.23 \,\mathrm{A} ig,m​=0.23A
vg,m=12 V v_{g,m} = 12 \, \mathrm{V} vg,m​=12V
Rg,m=5.3 Ω R_{g,m}=5.3 \, \mathrm{\Omega} Rg,m​=5.3Ω
kg,m=0.0235 V⋅s/rad k_{g,m} = 0.0235 \, \mathrm{V\cdot s/rad}kg,m​=0.0235V⋅s/rad
GgG_gGg​
Jf=12mfrf2=0.00103,Nms2/rad J_f=\frac{1}{2}m_fr_f^2=0.00103 ,\mathrm{Nms^2/rad} Jf​=21​mf​rf2​=0.00103,Nms2/rad
R=0.0254 m R = 0.0254 \, \mathrm{m} R=0.0254m
Ks=1908.9 N/m K_s = 1908.9 \, \mathrm{N/m} Ks​=1908.9N/m
kp k_p kp​
kd k_d kd​
ωn \omega_n ωn​
ζ \zeta ζ
K K K
τ \tau τ
27KB
RotaryGyro_Files.zip
archive
Figure 0.1: Rotary Gyro Experiment
Figure 0.2: Angular Momentum
Figure 0.3: Coordinate Frame and Angle Definitions
Figure 1.1: Simplified rotary gyroscope model.
Figure 1.2: Forces due to springs.
Figure 2.1: Unity Feedback System.
Figure 2.2: Gyroscope PD Control Block Diagram
Figure 3.1: q_gyro Simulink Diagram
θd=10°\theta_d = 10 \degreeθd​=10°
ψd=0°\psi_d = 0 \degreeψd​=0°
θd=0°\theta_d = 0 \degreeθd​=0°
ψd=30°\psi_d = 30 \degreeψd​=30°
θd=10°\theta_d = 10 \degreeθd​=10°
ψd=30°\psi_d = 30 \degreeψd​=30°
θd=10°\theta_d = 10 \degreeθd​=10°
ψd=30°\psi_d = 30 \degreeψd​=30°
VpV_pVp​
VθV_\thetaVθ​
VyV_yVy​
VψV_\psiVψ​
θc\theta_cθc​
ψc\psi_cψc​
θ\thetaθ
ψ\psiψ
θ˙\dot{\theta}θ˙
ψ˙\dot{\psi}ψ˙​
52KB
Part C Aero.zip
archive
Decoupled Dynamics with Decoupled Controller
Simulation Modeling and Evaluation
Part B: Controller Design
Decoupled Dynamics with Decoupled Controller
Simulation Modeling and Evaluation
Part B: Controller Design
Coupled Dynamics with Feedforward Controller
Simulation Modeling and Evaluation
Part B: Controller Design
Part B Control Design
Part A System Identification
decoupled pitch-only case
decoupled dynamics with decoupled controller simulation results from Part B Control Design
decoupled yaw-only case
decoupled dynamics with decoupled controller simulation results from Part B Control Design
combined pitch and yaw case
coupled dynamics without feedforward controller simulation results from Part B Control Design
combined pitch and yaw case (including feedforward control)
coupled dynamics with feedforward controller simulation results from Part B Control Design

Week 2

Objective

The objectives of this part of the laboratory experiment on the rotary inverted pendulum are as follows:

  1. Use energy-based control schemes to develop a swing-up pendulum controller.

  2. Implement the balance and swing-up controllers on the Quanser Rotary Pendulum plant and evaluate their performance.

109KB
Week 2.zip
archive

B. Balance Control (continued)

Feedback Control

The feedback control loop that balances the rotary pendulum is illustrated in Figure 7. The reference state is defined as where θd\theta_dθd​ is the desired rotary arm angle. The controller is Note that if xd=0x_d = 0xd​=0 then u=−Kxu = -Kxu=−Kx, which is the control gain used in the pole-placement algorithm.

Figure 7. State-feedback control loop

When running this on the actual system, the pendulum begins in the hanging, downward position. We only want the balance control to be enabled when the pendulum is brought up around its upright vertical position. The controller is therefore where ϵ\epsilonϵ is the angle about which the controller should engage. For example if ϵ=10\epsilon = 10ϵ=10 degrees, then the control will begin when the pendulum is within ±10 degrees of its upright position, i.e. when ∣x2∣<10|x_2| < 10∣x2​∣<10 degrees.

B.3 Experiment: Implementing the Balance Controller

In this section, the state-feedback control that was designed and simulated in the previous sections is run on the actual Rotary Pendulum device.

Experiment Setup

The q_rotpen_bal_student SIMULINK diagram shown in Figure 8 is used to run the state-feedback control on the Quanser Rotary Pendulum system. The Rotary Pendulum Interface subsystem contains QUARC blocks that interface with the DC motor and sensors of the system. The feedback developed in the previous section is implemented using a Simulink Gain block.

Figure 8. q_rotpen_bal_student SIMULINK diagram can be used to run balance controller
  1. Download the Week 2.zip file, unzip it into a new folder and open the week2setup.m script.

  2. Go to the 'Balance Control' section and put the gain K you found in Step 4 of Designing the Balance Control experiment. Run the script.

  3. Open the q_rotpen_bal_student SIMULINK diagram.

  4. As shown in Figure 8, the SIMULINK diagram is incomplete. Add the blocks from the Simulink library to implement the balance control.

    • You need to add a switch logic to implement Equation 30. Use Multi-port switch with 2 data points and zero-based contiguous. The output from the compare to constant block will be 0 if false and 1 if true. Check your block with TA.

    • Ensure that you connect the final signal going into the u(V) terminal of the Rotary Pendulum Interface, which is also connected to the u scope terminal.

  5. Turn ON the power amplifier.

  6. Ensure the pendulum is in the hanging down position, with the rotary arm aligned with the 0 marking, and is motionless.

  7. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  8. Press Connect button under Monitor & Tune and Press Start .

  9. Once it is running, manually bring up the pendulum to its upright vertical position. You should feel the voltage kick-in when it is within the range where the balance control engages. Once it is balanced, the controller will introduce the ±20 degree rotary arm rotation.

  10. The response should look similar to your simulation. Once you have obtained a response, click on the STOP button to stop the controller (data is saved for the last 10 seconds, so stop SIMULINK around 18-19 seconds once the response looks similar to Figure 9).

    CAUTION Be careful, as the pendulum will fall down when the controller is stopped.

  11. Similar to the simulation Simulink model, the response data will be saved to the workspace. Copy and paste into your group's folder. Ensure that the data variables have 10 seconds of data saved.

    Figure 9. Experiment balance control response example.

C. Swing up Control

In this section a nonlinear, energy-based control scheme is developed to swing the pendulum up from its hanging, downward position. The swing-up control described herein is based on the strategy outlined in [3]. Once upright, the control developed to balance the pendulum in the upright vertical position can be used.

Pendulum Dynamics

The dynamics of the pendulum can be redefined in terms of pivot acceleration AAA (see Figure 10) as

Jpα¨−12mpgLpsin⁡α=12mpLpAcos⁡α(31)J_p \ddot{\alpha} - \frac{1}{2}m_pgL_p\sin{\alpha} = \frac{1}{2}m_pL_pA\cos{\alpha} \quad \quad (31)Jp​α¨−21​mp​gLp​sinα=21​mp​Lp​Acosα(31)
Figure 10. Force vector diagram

The pivot acceleration, AAA, is the linear acceleration of the pendulum link base. The acceleration is proportional to the torque of the rotary arm and is expressed as

τ=mrLrA(32)\tau = m_rL_rA \quad \quad (32)τ=mr​Lr​A(32)

Control Law based on Lyapunov Function​

According to Lyapunov’s stability theory, a sufficient condition for asymptotic stability of a nonlinear system about an equilibrium point is that the first time derivative of a selected Lyapunov’s function (V(x)V(x)V(x)) is negative, i.e.,

Given

V(x)>0∀ x≠0(33)V(x) > 0 \qquad \forall~x \neq 0 \quad \quad (33) V(x)>0∀ x=0(33)

sufficient condition for asymptotic stability is

V˙(x)<0∀ x≠0(34)\dot{V}(x) < 0 \qquad \forall~x \neq 0 \quad \quad (34) V˙(x)<0∀ x=0(34)

Swing-up Control

Let us select a candidate Lyapunov function for arriving at the control law as a quadratic function of the difference in total energy (EEE) and the reference energy (ErE_rEr​) when the pendulum is in equilibrium in the upright position, i.e.,

V=12(E−Er)2(35)V = \frac{1}{2}\left( E-E_r \right )^2 \quad \quad (35)V=21​(E−Er​)2(35)

where the total energy (EEE) is the sum of kinetic energy EKEE_{KE}EKE​ and potential energy EPEE_{PE}EPE​.

EKE=12Jpα˙2(36)E_{KE} = \frac{1}{2}J_p{\dot{\alpha}}^2 \quad \quad (36)EKE​=21​Jp​α˙2(36)
EPE=12mpgLp(cos⁡α+1)(37)E_{PE} = \frac{1}{2}m_pgL_p(\cos{\alpha} +1) \quad \quad (37)EPE​=21​mp​gLp​(cosα+1)(37)
E=EKE+EPE=12Jpα˙2+12mpgLp(cos⁡α+1)(38)E = E_{KE} + E_{PE} = \frac{1}{2}J_p{\dot{\alpha}}^2 + \frac{1}{2}m_pgL_p(\cos{\alpha} +1) \quad \quad (38)E=EKE​+EPE​=21​Jp​α˙2+21​mp​gLp​(cosα+1)(38)

Also, the reference energy of the pendulum in equilibrium in its fully upright position as compared to its fully downward position becomes

Er=mpLpg(39)E_r = m_pL_pg \quad \quad (39)Er​=mp​Lp​g(39)

Taking the time derivative of Equation 35, we get

V˙=(E−Er)E˙(40)\dot{V} = \left( E-E_r \right ) \dot{E} \quad \quad (40)V˙=(E−Er​)E˙(40)

Taking the time derivative of Equation 38, we get

E˙=α˙(Jpα¨−12mpLpgsin⁡α)(41)\dot{E} = \dot{\alpha}\left( J_p \ddot{\alpha} - \frac{1}{2}m_pL_pg\sin{\alpha} \right ) \quad \quad (41)E˙=α˙(Jp​α¨−21​mp​Lp​gsinα)(41)

Now, we replace the bracketed term on the right-hand side of Equation 41 using the equation of motion of the pendulum obtained in Equation 31 to get

E˙=12mpLpAα˙cos⁡α(42)\dot{E} = \frac{1}{2}m_pL_pA\dot{\alpha}\cos{\alpha} \quad \quad (42)E˙=21​mp​Lp​Aα˙cosα(42)

Substituting Equation 42 in Equation 38, the time rate of change of the selected Lyapunov equation becomes

V˙=(E−Er)E˙=12mpLp(E−Er)Aα˙cos⁡α(43)\dot{V} = \left( E - E_r \right) \dot{E} = \frac{1}{2}m_pL_p \left( E - E_r \right)A \dot{\alpha}\cos{\alpha} \quad \quad (43)V˙=(E−Er​)E˙=21​mp​Lp​(E−Er​)Aα˙cosα(43)

Now, we need to select AAA such that V˙<0\dot{V}<0V˙<0 for asymptotic stability. This can easily be achieved by selecting AAA as

A=−(E−Er)α˙cos⁡α(44)A = -\left( E - E_r \right) \dot{\alpha}\cos{\alpha} \quad \quad (44)A=−(E−Er​)α˙cosα(44)

With the above selection of control law for the pivot acceleration, Equation 43 becomes

V˙=−12mpLp[(E−Er)α˙cos⁡α]2(45)\dot{V} = -\frac{1}{2}m_pL_p \left [ \left( E - E_r \right) \dot{\alpha}\cos{\alpha} \right ]^2 \quad \quad (45)V˙=−21​mp​Lp​[(E−Er​)α˙cosα]2(45)

which guarantees V˙<0\dot{V}<0V˙<0.

The selected control law (Equation 44) will continuously decrease the difference between current energy (EEE) and the energy of the pendulum in the vertically up position (ErE_rEr​). Note that the selected control law is nonlinear, it changes sign for 90∘<α<270∘90^{\circ}<\alpha<270^{\circ}90∘<α<270∘and α˙<0\dot{\alpha}<0α˙<0.

Now, for the quickest change in energy, we may want to use the maximum controller input (acceleration of the pivot), i.e.,

A=−Amaxsign[(E−Er)α˙cos⁡α](46)A = -A_{\text{max}}\text{sign}\left [ \left( E - E_r \right) \dot{\alpha}\cos{\alpha} \right ] \quad \quad (46)A=−Amax​sign[(E−Er​)α˙cosα](46)

but this controller can lead to chattering. Instead, we use

A=−satA,max(μ(E−Er)sign(α˙cos⁡α))(47)A = -\text{sat}_{A, \text{max}}(\mu \left( E-E_r \right ) \text{sign}(\dot{\alpha}\cos{\alpha})) \quad \quad (47)A=−satA,max​(μ(E−Er​)sign(α˙cosα))(47)

where μ\muμ is a tunable controller gain.

Recall that the acceleration of the pendulum pivot is related to the torque applied on the rotary arm

τ=mrLrA(48)\tau = m_rL_rA \quad \quad (48)τ=mr​Lr​A(48)

Additionally, from Equation 9 of the balance controller design section, we have

τ=ηgKgηmktRm(Vm−Kgkmθ˙)(49)\tau = \frac{\eta_gK_g\eta_mk_t}{R_m}\left( V_m - K_gk_m\dot{\theta} \right ) \quad \quad (49)τ=Rm​ηg​Kg​ηm​kt​​(Vm​−Kg​km​θ˙)(49)

Then, the voltage supplied to the rotary base motor is obtained by combining Equations 48 and 49 as

Vm=RmmrLrAηgKgηmkt+Kgkmθ˙(50)V_m = \frac{R_mm_rL_rA}{\eta_gK_g\eta_mk_t} + K_gk_m\dot{\theta} \quad \quad (50)Vm​=ηg​Kg​ηm​kt​Rm​mr​Lr​A​+Kg​km​θ˙(50)

Where from Equation 47, A=−satA,max(μ(E−Er)sign(α˙cos⁡α))A = -\text{sat}_{A, \text{max}}(\mu \left( E-E_r \right ) \text{sign}(\dot{\alpha}\cos{\alpha}))A=−satA,max​(μ(E−Er​)sign(α˙cosα))

The selected nonlinear control law will swing up the pendulum from the downward position towards the upright position. Once the pendulum is near the upright position, it is balanced around the fully upward position using the linear balance controller.

Combined Balance and Swing-up Control

The energy-based swing-up control can be combined with the balancing control in Equation 29 to obtain a control law that performs the dual tasks of swinging up the pendulum and balancing it. This can be accomplished by switching between the two control systems.

Basically, the same switching implemented for the balance control in Equation 30 is used. Only instead of feeding 0 V when the balance control is not enabled, the swing-up control is engaged. The controller therefore becomes

Vm={K(xd−x),if ∣α∣<ϵRmmrLrAηgKgηmkt+Kgkmθ˙,otherwise(51)V_m = \begin{cases} K(x_d - x), & \text{if}\ |\alpha| < \epsilon \\ \displaystyle \frac{R_mm_rL_rA}{\eta_gK_g\eta_mk_t} + K_gk_m\dot{\theta}, & \text{otherwise} \end{cases} \quad \quad (51)Vm​=⎩⎨⎧​K(xd​−x),ηg​Kg​ηm​kt​Rm​mr​Lr​A​+Kg​km​θ˙,​if ∣α∣<ϵotherwise​(51)

where A=−satA,max(μ(E−Er)sign(α˙cos⁡α))A = -\text{sat}_{A, \text{max}}(\mu \left( E-E_r \right ) \text{sign}(\dot{\alpha}\cos{\alpha}))A=−satA,max​(μ(E−Er​)sign(α˙cosα))

The parameter ϵ\epsilonϵ in Equation 51 is a user-selected range of α\alphaα over which the balance controller becomes active.

Experiment: Implementing the Swing up Control

  1. Run the week2setup.m script

  2. Check if the correct gain K value is loaded onto the workspace.

  3. Open q_rotpen_swingup_student Simulink diagram.

  4. Open the Swing-Up subsystem.

  5. Go into Swing-Up| Energy-Based Swing-Up Control | Pendulum Energy block. Complete the diagram by referring to the total energy of the pendulum given in Equation 38.

  6. Turn on the power amplifier.

  7. Ensure the pendulum is in the hanging down position, with the rotary arm aligned with the 0 marking, and is motionless.

  8. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  9. Press Connect button under Monitor & Tune and Press Start .

  10. Manually rotate the pendulum up to the upright position. The balance control implemented previously will be activated. While the inverted pendulum is balancing, record the total energy reading displayed in Pen Energy (J) numeric indicator.

  11. Close the SIMULINK. No need to save the data.

  12. Open q_rotpen_swingup_student_2 Simulink diagram.

  13. To build the model, click the down arrow on Monitor & Tune under the Hardware tab and then click Build for monitoring . This generates the controller code.

  14. Press Connect button under Monitor & Tune and Press Start . The pendulum should be moving back and forth slowly. Gradually increase μ\muμ until the pendulum goes up. You may do this by increasing the gain slider. When the pendulum swings up to the vertical upright position, the balance controller should engage and balance the link.

  15. After the link swings up and is balanced, wait for ~5 seconds and stop the SIMULINK.

  16. Note down the values of the swing-up parameters, i.e., ErE_rEr​, ,and μ\muμ.

  17. Save the data_alpha, data_theta, and data_Vm. Ensure that the data variables have 10 seconds of data saved.

Results for Report

B.3) Balance Controller Implementation

  1. From Step B.3.10, plots of the commanded position of the rotary arm (θc\theta_cθc​), experimental responses of the rotary arm (θ\thetaθ), pendulum (α\alphaα), and motor input voltage (u(Vm)u(V_m)u(Vm​)) obtained using your obtained gain K.

  2. Are Design Specifications 3 and 4 satisfied? Justify using the measured maximum pendulum deflection and motor input voltage values.

C) Swing-up Controller Implementation

  1. From Step C.10, the total energy reading of the inverted pendulum.

  2. From Step C.17, plots of the experimental responses of the rotary arm (θ\thetaθ), pendulum (α\alphaα), and motor input voltage (u(Vm)u(V_m)u(Vm​)).

  3. From Step C.16, ErE_rEr​, ,and μ\muμ used to bring the pendulum up.

  4. Did the swing-up behave as you expected with these parameters?

Questions for Report

C) Swing-up Controller Implementation

  1. Evaluate the potential energy of the pendulum when it is in the downward (180°180 \degree180°) and upright positions (0°0 \degree0°).

  2. Compute the maximum acceleration deliverable by the Rotary Servo. Assume the maximum equivalent voltage applied to the DC motor is 5 V such that

For Question 2, Use Equation 50 to get the maximum acceleration (AAA) of the rotary arm.

  1. Compare the calculated value of potential energy when upright position (Question C.1) with the value in Result C.1.

  2. Compare the calculated value of the maximum acceleration AmaxA_{max}Amax​ (Question C.2) with the value in Result C.3.

  3. Is the selected swing-up control law unique? Is it optimal? Comment.

Reference

[3] K. J. Åström and K. Furuta. Swinging up a pendulum by energy control. 13th IFAC World Congress, 1996. ROTARY PENDULUM Workbook INSTRUCTOR v

Week 1

Objective

The objectives of this laboratory experiment are as follows:

  1. Obtain the linear state-space representation of the rotary pendulum plant.

  2. Design a state-feedback control system that balances the pendulum in its upright position using Pole Placement.

  3. Simulate the closed-loop system to ensure the given specifications are met.

Equipment

Week 1

A. Modeling

This experiment involves modeling of the rotary inverted pendulum.

Rotary Inverted Pendulum Model

Figure 1 Rotary servo base with Rotary Pendulum module

Table 1 Rotary Pendulum components (Figure 1)

ID#
Component

1

Rotary Servo

2

Thumbscrews

3

Rotary Arm

4

Shaft Housing

5

Shaft

6

Pendulum T-Fitting

7

Pendulum Link

8

Pendulum Encoder Connector

9

Pendulum Encoder

Table 2 Main Parameters associated with the Rotary Pendulum module

Symbol
Description
Value
Unit

Mass of pendulum

0.127

​

​

Total length of pendulum

0.337

​

Distance from pivot to center of mass

0.156

​

Pendulum moment of intertia about center of mass

0.0012

Pendulum viscous damping coeffi­cient as seen at the pivot axis

0.0024

​

Mass of rotary arm with two thumb screws

0.257

​

Rotary arm length from pivot to tip

0.216

​

​

Rotary arm length from pivot to center of mass

0.0619

​

Rotary arm moment of inertia about its center of mass

9.98 x 10^-4

​

​

Rotary arm viscous damping coeffi­cient as seen at the pivot axis

0.0024

​

Rotary arm moment of inertia about pivot

0.0020

​

Pendulum encoder resolution

4096

​

Model Convention

The rotary inverted pendulum model is shown in Figure 2. The rotary arm pivot is attached to the Rotary Servo system and is actuated. The arm has a length of , a moment of inertia of , and its angle, θ\bm\thetaθ, increases positively when it rotates counterclockwise (CCW). The servo (and thus the arm) should turn in the CCW direction when the control voltage is positive, i.e. > 0.

The pendulum link is connected to the end of the rotary arm. It has a total length of LpL_pLp​ and it center of mass is . The moment of inertia about its center of mass is . The inverted pendulum angle, α\bm\alphaα, is zero when it is perfectly upright in the vertical position and increases positively when rotated CCW.

Figure 2 Rotary inverted pendulum conventions

Nonlinear Equations of Motion

Instead of using classical (Newtonian) mechanics, the Lagrange method is used to find the equations of motion of the system. This systematic method is often used for more complicated systems such as robot manipulators with multiple joints.

Specifically, the equations that describe the motions of the rotary arm and the pendulum with respect to the servo motor voltage, i.e., the dynamics, will be obtained using the Euler-Lagrange equation:

The variables qi\bm q_iqi​ are called generalized coordinates. For this system let

where, as shown in Figure 2, θ(t)\theta(t)θ(t) is the rotary arm angle and α(t)\alpha(t)α(t) is the inverted pendulum angle. The corresponding velocities are

With the generalized coordinates defined, the Euler-Lagrange equations for the rotary pendulum system are

The Lagrangian of the system is described by

where TTT is the total kinetic energy of the system and VVV is the total potential energy of the system. Thus the Lagrangian is the difference between a system’s kinetic and potential energies.

The generalized forces QiQ_iQi​ are used to describe the nonconservative forces (e.g. friction) applied to a system with respect to the generalized coordinates. In this case, the generalized force acting on the rotary arm is

and acting on the pendulum is

​See Table A in the Appendix for a description of the corresponding Rotary Servo parameters (e.g., such as the back-emf constant, ). Our control variable is the input servo motor voltage, . Opposing the applied torque is the viscous friction torque, or viscous damping, corresponding to the term . Since the pendulum is not actuated, the only force acting on the link is the damping. The viscous damping coefficient of the pendulum is denoted by .

Once the kinetic and potential energy are obtained and the Lagrangian is found, then the task is to compute various derivatives to get the EOMs. After going through this process, the nonlinear equations of motion for the Rotary Pendulum are:

​​

The torque applied at the base of the rotary arm (i.e. at the load gear) is generated by the servo motor as described by the equation 7. Refer to Table A in the Appendix for the Rotary Servo parameters.

Linearization

Linearization of a nonlinear function about a selected point is obtained by retaining upto first order term in the Taylor Series expansion of the function about the selected point. For example, linearization of a two variable nonlinear function f(z) where

z=[z1z2]Tz = \begin {bmatrix} z_1 & z_2\end {bmatrix}^Tz=[z1​​z2​​]T

about the point

z0=[ab]Tz_0 = \begin {bmatrix} a & b\end {bmatrix}^Tz0​=[a​b​]T

can be written as

flin(z)=f(z0)+∂f(z)∂z1∣z=z0(z1−a)+∂f(z)∂z2∣z=z0(z2−b)f_{lin}(z) = f(z_0) + \frac{\partial f(z)}{\partial z_1}\Bigr|_{z = z_0} (z_1 - a)+\frac{\partial f(z)}{\partial z_2}\Bigr|_{z=z_0}(z_2 - b)flin​(z)=f(z0​)+∂z1​∂f(z)​​z=z0​​(z1​−a)+∂z2​∂f(z)​​z=z0​​(z2​−b)

​

Linearization of Inverted Pendulum Equations

The nonlinear equations of the inverted pendulum system obtained as Equations (7) and (8) are linearized about the equilibrium point with the pendulum in the upright position, i.e.,

θo=0\theta_o = 0θo​=0, αo=0\alpha_o = 0αo​=0, θ˙o=0\dot{\theta}_o = 0θ˙o​=0, α˙o=0\dot{\alpha}_o = 0α˙o​=0, θ¨o=0\ddot{\theta}_o = 0θ¨o​=0, α¨o=0\ddot{\alpha}_o = 0α¨o​=0

Linearization of Equation (7) about the above equilibrium state gives

(Jr+mpLr2)θ¨−12mpLpLrα¨=kVm−bθ˙−Brθ˙(10)(J_r + m_pL_r^2)\ddot{\theta} - \frac{1}{2}m_pL_pL_r\ddot{\alpha} = kV_m-b\dot{\theta} - B_r\dot{\theta} \quad\quad (10)(Jr​+mp​Lr2​)θ¨−21​mp​Lp​Lr​α¨=kVm​−bθ˙−Br​θ˙(10)

where, from Equation(9) the servo motor torque coefficient kkk is

k=ηgKgηmktRmk = \frac{\eta_gK_g\eta_mk_t}{R_m}k=Rm​ηg​Kg​ηm​kt​​

and the back emf coefficient bbb is

b=ηgKg2ηmktkmRmb = \frac{\eta_gK_g^2\eta_mk_tk_m}{R_m}b=Rm​ηg​Kg2​ηm​kt​km​​

Likewise, linearization of Equation (8) about the equilibrium point with the pendulum in the upright position gives

−12mpLpLrθ¨+(Jp+14mpLp2)α¨−12mpLpgα=−Bα˙(11)-\frac{1}{2}m_pL_pL_r\ddot{\theta} + (J_p + \frac{1}{4}m_pL_p^2)\ddot{\alpha} - \frac{1}{2}m_pL_pg\alpha= -B\dot{\alpha} \quad \quad (11)−21​mp​Lp​Lr​θ¨+(Jp​+41​mp​Lp2​)α¨−21​mp​Lp​gα=−Bα˙(11)

where ggg is the acceleration due to gravity. Note that the negative sign of the gravity torque (α\alphaα term) in Equation 11 indicates negative stiffness with the pendulum in the vertically upright position.

Equation (10) and (11) can be arranged in the matrix form as

[M][θ¨α¨]+[D][θ˙α˙]+[K][θα]=[k0]Vm(12)[M]\begin{bmatrix}\ddot{\theta} \\ \ddot{\alpha} \end{bmatrix} +[D] \begin{bmatrix}\dot{\theta} \\ \dot{\alpha} \end{bmatrix} + [K] \begin{bmatrix}\theta \\ \alpha \end{bmatrix} = \begin{bmatrix}k \\ 0 \end{bmatrix}V_m \quad \quad (12)[M][θ¨α¨​]+[D][θ˙α˙​]+[K][θα​]=[k0​]Vm​(12)

Where mass matrix MMM, damping matrix DDD, and the stiffness matrix KKK become

[M]=[(Jr+mpLr2)−12mpLpLr−12mpLpLr(Jp+14mpLp2)][M] = \begin{bmatrix} (J_r + m_pL_r^2) & -\frac{1}{2}m_pL_pL_r \\ -\frac{1}{2}m_pL_pL_r & (J_p + \frac{1}{4}m_pL_p^2) \end{bmatrix}[M]=[(Jr​+mp​Lr2​)−21​mp​Lp​Lr​​−21​mp​Lp​Lr​(Jp​+41​mp​Lp2​)​]
[D]=[b+Br00Bp][D] = \begin{bmatrix} b+B_r & 0 \\ 0 & B_p \end{bmatrix}[D]=[b+Br​0​0Bp​​]
[K]=[000−12mpLpg][K] = \begin{bmatrix} 0 & 0 \\ 0 & -\frac{1}{2}m_pL_pg \end{bmatrix}[K]=[00​0−21​mp​Lp​g​]

Defining the state vector xxx, output vector yyy and the control input uuu as

x=[θαθ˙α˙]T,y=[θα]T,u=Vmx = \begin{bmatrix} \theta & \alpha & \dot{\theta} & \dot{\alpha}\end{bmatrix}^T , \quad y = \begin{bmatrix} \theta & \alpha \end{bmatrix}^T, \quad u = V_mx=[θ​α​θ˙​α˙​]T,y=[θ​α​]T,u=Vm​

Equation (12) can be rewritten in state space form as

x˙=Ax+Bu(13)\dot{x} = Ax + Bu \quad \quad (13)x˙=Ax+Bu(13)
y=Cx+Du(14)y = Cx + Du \quad \quad (14)y=Cx+Du(14)

where the system state matrix AAA, control matrix BBB, output matrix CCCand the feedthrough of input to the output matrix DDD become

A=[O2×2I2×2−[M]−1[K]−[M]−1[D]]A = \begin{bmatrix} O_{2\times2} & I_{2\times2} \\ -[M]^{-1}[K] & -[M]^{-1}[D] \end{bmatrix} A=[O2×2​−[M]−1[K]​I2×2​−[M]−1[D]​]
B=[O2×1M−1[k0]]B = \begin{bmatrix} O_{2\times1} \\ M^{-1} \begin{bmatrix} k \\0 \end{bmatrix} \end{bmatrix}B=​O2×1​M−1[k0​]​​
C=[10000100]C = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \end{bmatrix}C=[10​01​00​00​]
D=[00]D = \begin{bmatrix} 0 \\ 0 \end{bmatrix}D=[00​]

In the equations above, note that O2×2O_{2\times2}O2×2​ is a 2×22 \times 22×2 matrix of zeros, O2×1O_{2\times1}O2×1​ is a 2×12 \times 12×1 matrix of zeros, and I2×2I_{2 \times 2} I2×2​ is a 2×22\times22×2 identity matrix. Using the parameters of the system listed in Table 2 and the appendix Table A, the linear model matricesAAA and BBB can be computed.

Analysis: Modeling

19KB
Rotary Inverted Pendulum Week 1.zip
archive
  1. Download the above zip file and extract it.

  2. Open rotpen_week1_student.mlx live script and run the Modelling section. It will automatically load the parameters required for the state-space representation, and subsequently generate the A, B, C and D matrices required for the upcoming analysis. Please refer to Table 2 and Table A for additional information regarding the parameters. Note: The representative C and D matrices have already been included. The actuator dynamics have been added to convert your state-space matrices to be in terms of voltage. Recall that the input of the state-space model is the torque acting at the servo load gear (i.e. the pivot of the pendulum). However, we control the servo input voltage instead of control torque directly. The script uses the voltage torque relationship given in Equation 9 to transform torque to voltage.

  3. Note down your state-space matrices for your report. Note: You may want to cross-check the state-space matrix with TAs before proceeding to balance control.

  4. Find the open-loop poles of the system. Hint: Use eig(A).

B. Balance Control

Specification

The control design and time-response requirements are: Specification 1: Damping ratio: 0.6 < ζ\zetaζ < 0.8 Specification 2: Natural frequency: 3.5 rad/s < < 4.5 rad/s Specification 3: Maximum pendulum angle deflection: ∣α∣|\alpha|∣α∣ < 15 deg. Specification 4: Maximum control effort / voltage: < 10 V. The necessary closed-loop poles are found from specifications 1 and 2. The pendulum deflection and control effort requirements (i.e. specifications 3 and 4) are to be satisfied when the rotary arm is tracking a ±20\pm 20±20 degree angle square wave.

Stability

The stability of a system can be determined from its poles ([2]):

  • Stable systems have poles only in the left-hand plane.

  • Unstable systems have at least one pole in the righthand plane and/or poles of multiplicity greater than 1 on the imaginary axis.

  • Marginally stable systems have one pole on the imaginary axis and the other poles in the left-hand plane.

The poles are the roots of the system’s characteristic equation. From the state-space, the characteristic equation of the system can be found using where det()\mathrm{det}()det()is the determinant function, sss is the Laplace operator, and III the identity matrix. These are the eigenvalues of the state-space matrix AAA.

Controllability

If the control input uuu of a system can take each state variable, xix_ixi​ where i=1...ni = 1 ... ni=1...n, from an initial state to a final state in finite time then the system is controllable, otherwise it is uncontrollable ([2]).

Rank Test The system is controllable if the rank of its controllability matrix

equals the number of states in the system,

Companion Matrix

If (A,B) are controllable and B is n×1, then A is similar to a companion matrix ([1]). Let the characteristic equation of A be Then the companion matrices of A and B are

and

Define where TTT is the controllability matrix defined in Equation 16 and Then and

Pole Placement Theory

If (A,B)(A,B)(A,B) are controllable, then pole placement can be used to design the controller. Given the control law u=−Kxu = -Kxu=−Kx, the state-space model of Equation (13) becomes

We can generalize the procedure to design a gain KKK for a controllable (A,B)(A,B)(A,B) system as follows:

Step 1 Find the companion matrices A~\tilde{A}A~ and B~\tilde{B}B~. Compute W=TT~−1W = T\tilde{T}^{-1}W=TT~−1. Step 2 Compute K~\tilde{K}K~ to assign the poles of A~−B~K~\tilde{A} - \tilde{B}\tilde{K}A~−B~K~ to the desired locations.

Step 3 Find K=K~W−1K = \tilde{K}W^{-1}K=K~W−1 to get the feedback gain for the original system (A,B)(A,B)(A,B). Remark-1: It is important to do the K~→K\tilde{K} \rightarrow KK~→K conversion. Remember that (A,B)(A,B)(A,B) represents the actual system while the companion matrices A~\tilde{A}A~ and B~\tilde{B}B~ do not.

Remark-2: The entire control design procedure using the pole placement method can be simply done in MATLAB using the function called 'place' or 'acker'. For a selected desired set of closed loop poles DP, the full state feedback gain matrix KKK is obtained from

>> K = acker(A,B,DP);

Desired Poles

The rotary inverted pendulum system has four poles. As depicted in Figure 3, poles p1p_1p1​ and p2p_2p2​ are the complex conjugate dominant poles and are chosen to satisfy the natural frequency, ωn\omega_nωn​, and damping ratio, ζ\zetaζ, as given in Specification. Let the conjugate poles be and where​ σ=ζωn\sigma = \zeta\omega_nσ=ζωn​ and ωd=ωn1−ζ2\omega_d = \omega_n \sqrt{1-\zeta^2}ωd​=ωn​1−ζ2​ is the damped natural frequency. The remaining closed-loop poles, p3p_3p3​ and p4p_4p4​, are placed along the real-axis to the left of the dominant poles, as shown in Figure 3.

Figure 3 Desired closed-loop pole locations

Simulation Model with Feedback

The feedback control loop that balances the rotary pendulum is illustrated in Figure 4. The reference state is defined as where θd\theta_dθd​ is the desired rotary arm angle. The controller is Note that if xd=0x_d = 0xd​=0 then u=−Kxu = -Kxu=−Kx, which is the control used in the pole-placement algorithm.

Figure 4 State-feedback control loop

B.1 Experiment: Designing the Balance Control

  1. Select ζ\zetaζ and ωn\omega_nωn​ such that they satisfy the given design specifications.

  2. In the same rotpen_week1_student.mlx live script, go to the Balance Control section. Enter the chosen zeta and omega_n values.

  3. Determine the locations of the two dominant poles p1p_1p1​ and p2p_2p2​ based on the specifications and enter their values in the MATLAB live script. Ensure that the other poles are placed at p3 = -30 and p4 = -40. Hint: Use Equation 27.

  4. Find gain K using a predefined Compensator Design MATLAB command K = acker(A,B,DP), which is based on pole-placement design. Note: DP is a row vector of the desired poles found in Step 3.

For sanity check, if you use damping ratio of 0.7 and natural frequency of 4 rad/s, you should get around K = [-12 63 -5.5 7].

B.2 Experiment: Simulating the Balance Control

The s_rotpen_bal SIMULINK diagram shown in Figure 5 is used to simulate the closed-loop response of the Rotary Pendulum using the state-feedback control described in Balance Control with the control gain K found above. The Signal Generator block generates a 0.1 Hz square wave (with an amplitude of 1). The Amplitude (deg) gain block is used to change the desired rotary arm position. The state-feedback gain K is set in the Control Gain gain block and is read from the MATLAB workspace. The SIMULINK State-Space block reads the A, B, C, and D state-space matrices that are loaded in the MATLAB workspace. The Find State X block contains high-pass filters to find the velocity of the rotary arm and pendulum.

Figure 5: s_rotpen_bal SIMULINK diagram used to simulate the state-feedback control
  1. Run rotpen_week1_student.mlx live script. Ensure the gain K you found is loaded in the workspace (type K matrix in the command window).

  2. Open and run the s_rotpen_bal.mdl for 10 seconds. The responses in the scopes shown in Figure 6 were generated using an arbitrary feedback control gain. Note: When the simulation stops, the last 10 seconds of data is automatically saved in the MATLAB workspace to the variables data_theta, data_alpha, and data_Vm.

    Figure 6: Balance control simulation
  3. Save the data corresponding to the simulated response of the rotary arm, pendulum, and motor input voltage obtained using your obtained gain K. Note: The time is stored in the data_theta(:,1) vector, the desired and measured rotary arm angles are saved in the data_theta(:,2) and data_theta(:,3) arrays. Similarly, the pendulum angle is stored in the data_alpha(:,2) vector, and the control input is in the data_Vm(:,2) structure.

  4. Measure the pendulum deflection and voltage used. Are the specifications given satisfied?

Results for Report

A) Modeling

  1. The linear state-space representation of the rotary inverted pendulum system, i.e., AAA, BBB, CCC and DDD matrices (numerical values).

  2. Open-loop poles of the system.

B.1) Balance Control Design

  1. Chosen ζ\zetaζ and ωn\omega_nωn​ based on design specifications.

  2. Corresponding locations of the two dominant poles p1p_1p1​ and p2p_2p2​.

  3. Gain vector KKK.

B.2) Balance Control Simulation

  1. Plots of the commanded position of the rotary arm (θc\theta_cθc​), simulated responses of the rotary arm (θ\thetaθ), pendulum (α\alphaα), and motor input voltage (VmV_mVm​) obtained using your obtained gain K.

  2. Are Design Specifications 3 and 4 satisfied? Justify using the measured maximum pendulum deflection and motor input voltage values.

Questions for Report

B.1) Balance Control Design

  1. Based on your open-loop poles found in Result A.2, is the system stable, marginally stable, or unstable? Did you expect the stability of the inverted pendulum to be as what was determined?

  2. Determine the controllability matrix TTT of the system. Is the inverted pendulum system controllable? Hint: Use Equation 17.

  3. Using the open-loop poles, find the characteristic equation of AAA. Hint: The roots of the characteristic equation are the open-­loop poles.

    Instead of using det(sI−A)=0\mathrm{det}(sI - A) = 0 det(sI−A)=0, characteristic polynomials can also be found using MATLAB function poly.

  4. Find the corresponding companion matrices A~\tilde{A}A~ and B~\tilde{B}B~ . Hint: For A~\tilde{A}A~ , use the characteristic equation of A found in Question B.3 and Equation 19. For B~\tilde{B}B~, use Equation 20.

  5. Determine the controllability matrix T~\tilde{T}T~ of the companion system.

  6. Determine the transformation matrix WWW.

  7. Check if A~=W−1AW\tilde{A} = W^{-1}AWA~=W−1AW and B~=W−1B\tilde{B} = W^{-1}BB~=W−1B with the obtained matrices.

  8. Using the locations of the two dominant poles, p1p_1p1​ and p2p_2p2​, based on the specifications (Result B.1), and the other poles at p3=−30p_3 = -30p3​=−30 and p4=−40p_4 = -40p4​=−40, determine the desired closed-loop characteristic equation. Hint: The roots of the closed-loop characteristic equation are the closed-­loop poles.

  9. When applying the control u=−K~xu = -\tilde{K}xu=−K~x to the companion form, it changes (A~,B~)(\tilde{A}, \tilde{B})(A~,B~) to (A~−B~K~,B~)(\tilde{A}-\tilde{B}\tilde{K}, \tilde{B})(A~−B~K~,B~). Find the gain K~\tilde{K}K~ that assigns the poles to their new desired location. Hint: Use Equation 26 and find the corresponding characteristic equation. Compare this equation with the desired closed-loop characteristic equation found in Question B.5 to determine the gain vector K~\tilde{K}K~.

  10. Once you have found K~\tilde{K}K~, find KKK using Step 3 in Pole Placement Theory.

  11. Compare the gain vector KKKcalculated using Pole Placement Theory (Question B.1.10) with the gain vector KKK obtained using MATLAB (Result B.1.3).

Appendix

Table A Main Rotary Servo Base Unit Specifications

Motor nominal input voltage

6.0 V

Motor armature resistance

2.6 Ω ± 12%

Motor armature inductance

0.18 mH

Motor current-torque constant

7.68 × 10−3 N-m/A ± 12%

Motor back-emf constant

7.68 × 10−3 V/(rad/s) ± 12%

High-gear total gear ratio

70

Motor efficiency

0.69 ± 5%

Gearbox efficiency

0.90 ± 10%

rotor Rotor moment of inertia

3.90 × 10−7 kg-m2 ± 10%

High-gear equivalent moment of inertia without external load

1.823 × 10−3 kg-m2

High-gear Equivalent viscous damping coefficient

0.015 N-m/(rad/s)

Mass of bar load

0.038 kg

Length of bar load

0.1525 m

Mass of disc load

0.04 kg

Radius of disc load

0.05 m

Maximum load mass

5 kg

Maximum input voltage frequency

50 Hz

Maximum input current

1 A

Maximum motor speed

628.3 rad/s

Reference

[1] Bruce Francis. Ece1619 linear systems, 2001. [2] Norman S. Nise. Control Systems Engineering. John Wiley & Sons, Inc., 2008.

kg\mathrm{kg}kg
m\rm{m}m
m\rm{m}m
kg⋅m2\rm{kg \cdot m^2}kg⋅m2
N⋅m⋅s/rad\rm{N\cdot m\cdot s/rad}N⋅m⋅s/rad
kg\rm{kg}kg
m\rm{m}m
m\rm{m}m
kg⋅m2\rm{kg \cdot m^2}kg⋅m2
N⋅m⋅s/rad\rm{N\cdot m\cdot s/rad}N⋅m⋅s/rad
kg⋅m2\rm{kg\cdot m^2}kg⋅m2
counts/rev\rm{counts/rev}counts/rev
VnomV_{\rm{nom}}Vnom​