Laboratory Experiment 2: Implementation of a Speed Controller MTRN3020 Modelling and Control of a Mechatronics I verify that the contents of this report are my own work. Arthur Ching z5162176 12/04/20 1. Introduction This laboratory experiment was designed to create a speed controller implemented in a motorgenerator system. To design the controller, the so-called Ragazzini’s method and the direct analytical design method is required. The controller design involves only a small amount of calculations leading to a difference equation. The first part of the experiment connects the system to a DC motor for initial rotational power. The speed is shifted from 1000 rpm to 2000 rpm to simulate a plant generating power. Thus, using an encoder, the shaft speed is measured at a constant sampling rate. The second part of the experiment connects the system to a power grid. A load is connected to the generator, thus simulating the changes in the motor speed as a result of a change in the number of resistors connected. The number of resistors connected is determined by our unique student z-ID. The report illustrates and documents the experimental process and analysis used to obtain both the simulation and experimental results. As a result, this experiment can draw a conclusion between the differences of each procedures. 2. Aims of the Experiment The aims of the experiment are to design and model a controller using the direct analytical design method and Ragazzini’s method to control the speed of a motor. The main goal of the controller is to maintain that speed at the specified value regardless of load changes. Simulation and implementation of the experiment designed through MATLAB’s Simulink should determine the difference between the experimental and theoretical methods. 1 3. Experimental Procedure The experiment requires a motor that is connected to a generator, where the generators are driven by an electric motor. A pulse width modulation (PWM) amplifier will generate an applied voltage which becomes the control input to the system, thus the controller output becomes the input to the PWM amplifier. The controller decides based on the error of the speed. The electric motor drives a DC generator with identical parameters as the motor. A bank of 15 resistors is connected in parallel, each with 150β¦ of resistance, signalling the output of the generator. If there are zero resistors connected, then the generator system runs on “no load”. If there are a certain number of resistors connected, then there will be a current in the generator circuit, thus resulting in a load torque on the motor, driving the generator. The speed will be affected as the load changes. Pre-Lab Calculations 1. Download SpeedController.mexw64. 2. Run MATLAB 3. Change Folder to where you put SpeedController.mexw64 4. Find your desired time constant and sampling time from the spreadsheet MTRN3020SpeedControllerLabTimesAndData_2020.xlsx. 5. Execute the following command in MATLAB >> y = SpeedController(YourDesiredTimeConstantInSeconds, YourSamplingTimeInSeconds) Example for 54 ms desired time constant and 8 ms sampling time is >> y = SpeedController(0.054, 0.008) 6. This will give you five values. We will use these numbers to generate your data files. The five generated values y, Y= π. πππππππππππ − π. πππππππππππ 2 π. ππππππππ π. ππππππππ π Table 1: System Parameters System Parameter Desired Time Constant (s) Sampling Time (s) Value 0.054 0.008 Method Part A 1. Enter calculated system values into the computer from SpeedController. 2. Observe the change in the motor speed of the motor-generator system. 3. Record experimental results. 4. Compare results with simulated results. 5. Superimpose the results on a graph together to draw conclusions. Part B 1. Connect the Power Grid to the system. 2. Insert z-ID and system values to determine the number of resistors. 3. Observe the change in the motor speed of the motor-generator system. 4. Record experimental results. 5. Compare results with simulated results. 6. Superimpose the results on a graph together to draw conclusions. 3 4. Controller Design Calculation Figure 1 is the block diagram to be used for this experiment. Figure 1: Speed Control Block Diagram Step 1 Download the noload.m file from Moodle and load it into MATLAB. This file contains the response of the motor when a voltage of 24 Volts is applied. The controller πΊπ (π§) relates the error in counts/second to PWM Units, thus the motor speed won’t need to be converted to any other units. To obtain the transfer function that relates the applied voltage to the speed, it is required to use first order response fitting to the motor response data. This will become, π΄ 1+ πs πΊπ1(π ) = (1) Since the speed cannot be analysed in this experiment, the encoder that is used will sample the counts. Thus, the speed is calculated, and a transfer function is formed relating voltage to the counts, by adding an integrator. This results in, πΊπ (π ) = π΄ π (1 + π π ) (2) To find the values of the system gain A and the time constant π. By extrapolating the set of data from the noload.m file and plotting a graph of time (Column 1) as x-axis and the motor speed (Column 3) as 4 y-axis. This will produce an experimental plot of the response of the motor. The values for A and π can be determined using MATLAB as shown in Figure 2. Figure 2: MATLAB Value Calculation Since the system gain A, is simply the steady state of the graph, using the theoretical response of w(t) allows us to find the time constant value. This is shown in Equation 3. π€(π‘) = 24π΄ (1 − π − π‘ π) (3) To find the time constant value, at t = π , π€(π‘) = 24π΄(1 − π −1) (4) From MATLAB, π¨ = πππππ. π πππ π(π)π = ππππππ. π By plotting a line of π(π)π = ππππππ. π across the theoretical graph, this can approximately determine the time constant, as seen in Figure 3. 5 Figure 3: Finding the time constant π This results in the time constant as π = π. ππππ. Using these values, allows a comparison between the theoretical and experimental, as seen in Figure 4. 6 Figure 4: Theoretical vs. Experimental MATLAB Plot Step 2 By combining all blocks in the block diagram, except πΊπ (π§), the plant transfer function can be obtained as follows. πΊπ (π§) = π [ π΄ (π§ − 1) 24 (1 − π −π π ) ] π 126 π (1 + ππ ) π§π (5) (π§ − 1) π§π (6) Break this into two parts, πΊπ (π§) = π΄(π§) Using the following commands in MATLAB, found from Moodle, this allows the calculation of A(z). The system gains A, and the π values are found from the previous part, whilst the T (sampling time) value is found from the excel spreadsheet found on Moodle. 7 >> num = [24*A]; >> den = 126*[tau 1 0]; >> [numd, dend] = c2dm(num,den,T,’zoh’); >> roots(numd) >> roots(dend) This results in, ππππ‘π (ππ’ππ) = −0.930487042825578 1 0.805561107667721 ππππ‘π (ππππ) = The c2dm function will automatically take into account of the zero-order hold (ZOH). π΄(π§) can now be written in the form of, π΄(π§) = πΆ(π§ − π§1 ) (π§ − 1)(π§ − π1 ) (7 ) Where the constant C is calculated from the MATLAB commands. By substituting (7) into (6), πΊπ (π§) is now, πΊπ (π§) = πΆ(π§ − π§1 ) π§π(π§ − π1 ) (8 ) The following values can now be substituted into (8), where: • πΆ = 4.863343080223641 • π = 0.008 (ππππππππ ππππ) • π§1 = −0.930487042825578 • π1 = 0.805561107667721 πΊπ (π§) = πΆ(π§ − π§1 ) 4.8633(π§ + 0.9305) = 0.008π§(π§ − 0.8056) π§π(π§ − π1 ) 8 (9) Step 3 To obtain the πΉ(π§), the given design specifications will need to be used. However, the controller must also have a zero steady state error which can be achieved by eliminating the ringing zero introduced by the negative zero in the number of πΊπ (π§). The location of the closed loop pole in the s-plane can be found through a first order response with a desired time constant of 0.054 seconds, π = − 1 1 = − = −18.5151852 π 0.054 (10) Thus, an approximation for π§ can be obtained, π§ = π π π = π −18.5151852 ×0.008 = 0.8623033568 (11) However, this system has a zero at π§ = −0.930487, which is within the unit circle, but is on the negative real axis. This would mean a ringing in the stable system and would be considered undesirable. To eliminate the ringing, applying the stability constraint to make this zero absorbed by the numerator of πΉ(π§) will help this problem. Thus, the desired πΉ(π§) becomes, πΉ(π§) = π0 (π§ + 0.9305) π§(π§ − 0.8623) (12) This also satisfy the causality constraint, thus substituting πΉ(1) = 1, will result in π0 as, π0 = (1 − 0.8623) ≈ 0.07132741124 (1 + 0.9305) (13) Hence, πΉ(π§) is, πΉ(π§) = 0.07133 (π§ + 0.9305) π§(π§ − 0.8623) 9 (14) Step 4 To obtain the controller transfer function, knowing πΊπ (π§) and πΉ(π§) it is possible to use, πΉ(π§) 1 πΊπ (π§) (1 − πΉ(π§)) (15) π§(π§ − 0.8623) − 0.07133(π§ + 0.9305) π§(π§ − 0.8623) (16) π§ 2 − 0.93363π§ − 0.066369 π§(π§ − 0.8623) (17) πΊπ (π§) = Firstly, we need to find 1 − πΉ(π§), ∴ 1 − πΉ(π§) = = By substituting πΊπ (π§), πΉ(π§) and Eqn. 17, the controller transfer function is, πΊπ (π§) = = (π§ + 0.9305) 0.07133 0.008π§(π§ − 0.8056) π§(π§ − 0.8623) β π§ 2 − 0.9336π§ − 0.066369 4.8633(π§ + 0.9305) π§(π§ − 0.8623) (18) 0.07133(π§ + 0.9305) 0.008π§(π§ − 0.8056) β 4.8633(π§ + 0.9305) π§ 2 − 0.9336π§ − 0.066369 (19) π(π§) 0.000117336π§ 2 − 0.00009453π§ ≈ π§ 2 − 0.9336π§ − 0.066369 πΈ(π§) (20) 0.000117336 − 0.00009453π§−1 1 − 0.9336π§ −1 − 0.066369π§ −2 (21) = The coefficients were calculated through simplification, thus by cross-multiplying the coefficients, we can simplify it to the implementation, π(π) = π. ππππ π(π − π) + π. πππππ π(π − π) + π. πππππππ π(π) − π. ππππππππ π(π − π) 10 5. Simulink Block Diagram Part A – Design Verification The Simulink block diagram for this part is designed correctly, if the actual response shows zero steady state error and a first order response that shows a time constant of ππ . The block diagram was adjusted with no load to generate a plot displaying the motor speed changing from 1000 rpm to 2000 rpm. Figure 5: Simulink Block Diagram for Part A 11 Part B – Disturbance Rejection For the controller to be successfully designed, the resistors that are connected through the LoadSim will momentarily drop the speed, however the controller will make the system get back to its specified speed. The only difference between Part A and Part B, is the repeating sequence (stair) that’s been added to the number of resistors. The values of the repeating sequence are based on the z-ID 5162176 which has been converted into hexadecimal. Figure 6: Simulink Block Diagram for Part B 12 6. Part A – Discussion The results produced by Part A’s Simulink block diagram was superimposed with the experimental data as show in Figure 7. Figure 7: Simulation vs Experimental Data for Part A The time constant used for the design of the speed controller has proven to be very effective, thus reflecting a successful result. It can be seen that the simulation performed a lot more smoothly compared to the experimental results, however both responses are consistent. The prominent noise that happens during the steady state, could be a result of various physical limitations. For example, systematics errors that may have affected the results, could be the two motors connected to the central shaft that drives the system. The motion of the motors may have produced small vibrations, which could have affected the experimental data. To reduce the effect of this error, dampening measures such as lubrication between the motors could help reduce the vibration together. 13 7. Part B – Discussion Figure 8: Simulation vs Experimental Data for Part B In Figure 8, it is evident that the simulation and experimental data are similar and consistent. The speed controller that was designed proved to be successful in rejecting the disturbances effectively. Despite a slight initial overshoot in the motor speed for the experimental data, both results are in accordant with each other. The spikes on the plot are a result of the changes to the resistor loads. The simulation data drops faster and lower in motor speed than the experimental data but recovers faster. The ambient noise within the experimental data could be a result of the resistors and wires. Since this experiment, is set up as an electrical power-grid, applying a varying load pattern. In reality, these resistors and wires are imperfect and will have slight deviations from their labelled resistance within a tolerance. The load draws current through the changing resistors, thus allowing a built up in error 14 through resistive inconsistencies. To minimise this effect, it may be possible to create a more sensitive simulation which could result in a more accurate graph as it considers the varying changes of the load. 8. Conclusion In conclusion, the method for designing a zero steady state error controller was successful, as a result of proper planning and choice of the desired transfer functions and the plant. Using the direct analytical design method, a speed controller was able to be developed and implemented, thus controlling the rotation of a motor. Despite the simulation results being much smoother, the experimental results proved that there are a large number of factors that may affect the system. The prominent noises from the experimental data is inevitable, as a result of physical limitations, however it is possible to improve on the experiment method, and use higher quality equipment, that can imitate the simulated result. 15
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )