Skip to main content

Best Practices

MTP Design Variables

MTP is a large optimization with many moving parts. Each muscle included in an MTP optimization has six corresponding design variables associated with it:

  • Electromechanical delay
  • Activation time constant
  • Activation nonlinearity constant
  • EMG scale factor
  • Optimal fiber length
  • Tendon slack length.

Meyer, et al., 2017 goes into much detail about the Hill-type muscle model being used, and what each of the above parameters does.

In addition to the above design variables, each muscle without measured EMG data has additional design variables for their synergy vectors that are used to calculate the SynX excitations.

MTP does not currently support personalizing both legs inside of one optimization. A typical MTP formulation involves personalizing either the left or right leg first, and then personalizing the other leg afterwards. Remember to set the input .osimx file for the second optimization as the output .osimx file from the first optimization. This will ensure that your MTP results are all written to the same file even though they were generated in different optimizations.

MTP Cost Terms

The cost terms in MTP can be grouped into three types. The first type of cost term is a tracking cost term. These cost terms minimize deviations away from the experimental data, and in MTP, are used to track experimental joint moments. These cost terms are as follows:

  • passive_joint_moment
    • How closely passive joint moments should be tracked in MTLI
  • measured_inverse_dynamics_joint_moment
    • How closely all joint moments in the model should track experimental joint moments
    • Reduce max allowable error to use SynX muscles more
  • inverse_dynamics_joint_moment
    • How closely joint moments produced by muscles with experimental EMG data should track experimental joint moments
    • Reduce max allowable error to use experimentally measured muscles more

The second type of cost term in MTP is a muscle group cost term. Muscle group minimize deviations in certain parameters between muscles in the same group. These cost terms are as follows:

  • grouped_normalized_muscle_fiber_length
  • grouped_emg_scale_factor
  • grouped_electromechanical_delay

The third type of cost term in MTP is a regularization cost term. Regularization cost terms minimize deviations in design variables away from a given error center. MTP runs often personalize all design variables inside of one optimization, and so regularization terms are important to avoid overfitting to the experimental data. These cost terms are as follows:

  • maximum_normalized_muscle_fiber_length
    • This cost term is only in MTLI. It is used in conjunction with the <max_normalized_muscle_fiber_length> xml element.
  • minimum_normalized_muscle_fiber_length
    • This cost term is only in MTLI. It is used in conjunction with the <min_normalized_muscle_fiber_length> xml element.
  • optimal_muscle_fiber_length
  • tendon_slack_length
  • passive_muscle_force
  • activation_time_constant
  • activation_nonlinearity_constant
  • emg_scale_factor
  • muscle_excitation_penalty

The large collection of interconnected design variables makes MTP a very sensitive optimization to its initial guess and cost term parameters. Getting a good MTP result often requires iteratively adjusting the numerous cost term parameters using information from previous MTP results. When you create an MTP settings file in the OpenSim GUI, a default set of cost terms is created for you and this settings file can serve as a good intial MTP optimization. After you run this initial optimization, you will likely need to adjust cost term parameters.

Iterating on MTP Results

Some common issues with MTP runs and corresponding solutions are outlined below.

  • Poor joint moment tracking quality
    • Decrease max allowable error for measured_inverse_dynamics_joint_moment or inverse_dynamics_joint_moment
  • Large muscle activations
    • Decrease max allowable error or error center for emg_scale_factor or muscle_excitation_penalty
  • Large passive muscle forces
    • Decrease max allowable error on maximum_normalized_muscle_fiber_length, or passive_muscle_force
  • Large difference between muscle activations and muscle excitations
    • Decrease max allowable error on activation_nonlinearity_constant, or activation_time_constant
    • If the magnitude of the muscle activations and muscle excitations are significantly different, change activation_nonlinearity_constant
  • Large difference in activations or normalized fiber lengths between muscles in a group
    • Decrease max allowable error on grouped_normalized_muscle_fiber_length, grouped_emg_scale_factor, or grouped_electromechanical_delay
  • Under/overuse of SynX muscles
    • Change max allowable error on extrapolated_muscle_activation and residual_muscle_activation
    • Change max allowable error on measured_inverse_dynamics_joint_moment in main MTP or inverse_dynamics_joint_moment in SynX
      • If SynX muscles are being overused, decrease the max allowable error on the SynX joint moment tracking term. Do the opposite if SynX muscles are being underused.

Obtaining a good final MTP result can be difficult and often requires repeatedly iterating on MTP solutions. The above descriptions will hopefully serve as a starting point for getting the best MTP result, but it is possible that more problems than just the ones listed above occur.