Biomechanics of Movement

SIMULATION LAB #5:
Muscle-Actuated Simulation of Kicking
Modeling and Simulation of Human Movement
BME 599
Laboratory Developers: Jeff Reinbolt, Hoa Hoang, B.J. Fregley, Kate Saul Holzbaur, Darryl
Thelen, Silvia Blemker, Clay Anderson, Allison Arnold, Scott Delp
I.
Introduction
In this simulation lab, you will learn how to couple musculoskeletal geometry, muscle-tendon
actuator models, and dynamic skeletal models together to produce a muscle-actuated forward
dynamic simulation of human movement. The software package OpenSim will be used to
simulate kicking. After producing the model, you will explore some of the complexities involved
in defining a set of muscle excitations that can produce a coordinated, purposeful movement.
II.
Objectives
The purpose of this lab is to learn how to conduct a muscle actuated forward dynamic
simulation of movement.
By working through this lab, you will:




III.
Become familiar with the implementation of inverse and muscle-driven forward
dynamic simulations using OpenSim.
Investigate the sensitivity of joint moments to perturbations in task kinematics.
Explore the complexity of neuromuscular control for an apparently simple task.
Become familiar with the Analyze tool and several of the analysis options.
Deliverables
Please turn in a written
Simulate_Lab5_report.docx.
report
(hard
copy)
using
the
report
template
IV.
Getting Started
Download the following files from the course web site:
BME599_lab_5_muscle_actuated_simulation_kicking.pdf
Simulation_Lab5_report.docx
These files contain the instructions and the template for the lab and report.
Simulation_Lab5.osim
This file contains the template for simplified model of a right leg with 3 muscle
actuators.
Simulation_Lab5.mot
This movement file drives the nominal kicking motion.
Simulation_Lab5_Actuators.xml
This file includes a description of passive restraining torque actuators (i.e., due to
ligaments) that enforce the joint limits.
convertStorageToControls.exe
This utility program converts .sto files to .xml files. See Appendix for instructions.
Opensim User Guide (download from http://simtk.org/home/opensim)
You may find the OpenSim User Guide helpful for completing this simulation lab.
V.
Muscle-Actuated Forward Dynamic Models
Dynamic models of the musculoskeletal system are typically comprised of four components: 1)
the equations of motion for the body, or skeletal dynamics, 2) a representation of the
musculoskeletal geometry, 3) a model of activation dynamics, and 4) a model of muscle-tendon
mechanics. Figure 1 below shows how these components combine in a forward dynamic
simulation. Based on a set of initial states, which include the muscle activations 𝑎⃑(𝑡), muscle
forces 𝑓⃑(𝑡), generalized speeds 𝑢
⃑⃑(𝑡), and generalized coordinates 𝑞⃑(𝑡), differential equations
are numerically integrated to compute the states at time 𝑡 + 𝑑𝑡. The new states are fed back
and the forward dynamics process repeated, advancing the states in time until the final time of
the simulation is reached.
Figure 1. Schematic of a forward dynamic simulation.
The state equations can be written as a set of first order differential equations in the general
form:


u

q 
      M
   
    1    2
u  I (q )  {C (q , u )  G (q )  R (q )  f M (a , l )  E (q )  f E }
    
 

( x  a ) /  (a , x )
a 
M 
 M 

M  
v (q , u , l , a )
l


where the states consist of:

q
generalized coordinates

u
generalized speeds

a
muscle activations

lM
muscle fiber lengths
In this lab, you will be using numerical integration to solve for the states as a function of time
given initial states and muscle excitation-time histories 𝑥⃑(𝑡).
VI.
Inverse Dynamics
OpenSim can be used to generate an inverse dynamic solution for a kicking motion.
1. Open Simulation_Lab5.osim and load the kicking motion Simulation_Lab5.mot:
File/Open Model/Simulation_Lab5.osim
File/Load Motion/Simulation_Lab5.mot
Animate the kicking motion.
How many degrees of freedom does this model have? What are the generalized coordinates?
What quantities are constrained in the model? Which degrees of freedom are locked for this
motion?
Plot the kinematics of the kick.
2. Perform an inverse dynamic analysis.
Tools/Inverse Dynamics
Check that the motion loaded is the Kick (Simulation_Lab5.mot) motion, or specify
Simulation_Lab5.mot in the Load from file. Check that the location for the output files is where
you would like it to be. If you wish, you can save these settings. Run the analysis.
What happens to the muscles during the animation? Are they used in this analysis?
3. Plot the results of the simulation.
Load the output in Plotter from your output folder. Plot hip and knee moment (Note: the file is
labeled force, but it is a generalized force of an actuator. Because the analysis uses a torque
actuator at each joint, the results are moments).
Overlay plots of hip moment vs. time and knee moment vs. time.
At what times in the motion cycle do the peak moments occur? Compare these times with the
kinematic data. What events in the kinematic data correspond with the timing of the peak
moments? Using your knowledge of dynamics, explain your findings.
4. Use the Analyze tool to perform an inverse dynamics analysis.
Tools/Analyze…
Make sure that the desired motion is loaded. On the Analyses tab, choose Add/Inverse
Dynamics. Select the analysis and choose edit. Unclick use_model_actuator. Hit Run, and plot
results as in part 3.
How do the result of the Analysis compare to the Inverse Dynamics Tool?
VII. Forward Dyanmics
In this section, you will attempt to replicate a nominal two degree of freedom kicking motion by
specifying the activation patterns for a limited set of muscles over a one second period. Based
on visual analysis of the motion and moment plots, guess the activation patterns of the rectus
femoris (rect_fem_r), gluteus maximus 2 (glut_max2_r), and medial gastrocnemius
(gas_med_r) muscles. If you are not familiar with the functions of these muscles, use the model
viewer to turn on and off the display of these muscles to observe how they cross the hip and
knee joints. You must create a controls file that specifies the activations of the muscles. As a
simplification in this lab, you will specify a single onset time, offset time, and activation level for
each muscle in the model. To deactivate a particular muscle, specify 0 activation over the
desired time region.
1. Create a controls .sto file with time and activations for each of the three muscles as well as
for the two passive joint torque actuators. Then convert the controls file to a .xml file.
Hint 1: Look at Simulation Lab 2 for the format of these files.
Hint 2: After creating the first file, it may be easy to edit the .xml file directly since the
activation patterns are simple. The choice is up to you.
Hint 3: Time should go from 0 to 1.
Hint 4: The activations for the passive joint torque actuators should be 0.
Hint 5: MAKE SURE that the order of the actuators matches their order in the .osim file.
2. Create a settings file (Simulation_Lab5_Setup_Forward.xml) to run the forward dynamic
simulation.
Hint 1: See Simulation_Lab4 for a reminder of the format.
Hint 2: Include additional actuators in the simulation by pointing to them in the settings file.
The two relevant lines of code appear in the Simulation_Lab4 setup file, but one is commented
out. You want the replace_actuator_set flag to remain FALSE.
Include the text of the settings file in your report.
3. Create an initial states (.sto) file based on the format from the Simulation_Lab4 containing
time, generalized coordinates, and muscle activations and lengths (for muscle actuators only).
Hint 1: There will be a single data line at time 0.
Hint 2: Include ALL generalized coordinates, even those that are constrained by Coordinate
Coupler Constraints. MAKE SURE that the coordinates appear in the states file in the order in
which they appear in the .osim file.
Hint 3: Use the .osim file to determine the values of the constrained generalized coordinates.
Hint 4: States files can also include velocities for the coordinates. Any column you leave out will
be assumed to equal 0.
Hint 5: MAKE SURE that the value of ncolumns in the header is correct. The simulation will not
give correct results without the correct value for this parameter.
Include your initial states file in your report.
4. Perform a forward dynamic simulation of the kicking motion using your guesses for the
muscle activations.
5. Plot the kinematic results and compare to the nominal kicking motion. Guess a new set of
activation patterns to replicate better the nominal kicking motion (Simulation_Lab5.mot) and
perform another forward dynamic simulation. Repeat this process until you are able to produce
a kicking motion similar to the experimental data.
Record your final muscle activation patterns in the table below:
Muscle
Glut_max2_r
Rect_fem_r
Med_gas_r
Time of onset (s)
Time of offset (s)
Activation level
Describe briefly (one paragraph) the process you used to determine muscle activations.
How do the kinematic results from your muscle-actuated simulation compare to the nominal
motion (Simulation_Lab5.mot)?
Describe how the muscle forces combine to produce hip and knee moments calculated in the
inverse dynamics phase of this lab.
Why is it difficult to guess activation patterns that generate the nominal motion?
VIII. Exploration Phase
Muscle actuated dynamic simulations provide access to important biomechanical quantities
that underlie human motion. For example, knowledge of muscle force is essential for
quantifying the stresses placed on bones and also for understanding the functional roles of
muscles in normal and pathological movement.
The remainder of this tutorial will involve modifying your forward dynamics simulation to
estimate the loads at the hip joint during kicking. Your assignment is to use the joint reaction
analysis tool to quantify reaction forces at the hip.
Hint 1: Remember to append the Actuator set.
Hint 2: The Joint Reaction results are not in the states file but in a ReactionLoads.sto file.
There are two ways to access and use the Joint Reaction analysis tool (or any analysis). Describe
these two ways.
Create a plot of the X and Y components of the joint reaction forces acting at the hip (on the
femur). Create a second plot of the muscle forces.
What portion of the hip reaction loads can be attributed to muscle forces? What other forces in
the system contribute to the hip reaction loads?
Appendix A. Storage files and converting to xml files
1. Create a storage file of muscle excitations (designed or from processed EMG) (all values
should vary between 0 and 1). The file can be created in Excel but must be saved as
file_name.sto The following headers and titles should be included:
2.
OpenSim Header (change italicized words to match file):
file_name
nRows = numberofdatarows
nColumns = numberofdatacolumns
endheader
Note: No space should be left between the header and the row of column titles
Column Titles:
time nameofmuscle.excitation
Note: Muscles should be in the same order in which they appear in the actuator set of the .osim
file.
2.
Use the OpenSim utility convertStorageToControls to create a controls file from the
storage file by typing the appropriate text into the windows command window. The .sto file and
the utility must be in the same folder. You will copy the .sto file to the folder where
convertStorageToControls.exe is located, and you will then need to navigate to that folder in
the command window before calling the .exe.
Command Window Input Format (NOTE ALL ARGUMENTS):
Open a command window clicking on start->Run… and then in the Open: box, type cmd and
click on OK. Then in the command window that pops up, enter the following commands:
cd C:\<path to input file>
[the new file will also be saved in this directory]
convertStorageToControls <input file name>.sto <first muscle name>.excitation <number of
columns not including time> <output file name>.xml
Note: The convertStorageToControls utility will create two output files. The first one, which is
saved under the name you specify in the command window, is the one that should be used in
the forward dynamic simulation. The second file will have the same file name preceded by the
word New_ and can be ignored.
3.
Run a forward dynamic simulation in OpenSim using the newly created controls file as
the input control. Make sure to choose a time range that matches this file, and to correctly
specify the starting posture in the initial states file.