1. Michael Rosario
  2. musclemodelR

Wiki

Clone wiki

musclemodelR / Home

Introduction

musclemodelR is an R package that is used to simulate the dynamic interaction between Hill-type muscle models and linear elastic elements. The basic code was originally developed to simulate fixed-end contractions (i.e., no change in muscle-tendon unit length), but since has been expanded to study active lengthening of muscles. Currently, the models are used to simulate the effect of tendons on 1) deceleration of mass and 2) direct lengthening of the muscle-tendon unit during muscle activation.


Installation

The easiest way to install this package is to use the install_bitbucket() function from the devtools package.

Installing devtools

To install devtools:

install.packages("devtools")

If you have problems installing devtools, you can find more information at its github page.

Installing musclemodelR

To install musclemodelR after successful installation of devtools:

devtools::install_bitbucket(repo = "michaelvrosario/musclemodelR")

This may take a while because it will install musclemodelR as well as any dependencies.


Examples

The following example demonstrates the framework for simulating the effect of muscle activation in conjunction with a constant rate of muscle-tendon unit elongation.

# load package
library(musclemodelR)

# set up inputs to simulation
dt                   <- 1/1000 # s
Fmax                 <- 100 # N
v_mus_max            <- 10 # ML/s
m_muscle             <- 0.5 # kg
l_muscle             <- 70 # mm
l_spring             <- 42 # mm based on matson
k                    <- 50 # N/mm - based on initial calculations
actDynamics          <- F # 100% activation
maxActivation        <- 1 # maximal muscle activation
lengthenRate         <- -5 # mm/s
lengthenDuration     <- 0.100 # s
deactivationDuration <- 0.150 # s
stim_start           <- 0
stim_end             <- 0.100

initialConditions <- data.frame(
  dt,
  Fmax,
  v_mus_max,
  m_muscle,
  l_muscle,
  l_spring,
  k,
  actDynamics,
  maxActivation,
  lengthenRate,
  lengthenDuration,
  deactivationDuration,
  stim_start,
  stim_end
)

# run simulation and export to *.JSON file
RunSimulations_lengthening(inputParams = initialConditions,
                           previousResults = F,
                           JSONfile = "simulationResults_lengthen.JSON")

Todo

Coding

  • create simulation of direct lengthening
  • generalize deceleration code for recycling
  • setup lengthening simulations after experimental data
  • create script to analyze lengthening results
  • modify deceleration analysis to investigate effect of mass
  • include installation and usage in wiki
  • create documentation of functions using oxygen
  • generalize functions to include stimulation parameters
  • simulate deactivation with activation, split data into lengthening and not
  • fix lengthening unit tests
  • add indexing parameter for analysis fxns (DIY query)
  • add r package documentation
  • look up how to document package and make manual

Model parameters

  • iterate though tendon stiffness?
  • get a good estimate of combined FMax of all muscles connected to spring
  • calculate tendon stiffness from lengthening experimental data 829Mpa -> 378N/mm

Updated