- StudyBlue
- Washington
- University of Washington - Seattle Campus
- Mechanical Engineering
- Mechanical Engineering 477
- Garbini
- Lab 8 Report.doc

Anonymous

Advertisement

DESCRIPTION: The main goal of the lab is to observe and measure the speed and response of motor through a DC motor control C program by enabling data acquisition for reading into MATLAB. The actual control response of the motor will also be compared to the theoretical control response of from a transfer function. The objectives of this exercise are to: 1. Make minor modifications to the existing DC motor control program to enable data acquisition. 2. Compare the motor response to theoretical control analysis. The hierarchy of the C program is as follows(main changes to my lab 7 code are bolded): Main() ? program that calls the table editor to control/observe motor initSPI() - SPI interface; initializeSM() - initialize motor encoder; ctable(int edits,int shows,labels,values) - call table editor; isrC2() ? interrupt service routine initialize a?s in struct biquad by scaling by 1000, vel() ? assigns actual velocity of motor as a 16 bit integer in BDI/BTI compute b?s by scaling kp & ki by 1000 extend(int value) ? extends the sign of a 16 bit integer by changing the 12th-16th bit values. cascade(int #biquads, int error, struct biquad) ? create controller transfer function output value. Changed to lab 6 cascade. dac12(int output,2048) ? send output to DAC. Manage buffer so that the change in reference velocity begins a new data acquisition of newest step response. update() ? update table readings every 200 counts. The general process of the MATLAB script is as follows: Read in saved .mot file buffer readings from C program. Setup controller variables Compute transfer functions Compute step responses of the transfer functions Shift and scale responses Plot velocity and control signal plots versus time TESTING: Setup .c,.prj,.dbg files for lab. Entered base code script from lab 7 and used cascade function from lab 6 into compiler. Main changes made were first scaling a?s and b?s by multiplying/changing the placeholder in the struct biquad declaration and the values Ki and Kip by 1000. Added buffer declarations and buffer assignments such that when the reference velocity changes the buffer goes to the beginning and gets a new reading. Fixed the code mostly from editing and fixing lab 7 in the debugger, the problem was that the cascade function and extend function were incorrect. Confirmed that the program was working correctly once the output velocity of the motor equaled that of the tachometer measurement device. since the response has been automatically recorded in the buffer. Opened up MATLAB set directory to lab8 folder to access the .mot file. Enter code as in write-up to extract the data from the .mot file. Compared step response to MATLAB code output. This completes the programming for the controller and data acquisition. The lab procedure can be carried out and will be discussed in the RESULTS section. RESULTS: To conveniently describe the results from the experiment, the corresponding lab procedure steps have been included in this section. Laboratory Procedure: 1. Test and debug program with base parameters for entire lab experiment: Vref = 20 BDI/BTI BTI length = 10000 counts Kp = 20 da count-BTI/BDI Ki = 2 da count/BDI 2. Measure the steady-state speed of the motor with the tachometer. Compare this value to the reference speed that you specified in the table. How close is it? The steady-state speed of the motor was measured to be 120 rpm by the tachometer. The reference velocity was specified as 20 BDI/BTI. According to the conversion from BDI/BTI as described in lab 4 and also attached to this report, by multiplying the 20 BDI/BTI reading by 6 we get 120 rpm. The comparison of the tachometer reading and table reference speed are exactly the same. 3. While the motor is at steady-state speed, gently apply a steady load torque to the motor shaft. What are the responses of the actual speed and control voltage? While I apply a torque with my hand to the motor shaft, as expected, the actual speed response reading decreases and the control voltage increases. The encoder reads a lower speed of the slowing shaft and the voltage increases to 5V since the motor is trying to compensate for the low speed output. This is the result of the feedback, of the error between the actual velocity and reference velocity, being sent to the controller to send a lot of power resulting in a max 5v output read on the oscilloscope in an effort to reduce the error. 4. Explore the effect of varying the Proportional Gain Kp on the transient response. Try small (10) and large (30) values of Kp. What are the effects on the oscillation frequency and on the damping? Explain in terms of the transfer function parameters. The effects on the oscillation frequency is that as Kp changes, the oscillation frequency does not change. For the damping, as Kp increases the damping increases and as Kp decreases the damping decreases since Kp and zeta are proportional. 5. Explore the effect of varying the Integral Gain Ki on the transient responses. Try small (1) and large (10) values of Ki. What are the effects on the oscillation frequency and on the damping? Explain in terms of the transfer function parameters. The effects on the oscillation frequency is that as Ki increases the oscillation frequency increases and as Ki decreases the oscillation frequency decreases according to the natural frequency equation. The oscillation frequency is proportional to the square root of Ki. The effects on the damping are that as Ki increases the damping decreases and as Ki decrease the damping increases. But not by much since the square root lowers the effect of the gain caused by increasing/decreasing Ki. The damping is inversely proportional to the square root of Ki. 6. Try setting the Integral Gain to zero. Does the system still act to overcome an error in speed if you apply a steady load torque? Again, measure the steady-state speed of the motor and compare to the reference speed. The system still tries to overcome an error in speed, but this time not as much as a 5V max output. There is a light compensation but not enough to make the error zero. There is an effect of the speed response. As a steady 116 rpm is read from the tachometer which is different from the 20 BDI/BTI reference speed. With a percent error of? = (116 ? 120) / 120 = -3.33% This shows that the output speed is not what it should be. By the T2 transfer function(attached to this report), we can see that if Ki is zero this makes the numerator infinite. So the comparatively, the numerator is much larger than the denominator making the torque disturbance Td appear small. This makes the velocity reading higher than the true actual velocity. So the error between the velocity reading and velocity reference is lower resulting in lower voltage to adjust the error to zero. 7. Try setting the Proportional Gain (only) to zero. Vary the Integral Gain. What is the nature of the transient response? Visually, at Kp=0 results in a zero flat line and as Ki is increased to 10, the waveform oscillates in a square shape. Since Kp=0 sets the damping ratio to zero. And adjusting Ki changes the oscillation. 8. Explore the effect of varying the length of a BTI, on the transient and steady-state responses? on the speed of response? ...on the damping? The effect of varying the BTI length is that as it is increased the output velocity decreases as expected since the velocity in BDI/BTI, an increase in BTI in the denominator lowers the velocity value. Also we can examine the effect of varying the BTI on the transient and stead-state responses by observing the changes on the damping and the settling time(speed of response). The analysis is the attached to this report. Since T = BTI/2*10^6 and J is inversely proportional to the square of T, an increase in T results in a rapid decrease in J. Also for the natural frequency omegan and damping zeta, both of these increase as J decreases. Thus omegan and zeta increase as T increases. So T is proportional to zeta, therefore the damping increases as the BTI length increases. As for the speed of response, the settling time to reach a steady-state value within a small percentage i.e. 2% of the final value, the formula is given as So as the BTI increases, the damping and natural frequency increase resulting in a lower settling time or a faster speed of response. 9. Finally record the control and velocity responses for a step change in the reference velocity that starts from -20 BDI/BTI and goes to +20 BDI/BTI. In MATLAB, compare these experimental responses with the theoretical responses. What do you conclude? The output of the experimental velocity response is very similar to the theoretical response as shown in the figure attached to this report where the smooth curve is the theoretical response and the choppy curve is the actual response. There is a slight offset discrepancy between the curves because the motor velocity and DAC outputs are not ideal. SOURCE CODE: C code, MATLAB script, plots, and hand calculations attached.

Advertisement

"The semester I found StudyBlue, I went from a 2.8 to a 3.8, and graduated with honors!"

Jennifer Colorado School of Mines© 2014 StudyBlue Inc. All rights reserved.