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++).
Tip for new Notepad++ users
To teach Notepad++ to recognize XML tags in .osim files, go to Settings → Style 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 distribution. The Models folder can also be downloaded from . 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.
Create a set of files for a single muscle simulation as follows:
- In the model file (Tug_of_War_Millard_Iso.osim), change the Model name to "Tug_of_War_Millard_Iso". Expand the ForceSet element and remove the Millard2012EquilibriumMuscle element named "RightMuscle". Expand the Millard2012EquilibriumMuscle element named "LeftMuscle" and set its default_activation property to 0.01.
- Create a copy of the controls file (Tug_of_War_Millard_controls.xml) and name it "Iso_controls.xml".
- In the new controls file (Iso_controls.xml), delete the ControlLinear element named "RightMuscle.excitation".
- Create a copy of the initial states storage file (Tug_of_War_Millard_initial_states.sto) and name it "Iso_initial_states.sto".
- In the new storage file (Iso_initial_states.sto), delete the columns for "RightMuscle.activation" and "RightMuscle.fiber_length". Update the number of columns (nColumns) to 5.
Open the new Isometric model in the OpenSim GUI.
Configure the Forward Dynamics Tool as follows:
- In the Input pane, load the controls file (Iso_controls.xml) and the initial states file (Iso_initial_states.sto) and check "Solve for equilibrium for actuator states".
- Open the Excitation Editor and set the LeftMuscle excitation to the maximum value of 1.0 for the entire time range. Save the file and close the editor.
- Set the time range to between 0 and 0.5 seconds.
- Append "\FWD_Isometric" to the output directory.
- Open the Analyses tab and add a ForceReporter analysis.
- Save the Forward Dynamics Tool settings to "Setup_FWD_isometric.xml".
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:
- In the OpenSim GUI, open the ForceSet element in the Navigator. Expand the Muscles category and then select LeftMuscle to display its information in the Properties pane.
- Modify the "optimal_fiber_length" and "tendon_slack_length" properties according to the tendon-to-fiber length ratio. Ensure the "default_activation" property is set to 0.01.
- For the given ratio, create a new initial states storage file where the initial fiber length is set to the optimal fiber length value and the initial activation is 0.01.
- Run a forward dynamic simulation using the settings file you created in Part A. Ensure that the controls file maximally excites the muscle for the entire simulation, and that the initial states file correctly sets the initial activation and fiber length.
- Plot the muscle force vs. time for each tendon-to-fiber length ratio and analyze the resulting simulations.
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), run a forward simulation of 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 and initial states files 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. Given the excitation history, the activation history can be determined using the first-order activation dynamic 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:
- Before you open the Analyze Tool, ensure the "optimal_fiber_length" and "tendon_slack_length" properties have been set correctly for the LeftMuscle. Also, set "default_activation" to 1.0 for this part (part C) of the lab only.
- Open the Analyze Tool.
- In the Input pane, select "Iso_controls.xml" for the controls file.
- In the Input pane, select Motion and ensure the Loaded Motion is set to the "Tug_of_War_ConstantVelocity" motion.
- Check the box for "Solve for equilibrium for actuator states".
- Set the time range to between 0 and 1 second.
- In the Analyses tab, add a ForceReporter.
- Plot the muscle force of the LeftMuscle vs. time and analyze the resulting simulations.
- Right-click on the plot and select "Export Data...". Save the result file as TendonForceVsMotion_ratioX.sto, where X is the current tendon-to-fiber length ratio.
D. Design your best Tug-of-War competitor
The design variables that you can modify to create your competitor are:
– Maximum isometric muscle fiber force
– Optimal muscle fiber length
– Tendon slack length
– Muscle fiber pennation angle at optimal fiber length
– Muscle excitation time history
– Total length of muscle–tendon actuator
– Activation time constant
– Deactivation time constant
– Maximum contraction velocity (in units of optimal fiber lengths per second)
– Muscle volume
– The Z-coordinate of the muscle's attachment point on the ground body
The muscle must obey the following physical relationships:
– The specific tension of the muscle at its maximum isometric force (from Zajac, 1989).
, where
is the distance between the origin of the muscle (on the ground) and its attachment point (on the block) at the beginning of the simulation. Note that
must be set so this constraint is satisfied.
To be a valid entry for the design competition, your muscle must satisfy the following constraints:
Note that you can adjust
to satisfy this constraint.
(i.e., the max_contraction_velocity muscle property must be between 2 and 10)
(constraint on excitation signal)
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.