Share 
Follow 
AboutDownloadsDocumentsForumsSource CodeIssuesNews
Date:
2013-12-04 12:58
Priority:
3
State:
Open
Submitted by:
Gabriel Baud-Bovy (gavril)
Assigned to:
Thomas Uchida (tkuchida)
Summary:
bug in computing FiberForceVelocity in Thelen2003Muscle::printCurveToCSVFile

Detailed description
I have been looking at the OpenSim implementation of Thelen2003 muscle and found, I believe, a small bug in Thelen2003Muscle::printCurveToCSVFile.cpp.

Here are the problematic lines when computing the FiberForceVelocity in printCurveToCSVFile:

line 1484: fvInv = calcfvInv(a, a*1.0, dlceN, 1e-6,100);
line 1485: DdlceDaFalFv = calcDdlceDaFalFv(a,a*1.0,a*1.0*fvInv[1]);

the second argument of these call is multiplied by the activation (a) while it should be 1.0 (=fal).

In all other calls to calcfvInv, the second argument is fal. For example, the call is correct in Thelen2003Muscle::initMuscleState

line 1133 : fvInv = calcfvInv(ma,fal,dlceN,aSolTolerance, 100);

Note calcfvInv calls calcdlceN and calcDdlceDaFalFv

line 2001: dlceN1 = calcdlceN(aAct,aFal, aFalFv);
line 2003: dlceN1_d_Fm = calcDdlceDaFalFv(aAct,aFal,aFalFv);

where aFal is the second argument of calcfvInv

In the body of both functions, the second arguments is multiplied by the activation to compute afl, which is used to compute dlceN and dlcedFm. When calling calcfvInv with a*1.0 instead of 1.0 (or fal), the result is wrong.

The reason for the confusion is the name of the 2nd argument of calcfvInv and calcDdlceDaFalFv, which is named aFal, but should be fal. To what I could see, printCurveToCSVFile is the only place where this confusion leads to a wrong result but I don't have yet a global view of the code.

Add A Comment: Notepad

Message  ↓
Date: 2013-12-04 21:00
Sender: Thomas Uchida

Thank you for reporting this bug, and for your detailed comments. You are correct: the second argument to these methods should be fal, not a*fal. I believe all other calls are being made correctly.

Kind regards,
Tom Uchida

Date: 2013-12-04 16:38
Sender: Ayman Habib

Hi,

Thanks for reporting, I think the function printCurveToCSVFile is used for debugging only, but we'll look into the code to make sure the same issue doesn't appear anywhere else.

Best regards

Field Old Value Date By
assigned_tonone2013-12-04 16:38aymanh
Feedback