5 June 2016
... or, Differential Equations for Electricians
Ordinary differential equations are one of the the fundamental mathematical structures used to represent continuous time-
The use of block diagrams to represent equations has strong roots in several fields of electronic engineering. The first is control systems, which studies methods of building machines that can behave autonomously. An example of a simple control system would be the thermostat that keeps your kitchen oven at the the desired temperature. Examples of more complex (far more complex!) can be found in self-
The second engineering field in which block diagrams were commonly used was analog computing. Before digital computers became readily available in the 1970's, electronic analog computers were commonly used for engineering computations. Instead of representing numbers as series of 0's and 1's, analog computers represented them as continuous quantities -
Some Functional Blocks
The key feature of block diagrams are functional blocks, which perform mathematical operations. A functional block has one or more outputs, each of which in turn defines the value for a single variable. A functional block also may have one or more inputs, which monitor the values of other variables. A functional block with zero inputs is typically used to define either an input variable or a constant, and depending on the chosen notation details may not be explicitly drawn.
The figures below show a few examples of commonly used functional blocks.
GAIN (a) is multiplication by a constant K. This block defines the output variable Y as being equal to K times the input variable X. As X is an input variable, it is not influenced in any way, but is simply monitored.
SUMMATION (b) is the addition operator. In the example shown, Z is defined as the sum of W, X and -
GENERAL FUNCTION (c). A rectangular block is the catch-
INTEGRATION (d). This block defines integration of the X input variable over time. Note the 'IC' input at the top. This is used to establish the initial condition for the output variable Y at the start of the simulation (t=0). Note that integration in this context is implicitly performed over the time variable.
To formulate a meaningful or valid block diagram requires that one follows a couple of simple 'wiring rules':
1. Each connected network of 'wires' represents a single variable or constant.
2. All of the inputs of functional blocks must be defined. This means that you can't leave functional block inputs disconnected, as this would imply an undefined input value. While some simulation systems may allow this condition by assuming an a disconnected input to default to '0' or some other value, this is a departure from the basic modeling paradigm. After all, what is the value of SQRT(?) ?.
3. The output of a functional block can 'drive' an unlimited number of inputs. While in house wiring there is a limit to the number of things you can plug into a circuit until you blow a fuse, the wires in a block diagram convey information, and not amperage, so they have unlimited fan-
4. You can't connect two or more functional block outputs to a single wire. This is like trying to simultaneously assign two separate values to the same variable -
5. Evaluation 'order'. Whileblock diagram notation is a 'parallel' language in that all functions are continuously evaluated, so there is no intrinsic 'order'. When you build up networks of functional blocks, however, you do need to understand how they nest. To continue with the 'computer language' paradigm, functions further 'upstream' are evaluated with higher precedence, and ones further downstream are evaluated later. This is where the arrows on the wiring can be helpful.
Keep in mind that the above rules only define what could be called a 'syntactically' valid signal flow diagram. Following them does not guarantee that the block diagram correctly implements your model.
Feedback is one of the things that makes for interesting behavior, and is a very common feature even in simple systems. One downside of feedback is that it can also make for computational complexity. Consider the block diagram shown below. The two functions F and G are connected in a loop, which represents the algebraic equation shown alongside. While from a mathematical standpoint, this is a perfectly valid system, it does represent a potential problem from a simulation standpoint. Assuming that both F and G have well-
The addition of feedback, however has cast the system into an open-
Although static loops can be problematic, loops that are broken up by integration blocks, such as can be seen in the figure below, are not, and such loops are extremely common in the kinds of systems typically represented by block diagrams. While you still end up with non-
We will now consider a simple example of how one gets from physical system to a block diagram model. The key element of the system to be considered is a mass 'M' that has been mounted on ideal frictionless wheels so it can roll back and forth (figure below). Attached to the left side of this mass is a spring so that the mass will tend to be constrained around a horizontal position of X = 0 (horizontal displacement). Since we are assuming an ideal frictionless system, as generations of idealistic physics students have, if we were to pull the mass to the left and let it go, it would oscillate back and forth forever.
To make the system a little more realistic, we will add some damping with a device called a dashpot, connected to the right-
Each of the elements of the simulation has various properties such as forces, velocities, positions and accelerations, which all vary as a function of time. The following list shows the key relationships:
a) The spring force Fs is proportional (by 'K', the spring constant) and in opposition to the position (X) of the mass M.
b) The damping force Fd is proportional (bt 'D' the damping constant) and opposes the velocity (V) of the mass M.
c) The acceleration of the mass (second derivative of position) is controlled by the sum of the forces acting on it, and inversely proportional to the mass M. If you have a bigger mass, it accelerates more slowly (F=mA).
d) Velocity (V) is the integral of acceleration over time.
e) Position (X) of the mass is the integral of velocity over time.
All of the above could be combined to form the following ordinary differential equation (shown below), which could then be solved for position X as a function of time through well known methods that would require finding my old differential equations textbook.
Since the purpose of this post is to discuss signal flow graph models, my differential equations book shall remain entombed in a box in my basement. Instead, let us consider how the above equations map into the block diagram shown below:
The integral relations in equations (d) and (e) are realized by the two integation blocks placed in series, which sucesisvely transform acceleration into velocity and finally into position. The forces from the spring (eqn. a) and dashpot (eqn. b) are developed through gain blocks respectively driven from the X and V integrator outputs. Finally, these are converted back into acceleration by summation and being multiplied by 1/M (eqn. c).
While the choice of functional blocks and the connections between them are dictated by the physical system's mathematical model, there is a certain art to drawing a block diagram so that the system's structure is apparent.For example, in this system, one can clearly see the feedback relations between velocity and position and the acceleration. This is one of the major strengths of block diagram representations -
If a block diagram contains no static feedback loops, it can be straightforward to simulate. For a system as simple as the one presented above, an effective simulation can even be realized using a spreadsheet. As a check, lets implement the model, and assign the following parameter and initial values:
In the resulting plots shown below, you can see three effects which you would intuitively expect from this type of system:
1) The cart bounces back and forth sinusoidally (spring and mass action)
2) The bouncing dies out (the action of the dashpot)
3) Velocity and acceleration are 90 degrees out of phase (two sinusoids related by integration or differentiation)
Note that the solution shown above is from a step-
To conclude, block diagram notation offers a powerful way of describing complex dyanamic systems. The graphic nature of the representation often reveals system structure that might not be apparent when looking at traditional equation-