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 Modeling Using First-Principles and its and 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 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.
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:
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 Rotary Servo Base Unit User Manual 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:
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 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 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
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.
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:
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
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.
Download the Modeling_files.zip and extract the files to desktop.
Open q_servo_modeling.m
SIMULINK file.
Double click on the "Rotary Servo Interface - Speed" subsystem to access the DAQ configuration
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).
Open setup_servo_modeling.m
file to open the setup script for the q_servo_modeling SIMULINK model.
Run the script. Note: The calculated servo model parameter are default model parameters and do not accurately represent the Rotary Servo Base Unit system.
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.
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:
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
Set the Amplitude (V) slider gain to 0.
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.
Set the Simulation stop time to 5 seconds.
Open the load shaft speed scope, Speed (rad/s), and the motor input voltage scope, Vm (V) .
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).
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 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 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 under the 'Frequency Response Experiment' section.
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:
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
Set the Amplitude (V)
slider gain to 2.0 V.
Set the Offset (V)
block to 0 V.
Set the Simulation stop time to 5 seconds.
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).
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.
Calculate the gain of the system (in both linear and dB units) and enter the results in Table B.1.
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.
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:
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
Set the Amplitude (V)
gain block to 1.0 V.
Set the Offset (V)
gain block to 2.0 V.
Set the Simulation stop time to 5 seconds.
Open the load shaft speed scope, Speed (rad/s)
, and the motor input voltage cope,
Vm (V)
.
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).
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 Results section.
Click the Stop button on the SIMULINK diagram toolbar (or select QUARC | Stop from the menu) to stop the 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:
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
Set the Amplitude (V)
slider gain to 1.0 V.
Set the Offset (V)
block to 1.5 V.
Set the Simulation stop time to 5 seconds.
Open the load shaft speed scope, Speed (rad/s)
, and the motor input voltage scope, V_m (V)
.
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.
Notice that the model response does not match with the measured response.
Calculate the nominal values, and , using Eqs. 2.1, 2.26, 2.27, 2.28 and the specifications provided in Table A.1 and Table A.2 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.
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.
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.
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.
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 Table B.2.
Hint: May use the Data Tips tool to obtain values from the MATLAB Figure.
Include the labelled Bode plot along with tabulated values of Table B.1 in the report.
Plot the maximum load speed response (saved in the MATLAB workspace under the wl
variable) from Step 9 in MATLAB.
Find the steady-state gain using the measured step response (Result B.1) and enter it in Table B.2 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 Table B.2 under the 'Step Response Experiment' section. Show the calculations in the report.
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?
From the plots, describe how the gain and time constant affect the system's response.
Include the completed Table B.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).
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 .
Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .
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 .
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 .