## Friday, January 7, 2011

### Simulating Mechatronic Systems for Fun and Profit - Part 1

One of the more interesting skills I'm learning as a mechanical engineering student is the process of system simulation.  Given some mechanical configuration, how do you expect the system to react to inputs, like where it will vibrate, how much stress a beam will experience, etc.  The annoyingly class example of a failure of modeling is the first Tacoma Narrows Bridge.  Granted, at the time they didn't have the computing power we use now, but they failed to find the resonance of the entire bridge structure, which 40mph wind found fairly quickly once the system was deployed.

One of my classes last quarter at UC Davis was EME171, which is modeling systems through differential equations.  It requires using a computer to numerically integrate the equations over time, but it allows us to solve for the state of several systems that don't lend themselves well to the more traditional by-hand methods.

Normally, when an engineering student is given a mechanical system and told to wrote state equations for it, they start drawing force diagrams for each component and use equal and opposite forces to translate force throughout the entire system.  This is fine for the little toy systems we used in ENG102 (Dynamics), but tends to break down when you're dealing with extraordinarily complex systems, or even those which have conversions between energy domains (translational, rotational, electrical, hydraulic, etc.), and the student inevitably forgets one of the "equal and opposite" forces, and then everything goes to hell very quickly (the damn bridge, she fall down).

This is where the thesis of EME171 comes in: Bond graphs.

A bond graph is a graphical representation of the modeled system, which is useful because it tracks the both the flow and the force through the system, not just the force like the typical drawing of a system.  At first this is a little unintuitive, to be doing an analysis on a system using both the velocity and force on elements, after having spent so much time only considering velocity, or both current and voltage, instead of just voltage.  This is done by using nine different elements to represent all energy flow, storage, and conversion.

Bond graph elements:
0 Junction - This is a common effort junction.  This means all the elements connected to this junction experience the same effort, be it force or torque in mechanical systems, pressure in a hydraulic system, or voltage in an electrical system.  In a mechanical system, this would be when all of the elements are stacked on top of each other, like a stack of boards all being compressed with 10lbs, for example.  Electrically, this is when several components are in parallel, all experiencing the same voltage.  While they all experience the same effort, they must also all experience a net zero flow.  This means the sum of all flows into a junction must be the same as all the flows out of the junction, since there are separate elements for storing flow.
1 Junction - The common flow junction.  All elements experience the same flow, be it velocity in mechanical systems, current in electrical systems, or volumetric flow in hydraulic systems.  This would be a long series of pipes in a hydraulic system, all passing the same amount of fluid, or two springs in parallel between two objects, both experiencing the same compressive velocity, but different forces. Opposite of the 0 junction, the sum of the efforts into the junction must equal the sum of the efforts out of the junction, which enforces Newton's third law of motion for mechanical systems, and equivalent laws for other systems (eg electrical).

Resistance - This is the most basic single port passive element, which absorbs power from elsewhere in the system.  In electronics, it is the resistor, in mechanics it's the damper, in hydraulics it's the constriction, and in all of the domains it's also friction.  Ohm's law is the very familiar description of the relationship between the effort (voltage) and flow (current) across a resistor.  It turns out that this same equation, E=R * F, holds for all of the other domains as well.  The resistor is typically connected to a 0 or a 1 junction, which are used to tie the rest of the system together.

Compliance/Inertia - The  passive storage elements, which can absorb energy like the resistor, but also eventually return the same energy back to the system.  In electronics, this is the capacitor, and inductor.  In mechanics it's the spring, and mass, and in hydraulics it's the compliance, and inertia of the fluid.  These are both single port elements, which also come off of 0 and 1 junctions.  The compliance and inertia elements are relatively more interesting than resistances because they contain the state of the system (how fast is the ball rolling? How far is the spring compressed?).  They also have the interesting property that their state is a differential equation, which I will get into later.

Flow / Effort Source - At some point in a system, you have to say that everything beyond that point can be modeled by some simple function, otherwise its turtles all the way down and you end up with a bond graph modeling ground water when you're trying to look at car tire braking friction.  Based on their names, it's pretty simple to see that one provides power as a function of flow, and the other as a function of effort.  Your basic fully-charged battery can be modeled by an effort source.  A pump can usually be modeled as a flow source, since it delivers a fixed volume of fluid at whatever pressure the system requires.  Often, the choice of which of the two to use is based mostly on what matters more, so a motor could be modeled as either a flow source of mechanical energy or an effort source, but which one depends on what you know about the motor, and what about the system your really care about.  Remember, bond graphs are about generating equations from your models, not modeling itself.  For that, you're on your own...

Transformer - The transformer is a two port element which converts one effort to another, and a flow to another.  Assuming the transformer is linear, this gives the simple relationship that the second effort is some factor times the first effort, and the first flow is the same factor times the second flow.  There are some examples of transformers used in a single energy domain, such as electrical transformers, or mechanical levers, but transformers are usually used to convert between different energy domains.  The electrical transformer is a transformer, because based on the ratio of wire turns on the two windings, a high voltage/low current input (like from your house wall), can be stepped down to low voltage / high current, which is what all of your typical wall wart power supplied for cell phones and clocks do.  Examples of cross-domain transformers are the piston, which turns a volumetric flow into a linear displacement, and a wheel, which turns a rotational torque into a linear force, which does useful things like make your car go forward.

Gyrator - The last of the nine elements is the gyrator, which is a little more confusing than the transformer, because instead of converting one effort into another effort, it converts an effort into a flow and a flow into an effort.  The gyroscope is the namesake example, because it turns a torque in one direction into a rotation along a different axis.  The more common example of a gyrator is the electric motor, which turns voltage into rotational velocity, and current into torque.

That's probably enough for a single post, but in the following posts I'll show how to use these elements to convert a simple system into a bond graph, and then use this bond graph to find the causality of power flow to learn more about the system.