A. Explore and edit OpenSim model, storage, and controls files

For the following exercise, it is recommended that you have a program capable of recognizing XML tags and folding code (e.g., Notepad++ on Windows, TextMate on Mac, Sublime Text on either platform).

To teach Notepad++ to recognize XML tags in .osim files, go to SettingsStyle Configurator…, select "XML" from the Language list, type "osim" in the User ext. box, and click Save & Close. (You will need to re-open your .osim file for the change to take effect.)


The necessary files are located in the "Models/Tug_of_War" folder of the OpenSim Resources directory (by default, C:/Users/<username>/Documents/OpenSim/4.4). Locate the model file 'Tug_of_War_Millard.osim', the controls file 'Tug_of_War_Millard_controls.xml' , and the initial states file 'Tug_of_War_Millard_initial_states.sto' and copy them into your working directory. Copy the model and save it with the filename Tug_of_War_Millard_Iso.osim.

An OpenSim model is created using a series of XML elements. An XML element consists of a start tag, a value, and an end tag. The value between the start and end tags can be a string, a number, or another XML element.

Open the model file 'Tug_of_War_Millard_Iso.osim' in your favorite text editor. At the top of the file, you will find a block that indicates the presence of XML content, then an XML element called OpenSimDocument. Within the OpenSimDocument element is a Model element consisting of several model components. You may recognize the model components as categories shown in the Navigator Pane of the OpenSim GUI.


<?xml version="1.0" encoding="UTF-8" ?>
<OpenSimDocument Version="30000">
    <Model name="Tug_of_War_Millard">
		...
		<BodySet> ... </BodySet>
		<ConstraintSet> ... </ConstraintSet>
		<ForceSet> ... </ForceSet>
		<MarkerSet> ... </MarkerSet>
		<ContactGeometrySet> ... </ContactGeometrySet>
		<ControllerSet> ... </ControllerSet>
		<ComponentSet> ... </ComponentSet>
		<ProbeSet> ... </ProbeSet>
    </Model>
</OpenSimDocument>


Create a set of files for a single muscle simulation as follows:

Open the new Isometric model in the OpenSim GUI.

Configure the Forward Dynamics Tool as follows:

B. Examine the effect of tendon-to-fiber length ratio on isometric contraction simulations

Zajac (1989) showed that the ratio between the tendon slack length and the optimal muscle fiber length () can have a substantial effect on the mechanical response of a muscle–tendon actuator. In this section, you will vary this ratio and examine the mechanical response of the muscle–tendon actuator during isometric contractions.

Set the block_tz coordinate to zero and lock the coordinate in the GUI.

Run a forward dynamic simulation of isometric contraction using tendon-to-fiber length ratios of 0.5, 1.0, 2.0, 4.0, and 7.0. For each ratio, ensure the sum of the tendon slack length and the optimal fiber length is constant (i.e.,  ). Perform the following tasks for each tendon-to-fiber length ratio:

C. Examine the effect of tendon-to-fiber length ratio on isokinetic contraction simulations

In this section, you will evaluate the effect of the ratio between the tendon slack length and the optimal fiber length on an isokinetic (i.e., constant-velocity) contraction. The motion you will be using to calculate muscle forces is 1 second in duration and moves the cube at a speed of 0.1 m/s.

Copy the motion file "Tug_of_War_ConstantVelocity.sto" from the "Models/Tug_of_War" folder into your working directory. Unlock the block_tz coordinate in the OpenSim GUI. Load the motion into the OpenSim GUI and play the animation.

For the same set of tendon-to-fiber length ratios (0.5, 1.0, 2.0, 4.0, and 7.0), you will analyze an isokinetic contraction. For each ratio, ensure the sum of the tendon slack length and the optimal fiber length is constant (i.e., ). Use the controls from the previous section. To calculate the muscle forces, you will use the Analyze Tool to recreate the force profiles given the known information. As discussed in the introduction to this example, the activation, fiber length, and fiber shortening/lengthening velocity are needed to calculate the muscle force using a Millard2012EquilibriumMuscle model. The loaded motion for the block kinematics is used to calculate the muscle fiber length and velocity at each time step. The Analyze Tool uses this information to calculate the muscle force applied to the block.

For more background on the Analyze Tool, see the Analyses page in the User Guide.

Perform the following tasks for each tendon-to-fiber length ratio:

D. Design your best Tug-of-War competitor

You win the competition by getting the center of the block onto your side of the arena at the end of a 1.0-second simulation. For this competition, start with a copy of the original Tug_of_War_Millard.osim model file. 

The design variables that you can modify to create your competitor are:

The muscle must obey the following physical relationships:


To be a valid entry for the design competition, your muscle must satisfy the following constraints:

The initial activation will be 0.01 and the initial fiber length will be determined by the equilibrium condition. To match these conditions in your testing, make sure your muscle's default_activation is 0.01 and enable "Solve for equilibrium for actuator states" when using the ForwardTool.

Before you begin creating muscles, write down your conceptual strategy for building the best muscle possible.

Design your muscle and complete the design report in the questions section.


Next: Questions: Muscle Design for Tug-of-War

Home: Pulling Out the Stops: Designing a Muscle for a Tug-of-War Competition