These are draft notes from subtitles. Please help to improve them. Thank you!
Welcome back and fasten your seat belts, because in this unit we're going to brake as hard as possible. You design an anti-lock braking system that controls the brakes to apply the maximum available amount of friction, but rest assured it won't leave skid marks on your computer.
Breaking means to apply friction, lots of it, and for breaking it's vital to distinguish between two different regimes of friction--static friction and kinetic friction. If this object is at rest with respect to that surface, we can apply forces up to a certain threshold force without setting this object in motion, which remains static. Experiments showed that this threshold of force is a constant times the rate force, which often is called N because it's a normal force. It is perpendicular to the surface. Its coefficient is called the coefficient of static friction µs. As long as the force that we apply doesn't exceed this force, this object won't be set in motion. When this force becomes larger than the threshold, the object will be set in motion. For example, if the mass of this object is 1 kg, the gravitational force would be almost 10 N. A pretty high value for this coefficient of static friction would be 1, which means that the threshold force is at 1 * 10 N. It would have to exert a force of 10 N or more to set this object in motion. If we apply less, it remains static. Typically, this coefficient of static friction ranges between 1/3 and 1, which means that typically to set an object in motion, we need to apply less force sideways than the force with which gravity pulls that object down. Things are easier in the kinetic regime. We need to apply a certain force to keep this object going at a constant velocity. So this force is nothing else but the force exerted by friction, and from experiments, we find that this force is some constant times the normal force, the force exerted by gravity in this case, and this is the coefficient for kinetic friction. In the kinetic regime, we got the same expression but it's an equal sign. In this case it's not a threshold--we compute the force as such. What's of imminent importance for breaking is that the coefficient of static friction tends to be larger than the coefficient of kinetic friction. The coefficient of kinetic friction maybe be 1/4 less than the coefficient of static friction or it may even be smaller, and now think about breaking. We want to apply the maximum amount of friction. The maximum amount of friction is found in this static regime, because the coefficient of static friction is higher than the coefficient of kinetic friction. What we need to prevent is the locking of wheels. When wheel stays locked, it's sliding on the ground, and we're in the regime of kinetic friction.
Here is the situation for you to think about. Your notebook computer rests on a lectern, the surface of which is inclined by an angle of 45° to the horizontal. Will the notebook computer stay there or will it slide down? Assume that the coefficient of static friction equals 0.8.
Gravity exerts a certain force on that object, and this force results in forces of equal magnitude perpendicular to the surface and parallel to the surface. This happens because this angle equals 45°. If the coefficient of static friction was 1.0, we would be up a threshold of motion. The magnitude of the force that pushes the object along the surface is the same as the magnitude with which the object is pushed toward the surface. If the coefficient of static friction is 0.8, the threshold force would have a magnitude of 0.8 times this force, which means it's smaller than the actual force. This object is going to move. It's going to slide down.
Now let's look at how the distinction between static friction and kinetic friction applies to the rolling wheel. Assume that the wheel first occupies this position and then rolls on towards this position a fraction of a second later. This would be the distance covered by the car. Let's mark the same distance on the perimeter of the wheel. If the wheel was rolling without slipping, it would have rotated by this angle, but we want to study breaking so there will be a certain amount of slippage between the road and the wheel. The road will not turn by this complete angle. It will turn with less. There would be a certain amount of distance left marked in blue. This leads to the definition of wheel slip. Wheel slip is the ratio of that missing distance to the distance traveled by the car. If we have perfect rolling, there won't be any difference. The wheel slip becomes zero. It won't move at all. The blue distance equals the red distance and the wheel slip becomes one. Now one can study how friction depends on wheel slip. If a wheel slip equals one, the wheels are locked. They don't move with respect to the car. They slide on the streets, which means that we are in the regime of kinetic friction. The coefficient of friction will be less than optimum. If the wheel slip equals zero, the wheel is rolling perfectly, and the car only experiences the rolling friction, which is so small that we neglect it here and simply set the friction to zero. When there's just a slight amount of slippage between the wheel and the surface, the wheel develops the maximum friction. What's going to follow? we're working with one single curve to describe how the coefficient of friction depends on the wheel slip. Actually, that's far from true. With the higher speed of the car, friction will be reduced, and of course if there's water or ice on the street, we see a very strong reduction of friction. To keep things manageable, however, we're going to stick to one single curve.
How much difference does the coefficient of friction make? Let's compute what's going to happen if we brake with a very high friction 1.0, which is really optimistic, and with a slightly less friction. Our car should be traveling at 120 km/h, which is approximately 75 miles/h. How long will it take to come to a complete stop? Enter the numbers of seconds with 1 decimal place. Here's a hint--think about this diagram, how does the velocity of the car depend on time and think about Newton law from Unit 1.
If we apply this higher amount of friction, it's going to take 3.4 seconds to bring the car to a complete stop and for the smaller amount of friction, it's 4.9 seconds, and now let's look at how to compute this. We have to take two different forces into account. The force due to friction, biking that is, and the force due to gravity. Newton says F=m*a. The force due to friction equals the mass of the car times the deceleration as we are breaking off the car. But the force exerted due to friction is amountable of the force exerted by gravity with the proportionality constant µ and what's force the exerted by gravity? It's the mass of the car times the gravitational acceleration of the earth. You see that's Newton law applied in the reverse direction. If you look closely, you'll see that mass cancels from both sides of the equation and the deceleration equals the constant of friction times the gravitation acceleration. This is one funny consequence for astronauts. When you try to break a car on the moon, the gravitational acceleration is far less than on earth and so the deceleration is far less than on earth. Breaking is far more ineffective on the moon than on earth. Now we can use this result to look at how speed depends on time. The deceleration is constant so the velocity decreases by a certain fixed amount of meters per second. The relationship between velocity and time is linear and the slope of this line is given by the acceleration. This side has a length of 1, this side has a length of a, the acceleration, which is, as we now know, the constant of friction times the gravitational acceleration. You'll see two similar triangles in here. We have the time it takes to come to a complete stop divided by the initial velocity equals 1 divided by the deceleration. The time it takes to come to a complete stop equals 120 km/h divided by our deceleration which is the constant of friction times the gravitational acceleration. We have to go from kilometers per hour to meters per second. The gravitation acceleration equals 9.81 m/s² . To make this work, we should be using m/s for the velocity as well. One kilometer is 1000 meters and 1 hour amounts to 3,600 seconds. Now you can do the math.
This function that describes how the coefficient of friction depends on the wheel slip is a vital part of the simulation. The tricky thing about is that it stems from experiments. It contains empirical data. We do not have any nice equation for that curve--that is not until now. One way to deliver such empirical data in this simulation would be to use a lookup table such as this one. If we input a wheel slip of zero, we output a coefficient of friction that's zero as well. If we input a wheel slip of 0.1, we output a coefficient of friction that's 0.9 and so on. This would constitute a lookup table. The tricky thing is what would you do for a wheel slip of say 0.01234. What do you do about values of s that are not contained in this column? We have to somehow interpolate these values, which gets complex and it's not easy to do in a smooth fashion. A simple approach is to use a phenomenological equation to guess how one could possibly describe this in mathematics without worrying about the reasons for why it looks the way it looks. We just collect some mathematical functions that produce the right shape. If you look at the shape of this function, you may come up with the following idea-- for reasonably large values of s, this function almost is a line so why not use that line as one component in our equation. Close to zero it looks as though we are subtracting a quickly decaying function such as e^(-20s). Your job is now to make this work. Pick the right value for the constant a and then implement this function in Python.
To get the equation for the line, you can look at the slope and the intercept-- the intercept being 1.1 and the slope being -0.4. An important point to take care of when we pick the constant in front of that quickly decaying expression is that the coefficient of friction should be 0 when the wheel slip is 0. So if you plug in 0, you'll find -A * 1 + 1.1, meaning that A has to be 1.1. And implementing this in Python is of course straightforward.
Now we are in the position to write down differential equations. We look at a single corner of that braking car. Just a single wheel not all four wheels and just a quarter of the mass of that car. Let's called the velocity of the car V and the velocity of the rim of the wheel W. We specify the velocity of the wheel in m/s similar to how we specify the velocity of the car, and which will show you or rather find a discussion that uses the angular velocity of the wheel and that uses the moment of inertia of the wheel, which gets overly complex for all purposes. This quarter of the car exerts a certain force on the ground, namely-- the mass of that quarter of the car times gravitational acceleration. By friction, the road surface exerts this force on the wheel. If you wonder about the direction, imagine that the wheel was locked and friction will put it around in a clockwise fashion. The first thing to be computing is the wheel slip s and given these two velocities, the velocity of the car and the velocity of the rim of the wheel, we can compute the wheel slip by 1-W/V. Let's do this. I need to check. If the wheel is lock, the velocity of its rim will be zero. W will become zero. What do we get? 1-0. A value of one fitting to the wheel being locked. If we have a perfectly rolling motion, W will be equal to V and we compute 1-1/1 which is zero. This seems to be very plausible. Once we've got the wheel slip, we can compute the force from friction and it's the coefficient of friction which again depends on the wheel slip times the force perpendicular to that surface, 1/4 the mass of the car times gravitational acceleration and now it's time to look at the velocities. The car is decelerated. The rate of change of the velocity of the car minus the friction force divided by the mass of that 1/4 of the car. Think about Newton's law--F=m*a. The rate of change of the velocity is the acceleration. This our force, this is our mass, and we have to take care of that we are braking decelerating. We get a similar equation for the velocity of the rim of the wheel. Its rate of change increases through a friction, so we've got a plus sign now. The mass to be used here is not the mass of this 1/4 of the car. It's rather something like the effective mass of the rear. In reality, we would have to take care of the circumstance that the mass of the wheel is distributed over the cylinder. To make things simple, I'm using an effective mass here. That's my own term. As I said before, the typical way of dealing with this would be using angular velocities with moments of inertia, which considerably complex. Let's cheat a little and introduce this effective mass of the wheel here. If the mass of the wheel was concentrated at its circumference, then this would actually be the mass of the wheel. This is not all. We have to model the action of the brake which acts on the rear. The break decelerates the wheel. Let me put it like that minus capital B and this quantity B represents the strength of that braking process. If you put it like this, it acts like a deceleration of the wheel so it's something measured in m/s². If it wasn't for the friction force, the wheel would be decelerated by this amount. Now we have reached four equations that describes the process of braking.
The effective mass of the rear is obviously way smaller than the mass of the quarter of that car. Due to its low mass, it is much easier to accelerate than decelerate the wheel than to accelerate or decelerate the car which has a larger mass. So when we want to study equilibria of the wheel slip that its values which stays constant, we can start by thinking about the velocity of the car is a slow variable and the velocity of the rim of the wheel is a fast variable. We have cheated a little and say, okay, let's assume that the velocity of the car is almost constant but assuming that the velocity of the car is almost constant, this idea about the fast changing W and the slowly changing V helps us to think about the equilibria of the wheel slip. If that wheel slip reaches an equilibrium, its temporal, its rate of change becomes zero. It does not change anymore. This is the meaning of equilibrium. If s doesn't change and V is almost constant, we learned that W must not change, but we have an equation for the rate of change of W. It's the friction force divided by the effective mass of W minus the braking deceleration of the wheel. These two expressions have to be equal. We find approximately this equation for the equilibria of the wheel slip. When the wheel slip does not change with time, the friction force divided by the effective mass of the wheel has to be almost equal to the deceleration of the wheel by the brake. Given this equation, the task is now to determine the number of equilibria, the number of stable equilibria, and the number of unstable equilibra. For that, assume that the car is braking slightly below the optimum value and ignore the case that s, the wheels that equals one, which means perfect locking.
In turns out that there is one stable equilibrium and one unstable equilibrium and now, we will discuss the details. Let's take this equation and put it in this form so it's easier to see what has to be balanced. The force divided by the mass has to balance the deceleration by the brake. The force can be expressed with the help of the friction coefficient, the mass of 1/4 of the car, and the gravitational acceleration. So this equation boils down to the following--that the coefficient of friction has to equal the deceleration of the wheel over the gravitational acceleration times the ratio of the masses and now we can check with our diagram what this means. If we brake with an intensity slightly below the optimum, the coefficient of friction has to be on such a line slightly below its maximum value. This has to be the value of our coefficient of friction and hence, of the right hand side. We have two options to satisfy this equality and hence, two possible equilibria. This value of s and this value of s. The lower one is stable. The upper one is unstable. I just illustrate one part of the argument for that. Imagine s was a little lower than the value of the equilibrium, then we would have less friction because the coefficient of friction decreases, but if we have less friction, the brake acts stronger on the wheel, which means it's going to increase wheel slip and moving in that locking direction, which means upward. From the left side, this equilibrium is stable. When we are slightly below, this equilibrium point if you're moving up and you can argue in a similar fashion that we are slightly below that point if we are moving down. For this point, it's the other way around. If we are slightly below, we keep on moving down. If we're slightly above, we keep on moving up. Once we are past that point, we inevitably run into locking a wheel slip of one and strictly speaking, there is a 3rd equilibrium which is stable again. When the wheel slip is one, that means when the wheel is locked the deceleration by the brake always supersedes the force applied through friction. We are going to stay in that locked state. There is a practical consequence of this--if you push the break too hard, you're inevitably going to lock the wheels, which is far less than optimal. If we really stump on the breaks, there is no equilibrium below s=1 at all. No matter what, we're going to end up with locked wheels.
Now it's time to see the single corner model of a car in action. The program test different strengths of braking so that we can learn about the equilibria that we've analyzed before. The mass of 1/4 of the car and the effective mass of the wheel are provided 20 kg for that effective mass of the wheel is a little on the high side, but helps to make the simulation more stable. Your first task is to fill in the initial values. You want to start with the car speed of 120 km/h and no slip, perfect rolling. The other task for you is to implement the forward Euler method. We make sure that the wheel slip never decreases below zero. This helps to make things more stable. Your task is to compute x which is the position, V which is the velocity of the car, and W which is the velocity of the rim of the wheel and then we're cleaning up a little to make sure that the velocity of the rim of the wheel is never negative. Again, we measure to make things more stable.
The initial value for the velocity of the car is of course 120 km/h converted to m/s and the initial value for the velocity of the rim of the wheel has to equal the velocity of the car so that there is no slip. The implementation of the forward Euler method should be straightforward. The top most subplot illustrates the braking distance. The endpoint of each these curves is at the braking distance. The second subplot shows that the car velocity decreases almost linearly. This is not quite sure of the wheel velocity. In particular, you can see that the rear velocity quickly deceases to zero when the strength of braking this too high. The most interesting part, however, is the lower subplot. It shows the wheel slip. If we apply just a little of braking, we're going to run into the lower equilibrium, which is a stable one and which is always below the optimum value of the wheel slip of 0.2, and to see that for this curve colored in green and this curve colored in purple, we do not reach such a reasonable equilibrium, however, the wheel locks up. The wheel slip becomes one, which we have seen in the plot above as well. Among these five options, the red one seems to work best and you see that we must not apply too little braking and that we must not apply too much braking. You maybe wondering about this artifact here. Remember how we compute the wheel slips. One minus the velocity of the rim of the wheel divided by the velocity the car. If these two gets close to zero, the ratio is going to vary widely. This is a numerical artifact. So the reason for this artifact is built into our equations. At the end of the simulation, we're dividing numbers, which are close to zero. That's always a bad idea when it comes to maintaining stability.
By now you may have gotten the big idea behind anti-lock braking systems. Looking at this curve, it's obviously best to have a moderate amount of wheel slip, say, 0.2. So the wheels must not be rolling perfectly. It's also not good if the wheels do not roll at all. If they are locked, the wheel slip of about 0.2 would make more sense. This is the objective. We have to have some type of technology that make sure the wheel slips stays around 0.2. So that we apply the maximum amount of friction. This ensures that the braking distance is as short as possible but it also ensures the maximum amount of steerability. The larger the friction is the better we can steer the car while it is braking. You may ask yourself, okay, all of this is good and well but why don't we simply build a brake that applies this amount of friction and then we're done with it. No electronics, no sensors, no actuators whatsoever. The problem is that this curve looks different under different circumstances. With a higher speed, it may look like that. When there's water on the road, it may look like that and so on. So we do not know in advance which amount of friction would be best. What we do know that the slippage of 0.2 almost always make sense. Put note, a wheel slip of 0.2 actually does not make sense on snow and on sand. If you're on snow and on sand, locking the wheels as quickly as possible is the best option.
Before we get started with automatic control, let's try manual control. We want the driver to slam on the brake from 0 second to 0.7 seconds, then release the brake, then slam on the brake again from 1 second to 1.7 seconds, release the brake and so on. The code of the simulation runs twice--the first time with the strength of the brake close to optimum and the second time re-release slamming on the brake. Your job is to do something about that second time. In that case, this volume variable is pumping becomes true by the way these parenthesis are just for readability. Without them, the code look somewhat strange, and when we are pumping, simulate that this value of p is being modulated, which means that we have to complete this line here. What is the velocity of the rim of the wheel in the next step.
Let's look at the results first. The blue curve is the one that we know, almost optimal braking. And you see that this type of pumping doesn't really cut it. It takes more than 5 seconds to bring the car to a complete stop. As the driver slams on the brake, the wheels locked every second, which means that the wheel slip is almost never close to the optimum. The implementation uses this on/off factor to where switch the brake on and off. To compute when to switch off the brake, it'll get the fractional part of the time-- the time minus its integer part. In the solution, we won't be overly picky about this precise instance of time to take the finite step size into account, which require some more thinking.
Now it's time to have some automatic control of the brake. We want to set the wheel slip to 0.2, but actually the only thing that we can control is the brake. We can't directly control the wheel slip. So the job is to provide the right input to the brake so that the measured wheel slip is about 0.2. That's lot of things going on in between. Think about the dynamics of the car, the surface of the road, and so on. Situations such as these are studied in control theory. How to provide the right input to get the output that you want and this is the approach one would typically be using. We found the difference of the optimum value and the actual current value to get the current error. This is fed into a code controller, which as the name says controls the brake. So what we are doing right now is more than just a simulation. We're simulating the brake, the dynamics of the car, the sensors but in addition to that we're also be going to design a controller. That's a piece of software or maybe hardware that's going to actually be part of that real car.
When we're going to implement the most simple controller I may think of? A p-type controller. P stands for proportional. It's simply going to multiply the error by some number to produce the input for the brake. To be more concrete, let's multiply the error with 100,000 m/s². When doing so, we can, of course, get huge positive and negative numbers that don't make any sense to control the brake so we have to clamp the output. Whenever the result of that multiplication is negative, we return 0 instead. Whenever the result of that multiplication is larger than 200 m/s², we return 200 m/s². Why could that possibly work? Assume that when we're fitting this controlled value of 130 m/s² into the brake, we're actually ending up with the wheel slip of 0.1987. And the difference between the optimum value and the actual value is 0.00130. The controller is going to return the same number again, 130 m/s². So this foot constitutes an equilibrium. One thing to know about this naive version of the p-type controller is that the value of the equilibrium is always slightly less than the optimum. If anything changes concerning the dynamics of the car or the vault conditions, this actual value may change. When the actual wheel slip goes up a little, the difference is going to decrease. We're subtracting the actual wheel slip. This is going to become 0.00129. The error gets a little smaller. We're multiplying this error by 100,000 m/s², which results in 129 m/s². We're braking less, at least we're braking less hopefully. The slip is going to decrease again. So this looks like a stable equilibrium at least from the one side, but obviously, this also works when the actual wheel slip is a little too low. Now implement this in Python. Your first job is to implement the p control as a function. The function receives the actual value and the target value, 0.2 that is, and returns the output of the p control, which eventually controls the brake. Your second job is to call that function to control the brake.
To compute the function for the P-controller, we're computing the difference multiplied by our large number and then clamp the result. If this product is smaller than 0, negative that is, 0 will be the maximum. If this inner value is larger than 200, the minimum will be 200. So this min and max does the job. We could also use in construction business if or that would take several lines of code and then the forward Euler solver for the velocity of the rim. You simply insert the result of the control as the deceleration of the brake and of course, you're plugging in the optimum value of 0.2 for the target. If you look at the result, you see that the wheel slip indeed stays close to 0.2, a little less, but just before the car comes to a complete stop, strange things happen. We're multiplying tiny errors by huge numbers. That's pretty dangerous when it comes to instability. When you use this type of controller, you have to be really careful about stability, but actually in the next segment, we are going to show that we can use this type of controller anyway for completely different reasons.
Things are actually even worst. We cannot set the wheel slip directly and we can't even set the brakes directly, at least not with the standard type of hydraulic brake that's part of common cars. So realistic approach to anti-lock braking is the following--the driver slams on the brake as strongly as possible and then the electronic checks whether the wheel slips becomes too large. If so, it starts to decrease the pressure of the brake fluid and so on and so on. The implementation of this will be part of the homework.
Look at these few curves. Which of them tells you how strongly the brake x on the wheel? Which of them tells you what the wheel slip is and which of them tells you what the velocity of the rim of the wheel is?
Obviously, the middle one showed something like hydraulic pressure. The driver pushed the brake better and then the electronics modulates that value at a constant slope. The lower one has to be the wheel slip. As you brake stronger, the wheel slip increases. As the system decreases the pressure, the wheel slip eventually starts to drop again. The upper one has to be the velocity of the rim of the wheel. When the wheel slip is slow, the velocity of the rim of the wheel is large, approximately the velocity of the car. When the wheel slip is high, the velocity of the rim of the wheel has to be low.
Now that we've learned that it's harder as expected to control the brake, it's time to learn that it's hard as expected to measure the wheel slip. One simple approach to determine the velocity of the car is to use the W of all four wheels and to use the largest of them, so that when we have strong slippage for some wheels, we hope that at least one of those wheels has full contact to the road's surface. What do you think is the easiest way to improve that estimate of the car's velocity. Should we be using GPS, should we be using a camera and do motion analysis of the camera frames, should we be using a 5th wheel--a lightweight one with no brake, or should we be using a accelerometer of that kind you know from smart phones and game consoles.
GPS provides us with very accurate velocities, which is nice, but on the other hand, we want to be able to use our system in the tunnel too. Using a camera with motion analysis is really high tech. It's hard to get results that are really reliable in 99% of the cases. For experiments, you may actually use a fifth wheel, but in real life this would of course be awkward and costly. I would say the accelerometer is the way to go. It's just a tiny chip to be added to the electronics. One issue about the accelerometer is that it does not output the velocity, it outputs acceleration. Hopefully, you have a good estimate of the velocity before we start braking and then we can use the acceleration to estimate the evolutional velocity.
By now, we have a nice cartoonish model of a car, but there's lots of issue to consider to make this model really life-like. First thing to mention, the car can turn left and right. Our model should be able to do the same. This should be including a lateral motion. Each of the four wheels is not an exact cylinder. The cross section of a wheel is not a circle. The wheel is deformed as it touches the ground. The wheels are mounted with the help of some suspension, which may oscillating, and there's interaction between the wheels. What happens with one wheel may influence all three other wheels. In the next quiz, we're looking at one mechanism for such a sort of interaction between the wheels.
Here are two ways of transporting a heavy object. You can put it on the backseat or you can transport it on the roof. Now, imagine that you brake in this situation or in that situation. In which situation does the front of the car lower more or is there no difference at all? Think about the center of mass and think about levers.
In the second situation, the front of the car will lower more when we brake. To see that, let's look at the center of mass. In this situation, the center of the mass is put to the back of the car--may be it's here. In this situation, it's put up--may be it's here. Now let's look at the forces due to friction and the levers. We can see that in the second situation, the levers get longer and the angle between the forces and the levers is closer to perpendicular. So there are two reasons for this car is pushed stronger in the clockwise fashion, which means that its front lowers more.
One cannot discuss anti-lock braking without asking whether or not such an improved safety feature actually saves human lives. Some researchers argue that humans tend to stick to a certain riskiness of the behavior. The envelope of what can be considered risky behavior is pushed up with introduction of anti-lock braking. And many drivers are going to stay with the original level of riskiness, which means that with the introduction of anti-lock braking systems, they are going to drive faster and brake harder relying on the improved brakes. In the end, it all boils down to saying that psychology matters. To improve safety, we cannot only look at technology or to cite an example from history-- when your ship is supposedly unsinkable, why should you care about icebergs?
In this unit, we look at how to model a 1/4 of a car, seeing physics in action. I guess you can imagine how to model other types of machinery with the help of differential equations and the computer. And we took a glimpse at control theory trying to come up with feedback loops that ensure the system behaves in an optimum fashion.
For this problem, you're going to develop a semi-implicit solver to model just a single corner of the car and its motion. You saw the diagram that look pretty much just like this in the unit. Now all of these errors represent different types of quantities but they're just use for showing direction. V here represents the velocity of the car. W is the tangential velocity of the wheel. Mqc is the mass of one quarter of the car and therefore, mqc*g is equal to the gravitational force on this quarter of the car. F here represents friction or the force of friction that is acting in this direction against the motion of the car. The force of friction is a function of S, which stands for wheel slip. We can write out the equation for the force of friction just like this. The force of friction is equal to, as you've seen before, the coefficient of kinetic friction, which is the function of wheel slip, times the normal force, which in this case has a magnitude equal to that of the gravitational force. We can relate some other important quantities to the force of friction, and right here we can see that v-dot or the acceleration of the car is impacted definitely by the force of friction. Change in the velocity of the wheel depends both on the force of friction and on B, which is the braking acceleration. S here, as you remember, stands for wheel slip as I just said. We also have this expression from U, the coefficient of kinetic friction. Your first task in this problem is going to find an equation for W at the n+1 time step that fits this form right here. In this equation, C, D, F, and K all could depend on a number of different things. For example, it might depend on W sub n, on h the time step, or the mass at the corner of the car, on the affective mass of the wheel, mew right here, mg the acceleration due to gravity, on B the braking acceleration, or on v the velocity. For v which you see right here, we're going to use v-sub-n because as it turns out v changes very slowly compared to w. In fact, what we have is a stiff system of differential equations. You remember for our work earlier on in the course that stiff systems of differential equations require you to use a very small step size or else we'll end up with completely unreasonable results. If you want to test this out, try plugging in h=0.1 seconds for the step size and see what kind of craziness this is. In order to figure out what to plug in for C,D, F, and K here, we want you to use the backward Euler method along with the information that we've given you here. Looking at the code, you can see that we've given you a substantial portion of the program already. In fact, we've handed you a solver right here. Since we're asking you to use the backward Euler method, which is an implicit method, you're going to end up with an equation that is not linear and therefore, you can't solve explicitly. Once you've used the backward Euler method to come up with values for C, D, F, and K, we want you to use this solver in conjunction with the backward Euler method to come up with an expression for w[step+1]. In the solution video, I'll give you a more indepth explanation of what do solvers do and then how it works.
In order to use the backward Euler method to come up with an expression for w at the n+1 step, we know that we're going to need an expression for w dot. So that's the first thing we deal with. Beginning with our equation for the force of friction. We know that the acceleration of the wheel depends on the force of friction divided by the mass of the wheel. So we plug in this expanded version of the equation for the force of friction into the equation for w dot and of course the track b. In the backward Euler method, it says that w at the n+1 step is equal to w at the n step plus the step size times the change in w at the n+1 step. Now that we have expression for w dot, we can plug into the proper location in the equation below. If rewritten as the wheel slip to see here and here as 1-w at the n+1 step over v, which of course is just an equivalent expression. This gets rid of any explicit dependents on this. Remember from what I said earlier that v here changes much more slowly than w. We then specify which v we're referring to right here. But if you were to be more clear, this is the subn+1. There's a little bit of rearranging we can rewrite this equation for w n+1 as this equation right here. The amazing slightly counter intuitive to rearrange things like this since this expression looks maybe longer and more awkward than this one does. Remember, however, that our initial request for w was that it obey an equation of the form that I wrote up here. We have a term with w subn+1 and then term with e to that value and also a constant. All just added together equal in 0. That's exactly what we have down here now. This makes our job very simple. Remember, we want to identify what c, d, f, and k are. And now, we can just read them directly off of this equation. In order to implement the backward Euler method and the code now, all we have to do is translate the variables c, d, f, and k into code just like I've done right here. The expression for w that the solver is going to output. is equivalent to the one that we just found using the backward Euler method. It's very simple since the solver has already established for this. All we have to do is fill in the proper values for these variables. In the introduction video, I didn't talk much about what the solver is actually doing. So now just take a second to explain that. It's implementing something called a Newton-Raphson method. This is a method used for solving implicit equations that are not linear. So it's a perfect fit for the situation that we are faced with right now. Let's say I have a function like this green curve right here for which I want to find the x value of a certain point. Maybe for example I'd like to find the x value of this x intercept right here. So the thing that we actually know about this point then is the y value, which is 0. To use in Newton-Raphson method, I start by making a guess at what the x value that appears to that y value is. Maybe I guess the x coordinate that corresponds this blue line right here. What the Newton-Raphson method does is it takes the slope of the line tangent to the green curve at this point. This may be that tangent line looks a little something like this and extends that line down to the y value that we're interested in. Now, the next x value that I will guess is going to be the point of that tangent line intersects the x axis in this case then I will do the same thing for this point and so on and so forth. And eventually, my results will converge to the actual point that I'm looking for. This is a very effective method for solving implicit equations. The general equation showing the movement from one guess to the next guess is shown right here. We can specify this to deal with the situation we're looking at by using this equation right here. And in fact, that's exactly what's written in the code in this expression for w_new. Now that we understand how are solvers working, let's look at the plot we get. What we have here is a series of plot that all depends on time. First, we have position then car velocity then wheel velocity and then wheel slip. The difference series shown by the different colors in each plot represent different values for the magnitude of the breaking acceleration. Fusing them really close in the different parts of the top graph, you'll be able to tell that 70 m/s² is the blue line; 100 m/s² is the green line; 130 the red line; 160 the cyan line; and 190 the magenta line. So we can see then how different braking accelerations affect these 4 different quantities. Interestingly enough, it's the 130 m to second braking, which is one of the middle values that makes the car stopped first. When we slam on the brakes really hard which is shown at the magenta and cyan lines, the wheel stopped rotating very quickly and see the wheel velocity was 0 right away. However, in tandem with that, the wheel slip increases dramatically, and the wheels are locked very early on. As a result, the car velocity does not actually slid down much. Of course, as we would expect, we just don't put the brakes on very hard like with the blue one then the car does go a pretty far distance, and it actually does not come to stop it all in the time that we've allowed; however, this is the great example of how slamming on your brakes is not the most effective braking method. Great job on this problem.
In this problem for Unit 5, I want you to implement the control algorithm that you saw in sections 2 and 15 of Unit 5 for the hydraulic braking system. We've set up a number of important values for you, as always, including two things called low slip and high slip. These are both possible values for the real slip. If the real slip gets smaller than low slip, we want you to decrease the pressure of the brakes. Similarly, if the real slip gets higher than high slip, we wan you to increase the pressure. Increasing and decreasing the pressure like this leads to rate of change called hydraulic speed in the strength p of the brake. Hydraulic speed is shown right here while p the braking strength which you can see right here is measured as the deceleration of the velocity at the rim of the wheel if there is no friction from the road. Possibly logical, the strength of the brake cannot be a negative number and we've set the maximum value that it can take on with this constant called max brake right here. You're going to need most of the contents of the for loop inside this function, but there are a couple of line left that we want you to write. We want you to model how the brake pressure changes between these maximum and minimum values that we outlined above, and using these, how the brake acceleration changes step by step. This might require a little bit of creativity, so if you need some hints, come to the forums.
The first thing we did in order to model the zigzagging oscillation of the brake pressure was to create this perimeter called brake change. Just for simplicity,we set the initial value of brake change to zero. If you move down to the far loop, you can see that brake change alternates between having a value of 1 and -1. If the wheel slip falls below the constant low slip, then the brake change value switches to 1. And as soon as the wheel slip passes high slip, they change, switches signs, and becomes -1. An expression for b after the next times step We've ensure that b will not drop below zero by setting zero as the minimum value that it can take on. Then using this min method right here, we are assuring that its magnitude will not exceed max brake. However, anywhere in between zero and max brake, it will take on this value right here. We take the value of b at the previous step and add it to the step size times brake change, which is either you're going to make this a positive or negative quantity and multiply that by the hydraulics speed. Remember that hydraulic speed is just the rate of change of the strength of the brake. To visualize what we've done, let's look at our plots. This bottom graph shows how the brake strength changes with time. Just as we hoped, we see that our line either has a negative slope or a positive slope, but of the same magnitude just alternating signs. These changes in sign correspond to the flip in the sign of brake change. The crest of the brake strength curve are points at which brake change switches from being positive to being negative. We see that the brake change switches to -1 if the wheel slip exceeds the value of high slip and if you look at the corresponding values in wheel slip, you see that these points of transition in brake strength corresponds to the highest values in wheel slip and the lowest value in wheel slip which we can see signals a switch in brake change to +1 correspond to a change in the sign of the slope of brake strength from negative to positive. Zooming out and looking at these plots as a whole, they say that the wheel slip is controlled very nicely but the value of b does oscillate very strongly and this would look pretty stressful for the brake mechanism. What we would want instead would be a value of b that will be close to the correct value. One option for this would be to limit the range of b by holding the pressure constant or keeping the value of b constant then b gets either too large or too small. Let's try that out by making a small change in our code for just a second I'm going to comment out this line and instead infinite this line. Our original line of code kept the value of b between 0 and max brake. We are now going to replace those respectively with 100 and 150 so b is going to be within a much smaller range of values. Now, let's see what happens with this change. The first thing that I noticed when I looked at this is that as you would expect the graph of the brake strength, it doesn't look like it will put much strain and stress in the braking system as our previous system did. The wheel slip also still stays within a very nice range and their car does come to a complete stop. Despite the improvement that this would allow, it will require some additional knowledge that may be difficult to find. We have to be able to project a reasonable range for b depending on current road conditions and we also have to measure the hydraulic pressure of the brake. There are cheaper options that we could consider such as looking at the deceleration of the wheel to decide when to stop increasing or decreasing the pressure and to hold the pressure constant instead. I hoped you enjoyed this brief introduction into the intricacies of actuators with the speed dynamics. Unfortunately, this is the end of our work for now with cars and braking systems. We're moving on to something very exciting, wild fires. I know that playing with fire is risky, but luckily we are doing all that on computers so we don't really have much to worry about. Get ready for some very interesting problems and great job on this unit.