Manual Implementation of Force velocity multiplier

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Shivangi Giri
Posts: 51
Joined: Sun Jul 02, 2017 3:04 am

Manual Implementation of Force velocity multiplier

Post by Shivangi Giri » Mon May 01, 2023 2:03 am

Hello,
I have implemented force velocity multiplier of Thelen muscle model referring to both Complete description by Chand John and the updated code Thelen2003Muscle.cpp: https://github.com/opensim-org/opensim- ... Muscle.cpp

The code is as follows:
for j in range(number_of_muscles):

# Calculating contractile force multiplier
fce[j]=(fse[j]/cosphi[j])-fpe[j]

# Calculating normalized velocity vel_norm
# Calculating muscle Force-length multiplier
F_l_norm[j]=np.exp(-((Lm_norm[j]-1)**2)/0.45)

# active force multiplier fa=a*F_l_norm

fa[j] = a[j]*F_l_norm[j]
Af=0.25
Flen=1.8

if(fce[j]<=fa[j]):
b=fa[j]+(fce[j]/Af)
else:
b=((2+(2/Af))*(fa[j]*Flen-fce[j]))/(Flen-1)
vel[j]=(0.25+0.75*a[j])*V_max[j]*((fce[j]-fa[j])/b)
vel_norm[j]=vel[j]/(V_max[j])

if vel_norm[j]<-1:
F_v_norm[j]=(vel_norm[j]+1)/(1+(1/Af))
elif (vel_norm[j] >-1 and vel_norm[j]<0):
F_v_norm[j]=(vel_norm[j]+1)/(1-(vel_norm[j]/Af))
elif (vel_norm[j] >=0 and vel_norm[j]<(10/Flen)*(Flen-1)*(0.95*Flen-1)/(1+(1/Af))):
F_v_norm[j] = ((2+(2/Af))*vel_norm[j]*Flen+Flen-1)/((2+(2/Af))*vel_norm[j]+Flen-1)
else:
F_v_norm[j]=(Flen/(20*(Flen-1)))*((((1+(1/Af))*Flen*vel_norm[j])/(10*(Flen-1)))+18.05*Flen-18)

However, the fv curve does not match andd therefore the trajectory mapping is not happening as it was when using the inbuilt fv multiplier in Opensim4.3 (model.getMuscles().get(j).getForceVelocityMultiplier(state))

Kindly let me know where I must have gone wrong

Regards,
Shivangi
Attachments
Trajectory_mapping_with_OpenSimFv.png
Trajectory_mapping_with_OpenSimFv.png (25.18 KiB) Viewed 174 times
Trajectory_mapping_with_manualFv.png
Trajectory_mapping_with_manualFv.png (25.25 KiB) Viewed 174 times
Complete Description Of The Thelen 2003 Muscle Model.pdf
(96.84 KiB) Downloaded 7 times

Tags:

POST REPLY