Because of its ability to efficiently simulate
systems with discrete changes in state (in our case, the set of supports)
Simulink is particularly suited for the computational model of the MDMS.
The simulation models require Matlab V.5.3 or higher and Simulink V.3 or
higher. Simulation results can be viewed without Simulink.

The high-level model is shown in Figure 1.
Simulink represents models as block diagrams where directed arrows represent
the flow of time-varying scalar (thin lines) or vector (thick lines) signals.
Each block represents a function which operates on the signal. The leftmost
block performs the integration of the object's motion. The constants of
motion are its input, and its outputs are the position and angle of the
object. It contains state information about the current position, orientation,
and speed of translation and rotation of the object. The mux block combines
the position vector and angle scalar signals into a single 3-element vector.
The "Compute Supports" block contains an external function which uses the
object's position and orientation and returns a "mask" vector, which is
a list of ones and zeroes representing the support state of each cell. This
mask feeds into the rightmost block which checks if the mask has changed,
and if so, recalculates the constants of motion. The updated constants feed
back into the motion integration block as the set of supports changes.

The details of the "Integration Of Object Dynamics" block
are shown in Figure 2. The constants of motion, which
are fed back as a single vector, are split up into components corresponding
to each constant (either vector or scalar). The appropriate constants are
used in conjunction with the object's current position and velocity to calculate
the total force f and total torque t. The "f" and "tau" blocks involve
the multiplication and addition of the constants and position and velocity
signals according to Equations 18 and 23 (in the text). The details of the
"f" block are shown in Figure 3, and the details of the
"tau" block are shown in Figure 4. The force and torque
signals are then used in an expression of Newton's law to produce the linear
and rotational accelerations by dividing by the mass and inertia of the
object. The accelerations are then integrated twice to produce the velocities
and position and orientation of the object.

The details of the "Check for Change of Supports and Recalculation"
block are shown in Figure 5. The mask vector feeds through
a memory block to produce the mask vector at the "previous" time step. (Note:
The memory block does not maintain a constant step size. It is updated along
with the simulation as the step size changes dynamically to find the exact
time of transition. Thus there is not a true previous time.) The block compares
the previous value of the mask to the current value, and if they are different,
the Recalculate block is triggered. When triggered, this block generates
new values of the constants of motion according to their definitions in
Equations 18 and 23 (in the text). The details of the "Recalculate Block"
are shown in Figure 6.

Download the files into a local directory either by right-clicking
on each of the links above or by downloading and uncompressing one of the
following file which contains all the open and closed-loop simulation files
and sample runs.

To run the model, start matlab and change to the directory
in which you saved the files. To open the model, type, at the Matlab prompt:

simopenloop

This will open the main model window (Figure
1). To run the model, you first must run the startup script "setupsimopenloop.m"
which defines the positions and velocities of the cells, the size, weight,
and initial conditions of the object, the coefficient of friction, the length
of simulation, etc. Note that you can edit this file to change these parameters
(see the comments in the file for instructions). To run the script, type,
at the Matlab prompt:

setupsimopenloop

Once this script is run, you can start the simulation by
selecting "Start" of the "Simulation" menu in the main simulation window
or by typing Control-t in the main simulation window. After a few
seconds, Simulink will beep when the simulation finishes.

Simulink saves signals from the simulation as Matlab variables
for plotting and animation after the simulation runs. The position of the
center of mass of the object is stored in the two-column variable Xc,
the orientation of the object is stored in the one-column variable theta,
and the mask vector is stored in the n-column variable masks (where
n is the number of cells). In addition, the times at which these variables
are stored are stored in the one-column variable t.

The script "animate.m" uses these stored variables to display
a pseudo-real-time (assuming you computer is fast enough) animation of the
recorded motion of the object (one frome of which is shown in Figure 7. To view this animation, type, at the Matlab plot:

The script "makeplot.m" uses the stored variables to make
static plots of the progression of the object. Both "overhead" (Figure 8) and position and orientation vs. time plots (Figure
9)are made. To view these plots, type, at the Matlab plot:

The results of a simulation can be saved by saving the relevant
variables from the Matlab variable environment. To do this, type, at the
Matlab prompt:

save foo Lx Ly V X Xc masks t theta

The variables will be stored in the file name "foo.mat".

To load a set of saved variables from the file "foo.mat",
type, at the Matlab prompt:

load foo

The variable saved in "foo.mat" will be loaded into the Matlab
workspace. At this point, you can run the "animate.m" and "makeplot.m" scripts
as described above. The following set of stored runs is provided with this
appendix:

ellipticgoodanim.mat:
This is the orientable object example from the paper. The object dimensions
are 4.3 by 2.7 cell spacings.

ellipticbadanim.mat:
This is the unorientable object example from the paper. The object dimensions
are 4.7 by 2.3 cell spacings.

smallstableanim.mat:
An object finds a stable pose between cells. This demonstrates that even
an object which is locally orientable may find other stable equilibria.

smallstableanim.mat:
An object without the Positive Rotation Property finds a secondary unstable
equilibria.

unstablebadanim.mat: A very
large object without the Positive Rotation Property finds a secondary unstable
equilibria.

tiltedellipticanim.mat:
This and the following two are examples of fields resulting from skew-symmetric
but non-diagonal ks. The fields are simply rotated versions of the
simple elliptic field.

squeezecentanim.mat:
An orientable object centered relative to the cells on a squeeze field moves
as expected.

squeezeoffcentanim.mat:
An orientable object off-center relative to the cells on a squeeze field
moves shows unexpected behavior. Remember that we defined orientability
only in terms of symmetric squeeze-like fields.

squeezeoffcentcleananim.mat:
An orientable object off-center in a different way relative to the cells
on a squeeze again behaves as expected. The behavior depends greatly on
the initial condition relative to the discrete array.

transsqueezeanim.mat:
A squeeze filed superimposed with a uniform field along the squeeze line
transports an object while approximately maintaining orientation along the
line. Since the symmetry of the field relative to the center of the object
changes as the object moves between cells, it bounces around in orientation.