Controlling the system
Visual Cue  Narration 

In our last tutorial, we saw how to analyze a system and to see the gain of the feedback system at a particular point on the root locus. In this tutorial, we shall see how to decide which value of the gain to use and how to use this value of gain to design a simple proportional controller.
 
Show slide 1 on finding the gain at a point on the root locus 
Before we see how to *decide* which value of gain to use from the root locus, we see how to obtain the position of the point on the root locus in Scilab and how to use this position to find the gain.

Show slide 2 
We know that the root locus is the plot of the location of the **poles** of <math>kG(s)/(1 + k*G(s))</math> as k varies . That is to say, we need to find the solution of the denominator going to zero: That is 1 + k*G(s) = 0 Or, K = 1/G(s) 
Don't show slide 3, in Scilab, type locate(1) and click on the graph. 
We can find the location of a given point on the root locus using the locate() command. We then need to multiply the [x; y] coordinates returned by this command with [1 %i] so that we obtain the position in the complex plane. We then simply evaluate the rational expression 1/G(s) at the given position using horner() 
Now show all: evans(System) Kp = 1/real(horner(System, [1 %i]*locate(1))) css = horner(s*(Kp*System/. 1)*Rs, 0) Click on a point on the root locus and then shift to Scilab 
The value of gain Kp and steady state value css we obtain here is from the point we clicked on in the root locus. Now that we know how to obtain the gain Kp and steady state value css into the Scilab workspace, we now see how to decide which point to click on on the root locus. 
<show slide 1: achieving specific paramters> OS = 0.30 tr = 0.08 
Lets say we wish to achieve the following parameters: Overshoot = 0.30 Rise time = 0.08

<show slide 2: achieving specific paramters> 
From theory, we know that the values of zeta and omega_n would be <read values from slide>. We type this in Scilab: 
zeta = log(OS)/sqrt(%pi^2 + log(OS)^2) wn = (1/(tr*sqrt(1  zeta^2)))*(%pi  atan(sqrt(1  zeta^2))/zeta) 
As before, we plot the root locus: 
evans(System) 
Now, we use the sgrid function to draw the curves corresponding to zeta and omega_n on the root locus: 
sgrid(zeta, wn) 
We choose the point closest to the point of intersection of these two curves. Note that if these curves do not intersect on the root locus, the performance desired is not achievable without designing a controller that modifies the root locus. If we choose to stay with a simple proportional controller, we will need to change our desired performance thresholds. For this example, however, we do not have to worry as the point of intersection lies near the root locus. 
Kp = 1/real(horner(System, [1 %i]*locate(1))) (Click near the intersection and move to Scilab) 
This is the value of Kp we choose. 
We now design the proportional controller  
PropSystem = Kp*System/. 1 yProp = csim('step', t, PropSystem); plot(t, yProp) plot(t, ones(t), 'r') 
We note that there is high overshoot and some steady state error 
