Hi All,
I want to develop a new frame work in MATLAB for OpenSim. I know that we can link OpenSim and Matlab (Mansouri & Reinbolt (2012), Lee & Umberger (2015)). I also know that we can get Inverse Dynamic and Kinematic data from OpenSim in each time step. However, my question specifically is that: "How do I access the equilibrium equations at each time step?"
Thank you in advance,
Mohammadhossein Akhavanfar
Accessing to equilibrium equations
- Mohammadhossein Akhavanfar
- Posts: 19
- Joined: Mon Oct 16, 2017 9:11 am
- Adrian Lai
- Posts: 46
- Joined: Tue Mar 13, 2012 11:33 am
Re: Accessing to equilibrium equations
Hi Mohammadhossein,
I'm not sure if this helps but if you download OpenSim's source code, you can view and replicate the equilibrium equations that OpenSim uses by accessing the muscle model of interest and then looking for the compute functions. For example, the equilibrium equations for the Millard muscle model are detailed in the supporting paper, Millard, M., T. Uchida, A. Seth, and S. L. Delp. Flexing computational muscle: modeling and simulation of musculotendon dynamics. J. Biomech. Eng. 135:1–11, 2013
To my knowledge, I don't think there's a way to access the equilibrium equations at each time step other than providing inputs and obtaining the resulting outputs for specific compute functions.
Adrian
I'm not sure if this helps but if you download OpenSim's source code, you can view and replicate the equilibrium equations that OpenSim uses by accessing the muscle model of interest and then looking for the compute functions. For example, the equilibrium equations for the Millard muscle model are detailed in the supporting paper, Millard, M., T. Uchida, A. Seth, and S. L. Delp. Flexing computational muscle: modeling and simulation of musculotendon dynamics. J. Biomech. Eng. 135:1–11, 2013
To my knowledge, I don't think there's a way to access the equilibrium equations at each time step other than providing inputs and obtaining the resulting outputs for specific compute functions.
Adrian
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Accessing to equilibrium equations
Adrian provided some very useful information if you're interested in the fiber equilibrium equation. Is that what you mean by "equilibrium equations"?
- Mohammadhossein Akhavanfar
- Posts: 19
- Joined: Mon Oct 16, 2017 9:11 am
Re: Accessing to equilibrium equations
I meant dynamic equilibrium equations (i.e Newtonian equations). As you know in all biomechanical models, dynamic equilibrium should be maintained between external moments (due to inertia, gravity, and external loads) and internal moments (due to muscle forces and passive tissues forces). These equilibrium equations cannot be solved deterministically because the number of unknown muscle forces is greater than the equilibrium equations, thereby we use optimization methods to solve them. In other words, at each time step, we optimize muscle forces in the subject to satisfying equilibrium equations. I would like access to these dynamic equilibrium equations so I can manipulate them to add additional constraints.
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Accessing to equilibrium equations
Thanks for explaining. For a given state (joint angles, etc.), you can ask OpenSim to calculate the generalized accelerations (using Newton's laws). However, you rarely need to directly ask OpenSim to do this for you; the tools handle this internally. Instead, you describe (and manipulate) your system by adding the appropriate components to your model.
What is the constraint that you want to model?
What is the constraint that you want to model?
- Mohammadhossein Akhavanfar
- Posts: 19
- Joined: Mon Oct 16, 2017 9:11 am
Re: Accessing to equilibrium equations
Thanks Christopher for your response. We exactly need to access to the internal part that you mention. For example, I want to add some inequality constraints for summation of muscle forces or I want to define one muscle force is two times greater than the other one. For adding these constraints and more, I need to access the part that OpenSim compose equilibrium equations. I am not looking for adding and modifying components (i.e. musculature, etc.). I want to modify the estimation procedure by changing the mathematics of equations.
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Accessing to equilibrium equations
Here's the source code for Static Optimization, where it computes the generalized accelerations from the generalized coordinates and muscle activations: https://github.com/opensim-org/opensim- ... t.cpp#L664. Look in the functions computeAcceleration() and computeConstraintVector().
Also, look at this post: viewtopicPhpbb.php?f=1398&t=8323&p=0&start=0&view=
Also, look at this post: viewtopicPhpbb.php?f=1398&t=8323&p=0&start=0&view=