SIMU5 Program
/*******************************/
/* Readme file for SIMU5 v. c */
/* Dimitri Kalakanis 8-24-1995 */
/* email comments/bugs to: */
/* kalakanis@mail.utexas.edu */
/*******************************/
Legal stuff:
YOU MAY USE THIS PROGRAM FREE OF ANY CHARGE.
YOU MAY PASS IT ALONG, BUT, N-O-T CHARGE ANY FEES.
I ASSUME NO RESPONSIBILITY FOR ANY DAMAGES OR FRUSTRATIONS.
IF YOU USE IT YOU M-U-S-T SEND AT LEAST ONE MESSAGE ON THE
EMAIL ADDRESS ABOVE.
THANKS AND HAVE FUN!
Contents:
I. INTRODUCTION
REQUIREMENTS
II. INSTALLATION
ON A HARD DISK
ON FLOPPIES
II. RUNNING SIMU5
STARTING THE PROGRAM
THE MAIN SCREEN
ADJUSTING OPTIONS
ADJUSTING TORQUES
ADJUSTING TORQUE VALUES
ADJUSTING INCREMENT VALUE
ADJUSTING VIEWING WINDOW
SETTING TOQUE VALUES TO ZERO FAST
ADJUSTING ANTHROPOMETRICS
ADJUSTING SEGMENT LENGTHS
ADJUSTING SEGMENT MASS
ADJUSTING SEGMENT RADIUS OF GYRATION
ADJUSTING CM LOCATION
ADJUSTING INITIAL CONDITIONS
ADJUSTING INITIAL ANGLE
ADJUSTING INITIAL VELOCITY
ADJUSTING GRAVITY
ADJUSTING SIMULATION TIME
ADJUSTING ANIMATION DELAY
ADJUSTING THE COP WINDOW-BOX VIEW
RUNNING A SIMULATION
WHAT IS VIEWED WHILE ON MAIN
REPEATING LAST SIMULATION
SAVING LAST SIMULATION
SAVING ALL TRIALS ON A SAFE PLACE
LOADING A SAVED SIMULATION
VIEW SCREENS
ZOOMING ON ANIMATION
GRAPHING COP
GRAPHING ANGULAR KINEMATICS
ZOOMING ON SEGMENT AND KINEMATICS
TERMINATING THE PROGRAM
ADJUSTING THE COLORS OF THE PROGRAM
IV. FILES ON THE DISK AND THEIR USE
FILES TO RUN THE PROGRAM
EXECUTABLE
PARAMETERS
OTHER
DATA FILES OUTPUTTED
V. THANKS
VI. STILL TO DO
VII. WHAT WAS USED
I. INTRODUCTION
SIMU5 ver c, is a dynamical model of a 5 segment body with a
Graphical User Interface (GUI) that allows to:
a) Adjust the inputs (joint torques), parameters (segment
length, mass, inertia, cm location) and initial conditions (segment
angles, angular velocities) of the model.
b) Perform a forward simulation.
c) View the results (stick figure animation, angular
kinematics of all segments and COP trajectories).
The user can also adjust the simulation time-length as well as
the gravitational force and animation speed. All this with only the
use of a mouse!
Of course trials can be saved, with all parameters and
simulation outputs included, to be used in a report or to be re-
loaded at later time.
The model is made up of five segments, four of which are in
series. The fifth segment attaches to the third segment at the same
end as the fourth segment. In sort the segments initially modeled
were the low legs, upper legs, torso, arms and head. The head and
arms attach to the distal end of the torso at the same point but,
no torque is exerted from the head to the arms and visa versa. Of
course the user may adjust the segmental anthropometrics and
"model" the body differently. For example one may adjust and model
the legs as one, pelvis, torso and head as one, left arm, and right
arm.
Torque can be exerted at each joint and Newton's Action
Reaction law applies. Torque can be exerted at the ankle, knee,
hip, shoulder and neck joints. When a positive torque is applied
the distal (to the base of support) segment experiences a
counterclockwise (CCW) angular acceleration, while the proximal (to
the base of support) segment experiences an equal and opposite
(clockwise - CW) angular acceleration.
Torque histories as inputs for the simulation can be created
with the use of 21 nodes. Each node is 1/20 of total simulation
time away from the next node. A linear interpolation is used for
values between nodes.
REQUIREMENTS
You will need an IBM compatible machine running DOS 3.3 or
later (you can try earlier versions!), a disk with 1 MB space (can
be Hard or floppy), a VGA monitor capable of at least 640x480
resolution, a VGA video card with 16 colors or shades, a MS-
compatible mouse with at least two buttons, and a MS-compatible
mouse driver ver 6.2 or later (try earlier ones if you have to).
I have not try running it on an XT, but the simulation part is
pretty slow on a 286. It runs fine on a 386-25 notebook. The faster
the machine the better. The simulation uses a variable step
integrator and simulation time may be painful for long (>1sec)
simulations!
II. INSTALLATION
The program will NOT run from its disk as is! It will be
faster and safer from a hard disk, but it can run from a floppy.
If you know DOS, simply copy the self extract file from the disk
to a directory of your choice on your hard disk, and type "xsimu5c".
Otherwise do the following:
Enter the floppy disk on your appropriate drive (lets say A:).
ON A HARD DISK
Make a directory on your hard disk. Anywhere you like, any
name you like. For example: (type what is inside < > follow each
with Return)
< c: > "will move you on Hard disk C"
< c:\ > "will put you in the root of your C drive"
< md simu5 > "will make a directory called simu5"
< cd simu5 > "will put you inside directory simu5"
< copy a:\*.*/v > "will put all files from disk in drive A
to your new directory on C"
< xsimu5c > "will execute the self extract file and
all the files you need will expand in your
directory"
Note: Files "readme.1st" and "readme.txt" (compressed) are identical!
ON FLOPPIES
Use the DOS command < diskcopy >. Take the time to see your
DOS manual. If you need to put it on a disk you need to learn to
take your time! Then just type < xsimu5c > to expand all files.
In either case, at the end you may delete from your working
directory the "xsimu5c.exe" compressed file.
II. RUNNING SIMU5
This section will tell you everything you need to know before
and while you are running the simulation.
STARTING THE PROGRAM
Before you run the program, make sure you have a MOUSE
attached and that the driver for it is loaded! If the driver is not
loaded, the program will exit, but if the driver is loaded while
the mouse is not attached, the program will hang! In this, rare,
case you will have to reboot your system!
From you DOS prompt:
< simu5c >
The introductory screen appears and stays for at least a
second. You MUST hit a key on your keyboard to continue.
THE MAIN SCREEN
You must have a mouse cursor now (looks like a big X).
This is were you will spend most of the time. On the top right
you see the stick figure animation of the model. On the left are
the current torque histories. Bellow the stick figure is the COP
box. Bellow the COP box is a table with all the anthropometrics and
initial parameters. Bellow the table are variable small boxes with
some model and some screen parameters. At the bottom right you have
the save and load option. Finally at the top far right you have the
simulation, redo and exit options
The default trial you will first view is that of an arm raise.
Click in "redo" to view it. Any changes on the parameters will require
"simulate" for to have an effect on the simulation. The default trial
is pre-saved on the disk as "arm" and can be reloaded at any time.
ADJUSTING OPTIONS
The major purpose of the user GUI was to easily adjust the
parameters that effect the model and the simulation. You will not
have to touch the keyboard. Click the left mouse button to
increase, the right to decrease. Here are the details:
ADJUSTING TORQUES
The torque graphs are listed as: top graph is angle joint [1],
second from top graph is knee joint [2], middle graph is hip joint
[3], second from the bottom is the shoulder [4], and last is the
neck [5]. (I know, this works upside down, but, you will get used
to it!)
ADJUSTING TORQUE VALUES
Move your mouse cursor to the torque graph you wish to modify.
Notice the far left bottom of your screen displaying were you are
in time. Click or hold down a mouse button. If you are on a
vertical column that goes though a node, that node will move. Left
button will increase the nodes value, while right button will
decrease nodes value. The new value for that node can be viewed on
the small box adjacent to the torque curves marked "New Torque
Value". If you are clicking between nodes nothing will happened and
the "New Torque Value" box will be empty.
You may keep your mouse button down and move the cursor right
and left to increment/decrement more than one node.
ADJUSTING INCREMENT VALUE
Your nodes increment for every click (or every 18 msec when
button is hold pressed) by the value displayed in the box labeled
"Torque increment by". If you click inside that box you can change
its value (again Left increases, Right decreases) and thus be able
to have better control of your torque value changes.
ADJUSTING VIEWING WINDOW
The torque plot can be increased beyond the size of their
window. But, if you want to see them or if you wish to zoom in and
see small values better you can adjust the value inside the box
"Max Torque Display". Try it!
SETTING TOQUE VALUES TO ZERO FAST
When you wish to reset all torques to zero click on the
numbers, between the torque plots and the table, labeled [1], [2],
[3], [4] and [5]. Once again, [1] is the top plot and is the torque
applied at the joint fixed to the ground (ie ankle joint). Each
number will zero all nodes of its torque plot.
ADJUSTING ANTHROPOMETRICS
The same way you adjusted number inside small boxes you can
adjust the numbers inside any cell of the table.
ADJUSTING SEGMENT LENGTHS
These are on the column "lm" and are in meters. Again the top
value is for the lowest segment. Values must be positive and the
smallest is 0.01 meters. Changes on segment lengths are immediately
updated on the stick figure above. Try it, this is cool!
ADJUSTING SEGMENT MASS
Nothing spectacular here. It is the column labeled "M".
Units are KG. Again the smallest value is .01 kg.
ADJUSTING RADIUS OF GYRATION (moment of inertia)
Nothing stpctacular here neither. It is the column labeled "p"
(Greek rho) and it complies with the definetion by David Winter in
"Biomechanics and Motor Control of Human Movement". The default value
is this of a solid rod (center of mass in the middle)
This adjusts very slowly with the mouse (I need to work on this!) but
the user could a) be patient, b) edit the input files manually.
A short-cut is provided if he user wishes to restor the default values:
just click on the "p".
ADJUSTING CM LOCATION
It is the column labeled "cm". This should be less than
segment length and positive. The user is responsible for this, like
all other values, to make sence!
ADJUSTING INITIAL CONDITIONS
The initial conditions are needed for the integration.
ADJUSTING INITIAL ANGLE
This is in the column labeled "Q" to the far right of the main
table. The units are radians and you can put any joint at any
ankle. Like the segment lengths, changes are immediately updated on
the stick figure. This is also cool, check it out!
ADJUSTING INITIAL VELOCITY
This is the column to the left of the initial angles and is
labeled "W". Units are rad/sec and is usually left at zero for to
start a simulation from quite stance.
ADJUSTING GRAVITY
The "Gravity" box is low mid-right and the change increment is
1/10th m/sec/sec. At 9.80 and -9.80 it takes the value of 9.81 and
-9.81. Positive value means gravity is normal, that is downward.
ADJUSTING SIMULATION TIME
The simulation time is the total time over which the
integration will be performed. The integration step is of variable
time but its maximum limit is set as a percent of the total time.
Thus, large simulation (more a sec or two) will take significantly
longer than a half a second or less total time simulation. You must
run the simulation again for to obtain results for the new time.
ADJUSTING ANIMATION DELAY
Animation delay is simple how long the computer delays between
stick figure animation. Depending on your computer speed, you may
adjust this to your pleasure.
ADJUSTING THE COP WINDOW/BOX VIEW
The COP fore-aft window/box is the long skin box immediately
under the stick figure. The view of the window in meters is stated
in the box to the right of the COP window. The value can change by
click inside the box with the number. Thus, effectively zooming in
and out. The far left side of the window is 0.0 and is assumed to
be located at the angle joint. Note: the COP marker will appear
only during animation!
RUNNING A SIMULATION
Once you have adjusted all the parameters to your like, you
are ready to perform a simulation. Click on the top far-right
button labeled "Simulation" and relax. On a 486-50 a half a second
simulation will last about 5 secs. A 2-3 sec simulation may take
15-20 secs. Start with 0.3 to 0.5 second simulations so you have an
idea of how long should a simulation take on your system.
WHAT IS VIEWED WHILE ON MAIN
While the forward simulation is calculating, you have a blank
screen with the timer-mouse-icon. Once the simulation is completed
your original main screen is restored and the animation begins. The
stick figure performs according to the results of the simulation
while a vertical line marks were on the torque graphs each
animation frame occurs and the COP box shows where the COP is in
every frame. At the end, give a mouse click to refresh your screen.
REPEATING LAST SIMULATION
You may repeat the last simulation by clicking on the "Redo"
button on the top right of the screen. Redo will only repeat the
last seen animation. It will NOT put into effect any changes in
parameters that effect simulation. The only parameter that "Redo"
adjust for is the "animation delay". Thus allowing more comfortable
viewing. Also, during redo-animation the user may 'freeze' at a
frame by pressing and holding down a mouse button. If you wish to
quit the redo-animation before it reaches its last frame, simply
press both mouse buttons down. This will stop the animation and
give you back the mouse cursor. Once you have the cursor (gone
through all frames or not) give a single mouse click to refresh
your screen.
SAVING LAST SIMULATION
If you simulated a trial you like to save click on "save" box
(bottom right) and type in (yes! you got to use the keyboard on
this one) a name for saved files. Do NOT give it an extension and
do NOT use more than 8 characters, do NOT use spaces in the name.
The program will save all the inputs and outputs of the last
simulation under that name. Extensions to files must be left to the
program to design. The program will write on top of any older saved
trials under the same name. That also means that later they can be
written over by someone else. If you are not the only user, save
all trials on a disk.
SAVING ALL TRIALS ON A SAFE PLACE
Use the DOS copy command to save all need files on a disk or
existing directory. Once you exit the program, use:
copy "trial".* "wherever_is_safe"
Use the command for every "trial" you saved within the program and
wish to put in safer place.
LOADING A SAVED SIMULATION
Click on "load" (across from "save") and type in the name of
a file you previously saved. No extension, No more than 8
characters, No spaces. If the files do not exist disaster may
occur. To my experience nothing happens and you continue from were
you were before the attempt to load.
VIEW SCREENS
From the main screen and at any time you can view the last
simulation with "redo". However, there are numerus viewing options
that allow you to improve on what you see and/or to see more!
ZOOMING ON ANIMATION
Instead of clicking on the "redo", click on the animation
itself! As with "redo", you can freeze frames by holding a mouse
button down, and you can quit the animation pressing both buttons
at once. Finally, once you have a mouse cursor at the screen, give
a mouse click to return to main.
GRAPHING COP
The animation of the COP is pretty good only if your COP stays
within your window. Also, if you blink your eyes you missed it.
Click on the COP window and you will see a graph of COP vs time. On
the bottom of the graph you see a indication of the COP fore-aft
value and the time it occurred. Move the mouse pointer to any part
of interest in the curve and read its coordinates!
This option allows you to see COP trajectories behind the
ankle (negative COP)!
GRAPHING ANGULAR KINEMATICS
Below the COP window there are three circles. Click on them to
view the segmental angular kinematics. "A" for angular
acceleration, "W" for angular velocity, and "Q" for angular
displacement. Remember: [1] is the base segment!
ZOOMING ON SEGMENT AND KINEMATICS
If you need more detail than the shape of each curve, click on
any graph to zoom in and get detail similar to the COP graph with
the on-the-fly mouse pointer-digitizer.
TERMINATING THE PROGRAM
Quit by clicking on the box marked "exit". Next time you start
it will start from were the last simulation executed was. That is
if no one else uses the program it will start from were you left
it. If you are not the only user, save the last simulation with the
"save" option and, preferably, put it on a disk or safe directory.
ADJUSTING THE COLORS OF THE PROGRAM
Colors of the program can be changed by the user. Use an ASCII
editor (ei DOS edit) to open file col.dat. The very first column of
numbers is what the program uses for its colors. The second column
gives you a hind as to were the value on the left is used for. The
third column and fort column explain what a number/color relation
is. For example, if you want the background to be yellow, find
yellow on the last column, read the number to its immediate left
(3rd column). Find "background" in the second column, change the
number to its immediate left with the value you just got for
yellow.
The columnar display should be maintained.
Note: that the colors you make the same with the background
will not separate!!!
Change only one color at a time!
Save a good copy of "col.dat" file before you start adjusting.
IV. FILES ON THE DISK AND THEIR USE
FILES TO RUN THE PROGRAM
EXECUTABLES
C5D.EXE Performs the simulation if all parameter files are
present. Can be used from command line if one
suspects that the integrator crashes. (you can look
for messages during the run)
simu5c.EXE The main executable. It uses c5d and all .bat and
parameter files.
PARAMETERS
You should never have to manually open and edit any of these!
But, in case you wonder, or wand to use C5D from DOS's command
line, here it goes:
C5B.IN ASCII- Contains the anthropometrics, initial
conditions and gravity values. Simu5 reads and
updates this file. C5D uses it for the simulation.
The variables are:
first line: 5 segment lengths, 5 center of mass
lengths (from proximal, to base, end of segment),
and the gravity value.
second line: 5 segment masses
third line: 5 segment radius of gyration
fourth line: 5 initial angular velocities
fifth line: 5 initial segment angles (from
horizontal)
CNTRL.TRQ ASCII- Contains the Torque node values. Simu5 reads
and updates, C5D uses for the simulation. Each
column is for a segment.
AUTOTIME.IN ASCII- Do NOT change the first line
The second line contains the total simulation
interval, the rate at which it will save values
(MUST be 1/100th of the first number), and the
integration maximum step (MUST be <= to the second
number).
simu5b.INI ASCII- Used only by simu5 for its initial variables
other than those involved in the simulation (ie
animation delay/speed)
COL.DAT ASCII- Used only by simu5 for its color coding.
Read the section "adjusting colors above)
OTHER
SAVE.BAT Used by simu5 to save last simulation
LOAD.BAT Used by simu5 to reload a saved simulation
OUTL hard disk buffer used by C5D
DATA FILES OUTPUTTED
If you saved a simulation under "name", replace "C5B" with "name"
"C5B".OU1 From C5D, contains angular velocities
"C5B".OU2 From C5D, contains angles
"C5B".AU1 From C5D, contains vertical ground reaction force
"C5B".CO1 From C5D, contains joint torques interpolated from
node values
If you saved, you will also find some more files "name.something",
these are for simu5c graphics only.
Note: COP in fore-aft direction is found as:
COP = (torque at the ankle) / (vertical ground reaction force)
V. THANKS
This program was created as a part of my research work at
KRUG. Special thanks to Dr. Chuck Layne for he made this
appointment possible.
VI. STILL TO DO
----Improve inertia calculations
----Check for save-file name and ask for overwrite
----Check for file-load name and warn if it does not exist
----Check for simulation crash and warn
***-Be able to quit "redo" animation
----Check for load and save file names with spaces and extensions.
--Speed up some of the increment/decrement routines
-Add option to save graphics screens in pcx or gif or tiff formats
-Add a good-bye screen.
***-Check for mouse, (attempt to start it?)
--Create an installation program
---Improve the interpolation method between torque nodes
--Include Help screens (good for beginners)
VII. WHAT WAS USED
The equation of motion and simulation algorithm were created
with the use of AUTOLEV v2. The simulation algorithm was compiled
with IBM's PROFORT v1.22. The GUI was created in Borland's TURBO
C++ v3.00.
Back to ISB home page