## Introduction

### Philosophy

The point of a model is to synthesize the real world and predict future behavior.  It is often an added bonus that the mathematical representations offer additional viewpoints.  It is important to point out that time spent modeling is not always beneficial.  Direct experimentation is often faster and can provide more intuitive results.  Furthermore, a model is only as good as the observations that it is based upon.  Where do those observations come from?  Experimentation!

So if experimentation is so great why model at all?  Two reasons: 1) Non-destructive testing and 2) Interpolation.  Many times the experiment required to answer a particular result would destroy the object in question.  Collapsing a bridge by driving an over-loaded semi-truck on it is far less expensive in computer simulation than in real-life and also less traumatic for the truck driver.   Also, it can be expensive and time consuming to take many measurements that could be generated by a model.  A simple example of this is curve-fitting, where a curve is fit to experimental results.  Once the curve has been fit, you can use it to interpolate values that were not explicitly measured.

My model will hopefully be used for both non-destructive testing and interpolation of experimental results.  I don't have IRB approval to cut-open someone's head and look at their brain while they try to stand up-right, so hopefully I can metaphorically do that to my model.  Furthermore, I hope that the model fits the experimental data so that I can use it to interpolate recorded data.

### Modeling Goal

The double-pendulum model is a simplified model of the anterior-posterior motion of a standing human. This simulation mimics an experimental protocol where a subject is placed on a translational platform.  The platform movement is sudden, causing a disturbance similar to the sudden start/stop of a subway car to the standing subject.  Examining the patterns of muscle activation and motion of the body helps to reveal how the nervous system interacts with the musculoskeletal system.  In this dynamical model the links of the pendulum will approximate the legs and trunk of a human subject. An acceleration to the inertial frame will be applied to represent the disturbance caused by the translational platform.

### Algorithm

There are many methods of developing "dynamical" models.  However, to be successful with any technique requires an initial intuition about the motion of the system, development of kinematic relations and the analysis of forces.  The following algorithm works pretty well for a fairly wide range of simple systems and for the most part removes the requirement for having to remember the subtleties of mechanics.
1. Draw a sketch of system and think about how it moves.
2. Determine degrees-of-freedom (DOF) of system: number of variables you would need to locate the object in space
3. Define coordinate systems: an inertial frame is always required
4. Pick generalized coordinates: these are the variables that describe the DOF
5. Work out position vectors from the origin of the inertial frame to the center-of-mass (COM) for all of your rigid bodies.
6. Take the first derivative of all of your position vectors.
7. Identify all of the kinetic and potential energy.
8. Employ Lagrange's equations.
9. Apply external forces with virtual work.

## Kinematics

### Sketch

 θ1 - angular position of first link θ2 - angular position of second link L1 - length of first link L2 - length of second link m1 - mass of first link m2 - mass of second link

### Degrees-of-freedom & Coordinates

The two planar links each have two translational and one rotational DOF and are constrained by two pin joints, which limit the translational DOF.  Therefore the double pendulum system has two degrees of freedom.

A single planar cartesian coordinate system is all that is necessary to define the inertial coordinate frame.  Generalized coordinates describing the motion can be selected by specifying the rotation of the first link  with respect to the inertial frame and the second link's rotation relative to the first link.  Specifying the second link with a relative coordinate poses additional complexity, but makes it more intuitive when it comes time to implement control.

### Position

We are interested in first finding the position vectors for the center-of-mass for link 1 and 2, defined by points A and B.  Those vectors are as follows:
 (1) (2)

### Velocity

The derivatives of the position vectors give us the velocity for the COMs for the two links.  This will be useful for quantifying the amount of kinetic energy stored in the moving links.
 (3) (4)
It is also advantageous to write out the squared velocities at this time as they will be needed for further calculations.
 (5) (6)

## Dynamics

### Energy

The kinetic energy for the system can be found by summing the linear and rotational components for each rigid body.  A point of interest is that the rotational kinetic energy of the second link depends on the rotational velocity of itself and the first link.  This is because of how the generalized coordinates were selected.
 (7)
The potential energy for the system is quantified by the change in COM within a gravitational field.
 (8)
In order to correctly apply a perturbation to the double pendulum as if the ground was accelerated from side-to-side, we can pull a small trick.  Since such a perturbation would act as an acceleration to the inertial frame we can compute the "potential" within this frame.  We will call this applied acceleration x'' (here double prime = double dot = second derivative).
 (9)

### Lagrange

We now formulate the lagrangian using Eqs. 7, 8 and 9.
 (10)
Then using the lagrangian formula (Eq 11) we compute the equations of motion.
 (11)
The result is two equations, one for each DOF.  Equation 12 for θ1 and Eq 13 for θ2.
 (12) (13)

### Applied Forces

Torque is applied at each of the joints and written as T1 and T2.  To find the generalized forces associated with these torques we first compute the virtual work of the system.  To help with determining the virtual work pretend that all the joints are locked except for one and imagine the work that would be associated with that DOF, then go on to the next generalized coordinate.
 (14) $\delta W = T_1 \, \delta \theta_1 +T_2 \, \delta \theta_2$
From here we can recognize the generalized forces as those associated with the virtual increments of the generalized coordinates.
 (15) $Q_1 = T_1$ (16) $Q_2 = T_2$

### Equations of Motion

Finally, we can write the equations of motion in a compact form as shown in Eq 17.  Note that q'' is a vector holding θ1'' and θ2''.  Furthermore M is the mass matrix, which is symmetric and positive definite.  This ensures that the mass is always positive and real valued. F is the portion of the equations of motion associated with coriolis and gravitational forces.  Q is the vector containing the generalized forces and P is the vector containing the transformation for the perturbation acceleration x".
 (17) (18) (19) (20) (21)

Attached at the bottom of this page are Matlab files for symbolic manipulation and numeric computation for these equations of motion.  A simulation of these equations can be found here.
ċ
cartDoublePendulum.m
(2k)
Jeff Bingham,
Jun 23, 2009, 3:49 PM
ċ
mathCheckingAccl.m
(3k)
Jeff Bingham,
Jun 23, 2009, 3:48 PM
ċ
simScriptCartDoublePendulum.m
(0k)
Jeff Bingham,
Jun 23, 2009, 3:49 PM