Now that we've derived this, what I want to do is go by hand and actually develop a feedback control loop that we could do. You've done some exercises earlier with 1D first-order system. X dot x was equal to 5 minus X brackets squared, that kind of stuff. This appears a lot in these servo systems, that's why I wanted to practice in palmar 1 on first-order systems. Let me bring my notes that I have on the stuff. We're going to drive a loop and then go look at the issues that might arise. I'll do a reaction wheel, speed, servo loop. With the earlier equations, we found GS, IWS, Omega dot, and from this, we found an Omega dot. That really means if you have a controlled time period, given Delta T, the N plus one new speed we should have is going to be our current wheel speed. N plus this that we computed right now, at the current time, times Delta T, you'd be able to figure this out. We know what the new wheel speed should be at the end of the control time step. What's the goal? Goal is we have Delta, wheel speed, which is current wheel speed minus desired wheel speed. From here, this is actually the desired wheel speed that you would have, because from the servo control is an inner control loop from the outer controller that we had on the earlier slide, we would now say, okay, this is the acceleration you should have. Therefore, over control time period, this is how much I should be changing it, and this is that, and this is what we want to drive towards zero, Let's derive a system, but you will also need a differential equation at some point, so the inner loop that will control the wheel speed relates to the wheel motor torque. We had the motor torque equation So I'm just going to write that one down. Given the motor torque, S is equal to IWS times Omega dot transposed with GS hat plus the wheel speed dot, that's the one that we'd have. Okay, this becomes nothing but a tracking problem. It is for simple first-order system. We needed Lyapunov functions. In terms of what arguments do we have to write our Lyapunov function? What do you think, Evan? In terms of why did we authorize [inaudible]? This is my control setup, my V function has to be in terms of what? Delta-Omega? Delta-Omega. That's the thing we want to drive towards zero. You wouldn't just put Omega in here because that's not positive definite. Delta-Omega should be a positive definite expression. Now we need to pause a definite expression, sum is going to be really boring. 0-Omega squared over 2, that makes life easy. Then we take the derivative, you're going to have Del-Omega dot, which is Del-Omega times Omega dot minus Omegad dot. I knew what I was missing. I'm going to throw this constant in there, it'll make my life easier. It's a positive constant. So I can do that. That's still positive definite, it's like when we had the inertia rate squared or mass times mx dot squared over 2 for kinetic energy. It made the equation of motion stuff easier. If we do this, now, as before, I'm going to prescribe a V dot behavior I want and then back solve for what Control will make that work. We're going say this is simply going to be minus p times Del-Omega squared. Is this V dot negative definite or negative semi-definite? Negative definite, because we only care about Del-Omega. This is negative definite terms of Delta-Omega. For first-order systems, we get that, like great. We don't have to do [inaudible] and [inaudible] invariance principle. We can stop right there and go, if we can do this, it's going to be asymptotically stabilized, and in fact it's globally asymptotic stabilizing. We have del Omega here, del Omega here, this V dots have to be equal, and you can separate them out. This leads to del Omega times, here I have to plug in the equations for the system. The inertia time's real speed is equal to us minus this term. All this stuff times this is going to be nothing but us minus Iws Omega dot gs hat. That's this term, then I have minus Iws Omega d, then I factored out that Omega, that's those two. If this is equal to this, I'm going to bring this over to the left-hand side, factor out del Omega, so you get your classic feedback term, p times del Omega. This whole thing has to be 0. Julian, what can be argued now with this equation? How do we solve for motor torque? [inaudible] How do we do that? [inaudible] Yeah. In here, it's just a 1D, so you could divide by del Omega and say, well, as long as it's not 0, I'm fine. But really the other argument is this has to be true, regardless of my initial tracking errors, I need to be able to achieve this, so I cannot count on del Omega being 0 to drive it to 0, so that means the other term must always be 0. That's the classic argument. That's what we have again. Hopefully this starts to look very familiar. Different algebra, different math, but it's the same logic we apply over and over. If you do that, if this is 0, then us ends up being, let's see, this goes to the right-hand side, so I'll have Iws, big Omega d, I will have minus P, that should be Delta Omega, and this goes over to the other side, so that will be plus Iws gs hat Omega dot. This factored out del Omega, so there's going to be P delta Omega. If I can draw that properly, this boxed equation, that's your motor torque equation for a server loop. Now, if your outer loop is running at one Hertz, easy number, pretty typical, how fast do you have to run the server loop? [inaudible] Why? [inaudible] But you said at least. If you said at least one Hertz, you are allowing one Hertz server loop. [inaudible] Which Control? You said you want your control to be faster. Be more specific. There's an out-of-control and an inner control. Which control do you want to be faster? [inaudible] Are you asking me now? I'm looking for an answer. Who has an answer? Henry. [inaudible] Yeah, a bit faster. What does that mean? Does it need to update quicker? Do you need to run it at a million Hertz? Could you run it at two Hertz? [inaudible] I'm updating the outer loop, one Hertz. [inaudible] You're saying at least twice, maybe five times as fast. Everybody agree with that? [inaudible]? [inaudible] Why? Because [inaudible] It really goes back to the same question here. When we derive this continuous control law. Here we go. Here we had this one that we derived. That's a motor torque. What's the update rate here? Let's maybe start with the outer loop. What determines how often you need to control this digitally? [inaudible] No, not tracking her, not precision. Well, it will have an impact on the final convergence. Yes, that is an influence. Andrew, what do you think? How would you start? You would to start with one Hertz and cross your fingers? You can say yes, most people do that. I do it's often. Let's just try it. I know from history that's one Hertz should be in a ballpark for how? Because we will move so slowly. That's fine. But what I just said is really the key, I move so slowly. We keep talking about update rates, and it shouldn't be one times faster, two times faster, five times faster, if you have a sine wave. You want to sample this, how many sample points should you take to identify that it's a sine wave? What do you think? Two points? Two points will be enough? I take two points, and from that you're going to tell me oh, that's definitely a sine wave. Then more than two. How many do you think? [inaudible] Yeah. But that doesn't look like very much, does it? Yeah. You can have all kinds of odd behaviors. Or if I take two points, depending on whether you put them one here and one here, you're just going well. I think I'm doing this. How do I know it's a sine wave? Abby, what do you think? [inaudible] Okay. If you do evenly spaced, 1,2,3,4 starts to look, but it also could be this then. [inaudible] The Nyquist sampling frequency. Everybody heard of that before? Maybe in years, many years ago, I don't know. But that's basically what it comes down to. If you want to do this and with control, it's the same thing. If I'm controlling something here, I'm just going to go to a new figure. If I'm doing a feedback control, and let's say this is the attitude motion I want to track and this is one minute and this is two minutes as a timescale, so that's 60. I'm not going to draw all 60, but there's 30 seconds. This would be 15 seconds. There's five, 10 so 1, 2, 3, 4, 5. That's the sense that you're doing. The rule of thumb is you want to be about an order or magnitude faster, then the fastest frequency that you're trying to identify, then you're in a warm, fuzzy place and where you should be. This is a ballpark number. If you're doing this and you're trying to track this, and now our control will hold the torque piecewise constant, then we're just doing a constant acceleration for that short time period. If you updated this at this figure, once a second, do you think you will track this sine wave with an attitude motion reasonably well? Yeah. I mean constant torque, that actually means constant acceleration or constant curvature and you could prescribe a certain slope. Accelerations are constant parts of the world. Then in a simplified way, but that gives you a constant slope. If I had to piece this together in little sections of constant slopes, it's a pretty darn good, that's not bad. This is a sine wave 820 seconds and I'm sampling once a second. That's two order of magnitude faster. That's pretty good. That's going to give you good convergence. You're worried about final accuracy to discretizations. We're in pretty good shape. Could you use 10 seconds? Let me do a different color, if I turn it to red. What do you think? I got the feeling, I haven't run it. I would expect it probably work. But the discretization errors as Ricardo was pointing out can be quite a bit bigger all of a sudden. You can visually see already those lines between really don't look straight. They start to have a curvature so you're going to be a little bit off, but the feedback will help stabilize it and make it robust but you won't just nicely converge asymptotically as you thought you would or get to a small number. Definitely have an impact there, and 10 seconds is about an order of magnitude difference. It's really not necessarily what are you controlling? Because then the same question that comes in with that inner circle loop. If I'm tracking with the outer loop something that varies over 120 seconds and I'm using one second time steps, I'm really fast. My circle loop might also run at one second, because the bandwidth of my outer loop, the actual performance of how is the system moving is so slow that the one hertz was probably little bit overkill, but it made me really say for final convergence. It's a ballpark number. In most cases you make the inner loop faster because you've got the outer loop updating other required frequency to give you the performance that you're looking for for a digital implementation of a continuous system and then you need to enter one probably to be running quicker to track that, and that's the challenge there. We might have to run quicker. The inner one too, this feedback law that we're looking at now. Wait, I have to go back slides here. We derive this one. If we want to derive that, this assumes a completely continuous system. At every time step I'm getting a new, what's my tracking error that I'm computing this constantly, but really I'm updating this maybe at one hertz. If you want this behavior, what will happen is it's actually going to try to converge onto the desired, if this is an Omega, rates that you're going to have and you get this very big stair-stepping effect, which approximates to behavior. You don't get exactly the behaviors you're looking for, but you're close enough. How do you get the stair-stepping to be less? You make much smaller timesteps. That's why the speed loops need smaller time steps typically than the torque loop. If everything is running at a high frequency, you might be just fine with everything running at the same digital update rate. But again, the argument has to be the update rate digitally versus the bandwidth of the performance. If the fastest thing that you want to track is two hertz, you should not be controlling once a second because you're just way too slow to keep up with that. Make sense? Think of the combination, digital sampling plus performance that's to drive it. Here if you made now faster update rate, you could get this to start to look a lot more like what you want. Anybody seen a stepper motor work? Some kind of thing that can rotate. How does it sound, Anthony, when you turn on a stepper motor to rotate? It sounds good. Yes, like tah, tah, tah. Because there's really gone, it's hitting it hard with a really high gain to go. If you want to be this angle whack. Now you want to be at this angle, whack, and it puts you there. It's really herky-jerky how it gets you, but that's how you're driving the wheels then. Now you can play with the gains. You could back off on this. You don't want to be quite as aggressive and say, okay, I'm giving you a 10th of a second to get there. You don't have to get there in the millisecond. You could try to smooth it out. That's where you would balance with it. The other part is, we have a feet forward term which is great, because it will give us, well, if you're here now, and you're supposed to be here later, you're getting the trend. If you don't have a tracking error, you know you should be increasing. But that feet forward term can be difficult if we only discreetly update our desired wheel speeds at one hertz and we're running this at 10 hertz, you're going to have these things competing. Because if you're running to outer loop at one hertz, it's going to say, you're supposed to be 10 rpm faster, and this is going to go great, get me there. But once it gets there, this also says, well, the last one was minus 10, so I am moving at about 10 rpms per 10th of a second acceleration difference. It's going to feet forward that rate even though you got there and those two things will start to compete, and that's all due to because you go a digital, this is an inner loop and we're not updating smoothly. You could try to make it interpolator that you go, whoa, what's the last you can get fancier, so one second ago, what was mine? What is it now and instead of then doing a complete difference, you could try to interpolate maybe. I don't think most people do that. What an actual Servo looks like typically is they tend to remove this, and in fact they remove this as well. You make this term big enough to compensate earth, the spacecraft accelerations had to be pretty slow. I just got a small and whatever on model disturbances you will just compensate and put a bigger gain in there. Anyway, but this gives you the stair-stepping so that's why, whereas the torque doesn't just hold that wheel speed constant, it holds the slope constant the torque. I can get away with bigger time steps updating my torque loop and still approximate this line versus the wheel loop tends to like a step promoter, get you there quickly and then until you update the outer loop, it gets to the next one and then updates it again, and it gets it there. Obviously, any of these servos won't be perfect, they may not give you the torque that you asked for so how do we get this still to be stable? The answer is the outer loop. The outer loop that you had will update, let's say one hertz, and if you aren't at exactly the attitude it thought it would go with all these closed loop dynamics that just goes, okay, we're off by 0.1 degree, so here's a new torque that'll put us back on track. There's an outer loop that's going to keep that inner loop stable and keep it converging. But these two things have to be balanced. You can't just throw in any arbitrary gains. You can't make the inner loop converge in 60 seconds, but the outer loop converges in one second. That's not going to work. The outer loop, its stability is predicated on the assumption, if you do speed loop, that you actually get these changes in velocity that you're asking for, so those take way longer than you think in the control bandwidth you can drive things horribly unstable. You typically want to get the inner loop to converge an order of magnitude quicker. Basically leads to the control separation principle that we can talk about the stability of inner loop, and then on the outer loop we assume we will have these behaviors that we do, essentially what we do with torques when we say Yeah, we'll just hold it piece-wise constant and that's close enough. Comes back to Nyquist. Nyquist did a lot of good work. That was it for the reaction wheel speed loop. Julian? [inaudible]. I don't remember the details of micro stuff there, but it had to do with sampling, but I think it was more than twice. [inaudible]. Maybe that's the thing then. Okay, thanks. I should look up Nyquist before I talk about it again. To me the rule I remember is if you want to sample something like that and the fastest frequency is 50, I need to be something at least an order of magnitude faster, then I feel like then it's not going to be a problem. I'm going to get enough points and I will get there.