              # Experiment 4: Proportional Position Feedback Control Connect the motor to the PC and open up MATLAB as in previous experiments

Remember to go to system processes and set the number of cores used by the MATLAB application to one.

(1) Apply Hilink for real time control and fine tune the controller for the desired overshoot.

(2) Take measurements of the transient characteristics and compare them with simulation results.

(3) Determine error constants experimentally and compare them with theoretical predictions based on estimated transfer function.

(4) Study steady state error under step input and the effects of dithering.

(5) Determine phase margin and gain margin of a closed-loop control system experimentally using simulation and compare them with theoretical predictions.

(6) Measure the resonance frequency and peak for closed loop system.

(7) Measure bode plot of the closed loop systems. We begin by making sure the motor is connected to Hilink control board as shown below.

Note: P0_A could also be red+black and P0_B could also be purple under our new colour code. Once the motor is correctly connected to the Hilink control board and the control board is correctly connected to the PC, open MATLAB. Open windows task manager and set the number of cores that the MATLAB process operates on to only 1. In the MATLAB command window set S = inf and T = 1/2048. Run the program and make sure it works properly.

Replace the PID controller using the P controller that you have designed in Preparation for this experiment for real time control of the DC motor and measure the overshoot of the control system to see if it is 20%. If not fine tune the controller using the experience gained in Preparation for this experiment  for 20% overshoot in order to meet the design specification.

Note: There is a block of K at the output of the E0 block in the motor position block for conversion between radian and degree.   You may have to set K from 180/pi to 1 depending on the unit of your transfer function used for the design.  The system could be unstable if K is incorrect.

2) Measure the  rise time (10%-90%), settling time (5%) and overshoot.  Compare them with Matlab simulation predictions and mak comments

3)Determine the error constants for the DC motor control system using your experience gained in the Preparation.  Compare them with theoretical predictions based on the estimated transfer function and make comments.

4) Is there position error for step response in the control system?  Why?  Increase the amplitude (e.g. 5) of the dithering to see what happens and make comments.

5) Measure the phase margin and gain margin of the DC motor real time control system.  Compare the measured margins with the results obtained in Preparation and make comments.

Task 2 - Closed-loop frequency response

1) Set P=1 for the proportional controller and find the resonance frequency and peak of the real time closed-loop control system of the DC motor shown in the above Simulink program, The resonance frequency and peak of the real time control system can be found by measuring the frequency response of the closed loop system around the resonance frequency obtained in Preparation.  Are they the same as the theoretical and simulation results?  Make comments on the similarity and difference.

2) Measure the frequency response of the closed-loop real time control system for the closed loop bode plot as follows.  Set the amplitude of the sine wave from the signal generator block to 3 and adjust the frequency to 2 rad/sec. For a number of frequencies ranging from 2 rad/sec up to the frequency at least 10 times higher than the estimated resonance frequency make a table through experiment in terms of the followings: frequency (rad/sec), frequency (Hz), time difference between adjacent peaks (s), phase shift (degree), input (peak to peak), output (peak to peak) and the gain.  Taking extra measurements close to the resonant frequency and draw a bode plot for the closed loop system.