Discrepancy Between Calculated Muscle Forces and Static Optimization Results

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
hu hu
Posts: 13
Joined: Fri Jun 23, 2023 1:50 am

Discrepancy Between Calculated Muscle Forces and Static Optimization Results

Post by hu hu » Tue Dec 17, 2024 12:40 am

After performing static optimization, I obtained two files: `HYOID_Scaled_StaticOptimization_activation.sto` and `HYOID_Scaled_StaticOptimization_force.sto`. I am now using the activations obtained from the static optimization to calculate muscle forces and comparing them to the forces from the static optimization results. The code snippet is as follows.

Code: Select all

for i in range(nCoords):
        coord = coord_set.get(i)
        coord_value = data.get(i * 2)  
        coord_speed = data.get(i * 2 + 1)
        coord.setValue(state, coord_value)
        coord.setSpeedValue(state, coord_speed)
model.realizeVelocity(state)

Code: Select all

for i in range(nMuscles):
        muscle = MuscleSet.get(i)
        muscle_force[j, i] = muscle.calcInextensibleTendonActiveFiberForce(state, 1.0)*\
                            activation_data.get(i)
Below are the results of the comparison. The calculated results do not match exactly. How should this be interpreted? Am I missing something?
Attachments
example_plot.jpg
example_plot.jpg (533.31 KiB) Viewed 321 times

Tags:

User avatar
Thomas Uchida
Posts: 1797
Joined: Wed May 16, 2012 11:40 am

Re: Discrepancy Between Calculated Muscle Forces and Static Optimization Results

Post by Thomas Uchida » Thu Dec 19, 2024 5:37 am

Are there any constraints in the model? If so, you should use

Code: Select all

coord.setValue(state, coord_value, False)
and then call the assembler after the loop. Please see the comments in the documentation for the Coordinate::setValue() method here: https://simtk.org/api_docs/opensim/api_ ... f2e88d7c42.

User avatar
hu hu
Posts: 13
Joined: Fri Jun 23, 2023 1:50 am

Re: Discrepancy Between Calculated Muscle Forces and Static Optimization Results

Post by hu hu » Mon Dec 23, 2024 7:01 pm

Thank you for your reply, but I found that after making this adjustment, there is no noticeable difference in the results. Here is the code snippet:

Code: Select all

for i in range(nCoords):
        coord = coord_set.get(i)
        coord_value = data.get(i * 2)  
        coord_speed = data.get(i * 2 + 1)
        coord.setValue(state, coord_value, False)
        coord.setSpeedValue(state, coord_speed)
model.assemble(state)    
model.realizeVelocity(state)

User avatar
Nicos Haralabidis
Posts: 199
Joined: Tue Aug 16, 2016 1:46 am

Re: Discrepancy Between Calculated Muscle Forces and Static Optimization Results

Post by Nicos Haralabidis » Thu Dec 26, 2024 8:20 pm

Hello Huhu,

How are you calculating the coordinate speeds when you manually try to calculate muscle forces? Perhaps differences between your coordinate speeds and those calculated by the static optimization tool differ (impacting the force-velocity multiplier) which may explain the differences you observe.

Thanks,

Nicos

POST REPLY