Pid Control Of A Servo System Computer Science Essay

For this research lab you will be required to finish all of the exercisings listed in this book and compose a study in which you:

Present and explicate the consequences of your simulations.

Answer the inquiries from this lab book.

Provide and explicate the codification fragments that you have developed.

Each exercising includes a list of undertakings ( slug points ) that you need to finish. The undertakings which are highlighted in bold indicate what information you should include in your concluding research lab study.

Exercise 1: Compile and run the plan

Figure1. Controller outputIn this exercising, I have chosen the Kp = 6, Ki = 0, Kd = 0. The ascertained values of the DC servo gave us 90 grades overall without wave-off i.e. terminal to stop. When we applied the accountant for at least 30 seconds, so we saved the informations in the file data.txt as two columns. The first column corresponds to the accountant end product which is shown in figure1 along with the 2nd column corresponds to the system response ( potentiometer electromotive force ) is shown in figure1a below. C: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf11.jpg

Figure1a. System responseC: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf1.jpg

As we can see from the figure 1a above, the system response without the wave-off is measured from approx 2v to -3v which means the overall electromotive force measured is 5 Vs. This reassure the value is right because the given effectual scope for V from press release is in fact: -2.5/+2.5 Volts i.e. 5 Vs overall.

The chief stairss to analyze the response of the system in matlab are as followed:

Run Matlab

Load the data.txt

Dt=1/30 i?? This define the sampling clip

Sz=size ( data,1 ) ; i?? Determine the figure of samples available

secret plan ( [ 0: dt: ( sz-1 ) *dt ] , informations ( : ,1 ) ) ; i?? Plot the accountant end product ( first column )

secret plan ( [ 0: dt: ( sz-1 ) *dt ] , informations ( : ,2 ) ) ; i?? Plot the system response ( potentiometer electromotive force )

Next, when change overing the potentiometer end product Vp ( Volts ) into angular place O ( grades ) we need to happen the transition changeless v2deg to execute the procedure. V2deg is found by utilizing the overall value V and the mensural grades.

5 Vs i?? 90 grades

1 volt i?? v2deg

So, v2deg is = 18.

The secret plan of the system response expressed in grades is shown in figure1c below. C: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf12.jpg

Figure1c. System response expressed in grades.

Exercise 2: Proportional control of the servo system

This exercising will concentrate on how the relative elements in PID control consequence the system. After running the plan for about 30-40 seconds with different values of relative addition Kp. The responses of the systems are shown in figure below along with a tabular array bespeaking what values of the Kp used in each figures and the inside informations responses.




% Overshoot




0.2 s






0.18 s

















Kp= Proportional addition

tr = rise clip ( 10 % -90 % )

T = subsiding clip ( within 2 % )

tp = extremum clip

Note: the above values are merely approximation.f43.jpgf42.jpg

Figure2a. System response with Kp=3

Figure2a. Zoom version with Kp=3

Remarks when Kp=3: As we can see from figure2a above, there is no wave-off when Kp=3 but the overall system is slower comparison with the system when the value of Kp is increased. Degree centigrade: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf23.jpgC: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf22.jpg

Figure2b. Zoom version with Kp=6

Figure2b. System response with Kp=6

Remarks when Kp=6: the response has an wave-off of around 127 % but it gives faster response overall. The response inside informations values i.e. settling clip, rise clip, etc are shown in the table above.C: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf33.jpgC: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf32.jpg

Figure2c.Zoom version with Kp=7

Figure2c. System response with Kp=7

Remarks when Kp=7: The response starts to hover but increase the velocity of response of the overall system. It has an wave-off of around 117 % and increase the settling clip of the response i.e. ts= 0.5seconds.

Figure2d. Zoom version with Kp=8

Figure2d. System response with Kp=8C: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf53.jpgC: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf52.jpg

Remarks when Kp=8: the oscillation starts to increase and it besides increases the subsiding clip. However, it speeds up the overall system.

Overall remarks

The system response stats to hover when the Kp is greater than 6 i.e. when Kp=7 it is hovering as shown in figure2c above. In general, the system response becomes quicker as the Kp additions and the subsiding clip becomes bigger. However, the wave-off of the systems get bigger as Kp increases. The actuator impregnation effects are caused by the physical system that could non transcend a certain boundary bound. If one exceed the bound than, the altering values in the actuator did non give any effects to the systems end product. Furthermore, the steady province mistake is difficult to cut down if we merely used the Kp as we can see from the figures above.

Exercise 3: Proportional control of the servo system with measure perturbation.

In this exercising, we will see the effects of measure perturbation in the servo system with relative control merely.

Having uncommented the necessary codifications country which is “ Dain += 100 ; ” ( In the press release it mentioned Dain+=200 nevertheless in the given codes the Dain +=100 and we were told to go forth it as 100 ) the systems responses are as followed: Degree centigrade: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf72.jpg

Zoom version system of response when Kp=6

Zoom version accountant end product when Kp=6

Controller end product when Kp=6C: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf71.jpg

Remarks when Kp=6: The accountant response is shifted down 0.5 Vs compared to that for the system with the Kp=6 without the perturbation applied to it. Furthermore the system response becomes more oscillate than the system utilizing the same Kp without perturbation. The steady province mistake becomes larger if we merely increase the Kp. It besides increases the overall subsiding clip of the system when we compare that to the old same response without perturbations.

Degree centigrades: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf84.jpgC: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf82.jpg

Zoom version of system response when Kp=8

Zoom version of accountant end product when Kp=8

Remarks when Kp=8: When we increase the Kp to 8, the accountant end product is hovering for a certain period of clip before it reaches the steady province. It is obvious to see that this system response oscillate a batch comparison to that when Kp=6. So when we applied the perturbation, increasing the Kp will merely take to more oscillation, increase the settling clip and steady province mistake ( accountant merely ) but increase the overall response clip i.e. rise clip.

Degree centigrades: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf94.jpgC: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf92.jpg

Zoom version of system response when Kp=4

Zoom version of accountant end product when Kp=4

Remarks when Kp=4: When we cut down the Kp to 4, the accountant end product becomes less oscillating comparison to that when Kp= 6. The end product has a really little wave-off and good rise clip. However, the velocity of the response is reduced somewhat.

Exercise 4: PI control of the servo system with measure perturbation

In order to see the system response when we applied given PID accountant jurisprudence as shown below along with the codifications are:

//PID control jurisprudence

s ( T ) iˆ?iˆ s ( t iˆ­1 ) iˆ«iˆ vitamin E ( T )

U ( T ) iˆ?iˆ K pe ( T ) iˆ«iˆ Kd [ vitamin E ( T ) iˆ­e ( t iˆ­1 ) ] iˆ«iˆ Kis ( T )

//Having got the PID control jurisprudence now we will replace the values in the codification variables consequently.

//When we find the variable declarations subdivisions which is in the chief, we found that each variables //contributes to the above PID control jurisprudence equations.

//In the chief codifications we found one of the subdivision is PID related variables as followed:

nothingness chief ( )


/* PID related variables */

float Kp, Ki, Kd ; // Proportional, derivative and built-in additions

float Error ; // Positioning mistake vitamin E ( t-1 ) ( Vs )

float LastError=0 ; // e ( t-2 )

float SumError=0 ; // built-in mistake, initial is zero

float V ; // Controller end product ( Volts )

int Dist=0 ; // measure perturbation


//TODO implements the PID control jurisprudence and the codifications are as followed:

SumError = SumError + Error ; // mistake accumulated = Sumerror + error signal

V = Kp*Error + Kd* ( Error – LastError ) + Ki*SumError ; // accountant output= relative control *error signal + derivative control* ( error-last mistake ) + built-in control * Sum mistake.

Error= LastError ; //this mistake variable will hive away the intermediate consequence from last mistake


The system response when we applied different values for Kp and Ki are shown in table 4 below along with the system responses in the figures below.





% Overshoot





A n.a







A 0.1s


A 66.67



A 4.5


A 0.1s



A 1.8s


The responses are as followed: Degree centigrade: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf102.jpgC: UsersownerDocumentsdoc.uniS4ACS214, ACS271A3PID2figuresf104.jpg

Figure 4a.Zoom version of system response when Kp=4, Ki=0.1

Figure 4a.Zoom version of accountant end product when Kp=4, Ki=0.1

Remarks when Kp=4, Ki=0.1: The accountant end product and the system responses are more oscillating compared to that with the relative control merely. The value of tr, tp, wave-off and T are non possible to find because it is excessively oscillating.

Degree centigrades: UsersashleyAppDataLocalTempUDEFOVD } GCYDEU8R ( SNUT9G.jpgC: UsersashleyAppDataLocalTemp\_EMYQFRFN42ICK [ H0IXWHDT.jpg

Figure 4b.controller end product when Kp=6, Ki=0.1

Figure 4c.controller end product when Kp=4.5, Ki=0.05

Remarks of figure 4b when Kp=6 and Ki=0.1:

This clip I have saved the axis in the grades form instead than electromotive forces. As we can see in the figure 4b above, the response of the accountant end product has merely one wave-off comparison to that when merely utilizing Kp= 6 in exercising 3 i.e. 2 wave-off. Furthermore, the built-in component will give a better steady province mistake than merely utilizing Kp. The affects of Kp is to cut down the oscillation and gives more stableness to a system as we compare figure 4a and 4b.

Remarks of figure 4c when Kp=4.5 and Ki=0.05:

When comparing the accountant end product response with lone utilizing Kp=3 in the old exercising, we can see that when we merely used the Kp=3 the response is much faster with one wave-off. However, when we added the built-in component to the system as in figure 4c, the response becomes a spot slower but the built-in component gives better steady province mistake of the system comparison to that when merely utilizing Kp.

Exercise 5: PID control of the servo system with measure perturbation

I have non got clip to complete this exercising. However, I am anticipating the system response follow the mention input in a robust manner if a good parametric quantities of the PID accountant are selected.

By and large the affects of each component in PID accountant:

P is the relative component which relates to oscillation of a system response.

I is the built-in component which affect the steady province of a system response.

D is the derivative component which affects the velocity of the response and reduces the wave-off.