Anda di halaman 1dari 13

# September 12, 2009

## Experiment # 1: Ball & beam EE 380 (Control Lab), Fall 2009

D EPARTMENT OF E LECTRICAL E NGINEERING , IIT K ANPUR .

## Some information about the ball & system

xout xmax

The control system has two loops as shown in Figure 1. Pin (s) is as follows: Pin (s) = 1 s
Rm Jeq Km K g s + Kb K g

xin

xmax

## Figure 2: A saturation nonlinearity.

Please also use the write up that we already provided to you for this setup1 . For reference, we have included in gures 16 through 20 scanned copies of pages from  that are relevant to this experiment. Note that the write up has the following differences with respect to : 1. The write up denes Jl as Jl := J120 + J72 + J24 = 2.42 105 kg-m2 , whereas the table in Figure 19 gives the value of Jl as 0.001 kg-m2 when the arm is at the end of the disc. 2. The write up says Jeq = Jl + K2 g Jm . This works 2 out to 0.00192 kg-m , whereas Figure 20 gives the value of Jeq as 0.0029 kg-m2 . 3. The transfer function (TF) from to x in the write gr X (s) up is (s) = Ls2 , whereas Figure 17 shows the TF as X (s) 5 gr (1) = (s) 7 Ls2 We will consider the values given in  as the correct ones. However, in our design, we will use either one of the two values of Jeq shown in item 2 above as, in retrospective, this has a tolerable effect on the design of Cin . For the TF (s) , however, we will use Quansers expression shown in Equation (1). Each limiter in Figure 1 is described by the following equation xout = xin xmax if | xin | xmax , if | xin | > xmax
X (s)

3. Hardware limiter: the secondary gear (120 teeth) at the motor (see Figure 17) is allowed to turn only in the interval /4. 4. Hardware limiter: the beam has a length of 43.18 cm (see Figure 20). In the software, the midpoint of the beam has been chosen as the origin. So, the ball may move freely approximately 0.2 m on either side of this midpoint, after which it hits the end of the beam and stops.

Design goals

The goals for the controllers Cin (s) and Cout (s) are: Loop-shaping: The design must be based on the loop-shaping methods we learned in EE250 during Spring 2009. Respect the limiters: We need to take care that each signal stays within the linear region of its respective limiter. Why? Because, in EE250, we did not learn any technique that helps us account for the limiters at the design stage itself. So, if the signals will be in the saturation region of the limiters, then the system may behave in ways that we did not expect during design. Of course, we can predict the system behavior through simulations that take the limiters into account. But, that would not be very neat. Stability: The model that we have has several simplifying approximations. Consequently, we have unmodeled dynamics. We wish to have good stability in spite of these. Steady state error: The ball needs to settle to any specied point on the beam with ess 2%. Settling time: Mr. Manavaalan has found from his experiments with the dual-motor ball and beam setup that it is possible for the ball to settle at any specied point on the beam from anywhere on the beam in ts 5 s. So, we will aim for this settling time.

and is further illustrated in Figure 2. Such a limiter is called saturation nonlinearity. Going from left to right in Figure 1, these limiters are as follows: 1. Software limiter that prevents d from exceeding /4 rad. 2. Software limiter that prevents Vi from exceeding 6 V.
Instructor: Ramprasad Potluri, Room 217 A & B, Western Labs, Phone (off): 259-6093, (lab): 259-7735, E-mail: potluri@iitk.ac.in. 1 The write up can be downloaded from http://home.iitk.ac.in/lbehera/ee380_2007/expt2-Q.pdf

1 of 13

## September 12, 2009

Inside PC

xd Cout (s) ux d Cin (s) uV

6 V
Vi Pin (s)

gr 1 5 7 L s2

0.2 m
x

## Figure 1: The ball and beam control system. Pin (s) =

Rm Jeq Km K g

1 s + Kb K g

Overshoot: The value of xd should be such that the ball will not hit the ends of the beam. If we give xd = 0.2 (the length of the beam from its center), then, with a 50% overshoot, the peak value of x is 1.5/5 = 0.3 m, at least in simulation. If the setup will respond well, then in practice too the overshoot may be almost 10 cm. Such an overshoot will make the ball hit the ends of the beam, and is not acceptable. M p 20% in simulations may potentially be alright (we need to check, though). Combined with the friction that exists between the ball and the beam, in actual implementation, this overshoot may be smaller. On the other hand, if we aspire in simulation for absence of overshoot, then, according to Mr. Manavaalan, the ball may not reach its destination due to the friction. Controller order: Cin (s) and Cout (s) need to be of as low order as we can achieve so that they are simple to program. Also, the lower the order of the controller, the fewer parameters it has to tune online.

x (t) xd

20 log10 | Gdes ( j )|

t ux t

u l g

Figure 3: How the loop gain affects M p of x (t) and magnitude of u x (0+).

xd

C (s)

ux

G (s)

3
3.1

## Tool: Loop shaping

Recap of EE250-Fall2009s loopshaping method

In EE250, Spring 2009, we saw the following method for shaping the loop gain of the control system (this is valid for stable minimum-phase2 GOL (s)):
d(s) R(s) +

+
GOL (s)

Y (s)

n(s) +

1. For effective disturbance rejection and low steady state error, make | GOL ( j0)| high. This can be done by choosing suitably large values of K p , Kv , or Ka so that the low-frequency section of the BMP of GOL ( j g ) is above the low-frequency forbidden zone. 2. For effective noise suppression, make | GOL ( j)| low. This can be done by keeping the highfrequency section of the BMP of GOL ( j g ) above the high-frequency forbidden zone. 3. Choose g suitably for adequate speed of response. 4. In order to have adequate PM, make the BMP have a 20 dB/dec section that is centered at g . Note that, if the 20 dB/dec section centered at g is at least one decade wide on the BMP, then the PM will be 90 . If the section is one decade wide on the ABMP, then the PM will be 60 .

20 dB/dec
all stable TFs, and those that have the right-most poles only at the origin, that have the same BMP, the one that has the phase plot spread over the smallest interval of phases is said to be minimum-phase TF.
2 Of

NOTE: Item 4 above is the one that makes our loopshaping method applicable only to minimum-phase TFs. The rst three items can be used for shaping the loop gains of nonminimum-phase TFs too.

2 of 13

## September 12, 2009

y1

3.2

r1

e1

G (s)

These additional tips use the following facts (most likely, you discovered these on your own in the project in EE250-Fall2009): 1. The nal value theorem relates the low-frequency section of the loop-gain to the area of the timedomain response that is near t =
t

y2 f () e2 r2

## lim y(t) = lim sY (s)

s 0

2. The initial value theorem relates the highfrequency section of the loop-gain to the area of the step response that is near t = 0+
t 0+

k2 y

f (y) k1 y

## lim y(t) = lim sY (s)

s

3. From the previous two points, I am conjecturing that, as we travel right to left on the axis, we travel left to right on the t axis of the time-domain response. We summarize this idea through the following rule of thumb:
t0++

lim y(t) =

lim sY (s).

Figure 6: A sector-bounded nonlinearity. For such a nonlinearity, the following holds: f (0) = 0, k1 f (y)/y k2 for y = 0.

Here, t = 0+ is the time instant immediately to the right of t = 0, while t = 0 + +, t = 0 + ++, etc are time instants progressively further to the right of t = 0+. s = , s = , etc carry similar meaning. Finally, the additional tips are as follows: 1. To reduce |u x (0+)| reduce | Gdes ( j )| immediately after u , as shown in Figure 3, while also keeping the loop gain at higher frequencies small as shown. This can be seen using initial value theorem and Figure 4 as follows: u x (0+) = C () 1 + C () G ()

## Tool: Circle criterion

Assume that G (s) in Figure 5 has no poles in the RHP and that the nonlinearity f is sector-bounded as dened in Figure 6. A sufcient condition for inputoutput (from r1 , r2 to e1 , e2 , y1 , y2 ) stability of the system in Figure 5 is that the polar plot (i.e., G ( j ), 0 ) does not enter or enclose the circle that lies in the interval [1/k1 , 1/k2 ] with center on the real axis in the Nyquist plane (see Figure 7).

## Design of inner loop

assuming R(s) = 1/s. So, making |C ()| small will make |u x (0+)| small. Note that, the choice of u and l itself involves trial and error in practice. 2. To reduce M p (that occurs at t = 0 + +) of x reduce | Gdes ( j ) in the region much below high frequencies, but above the low frequency region, as shown in Figure 3. This can be seen using the above-mentioned conjecture as follows:
t0++

As we are aiming for ts 5 s for the outer loop, we will design the inner loop so that its settling time is about 5 10 times smaller. So, we can have ts 1 s for the inner loop, a number that agrees approximately with Quansers own peak time mentioned in Figure 18. How to design Cin while taking the two inner loop limiters into account? We have two options:
des (IL stands for 1. Ignore the limiters, specify a GIL inner loop, and des stands for desired), simulate

lim y(t)

lim

## C (s) G (s) 1 + C (s) G (s)

assuming R(s) = 1/s. So, making |C ( )| small will make M p small. 3. To reduce ts of x, we have two options: (a) Increase g . (b) Decrease M p as mentioned in item 2 above. We can assess the effect of each of these in Matlab using MAGSHAPE3 along with simulation as done in Section 6.
is a GUI tool in the Robust Control Toolbox that we used in EE250-Fall2009
3 MAGSHAPE

k11

k12

Im 0 Re G ( j )

Figure 7: Illustration of the circle criterion. The circles cen1/k2 ter is on the real axis and radius equals 1/k1 . 2

3 of 13

## September 12, 2009

Im Re G ( j )

Figure 9: Illustration of the circle criterion for nonliearities with k1 = 0, k2 = 1. The shaded region is outside the circle.

Step Response 6 5 Amplitude 4 3 2 1 0 0 0.1 0.2 0.3 0.4 0.5 Time (sec) 0.6 0.7 0.8 0.9 1 uV

## 0.8 0.6 0.4 0.2

the closed inner loops step response, and see if the signals uV and are within the linear region of their respective limiters, and have the required ts , M p , and ess . If they do not satisfy any of these criteria, then repeat the process. 2. Use some technique that takes the limiters into account at the design stage itself (the circle criterion is such a technique). This way, the amount of simulation effort will be reduced. We have used the second option for the inner loop. We will use the rst option for the outer loop. You are free to choose either option.

0.1

0.2

0.3

0.4

## 0.5 Time (sec)

0.6

0.7

0.8

0.9

Figure 10: Satisfactory step response of inner loop in simulation. ts 0.5 s for a 2% tube, overshoot is absent in , uV 5.

5.1

## Applying circle criterion to our inner loop

When the loop has nonlinearities in the forward path as in Figure 1, instead of in the feedback path as in Figure 5, we can use the block diagram transformations shown in Figure 8 and then apply the circle criterion. Our system has saturation nonlinearities. This nonlinearity is sector bounded with k1 = 0 and k2 = 1. Thus, if we design Cin (s) such that the polar plot of des ( s ) = C ( s ) P ( s ) is to the right of the straight GIL in in line through 1 as shown in Figure 9, then our inner loop will be stable.

1. On a semilog grid, draw the asymptotic Bode magnitude plot (ABMP) of Pin (s). des (s). For 2. On the same grid, draw the ABMP of GIL this, guess an ABMP that may have approximately the desired ts , M p , ess , and whose polar plot may remain entirely in the shaded region of Figure 9. 3. Check using Matlabs nyquist function if the podes is entirely in the shaded region of lar plot of GIL des . Figure 9. If it is not, then revise the ABMP of GIL
des 4. Plot step responses of GIL des 1 + GIL

and

Cin

1+

des GIL

## . If ts , M p , ess are not as desired,

des . The or if |uV | > 6, then revise the ABMP of GIL tips of Section 3.2 may be useful here. 5. If the step rsponses are satisfactory, then Cin (s) = des ( s ) P ( s ) . GIL in

Figure 10 shows satisfactory step responses from our design. We need to verify that this Cin performs well in practice too. This will be done in the lab. The next task is to design Cout . For this, the inner loops TF is denoted Gin (s) and equals
des GIL des 1 + GIL

5.2

## Steps in design of inner loop

The following steps employ the loop shaping method recapped in Section 3.1.

4 of 13

## Design of outer loop

20 10 Amplitude 0 10 20 30 40 0 1 2 3 4

Step Response

We perform the design as follows: 1. Form Pout (s): Form Pout (s) as 5 7 Ls2 Gin ( s ), instead 5 gr of as 7 Ls2 Gin (s). In the practical implementation, we will prex a sign to the Cout thus obtained4 . des in MAGSHAPE: We 2. Draw a preliminary GOL des draw a GOL that we hope will give us the kind of unit step responses that we desired in Section 2. In this drawing, we use the loop-shaping technique of Section 3. We plot u x (t) and x (t) for a unit step input xd (t). For a start, we can choose g to be about 5 times des . The 20 dB/dec less than the g we had for GIL section centered around g will need to be made at least one decade wide. This is because our plant model involves simplifying approximations. 3. Iterate the design: If the u x and x are not as desired, then we iterate our design in MAGSHAPE until we obtain the desired results. 4. Reduce order of Cout : Reduce the order of Cout thus obtained above to a maximum of second. For this, use reduce5 , or MAGSHAPE6 . If, in MAGSHAPE, the reduced Cout does not match the unreduced Cout well, then go back to step 2. NOTE: In this process, we have not suggested using the circle criterion. The reason is that we found the ts obtained using the circle criterion is about 30 s or more. The circle criterion is only a sufcient condition, not a necessary condition. So, it is quite possible that even when the system does not satisfy the circle criterion, it will be stable and its responses will respect the limiters. NOTE: You may use a semilog graph paper instead of MAGSHAPE. In the following, we discuss each of the above steps.
gr

ux

10

## 1 x 0.8 Amplitude 0.6 0.4 0.2 0 0 1 2 3 4 5 Time (sec) 6 7 8 9 10

des Figure 12: Unit step responses using the preliminary GOL shown as test in Figure 11. The magnitude of u x is not acceptable. Also, we will try to reduce ts further.

or Pout = or

Pout =

s2

s 11.76

s 46.71

+1
des GOL

6.2

## Draw a preliminary MAGSHAPE

in

The MAGSHAPE window with the preliminary des is shown in Figure 11, and the obshape for GOL tained unit step responses are shown in Figure 12. We present here the m-le bbout11.m we used to capture the results from MAGSHAPE, calculate the unreduced controller, and plot the results7 :
% bbout11.m: File to capture results from % MAGSHAPE and plot step responses of u x and x. % % To be used after using MAGSHAPE %% In MAGSHAPE I declared a lter named "test". % Having selected the radio button corresponding % to "test", I added many points that I wanted my % Gdes to t, and gave 6 as the lter order. % Then, I clicked on "t data" button. This % generated the lter named "test" that I am % using in the following: [ num1 , den1 ]= l t i t f ( t e s t ) ; % I found that num1 (den1) contain some terms % that are about 0.0001 or less times less in % absolute value compared to the largest-in% absolute-value term of num1 (den1). These % terms caused Gdes1 (earlier obtained as % Gdes1=tf(num1,den1)) to contain high-order % nondominating terms that made it a non-proper % TF. So, I wrote a little function "cleanup"
7 You may use the m-les provided in this note if you wish, but with your own Cin. You may also use the m-les that you wrote in EE250-Fall2009.

6.1

## Form Pout (s)

% TF o f p l a n t i n o u t e r loop Pout = s e r i e s ( Gin , t f ( 5 / 7 9 . 8 , [ 1 , 0 , 0 ] ) ) gives: Transfer function : 350 s 0 . 0 9 2 s ^5 + 5 . 3 7 9 s ^4 + 5 0 . 5 4 s ^3 This is essentially, Pout =
4 Thanks 5 In

## 350 s2 (0.092s2 + 5.379s + 50.54)

to Mr. Manavaalan for suggesting this Matlabs Robust Control Toolbox 6 Thanks to Himanshu Mohan for suggesting me the usage of MAGSHAPE for the reduction

5 of 13

## September 12, 2009

des shown as test. This one gave us M = 0% (OK), | u | 20 Figure 11: MAGSHAPE window showing a preliminary GOL p x (bad), ts 7.5 s for a 2% tube on x, as shown in Figure 12).

% that helps remove the non-dominating high % order terms from the TF of "test". [ n , d]= cleanup ( num1 , den1 ) ; Gdes1 = t f ( n , d ) ; % Recap Pout, and then form Cout: % Controller designed for inner loop % Cin = tf([50,0],[10,1]); Cin = t f ( [ 5 , 1 ] , [ 1 , 0 ] ) ; % Plant in inner loop Kg = 7 0 ; e t a = 0 . 5 ; Km = 0 . 0 0 7 6 7 ; Kb = Km; J l = 2 . 4 2 1 0 ^ ( 5 ) ; Jm = 3 . 8 7 1 0 ^ ( 7 ) ; Rm = 2 . 6 ; J e q = J l + Kg^2 Jm ; Pin = t f ( 1 , [Rm J e q /Km/Kg/eta , KbKg , 0 ] ) % Controller plus plant in inner loop gin = feedback ( s e r i e s ( Cin , Pin ) , 1 ) ; % Plant in outer loop Pout = s e r i e s ( gin , t f ( 7 / 1 7 , [ 1 , 0 , 0 ] ) ) ; % Cout = Gdes1/Pout ; % TF to see controller effort in outer loop f 1 = feedback ( Cout , Pout ) ; % TF to see plant output in closed outer loop f 2 = feedback ( s e r i e s ( Cout , Pout ) , 1 ) ; % TF to see plant output in closed outer loop f 3 = feedback ( 1 , s e r i e s ( Cout , Pout ) ) ; % Time span & step size for step response % computation t = linspace ( 0 , 1 0 , 1 0 0 0 ) ; close a l l subplot ( 3 , 1 , 1 ) ; s t e p ( f1 , t ) ; g r i d ; legend ( u_x ) ;

subplot ( 3 , 1 s t e p ( f2 , t ) ; subplot ( 3 , 1 s t e p ( f3 , t ) ;

## ,2); g r i d ; legend ( x ) ; ,3); g r i d ; legend ( e ) ;

% Print the gure to an .eps le for inclusion % in the report. p r i n t depsc Goutr e s p o n s e s . eps % Next, we will prepare for reducing the order % of Cout. % Access numerator and denominator of Cout [num, den ] = t f d a t a ( Cout , v ) ; % Store the state space realization of Cout % as a system matrix to be used by MAGSHAPE. C l t i = l t i s y s ( t f ,num, den ) ; % Now use MAGSHAPE and modify this Clti. For % this, write Clti as a lter name. This will % display the Bode magnitude plot of Cout. Then, % see the le bbout22.m for what to do next.

The function cleanup (in the le cleanup.m) that is used in bbout11.m is shown below:
f u n c t i o n [ n , d]= cleanup (num, den ) numerr = 0 . 0 0 0 1 ; denerr = 0 . 0 0 0 1 ; % In future, we can specify the values of % numerr & denerr based on various factors % such as the orders of the numerator and % denominator, and maybe others that I am % not seeing at the moment.

6 of 13

## Step Response 4 3 Amplitude 2 1 0 1 2 0 1 2 3 4 5 Time (sec) Step Response 1.5 x Amplitude 1 6 7 8 9 10 ux

figure bode ( s e r i e s ( Cout , Pout ) , s e r i e s ( Cred , Pout ) ) , legend ( Cout Pout , Cred Pout ) , g r i d p r i n t depsc bode . eps f 1 = feedback ( Cred , Pout ) ; f 2 = feedback ( s e r i e s ( Cred , Pout ) , 1 ) ; f 3 = feedback ( 1 , s e r i e s ( Cred , Pout ) ) ; t = linspace ( 0 , 1 0 , 1 0 0 0 ) ; figure subplot ( 3 , 1 , 1 ) ; s t e p ( f1 , t ) ; g r i d ; legend ( u_x ) ; t i t l e ( u_x using Cred ) ; subplot ( 3 , 1 , 2 ) ; s t e p ( f2 , t ) ; g r i d ; legend ( x ) ; t i t l e ( x using Cred ) ; subplot ( 3 , 1 , 3 ) ; s t e p ( f3 , t ) ; g r i d ; legend ( e ) ; t i t l e ( e using Cred ) ; p r i n t depsc Credr e s p o n s e s . eps

0.5

5 Time (sec)

10

Figure 13: Unit step responses after many iterations of test. ts 5 s (good), |u x | < 3 and M p 0% for xd = 1. This means that if I give xd = 0.2 (the length of the beam from its center), then, |u x | < 3/5 = 0.6 < /4 rad without overshoot in x.

f o r i = 1 : s i z e (num, 2 ) i f abs (num( i ) ) / abs ( max ( den ) ) < numerr num( i ) = 0 ; end end f o r j = 1 : s i z e ( den , 2 ) i f abs ( den ( j ) ) / abs ( max ( den ) ) < denerr den ( j ) = 0 ; end end n = num ; d = den ;

Of several valuable lessons we learned from our trials in reducing the order of Cout , the most relevant here is that the high-frequency roll-off of the test should not be steeper than about 60 dB/dec. If this condition is violated, the sixth order Cout is not properly approximated by a second order Cred (the name we use in bbout22.m for the reduced Cout . The transfer function of our second order Cout is as follows: 0 . 1 5 6 3 s ^2 + 1 6 . 0 4 s + 0 . 0 1 6 0 4 s ^2 + 2 . 7 4 s + 8 . 7 4 Figure 14 shows the bode plots of the loop gain with reduced and unreduced Cout . We note that in both cases, the PM is about 60 . So, we may expect the closed-loop system to be stable with our nal Cout . Figure 15 shows the unit step response of the outer loop using Cred. The results there match well with those in Figure 13.

6.3

## Iterate the design

After about 1 hour of iteration, we arrived at the responses shown in Figure 13.

6.4

## Reduce the order of Cout

We present here the m-le bbout22.m we used to capture the results from MAGSHAPE, calculate the reduced controller, and plot the results.
% bbout22.m: m-le to generate reduced version % of Cout. Works similar to bbout11.m % In MAGSHAPE I found that I could not t % anything to Clti. So, I declared a new % lter named "testC", besides "Clti" & "test" % that were already there. Having selected the % radio button corresponding to "testC", I % added many points (spaced at 1 cm intervals) % along Clti, and set 2 as the lter order. % Then, I clicked on "t data" button. This % generated the lter named "testC" that I am % using in the following: [ num3 , den3 ]= l t i t f ( t e s t C ) ; [ n , d]= cleanup ( num3 , den3 ) Cred = t f ( n , d ) ;

7
7.1

Questions
To do at home

Q1 Verify the block diagram of Figure 1 and the TFs shown in it. Q2 Design using loop-shaping techniques Cin (s) and Cout (s) of the least order possible to achieve the design goals. Q3 Simulate the continuous-time controllers in Q2 using Matlab. If the closed-loop system performance in simulation is not as desired, you may need to redesign your controllers. Q4 Discretize the continuous-time controllers. 7 of 13

## September 12, 2009

Bode Diagram 200 100 Magnitude (dB) 0 100 200 300 0 90 Phase (deg) 180 270 360 450 5 10 Cout*Pout Cred*Pout

tion into account, redesign your Cin , discretize it and repeat Q9. Q10 Import the data recorded in a text le into Matlab, and based on this data, plot the step response of the inner loop of the ball & beam setup. Is the plot similar to what you obtained at home? Q11 If the answer to Q10 is approximately YES, then include this comparison and plots in your report and proceed to Q12. If the answer to Q10 is sure NO, then explain the difference in the results. Taking this explanation into account, redesign your Cin , discretize it and go to Q9.
10
3

10

10

10

10

10

Figure 14: Bode plots of outer loop gain with full order Cout (Cout) and with reduced order Cout (Cred).

Q12 Program your Cout into the appropriate place in the code. Restore the inner loops command input to be obtained from Cout . Apply a step input to the outer loop, and run the ball & beam setup. Does the outer loop seem to behave the way you designed? Q13 If the answer to Q12 is approximately YES, then import the data recorded in a text le into Matlab, and based on this data, plot the step response of the outer loop of the ball & beam setup. Is the plot similar to what you obtained at home? If the answer to Q12 is sure NO, then explain the difference in the results. Taking this explanation into account, redesign your Cout , discretize it and go to Q12. Q14 If the answer to Q13 is approximately YES, then include this comparison and plots in your report and nish up your report, and hand it over to the tutor. If the answer to Q13 is sure NO, then explain the difference in the results. Taking this explanation into account, redesign your Cout , discretize it and go to Q12. Repeat only once. Q15 Conclusions: 1. Is the physics-based model a good match to the plant? If not, what do you think we have ignored that has lead to the difference? 2. What are the skills you learned from this experiment? 3. Would you have preferred to learn a different skill set from the control lab? If yes, which skills? 4. How could we have organized this experiment differently to make it more meaningful to you?

## 5 Time (sec) x using Cred

10

1.5 x Amplitude 1

0.5

5 Time (sec)

10

Figure 15: Step responses u x and x to a unit step input xd with reduced order Cout .

Q5 With the discretized version, perform a simulation of digital control of the continuous-time plant using the m-le sample_code_sim.m provided in the write-up of Experiment 2. Do you think that your digitally-controlled closedloop system will be stable in practice? Will it provide in practice the same performance as did the continous-time version in simulation? Q6 Write the digital controller in C.

References
 Jacob Apkarian. A comprehensive and modular laboratory for control systems design and implementation. Quanser Consulting, 1995.  Torkel Glad and Lennart Ljung. Control Theory: Multivariable and Nonlinear methods. Taylor & Francis, 2000.

7.2

To do in lab

Q9 Program your controller Cin into the appropriate place in the code. Provide a step input to the inner loop, and run the ball & beam setup. Does the inner loop seem to behave the way you designed? If the answer is approximately YES, then proceed to Q10. If the answer is sure NO, then explain the difference in the results. Taking this explana-

8 of 13

9 of 13

10 of 13

11 of 13