Saturday, April 12, 2014

Everything is the Same: Modeling Engineered Systems

1. Introduction - Modeling Components - Newton’s Laws:

In particular, good engineers typically employ a combination of 
  • analytical reasoning, 
  • computational skills 
  • physical knowledge 
to solve problems. The more critical the engineering problem is, such as making sure that the power grid does not experience failures, the more important it becomes to combine these skills rather than just using one. 
By analytical reasoning, is the ability to write down mathematical expressions that represent a physical system. 
By computational skills, is the ability to use a computer to either evaluate or predict characteristics of a model that are too challenging to solve analytically. 
And by physical knowledge. Possibly the most important of the three. is the crucial ability of an engineer to think critically about analysis and computations in the context of real physical knowledge about the world. This last piece can only come from experience. Combining analytical reasoning, computational skills, and physical knowledge is an essential part of being an engineer.

Modeling components of a mechanical system:

In general, we use what are called constitutive of laws to model individual components. These constitutive laws relate variables of interest like position x and velocity v. The derivative of position with respect to time to forces.

A relationship that has a line relating the two variables is called a linear relationship. A linear relationship is a lot to hope for. And in general, natural systems do not behave that way. But engineered systems have some engineer's brain involved. And that engineer's brain knows that we would prefer this to be a line. 



That's why engineered systems typically do end up with a constitutive law that can be described by a nice lineOnly engineered systems, systems that have been designed by someone actually behave this way. 



Mechanical diagrams play a critical role in how we set up models of mechanical systems. We always assume that we have three types of components, springs, dampers and massesWe will always use these three symbols to represent the three types of idealized components. First, we have a spring. Second, we have a damper. And lastly, we have mass. Whenever a spring, is an extension, it's position x is to be defined as positive. Whenever a damper, like syringe is extending, its velocity is defined to be positive. Moreover, the relationship between force and position of a spring is always a line represented by the constituent of law F sub s is equals to K times X sub s. Where the positive number K is called the spring constant. The relationship between force and velocity of a damper is also always a line represented by the constitutive law, F sub d is equal to b times v sub d. 

Fs = K.Xs

The relationship between force and velocity of a damper is also always a line represented by the constitutive law, F sub d is equal to b times v sub d. 

Fd = b.Vd

Where the positive number b is called the damping constant. Hence the force on a spring being positive, implies that the position must be positive. And the force on a damper being positive implies that the velocity of the damper must be positive and the damper must be extending. 

Fs > 0 ==> xs > 0,  Fd > 0 ==> vd > 0

With these sign conventions in mind, we can combine elements into combinations of elements. For instance, consider a wall and a spring and a damper that's in parallel with that spring. 



And an external force that's pulling on both of them. There are two elements that are in parallel and a force. Note that the spring and damper both connected to the wall in the left must move in unison. The only allowed motion is horizontal motion. No matter how many elements are in parallel with each other, they must move just to the left or to the right. They can not move up and down in diagram. That implies that the end of the spring is attached to the end of the damper. Which implies a relationship between the position of the spring x sub s and the velocity of the damper v sub d. In particular, the time derivative of the position of the spring must be equal to the velocity of the damper.

We always define positive acceleration of a mass to be to the right and external forces are always positive if the force is acting to the right—that is, the force would cause a positive acceleration of a mass. A spring with an external force. If the force changes instantaneously, so does the position of the spring. This is unintuitive because this is an ideal spring.



The simple system in figure that consists of a spring with no mass and an external force. When the spring is in extension, the force is defined to be positive, and when the external force is positive, it is pulling the spring into extension. What does our constitutive law say about what happens if Fext starts out at zero and then suddenly becomes positive? Specifically, what if Fext = 0N until t = 1 and then becomes Fext = 1N?

While the external force is zero, the force on the spring is zero and its position is zero. Because the spring will only be extended or compressed if something is forcing. If we make the force jump up to one Newton, the position of the spring will instantaneously jump as well. That probably seems unintuitive, but that's because real springs have ideal spring properties plus damping properties and mass propertiesKeeping in mind the difference between these idealized elements and the real physical objects they represent.  Because this difference forces us to bridge the gap between analytical reasoning and physical knowledgeKeep in mind that constitutive laws are linear because we engineer systems to make them linear. That sign conventions matter. And the idealized mechanical elements can have very unintuitive behavior.

As another example, with Fext = 0. Which of the two plots below is even plausible?




The one on the left implies that, as a function of time, xs gets smaller and smaller, very slowly. The one on the right implies that, as a function of time, xs gets bigger and bigger, very quickly. Therefore the one on the right doesn't really make sense for a physical system, but the one on the left does.


Newton's Laws:

What principles do we use to combine those constitutive laws into models of mechanical systems? Newton’s laws provide the basis for everything we do. They say that the sum of the forces at a point must be equal to the mass of that point times its acceleration.

The sum of forces being equal to mass times acceleration is very deep, because that means there can be multiple components that all interact with each other through this magical relationship.



In the spring and damper system shown in above picture, where we assume that the external force is equal to zero. This spring-damper system could represent a shock absorber on a vehicle that has a load of an external force on it or a bungee cord that can be stretched by pulling on the end with an external force. Newton’s laws tell us that the sum of forces at the point where the spring and the damper meet must be equal to the mass times the acceleration of that point.


A positive external force will cause the point mass to accelerate to the right. On the other hand, a positive spring force—indicating that the spring is in extension—will accelerate the point to the left. Similarly, a positive damping force would act to the left. Hence, the sign conventions we chose for the individual mechanical elements have consequences for the signs in Newton’s equations. 

Fext - Fs - Fd = ma = 0

The generalization of keeping track of sign conventions in this way is called a free body diagram. For us, free body diagrams are unnecessarily complicated and don’t really help very much, but as soon as you are trying to add up forces acting on a body in three dimensions they become really useful.


Now, if we assume that the external force is zero and that the mass of the point is zero, we are left with a much simpler expression of Newton’s laws -Fs - Fd = 0. If we use the constitutive laws that relate the spring force to the spring position and the damper force to the damper velocity, Fs = kxs , Fd = bvd


and substitute these constitutive relations into Newton’s laws, we get an equation involving xs and vd. -Fs - Fd = 0 ==> -kxs - bvd = 0.

If we additionally keep in mind that the time derivative of the position of spring is equal to the
velocity of the damper (i.e., x˙s = vd), we get a simple equation involving only the position of the spring.
-kxs - bx˙s = 0

Now, if we define x to be the position of the spring (just dropping the “s”), we get -kx - bx˙ = 0

and if we then solve for x˙ (remembering that the “dot” notion is the same as d/dt x), we get what is called an ordinary differential equation or ODE for short.

x˙ = (-k/b)x
x˙ = f(x)


This ODE says that the “derivative of the position is equal to the negative spring constant divided by the damping constant multiplied by the position”.

Note that this means that the derivative of the variable x is equal to a function of the variable x. This is the form of an ODE—it is always the derivative of “something” being equal to a function of that “something”. 

d/dt(something) = f(something)

In this case, that “something” is the position x and f(x) is equal to (-k/b)x. In general the "something” is called the state of the ODE.

States of mechanical systems do not have to be positions—later we will also use velocity of masses as states. Engineers get good at choosing the state of an ODE with experience.


Linear, constant coefficient, first-order ordinary differential equations:

  • Linear means that the dependence of a state velocity on a state is always a line. 
  • Constant coefficient means that the slope of that line is always constant. 
  • First order means that there is only one time derivative. That is, we should only see one dot over x rather than two.

Now we go back to the model of the spring and damper, but now allow the external force to be nonzero. This would be like we take the bungee cord and pull on it with a constant force. Now we have the external force in the equation but the mass is still zero. If we replace the spring and damper forces by their constitutive laws, we can solve for an ordinary differential equation that now includes the external force. 

0 = Fext - Fs - Fd
==> 0 = Fext - kx - bx˙
==> x˙ = (-k/b)x + Fext/b


It is worth thinking about this differential equation and what it means. It says that if the position of the spring starts out less than zero, making the left hand term greater than zero, and if the external force is greater than zero, then the velocity of the position of the spring must be positive. If the position of the spring is positive and the external force is negative, then the velocity of the spring must be negative.

But if both position and force are positive, we don’t know which direction the spring will move—it depends on the magnitudes of the external force, the spring constant k, and the damping constant b.
 Newton’s laws lead to Ordinary Differential Equations and that if the constitutive laws are linear, you should expect a linear, constant coefficient differential equation.


Example: Suppose one just has a damper (no spring and no mass) and applies a force to it—what happens?


The diagram might look like the one above. Applying force balance to this example leads to a potentially surprising outcome. We know that the damper force is defined to be Fd = bvdwhere vd is the velocity of the damper. Hence, Fd > 0 when the damper is extending and Fd < 0 when the damper is compressing. Moreover, if we write force balance at the drawn node, we get Fext - Fd = 0, so vd = (1/b).Fext. This means that if one applies Fext = 1N of force to a damper, it will extend at a constant rate forever, until Fext changes.

State Choices and Sign Conventions:

Something that can be very annoying about all of this is how arbitrary the state choices and sign conventions seem. Let me discuss first what it means to have a sign convention and then discuss — separately—why we choose states and signs the way we do. First, it is worth admitting that conventions are arbitrary. Everything in this class could be done under a different set of conventions, and one could make everything work out. For instance, we will always choose the position of a spring to be a state, and we will always choose the position to be positive if the spring is in extension and negative if the spring is in compression. This choice is largely to make the constitutive laws work out nicely. If the spring transitions from extension to compression, we would like the force generated by the spring to change sign as well, so choosing the position x to be positive in extension and negative in compression allows us to use a constitutive law of the form F = kx.
We could choose x to be the distance between the ends of the spring, but that would mean that the constitutive law would be F = k(x - L), so that whenever the spring is extended beyond its natural length L we get a positive force and whenever it is compressed we get a negative force. But this convention means we have to know L
So really, the convention we use is to make book keeping easier. It also turns out that with our choice of state, we will always get a linear ordinary differential equation, whereas if we use this one we get a form of ordinary differential equation that is harder to work with. The choice of state is largely to make our lives a bit easier. Choice of sign convention for forces works similarly. Here, it is worth noting that the “spring force” is not the same thing as the Newtonian force. Newtonian forces are defined as positive if the force is to the right and negative if the force is to the left. Spring forces are positive if the spring is in extension and negative if the spring is in compression. Spring forces are defined the way they are to enable the use of F = kx as the constitutive law, but Newtonian forces are defined the way they are so that we can use PF = ma. That means we will have to convert between them when we are solving problems.



  • Two springs with constants k1 and k2 are in series, the equivalent spring constant of a single spring is:
  • Ideal dampers react instantaneously to a change in force, a jump in velocity will be seen when the force changes.

  • The ODE that governs its time evolution for the following system is:

  • Linear means that the dependence of a state velocity on a state is always a line.
  • Constant coefficient means that the slope of that line is always constant.
  • First order means that there is only one time derivative.

In MATLAB or Python, take the mean (average) of the numbers 1,2,3,4,5,6,7,8,9,,99,100 using a for loop:

=================================================