              Experiment 5: Position feedback control using a PI controller Connect the motor and set up the proportional gain model in SimulinkConnect the motor to the PC and open up MATLAB as in previous experiments. Set T=1/2048 and S=inf as in previous experimentsRemember to go to system processes and set the number of cores used by the MATLAB application to one.  (1) Set up the following Simulink model, which can be downloaded here. Replace the PID controller using the PI controller that you have designed for real time position feedback control of the DC motor. 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) Fine tune the controller for the desired phase margin of 45 degrees and measure the gain margin.  Gain margin and phase margin of the closed system are measured using the open-loop transfer functions inside the closed loop.  For the open loop frequency response its input is the input to the PID controller in the above figure and its output is the input to the negative input of the comparator.  In order to measure the margins a scope has to be connected to the input of the PID controller for the input of the open loop frequency response. (3) Measure time domain performance characteristics including rise time (10%-90%), settling time(5%), overshoot and error constants.  For measuring the error constants the triangle wave can be obtained by passing a zero mean square wave through an integrator and the parabolic wave can be obtained by passing the triangle wave through an integrator.  The error constants are measured in steady state rather than transient state. (4) Change the PID controller parameters to see the effects of the P, I and D parameters on the performance of the system. Task 1 - Connect the motor and set up the PID controller model in SimulinkWe 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. 1) Open the Simulink model shown below which can be downloaded here. Run the program and make sure it works. 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. Using the PI controller that you have designed for the PID controller for real time control of the DC motor.  Measure and record the phase margin and gain margin of the DC motor real time control system by applying a sine wave to the closed loop system and measuring the open loop frequency response, i.e. the error signal (output of the comparator and input to the controller) is the input and the feedback to the negative input of the comparator is the output. 2) If the phase margin is not 45 degree fine tune the controller for the desired phase margin.   You can lower the corner frequency of the PI controller and adjust the gain to increase the phase margin and vice versa.  Measure and record the fine tuned margins. 3) Observe the steady state error of the control system under step, ramp and parabolic input.  Describe the error process.  If the error is not zero comments on why it happens.   Can it be reduced using the dithering? Why? 4) Measure the following transient characteristics.Delay timeRise time (10% - 90%)Percentage overshootSettling time (5%) 5) Find the resonance frequency and peak of the closed-loop control system of the real DC motor by measuring the frequency response of the closed loop system around the resonance frequency obtained using the estimated motor transfer function and Matlab.  Are they the same as the theoretical predictions?  Make comments on the similarity and difference. Task 2 - Effect of altering P, I and D on time domain performance Take  measurements for the following characteristics for the controller:Delay timeRise time (10% - 90%)Percentage overshootSettling timePosition error constantand record these results in the following table: Increase the value of I from zero in the PID controller 5 times inclusive, while keeping D zero and P the fine tuned value; each time record the results in the table.  After recording these results for 5 different values of I, keep P and I the fine tuned values and increase D from zero 5 times inclusive and record the results in the table. Comment on the effect of changing  I and D on the characteristics of the control systemNote: If you encounter problems changing the value of D, simulate the control system on a transfer function block with the same transfer function as that found in experiment 3. Make sure it is the position output transfer function. Still investigate the effects of I, however, on the physical motor. The problems with increasing the value of D may occur due to noise in the output signal.