Hello,
In the OpenSim documentation in "How Scaling Works" https://simtk-confluence.stanford.edu:8 ... ling+Works, it is mentioned that "...muscle's new optimal fiber length and tendon slack length are computed during the scaling process. A scale factor is computed as the ratio of the length before scaling to the length after scaling and the result is used to scale the component's length-dependent properties." I haven't been able to find how the new length of the muscle is calculated in https://github.com/opensim-org/opensim-core, and thus I don't know how the scaling factor for optimal fiber length and tendon slack length are calculated. Do you know where I can find the code or equation that calculated the new muscle length ?
Best Regards,
Scaling muscle properties
- Raphaël Gaiffe
- Posts: 3
- Joined: Wed Nov 02, 2022 8:34 am
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Scaling muscle properties
Hello,
Here's a link to the code snippet you're looking for:
https://github.com/opensim-org/opensim- ... e.cpp#L181
Please let us know if that answers your questions.
Best regards,
-Ayman
Here's a link to the code snippet you're looking for:
https://github.com/opensim-org/opensim- ... e.cpp#L181
Please let us know if that answers your questions.
Best regards,
-Ayman
- Raphaël Gaiffe
- Posts: 3
- Joined: Wed Nov 02, 2022 8:34 am
Re: Scaling muscle properties
That answers my question, thank you !
However, now I would like to know how upd_GeometryPath() works (mostly where it is) and how the path.getLength(s) and path.getPreScaleLength(s) calculate the muscle length ?
However, now I would like to know how upd_GeometryPath() works (mostly where it is) and how the path.getLength(s) and path.getPreScaleLength(s) calculate the muscle length ?
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: Scaling muscle properties
upd_GeometryPath() returns a writable reference to the GeometryPath.now I would like to know how upd_GeometryPath() works
The length of the GeometryPath (the total path of the muscle-tendon unit) is stored before the model is scaled. After scaling, extendPostScale() is called to adjust the optimal fiber length and tendon slack length properties. If scaling the model increased the length of the GeometryPath by x%, then the optimal fiber length and tendon slack length are also increased by x%. This is just one strategy; you can also update these properties yourself after the model is scaled.how the path.getLength(s) and path.getPreScaleLength(s) calculate the muscle length ?
- Raphaël Gaiffe
- Posts: 3
- Joined: Wed Nov 02, 2022 8:34 am
Re: Scaling muscle properties
Thank you for your answer, where can I find the code of the functions getLength(s) and getPreScaleLength(s) ?
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: Scaling muscle properties
You can search the code on GitHub (https://github.com/opensim-org/opensim-core) to find the implementations. Please note that the muscle length is obtained from the underlying GeometryPath.where can I find the code of the functions getLength(s) and getPreScaleLength(s)?