lab7_note

.pdf

School

University of California, Berkeley *

*We aren’t endorsed by this school

Course

16B

Subject

Mechanical Engineering

Date

Oct 30, 2023

Type

pdf

Pages

8

Uploaded by DeanKangaroo5110

Report
EECS 16B Designing Information Devices and Systems II Fall 2023 UC Berkeley Lab Note 7 Lab Note 7: Controls Previously, we have built S1XT33N’s motor control circuitry and developed a linear model for the velocity of each wheel. We are one step away from our goal: to have S1XT33N drive in a straight line! As you probably noticed, simply applying the same PWM input to both wheels as we did during data collection in the last lab is not sufficient; S1XT33N ends up driving in a circle if we do this because of the differences between the two wheels. In this lab, we will see how to use the model we developed in System ID to control S1XT33N’s trajectory to be a straight line. Part 1: Open-Loop Control Introduction Before we implement our closed-loop controller, we need to understand how open-loop control works. An open- loop controller is one in which the input is predetermined using your system model, and not adjusted at all during operation. To design an open-loop controller for your car, you would set the PWM duty-cycle value of your left and right wheels (your inputs u L [ i ] and u R [ i ] ) such that the velocity of both wheels is your target wheel velocity ( v L = v R = v ). You can calculate these inputs from the target velocity v , θ L , R , and β L , R values (all 3 of which are constants) from System ID and hard-code these input values, as they won’t change at all as your car runs in open-loop control. As a reminder, here are the equations for our model that we defined in the last lab: v L [ i ] = d L [ i + 1 ] d L [ i ] = θ L u L [ i ] β L v R [ i ] = d R [ i + 1 ] d R [ i ] = θ R u R [ i ] β R (1) This works well if your model is perfect ( θ L , R and β L , R exactly match the real system), and your car is never bumped or otherwise disturbed. In other words, with no mismatch between the idealized behavior we model in System ID and no noise or disturbances from the environment, your car will drive straight. Model mismatch inevitably arises because every model is ultimately an approximation (recall how you used least-squares to derive your model coefficients θ L , R and β L , R : were your v [ i ] vs. u [ i ] plots perfectly linear?). As a result, open-loop control does not work very well in practice since the car has no way of adjusting to perturbations and model mismatch present in the real world. Jolt Calculation Since we are starting our cars from rest, in order for the cars to move, we must first overcome static friction. However, simply feeding it the open-loop inputs may not be sufficient to allow it to do so. Thus, before our Arduino tries to control our car, we need to provide each of S1XT33N’s motors with a large PWM signal for a brief time; we will call this the jolt. As you (should have!) observed in the System ID lab, the individual motors respond differently to changes in the PWM duty cycles (i.e. they have different sensitivities to the PWM input, θ L , R ), as well as different velocity offsets ( β L , R ). By extension, this means that from rest, the two motors require different PWM duty cycle inputs and thus different jolt values in order to overcome static friction and start moving. If the motors need different duty cycles to start moving, it is evidence of one or more of the following: Difference in motor parameters. The motors contain a component called the armature, which generates torque to turn the wheel from the current flowing through it. Your motors might have different armature resistances, which in turn limits the amount of armature current flowing through the motor for a given voltage. If the resistance is higher, the motor will need a higher voltage to force enough current through the internal motor circuit for the motor to turn. Difference in motor efficiencies. This could be interpreted as a subsection of the previous item, but the dis- tinction between the two is that we will interpret the first as primarily a consequence of differences in electrical characteristics, and this one as a consequence of differences in mechanical characteristics. The friction within the motor may be higher for one motor than the other, or perhaps a gear is slightly misaligned in one motor, etc. Mass imbalance in the car. If the mass of the car isn’t distributed evenly between the wheels (e.g. your breadboard is off-center and puts more weight on one side), the torque required for the wheels to begin turning will differ. Most of the cases outlined above are expected, and we are able to correct for them by modifying the jolts we apply to start each wheel when the car starts up. 1 Lab Note 7 — Controls (v5.1)
EECS 16B Designing Information Devices and Systems II Fall 2023 UC Berkeley Lab Note 7 Part 2: Closed-Loop Control of S1XT33N Introduction To correct for the imperfections of open-loop control, we will build a closed-loop controller that uses feedback to ensure that both wheels still drive at the same velocity. How do we choose the correct input value for our closed-loop controller? First, we need to identify a control variable (and a value for it) which corresponds to our desired system behavior. Once we do that, we need to determine the relationship between the input and this variable. We will define our control variable , δ , to be the difference in the distance traveled between the left and right wheels at a given timestep. δ [ i ] = d L [ i ] d R [ i ] (2) Our goal is for the car to drive straight. This means the velocities , not necessarily the positions, of the wheels need to be the same. Sanity check: If we want v L [ i ] v R [ i ] to be zero, what condition does this impose on δ ? We introduced δ [ i ] = d L [ i ] d R [ i ] as the difference in positions between the two wheels. If both wheels of the car are going at the same velocity, then this difference δ should remain constant, i.e. δ [ i + 1 ] δ [ i ] = 0, since no wheel will advance by more ticks than the other. Note: this does not mean that δ needs to be 0! We approximate this constant δ [ i ] i = δ ss by using the final value of δ your car exhibits at the end of a run. Sanity check: What does it mean for the car’s trajectory for when δ is a constant 0? What about a constant nonzero value? Deriving the closed-loop model In System ID, you linearized the car system around your operating point (the value of v you selected). We will now be deriving the equations which govern the behavior of our system. These equations determine the dynamics of the system that we want to control. We will implement a state-space controller by selecting two dimensionless positive coefficients, f L > 0 and f R > 0 , such that the system’s eigenvalue λ is placed in a stable position . (Recall that for discrete-time systems, eigenvalues must be within the unit circle on the complex plane for the system to be stable; i.e. the magnitude of the eigenvalue must be less than 1). | λ | < 1 (3) We begin with our open-loop equations from last week: v L [ i ] = d L [ i + 1 ] d L [ i ] = θ L u L [ i ] β L v R [ i ] = d R [ i + 1 ] d R [ i ] = θ R u R [ i ] β R (4) We want to adjust v L [ i ] and v R [ i ] at each timestep by an amount that’s proportional to δ [ i ] . Let’s say we want to drive δ [ i ] towards zero. If δ [ i ] is positive, the left wheel has traveled more distance than the right wheel, so relatively speaking, we can slow down the left wheel and speed up the right wheel to cancel this difference (i.e. drive it zero) in the next few timesteps. Therefore, instead of v (our target velocity), our desired velocities are now v f L δ [ i ] and v + f R δ [ i ] . As v L and v R tends to v , δ [ i ] tends to zero. v L [ i ] = d L [ i + 1 ] d L [ i ] = v f L δ [ i ] v R [ i ] = d R [ i + 1 ] d R [ i ] = v + f R δ [ i ] (5) In order to bring d L [ i + 1 ] and d R [ i + 1 ] closer to each other, at timestep i we set v L [ i ] and v R [ i ] to the desired values v f L δ [ i ] and v + f R δ [ i ] , respectively. Setting the open-loop equation 4 for v [ i ] equal to our desired equation 5 for v [ i ] , we solve for the inputs u L and u R : u L [ i ] = 1 θ L ( v f L δ [ i ]+ β L ) u R [ i ] = 1 θ R ( v + f R δ [ i ]+ β R ) (6) 2 Lab Note 7 — Controls (v5.1)
EECS 16B Designing Information Devices and Systems II Fall 2023 UC Berkeley Lab Note 7 These are the inputs required to equalize d L [ i + 1 ] and d R [ i + 1 ] ! But how do we know what to set the feedback gain values f L and f R to? To figure this out, we will need to find the eigenvalue(s) of the system so we can better understand its behavior in closed-loop feedback. Let’s begin by reviewing some terms related to state-space control. • System variable: Any variable dependent on/responding to the input or initial conditions of a system. • State variables: The smallest set of linearly independent system variables such that the values of the members of this set, together with the initial conditions, inputs, and known functions that model the system behavior, completely determine the value of all system variables for all t t 0 . For example, voltages across capacitors and currents through inductors are state variables in circuits. • State space: The n -dimensional space whose axes are the state variables ( n is the number of state variables) that represents all possible configurations of the state variables and thus the system. To study the dynamics, we will first define our state variables. If the goal is to have the car go straight, then our goal should be to maintain equal velocity for the left and right wheels. However, we are measuring the distance travelled by the left and right wheels, so we will implement a controller that drives the difference δ [ i ] down to zero. Let’s pick δ as our state variable. Does the definition of state variables apply to δ [ i ] ? In other words, is the following statement true: Knowing δ [ i ] at each time step as well as the initial conditions and inputs, we can uniquely determine the value of all other system variables. Let’s now find δ [ i + 1 ] in terms of δ [ i ] . We can do so by subtracting the two sides of the system of equations from equation 5 from each other. δ [ i + 1 ] = d L [ i + 1 ] d R [ i + 1 ] = v L [ i ]+ d L [ i ] ( v R [ i ]+ d R [ i ]) = v f L δ [ i ]+ d L [ i ] ( v + f R δ [ i ]+ d R [ i ]) = v f L δ [ i ]+ d L [ i ] v f R δ [ i ] d R [ i ] = f L δ [ i ] f R δ [ i ]+( d L [ i ] d R [ i ]) = f L δ [ i ] f R δ [ i ]+ δ [ i ] = δ [ i ]( 1 f L f R ) (7) Key points: • Since we are trying to drive δ to zero, δ is our state variable. All other system variables, such as v L , v R , d L , and d R , can be obtained from δ , the initial conditions, and the inputs at each timestep i . • Since we have only one state variable, our state space is one-dimensional. • Since δ [ i + 1 ] = δ [ i ]( 1 f L f R ) , the coefficient 1 f L f R fully describes the evolution of our state variable in time. So, 1 f L f R is our system eigenvalue! Feedback Gain ( f -Value) Tuning We can get different system dynamic behaviors over time for different values of 1 f L f R . Below are some example plots of system behavior (assuming no model mismatch) with various f -values. The rapid ramp-up at the beginning of each plot from t = 0 to t 0 . 1 is from the jolts, which are set to be unequal so that the controller has something to correct in these ideal simulations. Note that in the following plots, the distance travelled by one of the wheels can decrease, but since our car cannot go backwards, this is not possible with our cars. The purpose of the plots is simply to demonstrate the system’s behavior for various values of the system eigenvalue. 3 Lab Note 7 — Controls (v5.1)
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: In a 2015 study entitled How Undergraduate Students Use Credit Cards, it was reported that…
Q: 5. A 20 resistor is connected to an AC circuit. The RMS current through the resistor is found to be…
Q: A new screening program was instituted in a certain country. The program used a screening test that…
Q: Consider the function in the graph to the right. The function has a Select an answer v of at x = 10…
Q: Project3 The goal of this activity is to create a program that identifies the largest number among…
Q: Provide the abbreviation of the following nucleotide. O-P-O- N Koy H OH H OH NH NH₂
Q: How will I draw the graph based on the data and result? Thanks.
Q: Find the domain of the function. (a) f(x) =(2x+1)/(x^2+x-2)            (b) g(x)= (cube root of x…
Q: A geologist uses a simple pendulum that has a length of 37.10 cm and a frequency of 0.8190 Hz  at a…
Q: #Original immigrant data x = c(61159,…
Q: The count in a bacteria culture was 900 after 15 minutes and 1100 after 35 minutes. Assuming the…
Q: 8. Explain one difference in how & and 8 are used in the definition of limits. 9. For f(x) = 2x²,…
Q: (a)Consider a t distribution with 29 degrees of freedom. Compute P(t ≥−1.63). Round your answer to…
Q: Each of the regions A, B, and C bounded by the graph of f and the x-axis has area 3. Find the value…
Q: 1. Suppose P(A) = 4/10, P(B) = 5/10, and P(AB) = 2/10. (a) Compute P(AC). (b) Compute P(AUB). (c)…
Q: Which acid would be best to use when preparing a buffer with a pH of 4.72? A list of Ka values can…
Q: A study was conducted to determine the proportion of people who dream in black and white instead of…
Q: In a poll of 225randomly selected U.S. adults, 117 said they favored a new proposition. Based on…
Q: Colter Steel has $5,300,000 in assets. Temporary current assets $ 2,600,000 Permanent current…
Q: Solute S has a distribution constant of 4.7 between water (phase 1) and hexane (phase 2). A 75.0 mL…
Q: If you are not able to remember your best friend’s dog’s name, that is an issue of:   retrieval…
Q: Benedict's reagent is blue in solution. Which compound when added to a solution of Benedict's…