This week has been a little crazy so I have fallen a little behind my schedule. Since only zero people read this I hope none of you are upset ;(). Anyways this post is going to be an introduction to System Dynamics, using a basic DC motor to gearbox to output system. I was going to start with electronics because that is the way you would do the analysis but many of the ideas are much easier to understand in a mechanical domain, so we are going to start with the general parts of a system.
What is a System?
A better question might be what is not a system? Everything is part of a system. Let’s think of a system as all the things we believe are in the world. We can then think of the model as how the things in our system are going to interact with each other. We have to be careful about what we include in our system. For example if we wanted to model how a baseball would fly through the air after being hit we could think of a lot of things as being in our system. For example we could say that our system is all the air on earth, the molecules on the ball, the muscle fibers in the arm of the person hitting the ball and on and on. While this is close to the true system it becomes impossible to model how these things are going to work together. We could simplify what is in our system by instead saying we have a force from the bat hitting the ball and the ball’s mass. This might be too simple as we are not looking at the air resistance or how long the force was on the ball, but it would be very easy to model the different interactions.
We need to carefully select what we include in our system so that we can not only keep our model simple but all keep it accurate. One of my favorite quotes is from George Box, “All models are wrong, but some are useful.” This is very true. We have to find the things that have a significant impact on whatever we really care about and only include those things in our model.
Why even bother with system dynamics?
System dynamics is mostly done for the sake of control. We want to know how stuff interact so we know how to make it do what we want. When you are system modeling you are an evil mastermind carefully determining how each part works together, allowing you to bend it to your will. Other applications can be in finance or other things I think are boring. In the context of robotics we use it to define how we control a robot, or interact with the world.
Now, maybe 10-20 years ago this wouldn’t even be a question but these days it is important to think about why we do it. Now there are many machine learning approaches that can learn how to control something or do something without a model. To do this type of learning you need data, lots and lots of data. The trade off is that when you model you often need little or no data and can get great results. It is interesting because off-model approaches to machine learning are all the rage in many fields right now, except for robotics. Robotics resists this type of learning because there is no-data approaches that have been working for years, and getting the data required for this learning can be costly, hard and the quality is not always guaranteed. So, while there is merit to off-model methods in robotics, for control, they are not always the best solution.
Now that you are titillating with excitement let’s get into the weeds on this. There are three basic parts to any mechanical system: mass, damping, and stiffness. Most systems can be described by a combination of these three things in a way that characterizes the system. We will go over each of them below but there are tools for understanding how these things work together.
In classical control theory, which is what we are dealing with, you have one Single Input and one Single Output (SISO). To describe the relationship we use what are called Ordinary Differential Equations or ODEs. For suckers stupid enough to study anything in the sciences you will take a class on this (except for most CS majors). To understand ODEs you will need a basic understanding of calculus and I will be assuming you have that. ODEs can be difficult to solve analytically in, what we call, the time domain, so often we convert ODEs to the Laplace domain. No one really understands the Laplace domain, and if they say they do they are most likely physicist and thus can’t be trusted. I will try to explain the Laplace domain such that it can be used to build control laws, but for a deeper understand you need to make sacrifices to your deity of choice.
We have two visualization tools we use to represent these systems. First is the block diagram. I don’t know if we will get to that in this post but it is used mostly in the control step. This is in the Laplace domain and that will be important to simplifying them later. The other is a system diagram. We draw this because it can show us the relationship between the different components in a system. Mass, dampening and stiffness each have a symbol. They are shown in the diagram below, stiffness looks like a spring (labeled k), mass is a box with a m, and the remaining one is a damper (labeled b) and shows damping. Note this is not a block diagram just a system diagram.
You might think you understand mass, I am almost positive you do not. Many people like to think of mass as the amount of matter you are made up of or they try to relate it in their minds to weight. Technical people tend to think the first, but they are wrong, very very wrong. Mass is resistance to motion. What does that mean? To understand that, think about it in the extremes. If you are very massive, how easy are you to move? If you are not massive how easy are you to move? If your answers where not a) hard to move and b) easy to move I can’t help you anymore with just words, go outside and try to push the largest rock you can find and then similarly try to push the smallest rock you can find. For the betterment of humanity please do both in a street, preferably a busy one.
This concept is really important to understand though, and I know fourth year engineers who don’t get it. Many people think of mass as having something to do with weight, this is not the case. Your weight is a force you put on things. This comes from the planet pulling you toward it not from an intrinsic property of what you are. A good example is to image you are in outer space. You and a buddy are playing space tag and he is twice as massive as you. First how much do you both weight? You have zero weight because you are in space and there is no planet pulling you toward it. Now you friend comes and pushes you. We know from newton’s third law that every force has an equal and opposite reaction. So when your friend pushes you he pushes you with a force and that same force acts on his body. Now who will fly away faster? The critical step in solving this puzzle is to understand mass. Mass is resistance to motion. The more massive you are the harder you are to move. Putting all that together you should figure out that your friend would move at half the rate you move because he is twice as massive. Boom! I should have just blown your mind.
Now I lied a little above when I said there was only three components to most mechanical systems. When things are rotating each of the three components mentioned above have a rotational counter-part. The mass rotational counterpart is called inertia or rotational inertia. Now if you think of mass as resistance to motion, you can think of inertia as resistance to rotation. All things have both mass and inertia but depending on the system we sometime use one or the other. This is dependent on if we are modeling rotation or linear motion. Now, I have seen many good engineering students struggle with inertia and it was always because they didn’t really understand mass. Take the time to think about what I wrote above, because everything can be applied to inertia. If you have a high inertia you are hard to rotate, and if you have a small inertia you are easy to rotate.
Inertia is slightly more complex because it is direction specific. Think about the coin in the following figure. When you through a coin it flips. This is because it has a low inertia in that direction, and it is easy for the air to create resistance that causes spinning. Now, it will only spin in the b direction (forgive the arrow) a small amount because it will have much more inertia in that direction.
Inertia will have the same symbol as mass but with a J in the box instead of a m in our system diagrams.
Stiffness is deceptive because you will think you understand it far before you actually do. Stiffness is how rigid a body is. This is an energy storage component in the body. To understand this think about steel. It is pretty stiff so when pressed a lot of energy can be stored inside it before it bends. This is not the same for aluminum as it will bend much sooner. On a conceptual level you can think that when you push a body its stiffness is what is pushing back. Stiffness acts a lot like a spring as long as you are not permanently deforming the material. Rubber bands have low amounts of stiffness, when you apply a force to them they bend and when you remove that force they move back. This can be used in really cool robotic hands to create grippers that passively deform around materials.
Understand that stiffness in this context is a perfect transmission. We assume that no energy is lost. This is not the case as in the example of the rubber band it would not oscillate back and forth forever but would eventually stop. When we model a system with a stiffness we treat it as having a perfect amount of springiness. In diagrams, stiffness is often shown as a spring, I don’t call it that and I didn’t start the discussion with that because it bias the way you think about stiffness. I think the spring metaphor confuses the conceptual ideas at the center of stiffness. Still it is a lot like a spring. A spring stores energy in its windings and then releases it back. This is exactly what materials do like steel or aluminum when you push on them.
Now up to this point we talked about a spring which stores energy in the system and we talked about mass which is a system’s resistance to motion. So the question becomes how does energy leave the system? Why damping of course. Damping represents how much energy is lost in the system from motion. If the system is not moving there is no damping. It is kind of a blanket term that will capture every friction source and every energy loss in a system but it works really well in practice.
Without damping if you placed a force on a mass the mass would move forever in a single direction. If you applied a force to a mass with some system it would oscillate back and forth forever. This is not real and as such we will almost always include a damping term, in fact I can’t think of a time in which you would ignore it.
So we have now established all the pieces in a system. I want you keep in mind what the three things do at a high level. One of them is how hard it is to get a system moving, the other is an energy storage term, and finally we had a energy removal term. This will come back when we talk about electronics so try to think about them now if you can.
Now we have talked at a high level about this stuff at a high level lets do some math. In order to model these different components we need to get them in a common language. For values this means getting them into the same units. Let us start with mass. Forces act on the world so why not try to get mass of a body related to the force. Any ideas? Why not . That works, and it fits with what we talked about above. The larger the mass the less acceleration a body feels when a force is put on it. Take a second and think about this. Now I don’t want a bunch of variables so lets call acceleration the second derivative of position with respect to time. We will call position so we can the express .
Now for stiffness, we will have to work a little harder. If it is a rigid body we can think of the stiffness as having a restoring force on a body. If the position is increasing we want the force to get larger and the inverse as well. So lets call the stiffness of a body and the force of stiffness .
Finally, damping is all that remains. Friction only applies a force when a body is moving so we want the force to be zero when the body is not moving and get larger the faster it is moving. We should then call the damping and make the force of damping proportional to the speed the body is moving at , or in this case the first derivative of position.
Now this tells us some of the times we can neglect stuff. If the mass is really small we can ignore it, same for any of the values. Therefore if we have a small stiffness it can be ignore since it won’t contribute to the forces on the body. If we are in a super low friction environment I guess you could ignore the damping. Now if your body is moving and not really resisting being pushed then you can often ignore the stiffness. We will do this when we are dealing with motor shafts. It is common to ignore the stiffness in the shaft since it tends to be small.
Now lets us look at the system I showed above.
There is a stiffness and damping attacked to a mass that is attached to ground. If we apply a force on the body what is going to happen? We will call the force applied . Conceptually we know that if there was only a mass that we could equate the force applied and the force from the mass and that would define how the position changes. We can further this logic and say that the mass, damping and stiffness apply a force that opposes the applied force allowing us to make the following equation:
Pretty cool right? You could image systems get more complex in a hurry but you just keep summing the forces on each mass and you can model the system.
I know this was a lot, please think about this stuff. This post was more conceptual then maybe most like but I think talking about stuff in the cloud is the first step to doing things in the real world. In the next post we will talk about modeling this with a block diagram in both Matlab and maybe python, we will see my motivation level. We will then see the system’s response to inputs. We will then try this with a more complex model, and maybe get to the Laplace Domain.
I hope everyone enjoys