AE4610
  • Welcome
  • Experiments
  • Lab 0: MATLAB & SIMULINK
  • Lab 1: Rotary Servo Base
    • A. Integration (Week 1)
    • B. Modeling (Week 1)
    • C. Control Design (Week 2)
    • D. Controller Implementation & Evaluation (Week 3)
  • Lab 2: 3 DOF Gyroscope
    • A & B. Modeling and Control Design (Week 1)
    • C. Controller Implementation (Week 2)
  • Lab 3: Rotary Flexible Link
    • A. System Identification (Week 1)
    • B & C. Control Design and Controller Implementation (Week 2)
  • Lab 4: Rotary Inverted Pendulum
    • A & B. Modeling and Balance Control
    • C. Swing-up Control (Demo)
  • Final Project
  • Archive
    • Old Lab 1 Model Validation
    • Problem Set
    • DC Motor
    • Lab 1: Rotary Servo Base (Older Version)
      • A. Integration (Week 1)
      • B. Modelling (Week 1)
      • C. Position Control (Week 2)
    • Quadcopter
    • Gyroscope
    • Inverted Pendulum
    • 3DOF Helicopter
    • Torsional Pendulum
    • Aero LQR
      • A. System Identification
      • A. System Identification (Week 1) last check
      • B. Control Design & Implementation (Week 2)
    • Rotary Gyro
      • Rotary Gyro
    • 2 DOF AERO
      • A. System Identification
      • B. Control Design
      • C. Controller Implementation
    • Copy of Lab 4: Rotary Inverted Pendulum
      • Week 1
      • Week 2
Powered by GitBook
On this page
  • 1. Modeling Using First-Principles
  • a) Electrical Equations
  • b) Mechanical Equations
  • c) Combining the Electrical and Mechanical Equations
  • 2. Modeling Using Experiments
  • a) Frequency Response
  • b) Bump Test / Unit Step Input Test
  • Experimental Setup
  • Frequency Response Experiment
  • a) Steady-state gain
  • b) Gain at varying frequencies
  • Step Response Experiment
  • Model Validation Experiment
  • 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
  • (B) Step Response Experiment
  • (C) Model Validation Experiment
  • (D) Additional Results
  • Appendix
  • Table A.1 Main Rotary Servo Base Unit Specifications
  • Table A.2 Rotary Servo Base Unit Gearhead Specifications

Was this helpful?

Export as PDF
  1. Lab 1: Rotary Servo Base

B. Modeling (Week 1)

PreviousA. Integration (Week 1)NextC. Control Design (Week 2)

Last updated 3 months ago

Was this helpful?

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 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. 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. Modeling Using First-Principles

a) Electrical Equations

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

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)
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)
τ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.

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) in dB. 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.

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)

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)

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 2π×352\pi \times35 2π×35 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 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. 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. 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).

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. 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).

Step Response Experiment

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. 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).

  7. 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 τ\tauτ 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. 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.

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

  8. Enter the nominal values, KKK and τ\tauτ , 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.

  9. 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 KKK and τ\tauτ 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 KKK and τ\tauτ 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

(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.

(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. 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

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 for more details) is represented by the N1N_1N1​ and N2N_2N2​ gears in Figure 7 and has a gear ratio of

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 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:

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.

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

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. 20log⁡10(Gain)20\log_{10}(\text{Gain})20log10​(Gain), 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.

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

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 .

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 .

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 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.

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

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.

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.

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

Calculate the nominal values, KKK and τ\tauτ , 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 KKK and τ\tauτ. You may also refer to the lecture slides.

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 τe,f\tau_{e,f}τe,f​ (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.

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.

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.

Include the completed .

Rotary Servo Base Unit User Manual
Rotary Servo Base Unit User Manual
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
Modeling Using First-Principles
Modeling Using Experiment
32KB
Modeling_files.zip
archive
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 τ\tauτ = 0.1Save wl data and name it something like modeling_section#_Group#_K1tau01.