hw08_sol

pdf

School

University of California, Berkeley *

*We aren’t endorsed by this school

Course

70

Subject

Electrical Engineering

Date

Oct 30, 2023

Type

pdf

Pages

18

Uploaded by DeanKangaroo5110

Report
EECS 16B Designing Information Systems and Devices II UC Berkeley Fall 2023 Homework 8 This homework is due on Saturday, October 21, 2023, at 11:59PM. Self- grades and HW Resubmissions are due on Saturday, October 28, 2023, at 11:59PM. 1. System Identification You are given a discrete-time system as a black box. You don’t know the specifics of the system but you know that it takes one scalar input and has two states that you can observe. You assume that the system is linear and of the form x [ i + 1 ] = A x [ i ] + Bu [ i ] + w [ i ] , (1) where w [ i ] is an external small unknown disturbance, u [ i ] is a scalar input, and A = " a 1 a 2 a 3 a 4 # , B = " b 1 b 2 # , x [ i ] = " x 1 [ i ] x 2 [ i ] # . (2) You want to identify the system parameters ( a 1 , a 2 , a 3 , a 4 , b 1 and b 2 ) from measured data. However, you can only interact with the system via a black box model, i.e., you can see the states x [ t ] and set the inputs u [ i ] that allow the system to move to the next state. (a) You observe that the system has state x [ i ] = h x 1 [ i ] x 2 [ i ] i at time i . You pass input u [ i ] into the black box and observe the next state of the system: x [ i + 1 ] = h x 1 [ i + 1 ] x 2 [ i + 1 ] i . Write scalar equations for the new states, x 1 [ i + 1 ] and x 2 [ i + 1 ] . Write these equations in terms of the a i , b i , the states x 1 [ i ] , x 2 [ i ] and the input u [ i ] . Here, assume that w [ i ] = 0 (i.e., the model is perfect). Solution: x 1 [ i + 1 ] = a 1 x 1 [ i ] + a 2 x 2 [ i ] + b 1 u [ i ] (3) x 2 [ i + 1 ] = a 3 x 1 [ i ] + a 4 x 2 [ i ] + b 2 u [ i ] . (4) (b) Now we want to identify the system parameters. We observe the system at the start state x [ 0 ] = " x 1 [ 0 ] x 2 [ 0 ] # . We can then input u [ 0 ] and observe the next state x [ 1 ] = " x 1 [ 1 ] x 2 [ 1 ] # . We can continue this for a sequence of inputs. Let us define an -length trajectory to be an initial condition x [ 0 ] , an input sequence u [ 0 ] , . . . , u [ 1 ] , and the corresponding states that are produced by the system x [ 1 ] , . . . , x [ ] . Assuming that the model is perfect ( w [ i ] = 0 ), what is the minimum value of you need to identify the system parameters? Solution: There are 6 unknowns so we need 6 equations to properly identify the system. Each additional timestep gives two new equations. To form the 6 equations we need to give the black 1
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 box = 3 inputs. Namely, given inputs u [ 0 ] , u [ 1 ] , and u [ 2 ] , we can see the state at times t = 0, 1, 2, 3 to give us our six equations. Notice that the initial condition on its own gives us no equations because the unknowns we are interested in do not impact the initial condition. They govern the evolution of the system, and hence the states at times 1, 2, 3 each give us two equations. Note that having 6 equations is a necessary, but not sufficient, condition for us to be able to invert the system to uniquely determine the system parameters. For example, if A = I and u [ 0 ] = · · · = u [ 1 ] = 0, then we would only have two independent equations. (c) We now remove our assumption that w = 0. We assume it is small, so the model is approximately correct and we have x [ i + 1 ] A x [ i ] + Bu [ i ] . (5) Say we feed in a total of 4 inputs u [ 0 ] , . . . , u [ 3 ] , and observe the states x [ 0 ] , . . . , x [ 4 ] . To identify the system we need to set up an approximate (because of potential, small, disturbances) matrix equation DP S (6) using the observed values above and the unknown parameters we want to find. Let our param- eter vector be P : = h p 1 p 2 i = a 1 a 3 a 2 a 4 b 1 b 2 (7) Find the corresponding D and S to do system identification. Write both out explicitly. Solution: Using eq. (4), we get x 1 [ 0 ] x 2 [ 0 ] u [ 0 ] x 1 [ 1 ] x 2 [ 1 ] u [ 1 ] x 1 [ 2 ] x 2 [ 2 ] u [ 2 ] x 1 [ 3 ] x 2 [ 3 ] u [ 3 ] a 1 a 3 a 2 a 4 b 1 b 2 x 1 [ 1 ] x 2 [ 1 ] x 1 [ 2 ] x 2 [ 2 ] x 1 [ 3 ] x 2 [ 3 ] x 1 [ 4 ] x 2 [ 4 ] (8) so D = x 1 [ 0 ] x 2 [ 0 ] u [ 0 ] x 1 [ 1 ] x 2 [ 1 ] u [ 1 ] x 1 [ 2 ] x 2 [ 2 ] u [ 2 ] x 1 [ 3 ] x 2 [ 3 ] u [ 3 ] , and S = x 1 [ 1 ] x 2 [ 1 ] x 1 [ 2 ] x 2 [ 2 ] x 1 [ 3 ] x 2 [ 3 ] x 1 [ 4 ] x 2 [ 4 ] . (9) (d) Now that we have set up DP S , we can estimate a 0 , a 1 , a 2 , a 3 , b 0 , and b 1 . Give an expression for the estimates of p 1 and p 2 (which are denoted ˆ p 1 and ˆ p 2 respectively) in terms of D and S . Denote the columns of S as s 1 and s 2 , so we have S = [ s 1 s 2 ] . Assume that the columns of D are linearly independent. (HINT: Don’t forget that D is not a square matrix. It is taller than it is wide.) (HINT: Can we split DP = S into separate equations for p 1 and p 2 ?) Solution: © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 2
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 Notice that eq. (8) can be split into two matrix equations, one for each of p 1 and p 2 : D p 1 s 1 (10) D p 2 s 2 . (11) Since D isn’t square, it isn’t invertible. However, we can still find p 1 and p 2 that best satisfy the equation via least-squares, which gives the solution ˆ p 1 = ( D D ) 1 D s 1 (12) ˆ p 2 = ( D D ) 1 D s 2 . (13) Here, D D is invertible (i.e. the solution is well-defined) because the columns of D are linearly independent. This was proved in 16A, but for completeness we include it here. Assume that the columns of D are linearly independent. Let v R 3 such that ( D D ) v = 0. Then 0 = v D D v = ( D v ) ( D v ) = D v 2 2 , so D v = 0. Since D has linearly independent columns, then v = 0. This means that the nullspace of D D is { 0 } , so D D must have full rank and is invertible. © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 2. Motor Driver and System Identification In the lab project, you will be designing SIXT33N, a mischievous little robot who might just do what you want — if you design it correctly. In phases 1 and 2, you will build the legs of SIXT33N: you will be designing SIXT33N’s wheels and developing a linear model for the car system. The wheels will be driven by two 9-Volt DC motors whose driver control circuit is shown in Figure 1 . M R B Microcontroller output pin V A B E C Motor NPN BJT Figure 1: Motor Controller Circuit There is some minimum voltage required to deliver enough power to the motors to overcome the static friction and start them, but after that point, we treat the motor speed as approximately lin- ear with the applied voltage V A (this will be the basis of the system model you will develop in this problem). As it is difficult to use a microcontroller (MSP430 in hands-on lab; Arduino in lab sim) to generate a true adjustable DC signal, we will instead make use of its PWM function. A PWM, or pulse-width modulated, signal is a square wave with a variable duty cycle (the proportion of a cycle period for which the power source is turned on, or logic HIGH). PWM is used to digitally change the average voltage delivered to a load by varying the duty cycle. If the frequency is large enough, the on-off switching is imperceptible, but the average voltage delivered to the load changes proportionally with the duty cycle. Hence, changing the duty cycle corresponds to changing the DC voltage supplied to the motor. An example can be seen in figure 2 . t [ ms ] V A [ V ] 0 1 2 3 4 5 6 7 8 9 10 5 V A,HIGH = 5V T period = 2ms T on = 1.4ms D = T on T period = 0.7 ( 70% ) Figure 2: PWM Example with switching frequency 500Hz and 70% duty cycle The PWM pin ( V A ) is connected via a resistor ( R B ) to the "Base (B)" of an NPN bipolar junction tran- sistor (BJT). This transistor, in reality, behaves a bit differently from the NMOS with which you are © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 4
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 familiar, but for this class, you may assume that it is functionally the same as an NMOS, behaving as a switch. On the BJT, the three terminals are analogous to those of an NMOS: the "Base (B)" is the gate, the "Collector (C)" is the drain, and the "Emitter (E)" is the source. The BJT in Figure 1 is switching between ON and OFF modes when V A is HIGH and LOW respec- tively. The model for both ON and OFF states are shown in Figure 3 . When the BJT turns on, V BE can be modeled as a fixed voltage source with voltage value V BE0 . In ON mode, there is a Current Controlled Current Source modeled between "Collector (C)" and "Emitter (E)", i.e., current at the "Collector (C)" is an amplified version of current at the "Base (B)" (notice that positive I B has to flow into the "Base (B)" for the relation I C = β F I B to hold). β F is called the Common-Emitter Current Gain . The diode in parallel with the motor is needed because of the inductive characteristics of the motor. If the motor is on and V A switches to LOW, the inductive behavior of the motor maintains the current and the diode provides the path to dissipate it as the BJT is turned off. When the BJT turns on, the diode is off so there is no current flow through the diode. B I B > 0 + V BE0 β F I B I C = β F I B C E (a) Model of BJT in ON mode (when V A is logic HIGH) B I B = 0 I C = 0 C E (b) Model of BJT in OFF mode (when V A is logic LOW) Figure 3: Model of NPN BJT in Different Modes Please use V BE0 = 0.8 V, β F = 100, V A ,HIGH = 5 V and V A ,LOW = 0 V for all following calculations. Part 1: Circuit analysis to construct the system model (a) Draw the equivalent motor controller circuit when the BJT is ON by substituting in the BJT model from Fig. 3a into Fig. 1 . Express I B and I C for V A = V A ,HIGH as a function of R B . Solution: First, we draw the equivalent circuit in figure 4 to analyze the quantities which will appear in it: I B and I C . © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 5
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 V A R B I B B + V BE0 E β F I B C I C M Figure 4: Equivalent circuit with model of BJT in ON state substituted in. When V A is HIGH, the voltage across the resistor in Figure 1 is V A ,HIGH V BE0 . This voltage is what determines the the current flowing into the "Base(B)" ( I B ) and current flowing into the "Collector (C)" ( I C ). I B = V A ,HIGH V BE0 R B = 5 V 0.8 V R B = 4.2 V R B (14) I C = β F I B = 100 4.2 V R B = 420 V R B (15) Observe that downward directed current through the motor when V A is HIGH is equal to the current I C as the diode will not allow current in the direction from the motor voltage source to the collector ( C ). (b) Draw the equivalent motor controller circuit when the BJT is OFF by substituting in the BJT model from Fig. 3b into Fig. 1 . Express I B and I C for V A = V A ,LOW as a function of R B . Solution: We draw the equivalent circuit as before. V A R B I B B E C I C M Figure 5: Equivalent circuit with model of BJT in OFF state substituted in. When V A is LOW, the BJT is OFF. As shown in Figure 5, the BJT is open from B to E , and from C to E . Thus I B = 0 and I C = 0. Consider that while I C can be zero, the current through the motor may not be as the diode conductive path allows for the inductor current of the motor to keep flowing. If we model the © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 motor and diode as a circuit with a small resistor, R , and inductor, L , in series, we see that for a small R , we will have a large time constant τ = L R , which means that the current does not decay very much through the motor during the time the BJT is in the OFF state. (c) Derive the average collector current, I AVG , over one period, T period , of the PWM signal, V A , as a function of R B and the duty cycle, D , of the PWM signal. Hint: The time average of some signal f ( t ) from time t 0 to t 1 is given as f AVG = 1 t 1 t 0 R t 1 t 0 f ( τ ) d τ . Figure 2 may be useful. Solution: We compute the time average of I C from t = 0 to t = T period , where T period is the period of the PWM voltage. I AVG = 1 T period 0 Z T period 0 I C ( τ ) d τ (16) Since I C depends on V A , and V A switches between two values V A ,HIGH and V A,LOW , we will have corresponding values of current I C ,ON and I C ,OFF . If we start at time 0, we spend times 0 t T on with constant current I C ,ON due to constant voltage V A = V A ,HIGH . This first current I C ,ON is the current we calculated in part (a). At times T on t T period , we turn our voltage V A to its low value, with corresponding constant current I C ,OFF . This is the current we calculated in part (b). Our integral becomes the following: I AVG = 1 T period Z T period 0 I C ( τ ) d τ (17) = 1 T period Z T on 0 I C ,ON d τ + Z T period T on I C ,OFF d τ (18) = 1 T period I C ,ON ( T on 0 ) + I C ,OFF ( T period T on ) (19) = I C ,ON T on T period + I C ,OFF T period T on T period (20) = I C ,ON D + 0 A ( 1 D ) (21) = I C ,ON D (22) = 420 V R B D (23) (d) In the previous part, explain briefly why is it sufficient to take the average over only one period if we are actually interested in the average collector current over multiple periods? Solution: It is enough to take the average over one period as this would be the same as the aver- age that would occur over an large integer number of periods and close enough to the average for a large non-integer number of periods. Reasoning of this form is enough. What follows is a mathematical statement of the intuition above for why we can look at only one period. It is not required but is here for your understanding. The assumption of having a high PWM frequency is relevant here, as a high frequency implies a small period. We should have our period T be small relative to the time we set a certain duty cycle value, so that the time spent in a fraction of a cycle at the very end of our string of full periods does not contribute much to the average and will be negligible. In notation, let the time we average over be from t = 0 to © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 7
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 t = T = NT period + δ , where N is an integer and δ is a time interval that is mid-cycle and not through the full period, i.e. 0 δ T period . I AVG = 1 T Z T 0 I C ( t ) d τ (24) = 1 T N 1 êçæêôæ i = 0 Z ( i + 1 ) T period iT period I C ( t ) d τ ! + Z NT period + δ NT period I C ( t ) d τ ! (25) = 1 T N 1 êçæêôæ i = 0 I C ,ON D + I C ,ON min ( δ , T on ) ! (26) = 1 T ( NI C ,ON T on + I C ,ON min ( δ , T on )) (27) = NT on NT period + δ I C ,ON + min ( δ , T on ) NT period + δ I C ,ON (28) The minimum term comes from that the time mid-cycle δ may be less than or greater than T on , so we may have current on for a shorter interval or have an interval in which we have turned our current off after spending the full time T on with the current on. However, notice that as we make N large, which is to say that our time T we are averaging over is large relative to our period T period , our average value approaches T on T period I C ,ON = DI C ,ON , where we have our duty cycle. This is what allows our duty cycle to determine our average current and voltage value, and why we should have a high enough PWM frequency for the system in consideration. If we were to only hold our duty cycle for a short period of time, on par with the period of the PWM signal, we lose this dependence of the average current on duty cycle and would have behavior that is a function of the time we hold our duty cycle for. This is an example of the important idea in control and computing that the parameters of a system (e.g. R , C in transistors, PWM frequency here) are chosen in such a way that trades off performance (usually speed) and reliability. (e) If R B = 2 k \YX , what is the average collector current, I AVG , that drives the motor when the duty cycle of the PWM signal is equal to 25%? Solution: From part (c), we have that I AVG = 420 V R B D . For R B = 2 k \YX and D = 0.25 (25%), I AVG = 420 V 2 k \YX 0.25 = 52.5 mA. © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 8
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 Part 2: Learning a Car Model from data To control the car, we need to build a model of the car first. Instead of designing a complex nonlinear model, we will approximate the system with a linear model to work for small perturbations around an equilibrium point. The following model applies separately to each wheel (and associated motor) of the car: v L [ i ] = θ L u L [ i ] β L (29) v R [ i ] = θ R u R [ i ] β R (30) Notice that this particular model has no state variables since we are measuring velocity directly here. To do system ID, we decide to use the exact same input u L [ i ] = u R [ i ] = u [ i ] for both motors. We measure both velocities however. Meet the variables at play in this model: (Note: the β here have nothing to do with the previous part.) i - The current timestep of the model. Since we model the car as a discrete-time system, n will advance by 1 on every new sample in the system. v L [ i ] - The discrete-time velocity (in units of ticks/timestep) of the left wheel, reading from the motor. v R [ i ] - The discrete-time velocity (in units of ticks/timestep) of the right wheel, reading from the motor. u [ i ] - The input to each wheel. The duty cycle of the PWM signal ( V A ), which is the percentage of the square wave’s period for which the square wave is HIGH, is mapped to the range [ 0, 255 ] . Thus, u [ i ] takes a value in [ 0, 255 ] representing the duty cycle. For example, when u [ i ] = 255, the duty cycle is 100 %, and the motor controller just delivers a constant signal at the system’s HIGH voltage, delivering the maximum possible power to the motor. When u [ i ] = 0, the duty cycle is 0 %, and the motor controller delivers 0 V. The duty cycle (D) can be written as duty cycle (D) = u [ i ] 255 (31) θ ( θ L , θ R ) - Relates change in input to change in velocity. Its units are ticks/(timestep · duty cycle). Since our model is linear, we assume that θ is the same for every unit increase in u [ i ] . This is empirically measured using the car. You will have a separate θ for your left and your right wheel ( θ L , θ R ) . β ( β L , β R ) - Similarly to θ , β is dependent upon many physical phenomena, so we will empirically determine it using the car. β represents a constant offset in the velocity of the wheel, and hence its units are ticks/timestep . Note that you will also typically have a different β for your left and your right wheel (i.e. β L ̸ = β R ). These β L and β R are different from the β F of the transistor. (f) By measuring the car with a PWM signal at different duty cycles, we can collect the velocity data of the left and right wheel, as shown in the following table: © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 Table 1: The velocity of the left and the right wheel at different duty cycles of PWM signal Duty Cycle × 255 ( u [ i ] ) Velocity of the left wheel ( v L [ i ] ) Velocity of the right wheel ( v R [ i ] ) 80 147 127 120 218 187 160 294 253 200 370 317 Since the same input is applied to both the wheels, we can take advantage of the same “horizontal stacking” trick you’ve seen before to be able to reuse computation. To identify the system we need to setup matrix equations of left and right wheel in the form of: D data P S (32) where P = " θ L θ R β L β R # . Find the matrix D data and matrix S needed to perform system identifi- cation to get the matrix of parameters of the left and right wheel, P . Solution: We can relate our data points in our table using the model equations eqs. (29) and (30). While we do not know the time indices, we can call them i 1 to i 4 . We start with the left wheel speed data. Approximate equality is used due to the possible presence of noise or unmodelled behavior. v L [ i 1 ] θ L u [ i 1 ] β L (33) v L [ i 2 ] θ L u [ i 2 ] β L (34) v L [ i 3 ] θ L u [ i 3 ] β L (35) v L [ i 4 ] θ L u [ i 4 ] β L (36) Putting the left and right hand sides into vectors, we get the following equation. v L [ i 1 ] v L [ i 2 ] v L [ i 3 ] v L [ i 4 ] | {z } s L θ L u [ i 1 ] β L θ L u [ i 2 ] β L θ L u [ i 3 ] β L θ L u [ i 4 ] β L = u [ i 1 ] 1 u [ i 2 ] 1 u [ i 3 ] 1 u [ i 4 ] 1 " θ L β L # | {z } p L (37) Here, s L is defined as the vector of measured wheel velocities, and p L is the vector of parameters for the left wheel. We will have corresponding vectors s R and p R for the right wheel when writing a similar set of equations with v R [ i ] , θ R , and β R . These equations utilize the same values of u [ i ] . v R [ i 1 ] v R [ i 2 ] v R [ i 3 ] v R [ i 4 ] | {z } s R u [ i 1 ] 1 u [ i 2 ] 1 u [ i 3 ] 1 u [ i 4 ] 1 " θ R β R # | {z } p R (38) © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 10
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 Since the matrix multiplying the parameter vectors are the same, we can concatenate s L , s R and p L , p R horizontally in the following way. | | s L s R | | | {z } S u [ i 1 ] 1 u [ i 2 ] 1 u [ i 3 ] 1 u [ i 4 ] 1 | {z } D data | | p L p R | | | {z } P (39) Substituting in the numerical values we have our D data and S matrices. D data = 80 1 120 1 160 1 200 1 S = 147 127 218 187 294 253 370 317 (40) (g) Solve the matrix equation D data P S with least squares to find θ L , θ R , β L , and β R . You may use a jupyter notebook for computation. Solution: Our estimate of our parameter matrix is given by b P = ( D data D data ) 1 D data S . Using a computing tool, we can compute the matrix product or use a built-in least squares function (e.g. NumpPy’s np.linalg.lstsq ). We get the following parameter value estimates: b θ L = 1.862, b θ R = 1.59, b β L = 3.5, and b β R = 1.6. (h) In most advanced systems, we usually use a combination of a physics-based equation and a data-centric approach to build the model. In our case, the velocity of the motor can be written as v [ i ] = kI AVG ( u [ i ]) β (41) where I AVG ( u [ i ]) is the average collector current which is the function of the duty cycle that you have already derived in Part 1. k represents the response of your motor speed to the average current. In our simplified motor driver model in Part 1, you have already derived the expression for the I AVG of the motor as a function of the circuit parameters and the duty cycle D . If we assume that the model from Part 1 holds, determine the resistance ratio R B,left R B,right from the model parameters you identified in Part 2 item (f). Assume that the left motor and the right motor respond the same, that is, k L = k R . The only difference is presumed to come from the resistors used. Solution: First, we investigate how the current affects our model by starting with the velocity equation involving I AVG for just one wheel. v [ i ] = kI AVG ( u [ i ]) β (42) = k 420 V R B D ( u [ i ]) β (43) After substituting in our average current expression from part (c), the only quantity that can be a function of u [ i ] is our duty cycle, D . We recall from the introduction to part 2 that D = u [ i ] 255 . v [ i ] = k 420 V R B u [ i ] 255 β (44) © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 11
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 = k 420 V 255 R B u [ i ] β (45) From our earlier learned model equations in eqs. (29) and (30), we can match coefficients and say that θ = k 420 V 255 R B . Since we identified b θ L = 1.862 and b θ R = 1.59 in part (f), we can take their ratio to see common terms cancel out. b θ R b θ L k R 420 V 255 R B,right k L 420 V 255 R B,left = R B,left R B,right (46) 1.59 1.862 R B,left R B,right (47) 0.85 R B,left R B,right (48) (i) In order for the car to drive straight, the wheels must be moving at the same velocity. However, the data from Table 1 tell us that two motors cannot run at the same velocity if the duty cycles of driving PWM signals are the same. Based on the model you extracted in Part 2 item (f), if we want the car to drive straight and u L = 100 , what should u R be? Solution: To have the car drive straight, we want to find u R satisfying v L = v R for u L = 100. From our identified constants, we can write the following equations. v L = 1.862 u L 3.5 (49) v R = 1.59 u R 1.6 (50) Setting v L and v R equal to each other with u L = 100, we get the following value of u R . 1.862 ( 100 ) 3.5 = 1.59 u R 1.6 = u R 115.91 116 (51) This observation was not required, but let us interpret the results of (f) and this part, (h). The significance of this calculation based on our learned parameters is that this difference in the required u L and u R required to have the same wheel velocities is a reflection of the underlying physics of our system. Taking the ratio u L u R = 100 116 0.86, we find that we have nearly the same ratio as in (f). This is not a coincidence. u L and u R are proportional to the average voltages supplied, V A,L,AVG (left average voltage) and V A,R,AVG (right average voltage). If the resistance R B,right is larger than R B,left per part (f), this implies for the same average voltage applied to both motors, we will see a lower average current driving the right motor, thereby making its speed lower, assuming k L = k R in the physical model equation. Note however, the ratios are not exactly equal for the reason of the β L and β R . However, because they are small relative to the larger values of θ L u L and θ R u R we see that we will have approximate equality, u L u R R B,left R B,right , to move straight with u L = 100. This is to say that in our systems we will always have to account for the variation in the subparts of our system that are not necessarily identical, matched, or ideal. We made an assumption in part (f) that k L = k R , and this could introduce another adjustment required. © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 12
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 3. Stability Criterion Consider the complex plane below, which is broken into non-overlapping regions A through H. The circle drawn on the figure is the unit circle | λ | = 1. Re { λ } Im { λ } 1 1j A B C D E F G H Figure 6: Complex plane divided into regions. Consider the continuous-time system d d t x ( t ) = λ x ( t ) + v ( t ) and the discrete-time system y [ i + 1 ] = λ y [ i ] + w [ i ] . Here v ( t ) and w [ i ] are both disturbances to their respective systems. In which regions can the eigenvalue λ be for the system to be stable ? Fill out the table below to indicate stable regions. Assume that the eigenvalue λ does not fall directly on the boundary between two regions. A B C D E F G H Continuous Time System x ( t ) Discrete Time System y [ i ] Solution: For the continuous time system to be stable, we need the real part of λ to be less than zero. Hence, C, D, G, H satisfy this condition. On the other hand, for the discrete time system to be stable, we need the norm of λ to be less than one. Hence, A, B, C, D satisfy this condition. © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 13
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 4. Bounded-Input Bounded-Output (BIBO) Stability BIBO stability is a system property where bounded inputs lead to bounded outputs. It’s important because we want to certify that, provided our system inputs are bounded, the outputs will not “blow up”. In this problem, we gain a better understanding of BIBO stability by considering some simple continuous and discrete systems, and showing whether they are BIBO stable or not. Recall that for the following simple scalar differential equation, we have the corresponding solution: d d t x ( t ) = ax ( t ) + bu ( t ) x ( t ) = e at x ( 0 ) + Z t 0 e a ( t τ ) bu ( τ ) d τ . (52) And for the following discrete system, we have the corresponding solution: x [ i + 1 ] = ax [ i ] + bu [ i ] x [ i ] = a i x [ 0 ] + i 1 êçæêôæ k = 0 a k bu [ i 1 k ] (53) (a) Consider the circuit below with R = 1 \YX , C = 0.5F. Let x ( t ) be the voltage over the capacitor. + u ( t ) R C + x ( t ) This circuit can be modeled by the differential equation d d t x ( t ) = 2 x ( t ) + 2 u ( t ) (54) Intuitively, we know that the voltage on the capacitor can never exceed the (bounded) voltage from the voltage source, so this system is BIBO stable. Show that this system is BIBO stable, meaning that x ( t ) remains bounded for all time if the input u ( t ) is bounded. Equivalently, show that if we assume | u ( t ) | < ϵ , t 0 and | x ( 0 ) | < ϵ , then | x ( t ) | < M , t 0 for some positive constant M . Thinking about this helps you understand what bounded-input-bounded- output stability means in a physical circuit. (HINT: eq. ( 52 ) may be useful. You may want to write the expression for x ( t ) in terms of u ( t ) and x ( 0 ) and then take the norms of both sides to show a bound on | x ( t ) | . Remember that norm in 1D is absolute value. Some helpful formulas are | ab | = | a || b | , the triangle inequality | a + b | ≤ | a | + | b | , and the integral version of the triangle inequality R b a f ( τ ) d τ R b a | f ( τ ) | d τ , which just extends the standard triangle inequality to an infinite sum of terms.) Solution: Using eq. (52), we get the solution to the scalar differential equation as x ( t ) = e 2 t x ( 0 ) + Z t 0 e 2 ( t τ ) 2 u ( τ ) d τ . (55) Then we can try to bound x ( t ) for t 0. We first use the triangle inequality ( | a + b | ≤ | a | + | b | ) to get | x ( t ) | = e 2 t x ( 0 ) + Z t 0 e 2 ( t τ ) 2 u ( τ ) d τ (56) © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 14
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 | x ( t ) | ≤ e 2 t x ( 0 ) + Z t 0 e 2 ( t τ ) 2 u ( τ ) d τ (57) We then use the property that the integral of absolute value will always be greater than the absolute value of the integral (equation (57) to (58)), and that an exponential is always positive (equation (58) to (59)): | x ( t ) | ≤ e 2 t x ( 0 ) + Z t 0 e 2 ( t τ ) 2 u ( τ ) d τ (58) = e 2 t | x ( 0 ) | + Z t 0 e 2 ( t τ ) 2 | u ( τ ) | d τ (59) Finally, plugging in our bounds for | u ( τ ) | and | x ( 0 ) | and doing the integral: | x ( t ) | ≤ e 2 t ϵ + Z t 0 e 2 ( t τ ) 2 ϵ d τ (60) = e 2 t ϵ + 2 ϵ e 2 t Z t 0 e 2 τ d τ (61) = e 2 t ϵ + 2 ϵ e 2 t 1 2 e 2 t 1 (62) = e 2 t ϵ + ϵ 1 e 2 t (63) = ϵ , t 0 (64) So we see that our state’s magnitude is bounded for all time. Note that the negative exponent of the exponential is what makes this system stay bounded. (b) Assume x ( 0 ) = 0. Show that the system eq. ( 52 ) is BIBO unstable when a = j2 π by construct- ing a bounded input that leads to an unbounded x ( t ) . It can be shown that the system eq. ( 52 ) is unstable for any purely imaginary a by a similar construction of a bounded input. Solution: Recall the solution of x ( t ) with the initial condition at zero x ( t ) = Z t 0 e a ( t τ ) bu ( τ ) d τ . (65) Remember, the style of argumentation here is the “counterexample” style. The question asks you to show that some bounded input exists that will make the state grow without bound. Because we know we can get an integral to diverge if we are just integrating a nonzero constant, we decide to try the bounded input u ( t ) = ϵ e j2 π t , whose magnitude is equal to ϵ for all t . Plugging this input and a value in, we see x ( t ) = Z t 0 e j2 π ( t τ ) b ϵ e j2 πτ d τ = Z t 0 e j2 π t b ϵ d τ . (66) Factoring out the terms that do not depend on τ , we are left with x ( t ) = b ϵ e j2 π t Z t 0 d τ . (67) Solving this integral, we get x ( t ) = b ϵ t e j2 π t . (68) Now taking the magnitude of x ( t ) using the fact that | e j ω t | = 1 for all ω , we get | x ( t ) | = ϵ | b | t which clearly diverges as t ª§¦ª . © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 15
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 (c) Consider the discrete-time system and its solution in eq. ( 53 ). Show that if | a | > 1 , then even if x [ 0 ] = 0 , a bounded input can result in an unbounded output, i.e. the system is BIBO unstable. (HINT: The formula for the sum of a geometric sequence may be helpful.) Solution: Consider when x [ 0 ] = 0 and u [ i ] = 1 i . This gives x [ i ] = a i x [ 0 ] + i 1 êçæêôæ k = 0 a k bu [ i 1 k ] (69) = i 1 êçæêôæ k = 0 a k b (70) = b a i 1 a 1 (as this is the sum of a geometric series) (71) When | a | > 1, then a i has magnitude that grows without bound, and thus | x [ i ] | does as well. We also know this from the convergence criteria for geometric series; when the common ratio a > 1, the series does not converge to a finite number as i ª§¦ª . (d) Consider the discrete-time system x [ i + 1 ] = 3 x [ i ] + u [ i ] . (72) Is this system stable or unstable? Give an initial condition x ( 0 ) and a sequence of non-zero inputs for which the state x [ i ] will always stay bounded. (HINT: See if you can find any input pattern that results in an oscillatory behavior.)) Solution: The system is unstable since the eigenvalue 3 has magnitude 1. To see this more explicitly, any non-zero x [ 0 ] and (bounded) u [ i ] = 0 i N will lead to unbounded x . Consider x [ 0 ] = 0 and the input u [ i ] = 1, 3, 1, 3, 1, 3, . . . . t 0 1 2 3 · · · x [ i ] 0 1 0 1 · · · u [ i ] 1 3 1 3 · · · 3 x [ i ] + u [ i ] 1 0 1 0 · · · In this case, we get x [ i ] = 0 when t is even, and x [ i ] = 1 when i is odd. In fact, there are an infinite number of input sequences that would result in bounded outputs. © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 16
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 5. Eigenvalue Placement through State Feedback Consider the following discrete-time linear system: x [ i + 1 ] = " 2 2 2 3 # x [ i ] + " 1 1 # u [ i ] . (73) In standard language, we have A = " 2 2 2 3 # , b = " 1 1 # in the form: x [ i + 1 ] = A x [ i ] + bu [ i ] . (a) Is this discrete-time linear system stable in open loop (without feedback control)? Solution: We have to calculate the eigenvalues of matrix A . Thus, 0 = det ( λ I A ) (74) = det " λ + 2 2 2 λ 3 # (75) = λ 2 λ 2 (76) = λ 1 = 2, λ 2 = 1 (77) Since at least one eigenvalue has a magnitude that is greater than or equal to 1, the discrete-time system is unstable. In this case, both of the eigenvalues are unstable. (b) Suppose we use state feedback of the form u [ i ] = h f 1 f 2 i x [ i ] = F x [ i ] . Find the appropriate state feedback constants, f 1 , f 2 so that the state space representation of the resulting closed-loop system has eigenvalues at λ 1 = 1 2 , λ 2 = 1 2 . Solution: The closed loop system using state feedback has the form x [ i + 1 ] = " 2 2 2 3 # x [ i ] + " 1 1 # u [ i ] (78) = " 2 2 2 3 # x [ i ] + " 1 1 # h f 1 f 2 i x [ i ] (79) = " 2 2 2 3 # + " f 1 f 2 f 1 f 2 #! x [ i ] (80) Thus, the closed loop system has the form x [ i + 1 ] = " 2 + f 1 2 + f 2 2 + f 1 3 + f 2 # | {z } A cl x [ i ] (81) Finding the characteristic polynomial of the above system, we have det λ I " 2 + f 1 2 + f 2 2 + f 1 3 + f 2 #! = ( λ + 2 f 1 )( λ 3 f 2 ) ( 2 f 2 )( 2 f 1 ) (82) = λ 2 f 1 λ f 2 λ λ + f 1 f 2 6 2 f 2 + 3 f 1 (83) ( 4 + f 1 f 2 + 2 f 1 2 f 2 ) (84) © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 17
EECS 16B Homework 8 2023-10-22 12:55:26-07:00 = λ 2 ( 1 + f 1 + f 2 ) λ + f 1 2 (85) However, we want to place the eigenvalues at λ 1 = 1 2 , λ 2 = 1 2 . That means we want λ 2 ( 1 + f 1 + f 2 ) λ + f 1 2 = λ + 1 2 λ 1 2 (86) or equivalently: λ 2 ( 1 + f 1 + f 2 ) λ + f 1 2 = λ 2 1 4 (87) Equating the coefficients of the different powers of λ on both sides of the equation, we get, 1 + f 1 + f 2 = 0 (88) f 1 2 = 1 4 (89) Solving the above system of equations gives us f 1 = 7 4 , f 2 = 11 4 . Contributors: • Nikhil Shinde. • Ashwin Vangipuram. • Sally Hui. • Bozhi Yin. • Kaitlyn Chan. • Yi-Hsuan Shih. • Vladimir Stojanovic. • Moses Won. • Sidney Buchbinder. • Tanmay Gautam. • Nathan Lambert. • Anant Sahai. • Druv Pai. • Varun Mishra. © UCB EECS 16B, Fall 2023. All Rights Reserved. This may not be publicly shared without explicit permission. 18
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help

Browse Popular Homework Q&A

Q: The electric flux through the surface shown in the figure is 17 Nm^2/C. What is the electric field…
Q: Ammonia contained in a piston–cylinder assembly, initially saturated vapor at T1 = 6°F, undergoes an…
Q: Two 2.50-cm-diameter disks spaced 2.00 mm apart form a parallel-plate capacitor. The electric field…
Q: As a group, the Dutch are among the tallest people in the world. The average Dutch man is 184 cm…
Q: 24. Find the value of 'x' in the picture. (4x-20) B Aart 19 C
Q: How did Britain and China disagree over how to handle British lawbreakers in China?
Q: What is the mistake for the synthetic division below? 나 3 J -2 a 12 -150 40 3m3-2m2-150 m-4
Q: 19. X = m/C= m/ABC = A хо SS G B 80° (2x-4) C
Q: Differentiate between these homeostatic imbalances of the eye:  myopia, hyperopia, glaucoma,…
Q: Explain Joint cumulative distribution function (joint cdf).
Q: Use the definition of bilateral Laplace transform to determine the Laplace transform and the…
Q: 7. Use the bank to complete the flowchart proof. Given A+mZB=m/BCD Prove MACB+mZA+m4B = 180° A B C D
Q: What are basic SQL commands?
Q: Write a complete Java program in a class named FightSong that generates the following output. You…
Q: Define Sequential Logic Circuit.
Q: The temperature C of a fresh cup of coffee t minutes after it is poured is given by C = 125e-0.03…
Q: Define - Static Multiple Issue.
Q: MODEL 3 Molecule 1 Amino acids Molecule 2 Hydrogen- bonds 11. Locate the secondary protein structure…
Q: Is the cane toad a direct or indirect threat
Q: Problem 2 Suppose scores on an IQ test are normally distributed, with a mean of 100. Suppose 20…
Q: 11. Find the fifteenth term in the expansion of (x2 - -) 18
Q: ) A sphere is attached to a string of length L = 21.2 cm and suspended from the ceiling, as shown in…