Latest / Mechanical Engineering Made Simple / (#49) Modeling Control Measurement The Engineering Cycle
Transcript
- 0:00Welcome back design junkies, to Mechanical Engineering Made
- 0:02Simple. Today we are doing a deep dive
- 0:05into the the foundational principles that engineers use to
- 0:09understand, predict, and ultimately control dynamic
- 0:12systems. Right.
- 0:12It's really a classic three-part journey for anyone building
- 0:16complex machinery. Yeah, first you have to create a
- 0:19model, then you design the control logic and 3rd and this
- 0:23is key, you have to make sure your measurements are accurate
- 0:26enough to validate the whole process.
- 0:28So our mission today is to really pull out the key insights
- 0:31from these sources that make that whole cycle work.
- 0:33Exactly. And it all starts with modeling.
- 0:35I mean, why do we spend so much time creating these mathematical
- 0:38representations of reality? Well, the answer is pretty
- 0:42simple actually. Models are the ultimate
- 0:44engineering shortcut. A shortcut how?
- 0:46They're cheaper for one. Yeah, and infinitely faster to
- 0:49build than a physical system. You can test things you know,
- 0:53failure modes, component swaps, things would be way too
- 0:56dangerous or just plain impossible to try on real
- 0:58hardware. So let's you ask those what if
- 1:00questions. Precisely for systems that might
- 1:03only exist on paper. OK, but that brings up this
- 1:06fundamental paradox of engineering, doesn't it?
- 1:09We assume the best model is the most accurate one, the one that
- 1:12captures every tiny detail. And that sounds like good
- 1:15science, but it could be really poor engineering, right?
- 1:19It's the trade off. The key insight here is that the
- 1:22best engineering model isn't the most accurate one.
- 1:24It's the simplest one that still gives you the information you
- 1:28need. Because if it's too complex.
- 1:30If it's so complex you can't solve the equations
- 1:32analytically, then you're stuck running experiments on a
- 1:35computer simulation anyway. So simplicity is king.
- 1:39You want the lowest order, most linear model you can get away
- 1:43with, which I guess brings us to lumped parameter modeling.
- 1:46Yes, and that phrase is so important.
- 1:48The real world is full of distributed parameters.
- 1:52Think of a long steel beam where mass and stiffness are spread
- 1:55out everywhere infinitely. A lumped parameter model just
- 1:58says, let's pretend all that mass is in one spot and all that
- 2:01stiffness is in another. We replace the continuous world
- 2:04with a set of discrete, idealized springs, masses and
- 2:09dampers. Which makes the math possible.
- 2:11And the really beautiful thing is that this approach is
- 2:14universal. Whether you're designing a
- 2:16robot, a fluid circuit, an electrical filter, you're using
- 2:20the same basic alphabet of elements.
- 2:22And that alphabet is built around energy.
- 2:24You have these idealized 2 terminal elements, and they're
- 2:28defined by two variables. Right.
- 2:29First is the through variable. That's the quantity that flows
- 2:33or gets transmitted through the elements like force in a spring
- 2:36or current in a wire. And the other one is the cross
- 2:39variable. Exactly.
- 2:41That's what you measure across the elements terminals.
- 2:43So the velocity difference across a damper, or a voltage
- 2:46difference, or a pressure drop. And with just those two
- 2:49variables, you can classify every passive element based on
- 2:52how it handles energy. We put them into three groups.
- 2:55It's all about storage or dissipation.
- 2:57So let's start with storage, OK? So we have the T type or
- 3:00inductive storage elements. These store energy because of
- 3:04the through variable. The classic electrical example
- 3:07is an inductor which stores energy based on current.
- 3:10And in the mechanical world? That's a spring, a translational
- 3:14or rotational spring. Hang on, I thought springs
- 3:17stored potential energy based on displacement, which feels like a
- 3:20state across its ends. Why is it AT type?
- 3:24That's a great question. It's because displacement is the
- 3:27integral of velocity, the across variable.
- 3:30If you look at the fundamental math of the element, the energy
- 3:34storage really depends on the accumulation of the through
- 3:36variable, which is force in this case.
- 3:38OK, that's a subtle distinction. It is, but let's look at the
- 3:41other storage type which is maybe a bit clearer, the A type
- 3:44or capacitive storage elements. Right, the A type elements store
- 3:47energy based on the across variable.
- 3:49Correct. And the perfect mechanical
- 3:51example is a mass or an inertia. It stores kinetic energy based
- 3:55on its velocity, which is an across variable.
- 3:58The electrical equivalent is of course, a capacitor.
- 4:00So T type for springs and inductors, a type for masses and
- 4:03capacitors that covers storage. What's the last?
- 4:05One, that's the D type dissipative.
- 4:08These are your resistors. They just get rid of energy,
- 4:10usually as heat. So friction dampers, electrical
- 4:13resistors, they all fit here. And with just those three TA and
- 4:17D, we can build a model for basically any dynamic system.
- 4:20It's. The universal alphabet.
- 4:22So once we've built the model, we need a standard way to write
- 4:25down the math. Classically that was the input
- 4:28output form the IO form. Yeah, that's what most people
- 4:30learn first. It's kind of the black box view.
- 4:32You don't care what's inside, you just want to relate a single
- 4:35input to a single output with one big differential equation.
- 4:40And that was powerful because it led to things like the Laplace
- 4:43transform. Exactly.
- 4:45You could turn these horrible differential equations into
- 4:48simple algebra, which made them much easier to solve, but.
- 4:50Getting that one equation sounds.
- 4:53Awful. Oh, it's brutal.
- 4:54Think about modeling even a simple milling machine.
- 4:57To get the relationship between the input torque and the final
- 5:01table position, you have to algebraically eliminate every
- 5:04single internal variable, every velocity, every internal force.
- 5:08And if you change just one little damper value in your
- 5:11model. You have to do the entire
- 5:13derivation all over again. It was incredibly tedious, and
- 5:16that's exactly why the state variable form took over in
- 5:19modern control theory. Because the IO form just
- 5:21couldn't handle complex systems. It becomes unwieldy, especially
- 5:25with multiple inputs and outputs, and more importantly,
- 5:28it hides what's actually going on with the energy inside the
- 5:31system. So the state variable form makes
- 5:33us look inside the box. How does it work?
- 5:36You define a set of state variables.
- 5:39They're the minimum number of variables you need to completely
- 5:42describe the energy state of the system at any instant.
- 5:46If you know them, and you know the current input, you can
- 5:49predict the entire future of the system.
- 5:51And what's the, you know, the natural choice for those
- 5:53variables? This is the really elegant part.
- 5:55The natural state variables are the through variables on your T
- 5:58type elements and the across variables on your a type
- 6:01elements. Yeah, the variables that
- 6:03literally describe the stored energy.
- 6:06Precisely. It makes perfect physical sense.
- 6:08You need to know how much energy is in all your storage tanks to
- 6:11know what's going to happen next.
- 6:13And this lets us write the whole system down in a really compact
- 6:16matrix form. Right, we use a state vector X
- 6:19of T which depends on an input vector U of T and two matrices
- 6:23A&B. It might look abstract, but the
- 6:25A matrix just describes how the energy states interact with each
- 6:28other, and the B matrix describes how your external
- 6:31inputs affect them. It scales beautifully.
- 6:33OK, so once we have that solid model, we can finally move on to
- 6:37actually controlling the system. What's the standard structure
- 6:40for a control system? It's always a loop.
- 6:42You start with sensors to measure the output.
- 6:44That measurement goes to an error detector, which compares
- 6:46it to what you want it to be. The error then goes to the
- 6:49controller, the brains, which sends a command to the actuators
- 6:54which physically changed the system.
- 6:56Let's talk hardware for a second.
- 6:57The sensors today are just incredible, like optical
- 7:00encoders. Oh absolutely.
- 7:01I think about a modern 16 bit absolute encoder.
- 7:04It gives you something like 10,435 counts per Radian.
- 7:08You're resolving the position down to a tiny tiny fraction of
- 7:11a degree. Your model is useless without
- 7:13that kind of fidelity. And then on the output side you
- 7:15have the actuator. The classic armature controlled
- 7:18DC motor is a good example. The torque is just proportional
- 7:21to the current you put in. Yes, but there's a really cool
- 7:24piece of physics in there. The back EMF.
- 7:27As the motor spins it generates its own voltage that pushes back
- 7:31against the voltage you're applying.
- 7:33It's a natural self breaking mechanism.
- 7:35And if you don't account for that in your model.
- 7:37Your controller will never work correctly.
- 7:39OK, so you've got good sensors, powerful actuators.
- 7:42Now for the brains of the operation, the PID controller.
- 7:47PID, the bedrock of control. Proportional, integral and
- 7:51derivative. Let's break that down.
- 7:53Proportional or P is the simple one.
- 7:55Yeah, it just responds instantly.
- 7:57The bigger the error, the bigger the control action.
- 7:59It's fast, but it has one major flaw.
- 8:02The offset error. The offset error exactly.
- 8:04If there's any damping in the system, P control by itself
- 8:07can't quite push the error all the way to 0.
- 8:10It gets stuck in some small steady state value.
- 8:12Which is unacceptable in most cases, so that's why we need the
- 8:15I term integral. Right, it's sometimes called
- 8:18reset action. It basically keeps adding up the
- 8:20error over time. As long as there's any error,
- 8:23the control signal keeps growing, which eventually forces
- 8:26that offset to 0. It's the essential tool for
- 8:29accuracy. It is, but here's that classic
- 8:32trade off again. Integral action is great for
- 8:35steady state, but it often hurts your transient performance.
- 8:39It can make the system sluggish or even unstable if you turn the
- 8:42gain up too high. Which brings us to D for
- 8:45derivative. This is the one that looks into
- 8:47the future. Sort of, yeah.
- 8:50It responds to the rate of change of the air, not the air
- 8:52itself. It's all about providing
- 8:54damping. If the system is oscillating
- 8:57wildly, the rate of change is high, so the D term pushes back
- 9:01hard to calm things down. It helps the system settle
- 9:03faster, so why not just use decontrol by itself if it's so
- 9:06good at damping? Because it amplifies noise.
- 9:10Any real sensor has some high frequency noise, some little
- 9:13jitter. The derivative operation just
- 9:14mathematically magnifies those rapid changes.
- 9:16So you'd be sending all that jitter straight to your motor.
- 9:19And you could get this jerky destructive motion.
- 9:22In practice, you almost never use a pure derivative.
- 9:26You filter it or apply it in clever ways to get the damping
- 9:29without the noise amplification. It's a constant juggling act.
- 9:33So that brings us to the final piece.
- 9:34We've got the model, we've got the controller, but none of it
- 9:38matters if our measurements are wrong.
- 9:39It all starts with the foundational standards from
- 9:42NIST, right? Absolutely, yeah.
- 9:44We have to remember all accuracy traces back to just four
- 9:47independent standards. Length from the speed of light,
- 9:51time from the cesium atom, that's 9,192,631,770 periods,
- 9:59Mass from the International Prototype kilogram and
- 10:02temperature from the triple point of water.
- 10:04Every precise measurement is linked back to those.
- 10:07And we have to get our terms right.
- 10:08People mix up accuracy, precision and resolution all the
- 10:11time. All the time.
- 10:13Accuracy is how close you are to the true traceable value.
- 10:17Precision is just how repeatable your measurements are.
- 10:20You can be very precise, but completely inaccurate.
- 10:23Like a broken clock that's stuck.
- 10:24It's precisely at 3.15, but it's not accurate most of the day.
- 10:28Good analogy. And resolution is just the
- 10:30smallest change your instrument can even detect.
- 10:33But the real pitfall in all of this is what's called the
- 10:35loading problem. Yes, this is the inescapable
- 10:39fact that the act of measuring something changes the thing
- 10:43you're trying to measure. Give me a simple example.
- 10:46Checking the air pressure in a tire.
- 10:48The moment you connect the gauge, you hear that little
- 10:51severe escaping. You've just lowered the pressure
- 10:53by the very act of trying to measure it.
- 10:56That's loading. So how do engineers deal with
- 10:58that? We use a concept called
- 11:00generalized input impedance, which we'll call Zgi.
- 11:04It's the ratio of an effort variable to a flow variable, and
- 11:08the rule is simple. When you're measuring an effort
- 11:10variable like voltage or force, you want the input impedance of
- 11:14your measuring device to be huge, as large as possible
- 11:17compared to the system you're measuring.
- 11:19So if I'm using a lewd cell to measure force in a structure, I
- 11:22want that load cell to be incredibly stiff.
- 11:24Exactly. You wanted stiffness to be way,
- 11:27way higher than the stiffness of the thing you're pushing on.
- 11:30If your load cell is too soft, it deforms.
- 11:34It changes the system's dynamics and your reading is wrong.
- 11:37This all comes together in error analysis.
- 11:39Let's take that classic pendulum experiment for measuring gravity
- 11:43G. The equation is g = 4π ^2 L / t
- 11:48^2. Right.
- 11:49And if you run the numbers on the most probable error, you
- 11:52find something amazing. What is it?
- 11:54The error in measuring the period T contributes 4 times as
- 11:59much to the final error in G is the error in measuring the
- 12:02length though. Four times.
- 12:04Wow, that's a huge insight it. Completely changes how you do
- 12:08the experiment. It means you can be a little
- 12:10casual with your measuring tape for the length, but you have to
- 12:12be absolutely meticulous about timing the period.
- 12:15Maybe a time 100 swings to average out the error.
- 12:17It tells you exactly where to focus your effort.
- 12:19And your money. But measurement fidelity isn't
- 12:21just about buying expensive gear.
- 12:23It's about understanding where the errors come from and how
- 12:25they compound. So we've really covered the
- 12:27whole cycle, building simple, robust models with T A&D
- 12:32elements, designing effective PID controllers and ensuring our
- 12:36measurements are actually trustworthy.
- 12:38And it really shows the power of these analytical linear tools.
- 12:42We spent this whole time talking about linear models because we
- 12:45can solve them. But here's the final provocative
- 12:47thought to leave everyone with Pretty much every real system is
- 12:50nonlinear. That's right, springs don't
- 12:53behave perfectly. Resistance changes with heat.
- 12:57All physical systems are non linear to some degree.
- 12:59And for those. For high order non linear
- 13:01systems there are rarely any general analytical solutions, so
- 13:05computer simulation is the only tool that works universally.
- 13:08Which is why we're seeing this push into advanced digital
- 13:11control. I'm thinking of modern robotics.
- 13:14Exactly. To get that smooth precise
- 13:16motion they use things like the computed torque method.
- 13:19The controller is running so fast that it's actively
- 13:21calculating all the complex non linear gravity and centrifugal
- 13:26forces in real time. And just mathematically
- 13:28cancelling them out. It's the ultimate evolution.
- 13:31You use a complex non linear model, run it with incredibly
- 13:35fast computation. Also that a simple linear
- 13:38control system can work perfectly in a messy non linear
- 13:41world. And you can't even begin to
- 13:42design those computational masterpieces without mastering
- 13:45the fundamentals we covered today.