In this section, we will create a muscle model that characterizes fatigue. We will then adapt the example from Chapter 2 to use this new type of muscle model. The resulting source code and associated files for this example come with the OpenSim 3.0 distribution under the directory, e.g.:

C:\OpenSim 3.0\sdk\APIExamples\MuscleExample

When creating a new muscle model, you can start from scratch by deriving from the base class, Muscle, or you can alter an existing muscle model. In this example, we will add the effects of muscle fiber fatigue to Millard2012EquilibriumMuscle, but we could just as easily do this to other muscle models.

Muscle modeling overview

A muscle is defined by a path and a set of force-generating parameters. The path of a muscle is stored in a GeometryPath object owned by the base class, Muscle. The force-generating parameters are usually different for each type of muscle, so they are stored in the derived muscle classes. A muscle also typically has one or more states (though it can have zero) whose differential equations describe the force, length, and activation behavior of the muscle. Millard2012EquilibriumMuscle has 2 states.