WELCOME TO THE NEW PLATFORM FOR THE OPENSIM DOCUMENTATION

Remember to update your bookmarks with our new URL.
If you find missing content or broken links, let us know: opensim@stanford.edu


Static Optimization Settings Files and XML Tags

The topics covered in this section include:

Setup File and XML Tag Definitions

The settings file is an XML file whose tags specify properties to be used by OpenSim for the static optimization analysis. The XML tags used are defined in the following sections.

The following setup file example can be found in examples/Gait2354_Simbody.

Example: XML file for a static optimization setup file

subject01_Setup_StaticOptimization.xml
<?xml version="1.0" encoding="UTF-8"?> 

<AnalyzeTool name="subject01_walk1"> 

  <!--Name of the .osim file used to construct a model.--> 
  <model_file> subject01_simbody.osim </model_file> 

  <!--Replace the model's actuator set with sets specified in <force_set_files>? If false, the actuator set is appended.--> 
  <replace_force_set> false </replace_force_set> 

  <!--Directory used for writing results.--> 
  <results_directory> ResultsStaticOptimization </results_directory> 

  <!--Output precision. It is 8 by default.--> 
  <output_precision> 20 </output_precision> 
  
  <!--Initial time for the simulation.--> 
  <initial_time> 0.4 </initial_time> 

  <!--Final time for the simulation.--> 
  <final_time> 1.6 </final_time> 

  <!--Set of analyses to be run during the investigation.--> 
  <AnalysisSet name="Analyses"> 
    <objects> 
      <StaticOptimization name="StaticOptimization"> 
		<!--Flag (true or false) specifying whether whether on. True by default.-->
        <on>true</on>
        <!--If true, the model's own force set will be used in the static optimization computation. -->
        <use_model_force_set>false</use_model_force_set>
        <!--A double indicating the exponent to raise activations to when solving static optimization.  -->
        activation_exponent>2</activation_exponent>
        <!--If true muscle force-length curve is observed while running optimization.-->
        <use_muscle_physiology>true</use_muscle_physiology>
        <!--Value used to determine when the optimization solution has converged-->
        <optimizer_convergence_criterion>0.0001</optimizer_convergence_criterion>
        <!--An integer for setting the maximum number of iterations the optimizer can use at each time.  -->
        <optimizer_max_iterations>100</optimizer_max_iterations>
      </StaticOptimization> 
    </objects> 
  </AnalysisSet> 

  <!--Motion file (.mot) containing the generalized coordinates for the model.--> 
  <coordinates_file> subject01_walk1_ik.mot </coordinates_file> 
 
  <!--Low-pass cut-off frequency for filtering the model generalized coordinates. A negative value results in no filtering. The 
      default value is 1.0, so no filtering.--> 
  <lowpass_cutoff_frequency_for_coordinates> 6 </lowpass_cutoff_frequency_for_coordinates> 

  <!--XML file (.xml) containing the forces applied to the model as ExternalLoads --> 
  <external_loads_file> externalLoads.xml</external_loads_file> 

</AnalyzeTool> 

Specifying an Execution Name

The properties for the analyze tool, which is responsible for performing the inverse dynamics analysis, are enclosed inside the opening and closing tags <AnalyzeTool> and </AnalyzeTool>. The name attribute name="subject01_walk1" specifies the execution name. The name of the results file generated will be prefixed with this name.

Specifying the Model

The <model_file> tag specifies the OpenSim .osim file used to construct a model. This file typically defines the OpenSim musculoskeletal model scaled to the dimensions of the subject by the Scale Tool.

Specifying the Forces

The <replace_force_set> allows the modification of the actuators defined in the model file. If the value of <replace_force_set> is true, then the actuators specified in any file listed under the property <force_set_files> will replace the corresponding model's actuators. If the value of <replace_force_set> is false, then the actuators specified in the files listed under <force_set_files> will be added to the model's existing actuator set.

Specifying the Results Directory and Precision

The <results_directory> tag specifies the directory where results should be written. The <output_precision> tag specifies how many decimal places should be used when writing results. A value of 20 is sufficient to avoid round-off error.

Specifying Initial and Final Times

The <initial_time> and <final_time> tags specify the time interval over which the inverse dynamics analysis is to be performed. The initial and final times may be adjusted to the nearest frames of data available.

Specifying a Static Optimization Analysis

The properties for the analysis set used by the analyze tool are enclosed inside the opening and closing tags <AnalysisSet> and </AnalysisSet>. The properties for the objects contained in the analysis set are enclosed inside the opening and closing tags <objects> and </objects >.

The properties for the static optimization analysis are enclosed inside the opening and closing tags <StaticOptimization> and </StaticOptimization>. The name attribute name="StaticOptimization" specifies the analysis name. The name of the results file generated will include this name. The <on> tag specifies whether or not the static optimization analysis should be performed. The <step_interval> tag specifies how often to record results during the static optimization analysis. A value of 1 means results are recorded every 1 frame of motion data. The <use_model_force_set> tag specifies whether or not the model's actuator set will be used in the static optimization analysis. If not, generalized forces (e.g., net joint forces and torques) will be computed for all unconstrained degrees of freedom.

Specifying Coordinates and Filtering

The <coordinates_file> tag specifies the time histories of kinematics (e.g., generalized coordinates) that describe the movement of the model. For example, this file may be generated by the inverse kinematics tool. The <lowpass_cutoff_frequency> tag specifies the low-pass cutoff frequency for filtering the kinematics. If the kinematics have already been filtered, specify a negative cutoff frequency to prevent filtering.

Specifying External Loads

The <external_loads_file> tag specifies the XML file containing the external loads applied to the model during a static optimization analysis. See How Inverse Dynamics Works for additional details for applying any number of external loads as point forces and/or body torques.

Optimizer Parameters.

As of OpenSim 3.1, you can additionally specify the properties of the optimizer, including the <optimizer_convergence_criterion> and <optimizer_max_iterations>/

 

OpenSim is supported by the Mobilize Center , an NIH Biomedical Technology Resource Center (grant P41 EB027060); the Restore Center , an NIH-funded Medical Rehabilitation Research Resource Network Center (grant P2C HD101913); and the Wu Tsai Human Performance Alliance through the Joe and Clara Tsai Foundation. See the People page for a list of the many people who have contributed to the OpenSim project over the years. ©2010-2024 OpenSim. All rights reserved.