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...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
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.
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
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.
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.
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
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
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
Rearranging the filter transfer function above,
we can represent the filtering using the differential equation
Follow the steps and build the SIMULINK model below:
Follow these steps to read the motor velocity:
First, download and open q_servo_vel_direct.slx Simulink model.
Configure the model to apply a 0.4 Hz square wave voltage signal going between 0.5V and 2.5V.
Change the simulation time to 5 seconds from Simulation tab, stop time.
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).
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.
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.
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.
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).
Response plots from Step 7.
Response plots from Step 8.
Response plots with and without encoder wrapping from Step 9.
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?
Completed SIMULINK block diagram with low-pass filter from Step 10.
Response plots from Step 10.
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.
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.
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
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.
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.
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, next click the Connect button, also under Monitor & Tune and then run SIMULINK by clicking Start .
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.
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.
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.
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.
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.
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.
Welcome to the first hands-on experiment!
The objective of this part of the DC motor experiment is to implement the controller designed in part B and evaluate its performance.
The following is a list of the required equipment to perform this experiment:
Open q_servo_pos_cntrl.slx
file. Do not change anything except the PID gains.
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.
Check that the sampling time is set to 0.002 s (located under “Modeling” -> “Model Settings” -> “Solver Details”).
Turn on the power amplifier.
Open the position scope.
Save your data. No need to Build again unless you change any blocks or configuration settings in the model.
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).
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
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 .
Change the sampling time back to 0.002 sec (“Modeling” -> “Model Settings” -> “Solver Details”).
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.
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.
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")
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.
What is the effect of proportional controller gain on closed-loop system behaviour?
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.
What is the effect of derivative controller gain on closed-loop system behaviour?
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.
Plot angle or rotary position (commanded and experimental) and control input Vm from Step 1.11.
What is the effect of sampling time on closed-loop system behaviour?
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")
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.
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.
Mention the final PID gains after tuning.
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.
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.
let , DC gain of the motor.
Since , where is the angular position of the motor, the transfer function from the applied voltage to the motor angular position is
The block diagram of a DC motor with a proportional controller is shown in Fig.1. In this case, the controller transfer function () is a simple gain . From Fig. 1, 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.
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 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.
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.
From Fig. 3, 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.
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, , 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 . If the amplified voltage, , 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 . Therefore, the input voltage 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}
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.
The closed-loop DC motor system must meet the following specifications.
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.)
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.)
Zero steady-state error to both step and ramp commands.
Save root locus open-loop Bode, closed-loop bode and step response plots 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.
Only for controlSystemDesigner or rltool only, you may use the Snipping tool and save the figures in a Word document.
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:
Using the model, i.e., K and tau values, you have obtained from the Modeling - Model Validation, input the transfer function (Equation 3.1) into MATLAB. Use K and tau from the model validation values.
First consider a proportional controller, i.e., C = Kp
. Input C = 1
into MATLAB.
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.
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.
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 the bandwidth is more than 25 rad/sec. Save the root locus, open and closed-loop Bode, time response plot and P gain.
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.
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 – , , ).
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)
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.
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.
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.
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.
Root locus plot
Open-loop Bode plot
Closed-loop Bode plot
Time response plot
P (proportional) gain
Root locus plot
Open-loop Bode plot
Closed-loop Bode plot
Time response plot
PD (proportional and derivative) gains
Root locus plot
Open-loop Bode plot
Closed-loop Bode plot
Time response plot
PID (proportional, derivative and integral) gain values (mention if the gains are the same values or readjusted values from Step 8)
Closed-loop transfer function
Poles of the closed-loop system
Natural frequency of the closed-loop system dominant poles
Damping of the closed-loop system dominant poles
PID controller SIMULINK block diagram (image)
Plots comparing the ramp responses of PD and PID controllers (on the same figure)
Plots comparing the error variable of PD and PID controllers (on the same figure)
What is the difference between Fig. 2 and the control structure screenshot that you saved in Step 6? Hint: Focus on where is located in the control loop and what it is multiplied by.
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., 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:
Step responses (two plots on the same figure)
Ramp responses (two plots on the same figure)
Derivative of error signal and speed value in one figure for the step input from both models
Derivative of error signal and speed value in one figure for the ramp input from both models
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:
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:
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
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).
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).
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).
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.
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.
Plot the maximum load speed response (saved in the MATLAB workspace under the wl
variable) from Step 9 in MATLAB.
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.
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).
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.
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.
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.
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:
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
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.
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.
Open the script gyro_sim_week1.mlx and run the first section to initialize symbolic system parameters.
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.
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 .
Select a nominal value for the inner loop rate feedback gain , for example
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.
Initialize C = 1, then open controlSystemDesigner(G,C) in MATLAB.
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:
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.
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.
Save the controlSystemDesigner window plots, and your final gains Note: Check your final gains with your TA before proceeding.
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.
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.
Run the Simulink diagram for a reference angle of . This can be accomplished in one of two ways:
Provide a step input of an initial value of 0 and a final value of 10. This will generate a step input of .
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.
Verify if the Simulink diagram output is similar to the controlSystemDesigner step-input plot.
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.
General principle used to obtain equations of motion for the gyroscope.
The three time-domain linearized equations of motion for the experiment.
(both symbolic and numerical forms).
(both symbolic and numerical forms).
Brief description of control design objective.
The closed-loop transfer function for using rate feedback.
, the transfer function from to (both symbolic and numerical forms).
Gain values from controlSystemDesigner (Step 10).
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).
Simulink model (Step 12).
Simulink response plots (to be generated using MATLAB, not Scope).
Validation of control design specifications being met or not.
Final tuned gain values from Simulink (Step 15).
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.
Briefly explain the need for the inner loop rate () feedback.
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
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.
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
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
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
equals the number of states of the system,
Assuming the time-domain design specifications are
Then one can use the Bryson’s rule to choose the weighting matrices as
In our case,
The reference state is defined as
and the controller is
Note: The results from the following steps have to be included in the Analysis section of the report.
>> [K,S,E] = lqr(A,B,Q,R);
Using Figure 1 as a guide, develop a Simulink model of the system.
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)
Check if all the given specifications are met.
Check your plots with the TA.
Check if the specifications are met (no need to tune Q and R matrices.)
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.
Turn the amplifier power on.
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.
Align the flexible link along the 0 mark on the servo stand.
Double click on the scopes and open them.
Ensure that the manual switch is connected to the full state feedback.
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.
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.
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.
Turn the power off.
Results
Include the results from the controller design procedure Steps 1-6.
Questions
>> 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.
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.
Results
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.
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
Explain why the link deflection angle goes opposite to servo rotation initially.
For a controllable system, can partial state feedback guarantee stability like full state feedback? Briefly explain.
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.
1. Orient the gyroscope discs as shown:
2. Make sure the pitch axis/red gimbal is locked.
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.
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.
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.
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.
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.
Briefly describe the controller implementation experiments.
Explain the behavior of the gray axis as you disturb it.
Plot motor 2 current simulated and experimental responses on the same axes.
Explain any differences between simulated and experimental responses.
Plot motor 2 current.
Plot motor 2 current.
Which axis of the setup is fixed to the spacecraft?
Using the gyroscopic principle, what changes would you make to the gyroscope system for measuring yaw rate of the spacecraft?
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.
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.
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.
where the various constants are SRV02 parameters which are mentioned in Table 2.
Table 2. Setup Parameters
The characteristic polynomial for a second-order system is:
The damping ratio of this second-order system can be found from its response (underdamped system) using the logarithmic decrement given by
The period of oscillation in a system response can be found using the equation
From this, the damped natural frequency (in rad/s) is
and the natural frequency is
Mount the flexible link onto the calibration bench.
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.
Open the scope alpha.
Turn on the power supply.
Check you have good data and save the link deflection angle data for the free oscillation using the filename FreeOsc_1 to your folder.
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.
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.
Compute the mass moment of inertia of the link using the equation in Table 2.
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
The general solution to Eq. (1.15) can be obtained using separation of variables, as in Eq. (1.17) below.
Equation (1.18) can be rewritten as
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
Hence, Eq. (1.22) becomes
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
or
The mode shapes of a uniform cantilever beam are shown in Fig. 7.
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.
Mount the flexible link onto the rotary servo base.
Download and open FlexLink_ExciteMode.mdl
Open the scope alpha.
Turn on the power supply.
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.
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.
Save the data using the format Osc_ChirpSignal into your folder.
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.
Using Eqn. 1.26 and the values of necessary system parameters, calculate the first and second modal frequencies.
Analytical expressions for the mode shapes are given in Eq 1.25.
Open the FlexLink_ExciteMode.mdl Simulink file used in part 2.
Open the scope alpha.
Turn on the power supply.
Connect the manual switch to the Sine wave signal input. This signal will provide a sinusoidal signal of fixed amplitude and fixed frequency.
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.
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).
Observe the corresponding mode in the link and note down the number of nodes and their locations with respect to length of the link.
Save the data using the file name Osc_Sineinput into your folder. This is the result for the first modal frequency.
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).
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.
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.
Equations for time period of oscillation, damped frequency, undamped frequency, damping ratio, stiffness, and viscous damping coefficient.
Plot of measured angular deflection of the link vs. time
Fast Fourier Transform (FFT) plot of link deflection with dominant frequencies and their magnitudes identified (either marked on the plot or mentioned in writing).
Calculation of mass per unit length of the link
Calculations and values for the theoretical first and second modal frequencies (calculated using Eqn. 1.26).
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.
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.
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)
Number of nodes and their locations for each mode (theoretical and experimental). Use Table B.2 to document the values.
Comparison of experimental and theoretical mode shapes/node locations and state the reason(s) for why they differ.
Compare the damped and undamped frequencies of the link and report your observation. What does this signify with respect to the flexible link damping?
The following code performs FFT analysis on the flexible link angle response
The objectives of this laboratory experiment are as follows:
Obtain the linear state-space representation of the rotary pendulum system.
Design a controller that balances the pendulum in its upright position using Pole Placement.
Simulate the closed-loop system to ensure the given specifications are met.
Implement the balance controller on the Quanser Rotary Pendulum system and evaluate its performance.
This experiment involves modeling of the rotary inverted pendulum.
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.
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:
With the generalized coordinates defined, the Euler-Lagrange equations for the rotary pendulum system are
The Lagrangian of the system is described by
and acting on the pendulum is
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:
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
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
Likewise, linearization of Equation (8) about the equilibrium point with the pendulum in the upright position gives
Equations (10) and (11) can be arranged in the matrix form as
Equation (12) can be rewritten in state space form as
Download the Part 1.zip file and extract the folder contents.
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.
Find the open-loop poles of the system.
Hint: Use eig(A).
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
Rank Test The system is controllable if the rank of its controllability matrix
equals the number of states in the system, i.e.
For a controllable system with nxn system matrix A and nx1 control matrix B. The companion matrices of A and B are
and
Now define W,
Then
and
and
The feedback control loop that balances the rotary pendulum is illustrated in Figure 4. The reference state is defined as
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
In the same rotpen_part1_student.mlx live script, go to the Balance Control section. Enter the chosen zeta
and omega_n
values.
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].
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).
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
.
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.
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.
Download the Part 2.zip file, extract the folder contents and open the part2setup.m script.
Open the q_rotpen_bal_student SIMULINK diagram.
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.
Turn ON the power amplifier.
Ensure the pendulum is in the hanging down position, with the rotary arm aligned with the 0 marking, and is motionless.
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.
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.
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.
Open-loop poles of the system.
Did you expect the stability of the inverted pendulum to be as what was determined? Justify.
For the questions below, calculations and intermediate steps must be shown.
[1] Norman S. Nise. Control Systems Engineering. John Wiley & Sons, Inc., 2008.
[2] Bruce Francis. Ece1619 linear systems, 2001.
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 .
To build the model, click down arrow on Monitor & Tune under Hardware tab and then Build for monitoring .
Press Connect button under Monitor & Tune and then press Start . Run the experiment for 5 seconds.
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.
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.
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.
Recall that the transfer function of the motor from to in is approximated as
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 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 and . 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 ).
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 1% of ). 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 form. This should give you value of . To put it in the compensator the zero locations are -1/A and -1/B.
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.
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
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 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. , 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, 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.
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.
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 .
Assuming the viscous damping of the link is negligible, i.e. = 0 and substituting the torque using the expression,
with and, where
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
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.
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 ).
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 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):
Obtain the and matrices of the system using the parameters from Part A: System identification. Check your A and B matrices with the TA.
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).
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
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.
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.
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 .
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.
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.
Record (and plot for lab report) the servo angle () link angle () and voltage input
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
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.
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.
3. Make sure the gray frame and blue gimbal ( and respectively) are unlocked.
7. Set the and values to those found in Week 1 Part B.
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.
Plot commanded and response plots on the same axes.
Plot response.
Plot motor 2 current ( gimbal control current).
Plot commanded, simulated, and experimental plots on the same axes.
Plot simulated and experimental responses on the same axes.
Plot commanded and response plots on the same axes.
Plot response.
Plot commanded and response plots on the same axes.
Plot response.
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.
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 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
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 .
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).
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.
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.
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
where is the time of the peak is the time of the first peak, and is the number of peaks considered.
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.
Press Connect button under Monitor & Tune and hold on to the base to prevent any rotation at the root.
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.
From the peaks selected, determine the logarithmic decrement (Eq 1.10) and the time period (Eq 1.12).
Average the logarithmic decrement and the time period for the three sets of data to get single values of and .
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.
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
Substituting (1.17) in (1.15), setting and rearranging gives
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.
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
On further substitution of the natural boundary conditions at in the derivatives of Eq. (1.24) yields
Since , the modal frequencies are given by
is mass per unit length
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.
Press the Connect button under Monitor & Tune and click on Start . Run the servo motor with the chirp input voltage for 60 seconds.
Using the system parameters provided in Table 2, determine the mass per unit length of the beam .
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.
Press Connect button under Monitor & Tune and Press Start . Run the servo motor with the sine wave for at least 20 seconds.
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 .
Values of logarithmic decrement and time period for each data set, along with corresponding average values. Use table B.1 to document these values.
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 .
Calculation of mass moment of inertia of the link ()
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.
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
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
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 .
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.
, , , , ,
where, from Equation(9) the servo motor torque coefficient is
and the back emf coefficient is
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.
Where mass matrix , damping matrix , and the stiffness matrix become
Defining the state vector , output vector and the control input 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.
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.
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.
where is the determinant of a matrix, is the Laplace operator, and is the identity matrix. These are the eigenvalues of the system matrix .
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]).
Where are the coefficients of the characteristic equation of the system matrix A written as
where is the controllability matrix defined in Equation 16 and
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
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
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.
where is the desired rotary arm angle. The controller is
Note that if then , which is the control used in the pole-placement algorithm.
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.
Select and from the table below. Ensure to choose a different set of values from your groupmates
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.
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.
Measure the pendulum deflection and voltage used. Are the given satisfied?
Go to the 'Balance Control' section and put the gain K you found in . Run the script.
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.
Press Connect button under Monitor & Tune and Press Start .
The linear state-space representation of the rotary inverted pendulum system, i.e., , , and matrices (numerical values).
Chosen and based on design specifications.
Corresponding locations of the two dominant poles and .
Gain vector .
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.
Are satisfied? Justify using the measured maximum pendulum deflection and motor input voltage values.
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.
Are satisfied? Justify using the measured maximum pendulum deflection and motor input voltage values.
Based on your open-loop poles found in , is the system stable, marginally stable, or unstable?
Determine the controllability matrix of the system. Is the inverted pendulum system controllable? Hint: Use Equation 17.
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 .
Find the corresponding companion matrices and . Hint: For , use the characteristic equation of A found in and Equation 19. For , use Equation 20.
Determine the controllability matrix of the companion system.
Determine the transformation matrix .
Check if and with the obtained matrices.
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.
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 .
Once you have found , find using .
Compare the gain vector calculated using Pole Placement Theory () with the gain vector obtained using MATLAB ().
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
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 flexible link
Length of flexible link
Width or breadth of flexible link
Thickness of flexible link
Young’s modulus of flexible link
Area moment of inertia of link cross-section
High-gear viscous damping coefficient of SRV02
Equivalent high-gear moment of inertia of SRV02 (no load)
Motor armature resistance
Motor torque constant
Motor efficiency
Back-emf constant
High-gear total gearbox ratio
Gearbox efficiency
Viscous damping coefficient of flexible link
Determined from experiment
To be calculated
Stiffness of flexible link
Determined from experiment
To be calculated
Number of peaks selected (n)
First
1
First
...
First
Second
1
Second
...
Second
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 coefficient 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 coefficient as seen at the pivot axis
0.0024
Rotary arm moment of inertia about pivot
0.0020
Pendulum encoder resolution
4096
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
This page details information about the AE 4610 Final Project
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:
System dynamics modeling
Simulation
Controller design and implementation
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
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!!!
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
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.
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.
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.
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:
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.
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
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 !!
Arduino Uno Rev3 SMD
Arduino Nano 33 IOT
Arduino Due
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
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)
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
Digital multimeters
General tools
General electronics tools
Heat shrink and heat gun
Adhesives (JB Weld, Kwikweld, Super Glue, Wood Glue, All-Purpose Glue)
Tape (Gorilla, Duct, Scotch, Packaging, Aluminum HVAC, Masking, Painters, Electrical)
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.
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.
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.
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:
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.
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
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.
The power delivered to the shaft is
The transfer function for the DC motor as derived in (2.7) and as shown in Fig. 2.3 is
where
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
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.
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.
Open the scope Theta_dot.
Turn on the power supply.
For the braked position of the magnetic brake (1 position), choose 3 different input voltages (< 5 volts).
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.
Repeat steps 8, 9 for all the three step inputs.
Run the motor for 10 seconds for sinusoidal voltage input. Select the amplitude (< 5 volts) and frequency (< 5 rad/s). Save the data.
Data will be uploaded on Canvas by the TA. DO NOT DELETE THE SIMULINK MODEL. Close Simulink and DO NOT SAVE.
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.
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.
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.
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).
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.
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.
Comparing the above transfer function to the standard form for a second-order system, i.e.,
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.
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.
The closed-loop DC motor system must meet the following specifications.
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.)
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.)
Zero steady-state error to both step and ramp commands.
First consider a proportional controller, i.e., C = Kp
. Input C = 1
into MATLAB.
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.
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.
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.
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.
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.
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.
The objective of this part of the DC motor experiment is to implement the controller designed in part B and evaluate its performance.
The following is a list of the required equipment to perform this experiment:
With the help of the TA, check and ensure that the Quanser QUARC software is linked to MATLAB.
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.
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.
Open the scope Theta.
Turn on the power supply.
Save your data.
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.
Repeat Step 1 with the magnetic brake set in other positions (position 0 or 2). Save the data (i.e. filename “dccloopoffdesign”).
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”).
Email the data to yourself and delete the data files. DO NOT DELETE THE SIMULINK MODEL. Close Simulink and DO NOT SAVE.
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.
Compare the simulation results for the nominal case with the experimental results for the off-design case and explain any differences.
Run simulations with the zero-order hold set to 0.01 sec and 0.1 sec and save simulation outputs.
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.
Compare the simulation output with a zero-order hold of 0.1 sec to the slow sampling experimental results and explain any differences.
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
The longitudinal dynamic model of a Boeing 747 aircraft flying at a speed 870 ft/s is obtained as
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)
(ii) Obtain the transfer function between the pitch attitude and the elevator control input. (2 points)
(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)
(iv) Compute the damping ratios, natural frequencies, damped frequencies and time periods of the individual modes. (2 points)
(v) Using the transfer function of part (ii), obtain frequency response plots (Bode plots). (1 point)
(vi) Plot the pitch attitude and pitch rate responses to a step elevator input of 0.02 rad. (2 points)
Consider the following block diagram of a feedback control system:
Given
design a lead compensator
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.
Consider the differential equation given by:
A SIMULINK model for this system is given in the following figure:
The following differential equation describes the dynamics of a system:
Print out your SIMULINK diagram, command input plots and response plots.
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?
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.
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
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.)
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.)
Welcome to the first hands-on experiment!
The current schedule of the Lab 1 is as follow:
When submitting lab manual on Gradescope please attach rubric on first page before your cover page and clearly tag each section.
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.
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.
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.
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.
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.
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
Change PID gains to gain set #1
Run python3 lab8_part1_plot.py
Change log name, view log
Change PID gains to gain set #2
Run python3 lab8_part1_plot.py
Change log name, view log
Change PID gains to gain set #3
Run python3 lab8_part1_plot.py
Change log name, view log
Compare three logs, discuss the difference, and explain how each gain affects the outcome
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.
Place the CrazyFlie in the center of the floor mat and away from any other objects.
Open lab8_part2_push.py
Make sure the MIN_DISTANCE is set to 0.4 meters.
Make sure the VELOCITY is set to 0.5 m/s.
Run lab8_part2_push.py:
python3 lab8_part2_push.py
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.
Try to imitate a static obstacle with your hand or object, commanding the CrazyFlie to maintain the minimum distance.
Save the position data.
Try to imitate an incoming obstacle with an object moving slower than 0.5m/s.
Save the position data.
Try to imitate an incoming obstacle with an object moving faster than 0.5m/s. Do not hit the vehicle!
Save the position data.
Close everything. DO NOT SAVE THE CHANGES.
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.
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.
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.
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.
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.
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.
The basic gyroscope equation 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:
In this section, we proceed to linearize the nonlinear gyroscopic equations (Eq. 3.5) by imposing certain assumptions.
The angle of rotation of the rotor disk D about the gimbal axis 2 is small.
The equations defining the numerators and denominators in the block diagram are as follows.
All closed-loop poles must be in the left half of the complex plane
The peak time in response to a unit step command input must be less than 0.2 sec.
The 2% settling time to a unit step command input must be less than 0.5 sec.
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.
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.
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.
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.
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.
This test ensures if everything is sound mechanically, electrically, and in the software.
Hardware checks
Ensure the rotor cover panel is secure.
Switch on the ECP control box and disengage Axis 3 and Axis 4 brakes.
Ensure all axes can turn freely with no significant friction felt by hand.
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.
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.
Software checks
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
If the program doesn't launch, make sure it is being executed in Windows XP SP3 compatibility mode
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.
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/.
Load Configuration file "default.cfg" from C:\Program Files (x86)\ECP Systems_MV\mv.
Go to Utility > Reset Controller
and check the following values on the main screen have been set:
Encoders 1/2/3/4 Pos: 0 COUNTS
Control Loop Status: OPEN
Motor 1 Status: OK
Motor 2 Status: OK
Servo Time Limit: OK
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.
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).
Apply all brakes and turn off the ECP control box.
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).
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).
It is not critical where Axis 4 is located since the controller will be doing a relative angle maneuver.
Go to the Data
menu and click on Setup Data Acquisition.
Be sure that the selected variables to log match those below. When finished, hit OK to exit this menu.
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!
Switch on the ECP control box.
Brake all axes so that the accelerating rotor does not cause the axes to move from the initialized positions:
Set Axis #3 and Axis #4 on the ECP control box to ON.
Set Axis #2 V-Brake on the ECP software main screen to ON.
Click on the Command
menu and then on Initialize Rotor Speed.
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.
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.
Observe gyroscopic precession and nutation in open-loop using a ruler or similar object to perturb the system about Axis #4:
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.
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.
Return Axis #2 to its vertical position by torquing Axis #4.
Go to the Setup
menu and clicking on Control Algorithm
.
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.
Check the values with a TA before entering them.
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.
Enable the algorithm by clicking Implement Algorithm.
Click OK, and check that the Control Loop Status now reads CLOSED on the main screen.
With the rotor initialized and the closed-loop controller active, you will now evaluate your calculated gains in three different trajectories.
Select the Command menu
and then Trajectory 1
.
Select the Step Input and then click the Setup
button. Enter the following parameters for this case:
Step size = 200 counts.
Dwell time = 1000 ms.
1 repetition.
Hit OK, then OK again to leave the setup trajectory menus.
Ensure the rotor is oriented vertically using the wooden ruler.
Ensure all people are at a safe distance from the gyroscope.
Go to the Command
menu and click Execute
. Make sure that both Normal Data Sampling and Execute Trajectory 1 Only are checked.
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.
Plot and review the data:
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.
If desired, zooming the plot can be accomplished by going to the Plotting
menu and selecting Axis Scaling.
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.
Save the data by clicking on Data > Export Raw Data
.
Repeat steps 1-8 from Trajectory 1, but this time using the following trajectory settings:
Step size = 1000 counts.
Dwell time = 1000 ms.
1 repetition.
Save the data by clicking on Data > Export Raw Data
.
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.
Repeat steps 1-8 from Trajectory 1, this time using the following trajectory settings:
Ramp input (Unidirectional Moves not checked).
Distance = 6000 counts.
Velocity = 2000 counts/sec.
Dwell Time = 1000 ms.
2 repetitions.
Save the data by clicking on Data > Export Raw Data
.
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.
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.
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?
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:
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)
.
Save wl data and name it as modeling_section#_Group#_K1tau01.
Enter the command K = 1.25 in the MATLAB Command Window.
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.
Save wl data and name it as modeling_section#_Group#_K125tau01.
Enter the command tau = 0.2
in the MATLAB Command Window.
Save wl data and name it as modeling_section#_Group#_K125tau02.
The objectives of this part of the laboratory experiment of the rotary inverted pendulum are as follows:
Use energy-based control scheme to develop a swing-up pendulum controller.
Implement the swing-up controller on the Quanser Rotary Pendulum plant and evaluate its performance.
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.
Given
sufficient condition for asymptotic stability is
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
With the above selection of control law for the pivot acceleration, Equation 43 becomes
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
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
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.
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
Run the part2setup.m script extracted from the Part 2.zip file in the 'Balance Control' section.
Check if the correct gain K value is loaded onto the workspace.
Open q_rotpen_swingup_student_2 Simulink diagram.
After the link swings up and is balanced, wait for ~5 seconds and stop the SIMULINK.
OPTIONAL: Save the data_alpha, data_theta, and data_Vm. Ensure that the data variables have 10 seconds of data saved.
Briefly summarize the swing-up controller experiment and your observations. Did the swing-up control behave as you expected?
[3] K. J. Åström and K. Furuta. Swinging up a pendulum by energy control. 13th IFAC World Congress, 1996.
Moment of inertia of flexible link about pivoted end This is an inline equation: ()
Mass per unit length of flexible link ()
Time of peak 1 (s)
Time of peak n (s)
Magnitude of peak 1,
Magnitude of peak n,
Time period (Eq 1.12)
Logarithmic decrement (Eq 1.10)
(rad/s)
A GTAE Responsible Itemized Bill of Materials for all items you will use from the (instrumentation/hardware/sensors/tools) including information on:
GTAE can only buy from the four vendors listed
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 .
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.
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
: 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
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
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 .)
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.
The time constant is the time at which the output reaches 63.2% of its steady-state value.
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).
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.
Recall that the transfer function of the motor from to in (2.8) is approximated as
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
we notice that the proportional gain affects the natural frequency (and hence the bandwidth) of the closed-loop system.
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.
From Fig. 2.8, the open-loop transfer function becomes
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.
Using the model you have obtained from the prelab, input the transfer function (equation (2.11)) into MATLAB.
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.
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.)
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
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.
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 – , , ).
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)
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.
To build the model, click down arrow on Monitor & Tune under Hardware tab and then Build for monitoring .
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.
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.
PID Controller: Open the controller block and change the current values of , and to match with your controller from Part B.
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.
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
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 arbitrary initial values of and were chosen. The value of was chosen so as to meet the specified value of the velocity error constant.
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".
Similar to Problem 2, launch Control System Designer, with , and , using an arbitrary value for, for example
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.
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.
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.
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.
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
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.
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
Location:
Aug 29th - Sep 2nd : and
Sep 12th - Sep 16th :
Gain Set #2: Higher
Gain Set #3: Higher
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.
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:
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
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 :
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.
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.
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 .
For the outer loop, must be less than 6.0 and must be less than 0.4.
Select the inner loop derivative gain to be equal to 0.08.
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.
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.
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.
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.
Set the and gains to the values from your controller design in Part B.
Do not input magnitude of nor .
Retain the sign of each gain, only changing the magnitude from your calculations in Part B; and should be positive, whereas should be negative.
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 .
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.
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.
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.
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.
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.
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
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.,
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 .
Now, we need to select such that for asymptotic stability. This can easily be achieved by selecting as
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 .
where is a tunable controller gain.
Where from Equation 47,
where
The parameter in Equation 51 is a user-selected range of over which the balance controller becomes active.
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.
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.
Initial PID Gains
X-Axis
Y-Axis
Z-Axis
2.0
2.0
2.0
0.2
0.2
0.2
Initial PID Gains
X-Axis
Y-Axis
Z-Axis
3.0
3.0
3.0
0.2
0.2
0.2
Initial PID Gains
X-Axis
Y-Axis
Z-Axis
2.0
2.0
2.0
0.5
0.5
0.5
Body
Inertia Element
Value (kg - m^2)
A
0.067
B
0.012
0.012
0.03
C
0.0092
0.023
0.022
D
0.015
0.027
Axis i
1
6667
1061
2
24400
3883
3
16000
2547
4
16000
2547
Gain
Value (N/count)
1.28 E-05
9.07 E-05
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.
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 free-body diagram of the Quanser Aero Experiment is illustrated in Figure 2.
The following conventions are used for the modeling:
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 acting about the pitch and yaw axes are
The step response of a first-order transfer function
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
The free-oscillatory equation of motion of a second-order system is described by
The prototype second-order equation is defined
The period of the oscillations in a system response can be found using the equation
and the undamped natural frequency is
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
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
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
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
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
or,
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
First download the zip file below and extract it in the desktop:
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.
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
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.
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.
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.
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.
1) Open the q_aero_step_response_yaw SIMULINK file.
2) Select a step voltage 15V
3) Select simulation time 60 sec.
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.
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.
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.
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.
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.
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).
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.
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.
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.
where
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
where
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.
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
The standard form for the transfer function of a second-order system is
The controller is now
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
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
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
The following are the estimated parameter values for the 3-DOF Helicopter Mechanism.
In pitch: 3 sec < peak time < 3.5 sec, 5% settling time < 5 sec
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:
Note: The roll controller is a PD controller, and does not have an integral gain.
In yaw rate response: 4 sec < rise time < 5 sec
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.
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.)
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.
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.
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).
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.
Always stay clear of the helicopter while running and catch it while stopping.
Check and ensure that the counterweight in the secondary arm is fixed in the furthest hole/position away from the rotors.
Turn the power on.
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.
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.
Double click the Pitch Command block to open it and change the gain after the Pitch(step) input to 0.
Double click the Roll Command block to open it and change the gain after the Roll(step) input to 0.
Hold the helicopter in a level position before starting the experiment until the fans are in full power.
Double click on the scopes and open them.
Gently disturb the helicopter to see the effect of the controller.
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.
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.
Double click the Pitch Command block to open it and change the gain after the Pitch(step) input to 0.
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.
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.
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.
Set the PID gains in the Pitch Controller, Roll Controller, and Yaw Rate Controller blocks in the Simulink diagram.
Double click the Pitch Command block to open it and change the gain after the Pitch(step) input to 0.
Double click the Yaw Rate Command block to open it and change the gain after the Yaw(step) inputs to 1.
Hold the helicopter in a level position before starting the experiment until the fans are in full power.
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.
Turn the POWER OFF.
Compare the actual responses with the simulated responses from Part B. Comment on the differences in the responses.
Give a reason why it is better to design a yaw rate controller instead of a yaw attitude controller.
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.
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.
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.
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.
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.
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
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
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
Rearranging the filter transfer function above,
we can represent the filtering using the differential equation
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?
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.
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?
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?
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:
Follow these steps to read the motor velocity:
First, download and open q_servo_vel_direct.slx Simulink model.
Configure the model to apply a 0.4 Hz square wave voltage signal going between 0.5V and 2.5V.
Change the simulation time to 5 seconds from Simulation tab, stop time.
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).
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.
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.
Save the speed data (wl) to plot in the report. Name the file such as integration_wrapping.
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.
Pre-lab calculations.
Complete SIMULINK block diagram with low-pass filter.
Response plots from In-Lab Experiment Step 7,8,9 and 10. Comparison between measured and calculated values.
Answer all the questions asked in the In-Lab experiment.
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).
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.
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.
The free-body diagram of the Quanser Aero Experiment is illustrated in Figure 2.
The following conventions are used for the modeling:
The equations of motion can be approximated as:
For pitch axis:
For yaw axis:
where the torques acting on the pitch and yaw axes are
The parameters used in the EOMs above are:
The step response of a first-order transfer function
The general equation of motion of a second-order system with input u(t) is described by
The characteristic equation from Equation (10) is obtained as,
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:
The period of the oscillations in a system response can be found using the equation
and the undamped natural frequency is
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
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
Taking its Laplace transform gives
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
In terms of angular rate, the equation becomes
and solving for the speed we get
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.
Solving for the normalized thrust gain we get
Discrete Derivative Method: The thrust gain parameter can be obtained as
or,
Discrete Derivative Method: The thrust gain parameter can be obtained as
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.
Unlock the pitch axis. Lock the yaw axis.
Open the pitch_impulse SIMULINK file.
Set the amplitude gain block to 18. This applies a pulse input of -18 V for 1.5 sec in the pitch axis.
Select simulation time 30 sec.
Copy aero_pitch_impulse.mat
to your folder.
If the data is not smooth/clean, repeat steps 3-7 with a different pulse voltage.
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)
Lock the yaw axis.
Open the pitch_step SIMULINK file.
Apply a step input in the pitch axis. If your setup is Aero1, apply 18 V. If your setup is Aero2, apply 14 V.
Select simulation time 100 sec.
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.
Copy aero_pitch_step.mat
to your folder.
If the data is not smooth/clean, repeat steps 3-7 with a different step voltage.
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)
Unlock the yaw axis. Lock the pitch axis.
Open the yaw_step SIMULINK file.
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.
Select simulation time 100 sec.
Copy aero_yaw_step.mat
to your folder.
If the data is not smooth/clean, repeat steps 3-7 with a different step voltage.
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)
From the pitch response due to pitch motor impulse input, find the natural frequency and damping ratio
Table B.1 and Table B.2.
Compare the normalized thrust gains obtained from the steady-state method and discrete derivative method and explain any differences.
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.
The objectives of this laboratory experiment are as follows:
Identify the parameters of a multi-degree-of-freedom system.
Demonstrate some key concepts associated with proportional plus derivative control for a two degree-of-freedom torsional mechanism.
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.
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
where
Since
it follows that
It follows then easily from (4.3) and (4.2) that
or that
Therefore
where
The previous two equations give that
or that
Finally,
Recall that
or that
From (4.7) and (4.2), the damping coefficient can be computed from
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.
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
Enter the program by clicking on the shortcut to 3D Torsion on the desktop and turn on the torsional mechanism.
Enter File menu, choose Load Setting and select the file C:\Program Files (x86)\ECP Systems\cn\default.cfg.
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.
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.
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.
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.
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.
Save the data by clicking on the Data menu and going to Export Raw Data.
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.
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.
Remember to switch off the system when you are done with your experiments.
Mass (including bolt and nut): 500g (± 5g)
Diameter: 5.00 cm (± 0.02 cm)
Compare the damping ratios of the loaded and unloaded cases of upper and lower disks and report your observations.
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.
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.
where
where
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
where
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.
All closed-loop poles must be in the left half of the complex plane.
Develop a SIMULINK diagram using the block diagram shown in Fig. 4.8 as reference and save it.
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).
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.
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.
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
Enter File menu, choose Load Setting and select the file C:\Program Files (x86)\ECP Systems\cn\default.cfg.
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.
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.
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.
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.
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.
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.
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.
Save the data by clicking on the Data menu and going to Export Raw Data.
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?
Remember to SWITCH OFF the system when you are done with your experiments.
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.
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.
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.
Assume now that the total angular momentum of the gimbaling gyroscope is given by
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
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
The Servo Base Unit (SRV02) open-loop transfer function is given by
and
Consider the simplified model shown in Figure 1.1.
By examining equations (1.4) and (1.5), we find the gyroscopic sensitivity gain is given by
and
The spring torque about the pivot due to the two forces is
The rotational stiffness is given by
The output of the system can be written as
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
The desired time-domain specifications for stabilizing the gyroscope are:
or 3Hz, and
To stabilize the heading of the gyroscope, we will develop a Proportional-Derivative (PD) controller depicted in Figure 2.2.
which is the integral of the deflection angle, the gyro transfer function can be changed into the form
Adding the PD control
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:
Verify that the amplifier is turned ON and the disc is rotating. Ask TA if there's an issue.
Run the setup_gyro.m script
Open the q_gyro simulink diagram.
Make sure the Manual Switch is set to downward position to enable the PD control.
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.
Stop the controller once you have obtained a representative response.
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.
Start the controller again, but this time with the Manual Switch set in the upward position, which turns off the PD controller.
Rotate the bottom base plate by the same amount as previously done, in an attempt to reproduce the motion as previously executed.
Plot the responses.
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.
Briefly describe the main goal of the experiment
Briefly describe the experimental procedure in steps 7 and 9 of section 3.
Briefly describe the experimental procedure in step 11 and 12 of section 3.
Provide results of plots for step 9 and step 12 of section 3.
Explain the effect of having the PD control on and off.
Briefly explain how does this relate to an actual gyroscope system?
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.
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.
Consider the system
such that the closed-loop 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
Choose the weighting matrices as
The Riccati equation gives
Expanding, we obtain
Solving these equations, we get
or that
The optimal gain matrix is given by
The closed-loop system matrix is
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.
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.
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):
First, we write the motor equation as
or
where
The torque generated at the output of the motor is given by
Thus, the force transmitted to the cart via the pinion is
and on substituting the values of
we get
Substitution of the above expression for F in the linearized equations results in
The LQR formulation provides a linear control law
which minimizes the quadratic cost given by
Assuming the time-domain design specifications are:
one can choose
The block diagram of the experimental setup in the lab is shown in Fig. 7.7.
Assume that:
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);
Compute the open-loop and closed-loop eigenvalues of the system and comment on the stability of the open and closed-loop systems.
Compute the natural frequencies and damping ratios of the closed-loop system.
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.
Turn the power on.
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.
Switch the Command Signal block to 0.
Enter the gains you obtained in the corresponding gain blocks.
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.
Double click on the scopes and open then.
Gently disturb the pendulum to see the effect of the controller and then stop the simulation.
Switch the command signal to step input. It should make the cart to move 20 cm to the right after 10 seconds.
Save the data with a descriptive name. DO NOT SAVE THE MODEL.
Turn the POWER OFF
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.
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:
The DC motor armature circuit schematic and gear train is illustrated in Figure 7.
Using Kirchoff’s Voltage Law, we can write the following equation:
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:
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
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.
The magnitude of the frequency response of the Rotary Servo Base Unit plant transfer function given in equation Eq 2.1 is defined as:
Then, the magnitude of it equals
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:
From this, the model time constant can be found as:
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
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.
Download the Modeling_files.zip and extract the files to desktop.
Open q_servo_modeling.m
SIMULINK file.
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.
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.
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 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.
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.
Result: Calculate the gain of the system (in both linear and dB units) and enter the results in Table B.1.
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 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.
Find the time constant from the obtained response and enter the result in Table B.2.
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 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:
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)
.
Save wl data and name it as modelling_section#_Group#_K1tau01.
Enter the command K = 1.25 in the MATLAB Command Window.
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.
Save wl data and name it as modelling_section#_Group#_K125tau01.
Enter the command tau = 0.2
in the MATLAB Command Window.
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?
The output of this system can be written as:
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:
Consider a second-order system as shown in Equation 3.4 subject to a step input given by
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
The peak time depends on both the damping ratio and natural frequency of the system and it can be derived as:
Generally speaking, the damping ratio affects the shape of the response while the natural frequency affects the speed of the response.
We can find the steady-state error of this system using the final-value theorem:
Applying the final-value theorem gives
When evaluated, the resulting steady-state error due to a step response is
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.
The desired time-domain specifications for controlling the position of the Rotary Servo Base Unit load shaft are:
and
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.
The proportional-derivative (PD) compensator to control the position of the Rotary Servo Base Unit has the following structure
From the Plant block in Figure 19 and Equation 3.3, we can write
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
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)
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:
From the Plant block in Figure 21 and Equation 3.3, we can write
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
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:
When in steady-state, the expression can be simplified to
Do problems 1 - 7
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:
Step response with PD controller,
Ramp response with PD controller, and
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.
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.
Open the setup_servo_pos_cntrl.m
file to open the setup script for the position control Simulink models.
Replace the default model parameters (K
and tau
) with the values calculated from the Modelling section in the setup script.
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.
Enter the proportional and derivative control gains found in Pre-Lab Question 4 in the Matlab command window as kp
and kd
.
Set the integral gain to 0 in the Matlab window, denoted as ki
.
To generate a step reference, ensure the Signal Generator
is set to the following:
Signal type = square
Amplitude = 1
Frequency = 0.4 Hz
Set the Manual Switch
such that the velocity of the motor load shaft is fed back directly.
Open the servo position Position (rad)
scope and the motor input voltage Vm (V)
scope.
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.
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.
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.
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).
Set the Manual Switch
block to the down position to enable the derivative and filter.
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.
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.
From the extracted files, open q_servo_pos_cntrl
Simulink file.
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).
Open setup_servo_pos_cntrl.m
file and run the script.
Enter the proportional and derivative control gains found in Pre-Lab Question 4.
Set Signal Type in the Signal Generator
block to square to generate a step reference.
Set the Amplitude (rad)
gain block to 0.4 to generate a step with an amplitude of 45.8 degrees.
Open the load shaft position scope, Position (rad)
, and the motor input voltage scope, Vm (V)
.
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.
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.
Click the Stop button on the SIMULINK diagram toolbar to stop the experiment.
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.
Clear the workspace and run the setup_servo_pos_cntrl.m
script in MATLAB.
Enter the proportional and derivative control gains found in Pre-Lab Question 4 and set the integral gain to 0.
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
Inside the PID Control
subsystem, set the Manual Switch
to the down position so that the High-Pass Filter
block is used.
Open the load shaft position scope, Position (rad)
, and the motor input voltage scope, Vm (V)
.
Start the simulation. The scopes should display responses similar to Figure 26a and Figure 26b.
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.
Measure the steady-state error. Result: Compare the simulation measurement with the steady-state error calculated in Pre-Lab Question 6.
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.
Clear the workspace and run the setup_servo_pos_cntrl.m
script in MATLAB.
Enter the proportional and derivative control gains found in Pre-Lab Question 4.
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
Open the load shaft position scope, Position (rad)
, and the motor input voltage scope, Vm (V)
.
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.
Measure the steady-state error. Result: Compare it with the steady-state error calculated in Pre-Lab Question 6.
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.
List the independent and dependent variables of your proposed controller. Explain their relationship.
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.
For each case, generate a Matlab figure showing the position response of the system and its corresponding input voltage.
In each case, measure the steady-state error.
Pre-lab calculations.
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:
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.
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.
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.
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
Mention the final yaw PD gains (Step 3).
Mention the final tuned pitch PID gains (Step 7).
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.
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.
Note: It is possible that specifications are not met due to coupling between pitch and yaw dynamics.
Mention the feedforward gain values.
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.
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.
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?
Why a PID controller is used for the pitch and a PD controller for the yaw?
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
and the control variables as
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.
Using parameters from Part A, obtain state-space matrices of the system neglecting coupling effect.
Build the SIMULINK model of the system
Check whether your controller meets the desired specifications.
Save the data and plot the closed-loop system response for pitch and yaw
Now, use system matrices with coupling effect and use the controller without coupling
Repeat steps 4-6
The closed-loop response in this step does not have to meet the desired specifications
Build the SIMULINK model of the system
Repeat steps 4-6
Check whether your controller meets the desired specifications.
Save the data and plot the closed-loop system response for pitch and yaw
What happened when you neglect the coupling effect?
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.
Unlock both pitch and yaw axes to enable the full 2 DOF motion.
Open q_aero_2dof_lqr_control SIMULINK file.
Use pitch command (10 deg) only by changing Amp_y to zero.
Copy aerolqrrsp.mat
to your own folder and rename it as nocouple_pitch_only.
Examine the obtained closed-loop response and see if it matches the desired specifications.
Use a yaw command (45 deg) only by changing Amp_p to zero.
Run SIMULINK
Copy aero_lqr_rsp.mat
to your own folder and rename it as nocouple_yaw_only.
Examine the obtained closed-loop response and see if it matches the desired specifications
Use both pitch and yaw command
Run SIMULINK
Copy aerolqrrsp.mat to your own folder and rename it as nocouple_pitch_yaw.
Examine the obtained closed-loop response and see if it matches the desired specifications
Repeat above Pitch Only, Yaw Only and both Yaw and Pitch runs and rename the files as couple_####_###.
Close the Simulink. DO NOT SAVE THE CHANGE!
Did your controller successfully meet the specs? If not, why?
How does the coupling affect the performance of the controller?
How can we improve the controller?
Output/Rev (counts/rev)
Gain (counts/rad)
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 =
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 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
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:
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.
and the time constant is
is shown in Figure 4. Assuming the initial conditions , the Laplace transform of Equation (9) is
where is the damping ratio and is the natural frequency. Equating the characteristic equation in Equation (10) to this gives
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
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
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.
Assuming the initial velocity is zero, , and solving for position we get
where . Taking its Laplace transform
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
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
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 .
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) 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 .
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 .
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 .
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 .
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.
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.
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
: 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
: mass moment of inertia of the body about the roll axis.
: distance from the roll axis to either motor.
: roll angle measured in radians.
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.
: moment of inertia of the body about the yaw axis.
: yaw rate in rad/sec.
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
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.)
We will tune the integral gain using simulation of the nonlinear system with an initial guess of .
where is the commanded roll angle. The resulting closed-loop transfer function is given by
where and are respectively the desired natural frequency and damping ratio of the closed-loop rolling motion.
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
Once the proportional gain is determined, we can add the integral term and tune the integral gain through nonlinear simulation of the system.
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:
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.
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:
Note: For a first-order system, the rise time () is related to the time constant () by the following relation:
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.
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.
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.
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.
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.
Press Connect button under Monitor & Tune and then press Start . Check if the controller can maintain the attitude of the helicopter.
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.
Press Connect button under Monitor & Tune and then press Start .
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.
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.
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
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.
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.
A low-pass filter with a time constant of is used in the velocity estimator and the sampling of the control runs at s. Evaluate the ripple in the velocity with this filter.
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 .
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 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.
Add a low-pass filter with a time constant of s 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.
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 =
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 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 that acts on the body at a distance from the yaw axis as well as a torque about the pitch axis as shown in Figure 2.
: the damping ratio of the pitch dynamics
: the natural frequency of the pitch dynamics
: the time constant of the yaw dynamics
: normalized torque thrust gain from the pitch rotor (normalized by )
: normalized torque thrust gain from the yaw rotor (normalized by )
: normalized cross-torque thrust gain acting on the pitch from the yaw rotor (normalized by )
: normalized cross-torque thrust gain acting on the yaw from the pitch rotor (normalized by )
: voltage applied to the pitch rotor motor
: voltage applied to the yaw rotor motor
: the total moment of inertia about the pitch axis
: the total moment of inertia about the yaw axis
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, rad/V and sec.
To obtain the time constant from the response, find the time it takes to reach or 63.2% 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.2% of the final value, as illustrated in Figure 3.
Assuming the initial conditions and , the Laplace transform of Equation (9) is
where is the damping ratio and is the natural frequency.
where is the time of the peak, 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
where is the peak magnitude of the first oscillation and is the peak magnitude of the oscillation. Note that > , as this is a decaying response. The damping ratio can then be found using
The damping ratio and the natural frequency of the pitch axis, and in Equation (1) can be found from the oscillatory portion of the step response.
Assuming the initial velocity is zero, , and solving for position we get
where . Taking its Laplace transform
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 and in Equation (1), the equation of motion for the pitch axis is
Remark that this is the normalized thrust torque gain parameter. The normalized force thrust gain would be , where 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 and (zero at steady-state), the normalized thrust gain is obtained as
where is the magnitude of the voltage input to the pitch rotor motor.
where and is the difference between the time instance when the step input is given and a time instance slightly above , i.e., . Thus we can find the normalized pitch thrust gain from the measured pitch rate and derived acceleration (discrete-derivative of pitch rate).
Similarly, to find the normalized thrust gain acting on the yaw axis system, apply a voltage to the tail rotor motor. Plugging and in Equation (1), the equation of motion for the yaw axis is
where is the angular rate of the yaw axis. The normalized yaw torque thrust gain is
Steady State Method: At steady-state condition, and neglecting the (zero at steady-state), the normalized thrust gain is obtained as
where is the magnitude of the step voltage input to the yaw rotor motor.
where and is the difference between the time instance when the step input is given and a time instance slightly above , i.e., . Thus we can find the normalized yaw thrust gain from the measured yaw rate and derived acceleration (discrete-derivative of yaw rate).
The normalized cross-torque thrust parameters, and 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 and , are
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 and , are
Estimating and are out of scope of this lab. The values of these parameters are provided 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 .
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 . 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.
The cross-torque thrust parameters are Nm/V, Nm/V. These will be required for .
Hint: Use equations
You can also use the above-attached Aero_Pitch_SystemID.mlx
script to find and . Complete the lines marked with TODO.
Fill the corresponding values in
From the pitch response due to pitch motor step input find the normalized thrust gain , using both the steady state method and discrete derivative method.
Hint: For the steady-state method, use equation and for the discrete derivative method, use equation .
You can also use the above-attached Aero_Pitch_SystemID.mlx
script to find . Complete the lines marked with TODO.
Fill in the values in .
From the yaw speed response due to yaw motor step input find the time constant and normalized thrust gain
Hint: For time constant. use equation . For , use equation for the steady-state method and use equation for the discrete derivative method.
You can use the above-attached Aero_Yaw_SystemID.mlx
script to find and . Complete the lines marked with TODO.
Fill the respective values in and .
Equations used for calculating , , , .
The given value of is positive and is negative for our setup (see Step 1 of section). Why?
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).
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.
The value of during two complete successive cycles is given by
Let the logarithmic decrement be given by
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
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
for the loaded and unloaded cases, respectively. Solving for and equating the resulting expressions yields
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.
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 .
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.
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?
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.
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.
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).
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
= applied voltage
, gain that converts volts to torque in N-m, is calculated as follows (see Fig. 4.7):
, 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
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
, 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 rise time to a unit step command input must be less than 0.4 sec (for ).
The overshoot in response (for ) to a unit step command input must be less than 10% without excessive oscillation.
must be less than 1.0 and must be greater than 0.02 but less than 0.1.
Open a new m-file and compute the transfer function using Eqn. 4.13. Save your m-file.
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.
Compute the transfer function using Eqns. 4.13 and 4.14.
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.
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.
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?
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.
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.
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 .
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
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.
Further assuming that the rotary base motor has achieved steady-state (, ), and that the flywheel's velocity is constant (i.e. ), we have that
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.
where is the load gear position and is the applied motor voltage. The system steady-state gain and time constant are given by:
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
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 .
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 )
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.
By solving for we get the closed-loop transfer function
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 .
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
Add the SRV02 dynamics given in Section 1.1 into to introduce our control variable to get
and solving for we obtain the closed-loop transfer function
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.
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.
Press Connect button under Monitor & Tune and Press Start .
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
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):
where and . Let and . The system matrices are
Notice that the solution matrix P is positive definite. Its eigenvalues are .
and the eigenvalues are
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.
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.
: 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)
where is the motor torque constant given by
where is the conversion factor from volt-amp to N-m given by
Letting and , the input force F can be written as
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.
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):
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).
(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 .
Obtain the A and B matrices of the system using , and .
Choose and based on the following:
No constraints on and . (They can go to infinity…)
According to Bryson’s rule, this will result in the following and matrices:
and
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.
Press Connect button under Monitor & Tune and then press Start .
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.
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:
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 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
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:
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:
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). 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.
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:
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 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:
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
Express the steady-state gain () and the time constant () of the process model Eq (2.1) in terms of the , , and parameters.
Calculate the and model parameters using the system specifications given in . The parameters are to be calculated based on an the Rotary Servo Base Unit in the high-gear configuration.
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 and the external load moment of inertia , the load inertia is . Using the specifications given in the Rotary Servo Base Unit User Manual find the total moment of inertia from the gears. Hint: Use the definition of moment of inertia for a disc .
Assuming that the disc load is attached to the load shaft, calculate the inertia of the disc load, , and the total load moment of inertia acting on the motor shaft from the disc and gears, .
Evaluate the equivalent moment of inertia . 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 .
Calculate the steady-state model gain and time constant . These are the nominal model parameters and will be used to compare with parameters that are later found experimentally.
Referring to the Frequency Response, find the expression representing the time constant of the frequency response model given in Eq. (2.31). Begin by evaluating the magnitude of the transfer function at the cutoff frequency .
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 .
Evaluate the step response given in Eq. (2.40) at and compare it with Eq. (2.35).
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:
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 .
Result: Calculate the steady-state gain both in linear and decibel (dB) units as explained in . 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.
Click Connect button under Monitor & Tune and then run SIMULINK by clicking Start .
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 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.
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 .
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 .
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.
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.
Enter the nominal values, and , 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.
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 and 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 and . 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.
The block diagram shown in Figure 16 is a general unity feedback system with a compensator (controller) and a transfer function representing the plant, . The measured output, , is supposed to track the reference signal and the tracking has to match certain desired specifications.
By solving for , we can find the closed-loop transfer function:
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 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:
where is the natural frequency and is the damping ratio. This is called the standard second-order transfer function. Its response depends on the values of and .
with a step amplitude of . The system response to this input is shown in Figure 17, where the red trace is the response (output), , and the blue trace is the step input .
The maximum value of the response is denoted by the variable and it occurs at a time . The initial value of the response is denoted as . For a response similar to Figure 17, the percent overshoot is found using
From the initial step time, , the time it takes for the response to reach its maximum value is
Steady-state error is illustrated in the ramp response given in Figure 18 and is denoted by the variable . It is the difference between the reference input and output signals after the system response has settled. Thus, for a time when the system is in steady-state, the steady-state error equals
where is the value of the steady-state input and is the steady-state value of the output.
We can find the error transfer function in Figure 16 in terms of the reference , the plant , and the compensator . The Laplace transform of the error is
Solving for from Equation 3.3 and substituting it in Equation 3.11 yields
In this equation, we need to substitute the transfer function for from Equation 3.12. The transfer function requires, , and . For simplicity, let as a compensator. The and were given by equations Equation 3.3 and Equation 3.5, respectively. Then, the error becomes:
where is the proportional control gain, is the derivative control gain, is the setpoint or reference load shaft angle, is the measured load shaft angle, and is the Rotary Servo Base Unit motor input voltage. The block diagram of the PD control is given in Figure 19.
We need to find the closed-loop transfer function for the closed-loop position control of the Rotary Servo Base Unit. Taking the Laplace transform of Equation 3.20 gives
Substituting Equation 3.21 into Equation 3.22 and solving for gives the Rotary Servo Base Unit position closed-loop transfer function as:
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, , 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 . If the amplified voltage, , 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 . Therefore, the input voltage is the effective voltage being applied to the Rotary Servo Base Unit motor.
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 . After rearranging the terms we find:
Substituting the input ramp transfer function Equation 3.25 into the variable gives
where is the proportional control gain, is the integral gain, is the derivative control gain, is the setpoint or reference load shaft angle, is the measured load shaft angle, and is the Rotary Servo Base Unit motor input voltage.
We need to find the closed-loop transfer function for the closed-loop position control of the Rotary Servo Base Unit. Taking the Laplace transform of Equation 3.28 gives
Substituting Equation 3.29 into Equation 3.30 and solving for gives the Rotary Servo Base Unit position closed-loop transfer function as:
Then, substituting the reference ramp transfer function Equation 3.25 into the variable gives
where the variable is the integration time.
Calculate the maximum overshoot of the response (in radians) given a step setpoint of 45 deg and the overshoot specification given in . Hint: By substituting and step setpoint into Equation 3.6, we can obtain . Recall that the desired response specifications include 5% overshoot.
The Rotary Servo Base Unit closed-loop transfer function was derived in Equation 3.23 in . Find the control gains and in terms of and . Hint: Remember the standard second-order system equation.
Calculate the minimum damping ratio and natural frequency required to meet the specifications given in .
Based on the nominal Rotary Servo Base Unit model parameters, and , found in the Modeling laboratory experiment, calculate the control gains needed to satisfy the time-domain response requirements given in . (Use rad/(Vs) and ) (Need answers from Q2 and Q3)
In the PD controlled system, for a reference step of (i.e. 45 deg step) starting from position, calculate the maximum proportional gain that would lead to providing the maximum voltage to the motor. Ignore the derivative control (). Can the desired specifications be obtained based on this maximum available gain and what you calculated in Question 4? (Need answer from Q4)
For the PD controlled closed-loop system, find the steady-state error and evaluate it numerically given a ramp with a slope of rad/s. Use the control gains found in Question 4. (Need answer from Q4)
What should the integral gain be so that when the Rotary Servo Base Unit is supplied with the maximum voltage of V 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 , , the you found in Question 4 and found in Question 6. Remember that is constant.
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 . When the integral gain is set to zero, it essentially becomes a PD controller.
Download the and extract the files to the desktop.
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 which results in a step amplitude of 0.8 rad).
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 ?
Hint: You can use the Cursor Measurements tool in the Simulink scopes or save the data and use MATLAB function : stepinfo()
.
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 . 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.
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 , except a low-pass filter is placed in series with the derivative to remove the noise.
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.
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.
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 ?
Similar to the Step Response experiment in , in this experiment you need to use the s_servo_pos_cntrl
Simulink diagram shown in Figure 22 in again.
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:
In the SIMULINK diagram, set the Amplitude (rad)
gain block to .
As in the Step Response experiment in , 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.
In the Simulink diagram, set the Amplitude (rad)
gain block to .
Build the model by clicking on the down arrow on Monitor & Tune under the Hardware tab and then select Build for monitoring .
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.
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 .
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 and Experiment as per , except the value of ki (i.e., ki 0).
For each case comment on whether the steady-state specification given in was satisfied without saturating the actuator.
Model parameters ( and ) and controller gains (, and ) implemented during the In-Lab Simulations and Experiments.
Response plots from In-Lab Simulations and Experiments (: , ; : Step 8; : Step 9; : Step 8; : Step 5).
Corresponding measured peak time, percent overshoot and steady-state error for the response plots mentioned above (: , ; : Step 9; : Step 10; : Step 9; : Step 6). Note: Peak time and percent overshoot are required only for step response simulation and experiment, not ramp response.
Answer all the questions asked in all the In-Lab simulations and experiments (: , ; : Step 9; : Step 10; : Step 9; : Steps 1, 2, 3 and 7).
Steady-state error to a step command input: (a) = 0 deg (b) = 0 deg
Peak time of response to a step command input: (a) ≤ 2s (b) ≤ 2s
Percent Overshoot of response to a step command input: (a) ≤ 7.5% (b) ≤ 7.5%
No actuator saturation: (a) ≤ 24V (b) ≤ 24V
Choose appropriate values for and in both pitch and yaw axes satisfying the design specifications.
For these selected values of and within the design specs, compute the desired values of damping ratio and natural frequency using the following equations:
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.
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.
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.
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.
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.
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.
Simulate the closed-loop response of the system with pitch-only command: and . Save the data.
Simulate the closed-loop response of the system with yaw-only command: and . Save the data.
Simulate the closed-loop response of the system with simultaneous pitch and yaw commands: and . Save the data.
Mention the chosen design specifications values (Step 1 of ).
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).
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).
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).
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).
Given the linear state-space equations: and , we define the state for the Quanser Aero Experiment as
the output vector 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
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 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.
Steady-state error: pitch ≤ 2 , yaw ≤ 2 .
Peak time: ≤ 2 s.
Percent Overshoot: ≤ 7.5%.
No actuator saturation: ≤ 24V and ≤ 24V .
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)
Simulate the closed-loop response of the system with pitch-only command: . (Make sure to change deg to rad in SIMULINK)
Simulate the closed-loop response of the system with yaw only command: . (Make sure to change deg to rad in SIMULINK)
Simulate the closed-loop response of the system with pitch and yaw command: and . (Make sure to change deg to rad in SIMULINK)
If it fails to meet the specifications, tune and/or to meet the specifications
Now, design , and with the coupling effect
If it fails to meet the specifications, tune and/or to meet the specifications
Is there any systematic way to design and ?
Steady-state error: pitch ≤ 2 , yaw ≤ 2 .
Peak time: ≤ 2 s.
Percent Overshoot: ≤ 7.5%.
No actuator saturation: ≤ 24V and ≤ 24V .
Use the gain obtained in Part B. neglecting the coupling effect.
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 .
Use the gain obtained in Part B. with the coupling effect.
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
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.
Unlock pitch axis and lock yaw axis.
Open q_aero_2dof_PID.slx.
Set yaw controller PD gains and feedforward controller gains to 0.
Apply a pitch-only command ( , ).
GET DATA OUT!!! and save it as pitch_only.mat
.
Unlock yaw axis and lock pitch axis.
Set pitch controller PID gains and feedforward controller gains to 0.
Apply a pitch-only command ( , ).
Run SIMULINK.
GET DATA OUT!!! and save it as yaw_only.mat
.
Unlock both pitch and yaw axes to enable the full 2 DOF motion.
Implement the PID and PID gains in pitch and yaw controllers respectively. Set feedforward gains to zero.
Apply simultaneous pitch and yaw commands ( , ).
Run SIMULINK.
GET DATA OUT!!! and save it as pitch_yaw.mat
.
Repeat the pitch+yaw experiment with simultaneous pitch and yaw commands ( , ).
Save data as ff_pitch_yaw.mat
.
Close SIMULINK. DO NOT SAVE THE CHANGES!
Pitch command, pitch experimental response and pitch simulation response (one figure)
Voltage input to pitch rotor motor experiment and simulation results (one figure)
Explain any differences between the experimental and simulation results.
Yaw command, yaw experimental response and yaw simulation response (one figure)
Voltage input to yaw rotor motor experiment and simulation results (one figure)
Explain any differences between the experimental and simulation results.
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)
Explain any differences between the experimental and simulation results.
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)
Explain any differences between the experimental and simulation results.
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).
Did your controller successfully meet the specifications while running on the Quanser Aero hardware? If not, why?
The objectives of this part of the laboratory experiment on the rotary inverted pendulum are as follows:
Use energy-based control schemes to develop a swing-up pendulum controller.
Implement the balance and swing-up controllers on the Quanser Rotary Pendulum plant and evaluate their performance.
The feedback control loop that balances the rotary pendulum is illustrated in Figure 7. The reference state is defined as where is the desired rotary arm angle. The controller is Note that if then , which is the control gain 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. For example if degrees, then the control will begin when the pendulum is within ±10 degrees of its upright position, i.e. when degrees.
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.
Download the Week 2.zip file, unzip it into a new folder and open the week2setup.m script.
Open the q_rotpen_bal_student SIMULINK diagram.
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.
Turn ON the power amplifier.
Ensure the pendulum is in the hanging down position, with the rotary arm aligned with the 0 marking, and is motionless.
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.
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.
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.
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.
The dynamics of the pendulum can be redefined in terms of pivot acceleration (see Figure 10) 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
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
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.
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.
Run the week2setup.m script
Check if the correct gain K value is loaded onto the workspace.
Open q_rotpen_swingup_student Simulink diagram.
Open the Swing-Up subsystem.
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.
Turn on the power amplifier.
Ensure the pendulum is in the hanging down position, with the rotary arm aligned with the 0 marking, and is motionless.
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.
Close the SIMULINK. No need to save the data.
Open q_rotpen_swingup_student_2 Simulink diagram.
After the link swings up and is balanced, wait for ~5 seconds and stop the SIMULINK.
Note down the values of the swing-up parameters, i.e., , ,and .
Save the data_alpha, data_theta, and data_Vm. Ensure that the data variables have 10 seconds of data saved.
Did the swing-up behave as you expected with these parameters?
Evaluate the potential energy of the pendulum when it is in the downward () and upright positions ().
Compute the maximum acceleration deliverable by the Rotary Servo. Assume the maximum equivalent voltage applied to the DC motor is 5 V such that
Is the selected swing-up control law unique? Is it optimal? Comment.
[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
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.
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:
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
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
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
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
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
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
First download the zip file below and extract it in the desktop:
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.
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
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.
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.
1) Open the q_aero_step_response_yaw SIMULINK file.
2) Select a step voltage 15V
3) Select simulation time 40 sec.
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.
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.
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.
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.
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.
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).
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.
Find the thrust and cross-torque thrust gain parameters by performing discrete derivative to peak values or from the steady state of step response.
The objectives of this laboratory experiment are as follows:
Obtain the linear state-space representation of the rotary pendulum plant.
Design a state-feedback control system that balances the pendulum in its upright position using Pole Placement.
Simulate the closed-loop system to ensure the given specifications are met.
This experiment involves modeling of the rotary inverted pendulum.
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
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 coefficient 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 coefficient as seen at the pivot axis
0.0024
Rotary arm moment of inertia about pivot
0.0020
Pendulum encoder resolution
4096
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, , 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 it center of mass is . 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.
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 are called generalized coordinates. For this system let
where, as shown in Figure 2, is the rotary arm angle and 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 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
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:
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
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.
Equation (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
Download the above zip file and extract it.
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.
Find the open-loop poles of the system.
Hint: Use eig(A).
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.
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 is the determinant function, is the Laplace operator, and the identity matrix. These are the eigenvalues of the state-space matrix .
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 ([2]).
Rank Test The system is controllable if the rank of its controllability matrix
equals the number of states in the system,
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 is the controllability matrix defined in Equation 16 and Then and
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
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.
Select and such that they satisfy the given design specifications.
In the same rotpen_week1_student.mlx live script, go to the Balance Control section. Enter the chosen zeta
and omega_n
values.
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.
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].
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).
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
.
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.
The linear state-space representation of the rotary inverted pendulum system, i.e., , , and matrices (numerical values).
Open-loop poles of the system.
Chosen and based on design specifications.
Corresponding locations of the two dominant poles and .
Gain vector .
Plots of the commanded position of the rotary arm (), simulated responses of the rotary arm (), pendulum (), and motor input voltage () obtained using your obtained gain K.
Determine the controllability matrix of the system. Is the inverted pendulum system controllable? Hint: Use Equation 17.
Using the open-loop poles, find the characteristic equation of . Hint: The roots of the characteristic equation are the open-loop poles.
Determine the controllability matrix of the companion system.
Determine the transformation matrix .
Check if and with the obtained matrices.
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
[1] Bruce Francis. Ece1619 linear systems, 2001. [2] Norman S. Nise. Control Systems Engineering. John Wiley & Sons, Inc., 2008.
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.
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 .
Implement yaw PD controller using the gains tested in Step 3 of the section under in .
Set the feedforward gains to the values in Step 1 of the section under in .
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.
Plot and compare the experimental results obtained for the with the corresponding :
Plot and compare the experimental results obtained for the with the corresponding :
Plot and compare the experimental results obtained for the with the corresponding :
Plot and compare the experimental results obtained for the with the corresponding :
Go to the 'Balance Control' section and put the gain K you found in . Run the script.
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.
Press Connect button under Monitor & Tune and Press 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.
Press Connect button under Monitor & Tune and Press 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.
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.
From , plots of the commanded position of the rotary arm (), experimental responses of the rotary arm (), pendulum (), and motor input voltage () obtained using your obtained gain K.
Are satisfied? Justify using the measured maximum pendulum deflection and motor input voltage values.
From , the total energy reading of the inverted pendulum.
From , plots of the experimental responses of the rotary arm (), pendulum (), and motor input voltage ().
From , , ,and used to bring the pendulum up.
Compare the calculated value of potential energy when upright position (Question C.1) with the value in .
Compare the calculated value of the maximum acceleration (Question C.2) with the value in .
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 .
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 .
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 .
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 .
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 .
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 .
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.
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.
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 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 (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.
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 damping ratio, , as given in . Let the conjugate poles be and where and is the damped natural 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.
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 velocity of the rotary arm and pendulum.
Measure the pendulum deflection and voltage used. Are the given satisfied?
Are satisfied? Justify using the measured maximum pendulum deflection and motor input voltage values.
Based on your open-loop poles found in , is the system stable, marginally stable, or unstable? Did you expect the stability of the inverted pendulum to be as what was determined?
Instead of using , characteristic polynomials can also be found using MATLAB function .
Find the corresponding companion matrices and . Hint: For , use the characteristic equation of A found in and Equation 19. For , use Equation 20.
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.
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 .
Once you have found , find using .
Compare the gain vector calculated using Pole Placement Theory () with the gain vector obtained using MATLAB ().