University of Miami Box Lifting Model

Dear Anybody

Thanks very much to Moonki again for his expert advice to help with the model. Here is the link of the initial development http://forum.anyscript.org/showthread.php?t=3387

Continue development of the model:

During loading, this below notice shows up. It looks like the program automatically makes adjustments, and since this is a NOTICE it is not necessary to make any code changes. Is this correct?, Is it better to make changes to the code so this NOTICE does not show up?

NOTICE(OBJ1) : C:/U…s/d…l/D…s/+…l/1…l/1…y/EnvironmentAutoDetection.any : ForcePlateType2_Origin_Z_value_message : The older AMTI origin has its Z value as positive. So this value is converted automatically. Please refer to www.c3d.org/HTML/type21.htm.

Sincerely thanks
Damon

Hi Damon,

Sorry for late reply.

This message regarding the ORIGIN value of the force plate, you don’t need to change anything.

The detail explanation will be here:
http://www.c3d.org/HTML/type21.htm

This is about the auto correction of ORIGIN value from some old AMTI platform.

Best regards,
Moonki

Thanks Moonki

I removed the old files and added the zipped folder in dropbox.

I noticed with “EnvironmentAutoDetection” file the code reads as ForcePlateType4, but with “Environment” file th code reads as ForcePlateType2AutoDetection. Should the code in both files read as type 2?

Also, I’ve notice that sometimes the markers are not where they should be, such as the shoulders and the feet. I took carfule steps during placing the markers to be in the right locations. How can I get the bones to match up better to the motion capture markers? See this trail where the markers are not aligning… https://www.dropbox.com/s/e3oisoo060migpg/AMMR.v1.5.1_1_1_UniversityOfMiamiBoxLiftingModel_SentToABMoonki_DropBox_3.zip

Sincerely thanks
Damon

Hi Moonki

Is there a way to obtain the clock time that the program is running? If not is there some code I can add that will generate the clock time the program is running? This is the time for the bones to process, and then a time for the muscles to process.

I’m trying to improve computing speed, and am testing a new computer to determine if it helps run the program faster.

Sincerely thanks
Damon

Hi Damon,

you can either wrap it by a Python function that calls AnyBody from command line and use the following code to time it:


import time

t0 = time.time()
code_block
t1 = time.time()

total = t1-t0

or you can create a batch file that will print out times, call it from a AnyOperationShellExec , place this operation into the InitialConditions.PreOperation folder and for the final time into InverseDynamics.PostOperation folder.

An example of the batch file looks like:

@echo %time%

Regards,
Pavel

Hi Pavel

Got this error, ‘@echo’ : Unexpected character.

The code is after this section of the main file.

“InitialConditions.SolverType = KinSolOverDeterminate;”

Here is the code.

[SIZE=3]AnyOperationShellExec[/SIZE] Time =
{

Settings =
{
Echo = On;

@echo %time%

};

FileName = “time_bones”;

};

Hi Damon,

I suggested to make a batch file, not write command line instructions in AnyBody.

  1. Make a batch file for timing before and after the analysis, time.bat, with the following contents:
@echo %1 : %time% >> t.txt

%1 - an argument, that will be written before the time (we’ll use ‘before’ or ‘after’), %time% gets the system time, >> appending to a text file.
2. Add the following block to the InverseDynamics folder in AnyBody:


  AnyBodyStudy Study = {
    AnyFolder &Model = .Model;
    
    InitialConditions.PreOperation ={
      AnyOperationShellExec TimeBefore = {
        FileName = "time.bat";
        Arguments = "before";
        WorkDir=".\ ";
      };
    };
    InverseDynamics.PostOperation ={
      AnyOperationShellExec TimeAfer = {
        FileName = "time.bat";
        Arguments = "after";
        WorkDir=".\ ";
      };
    };
  };

This code will generate write a file with times, as you may have already guessed, which should look like:


before :  9:17:06.91 
after :  9:17:21.62 

Regards,
Pavel

P.S. I have done this example based on the StandingModel, this batch file was added next to the main file - so please adjust paths yourself.

Hi Pavel

I tried using the code. There is this error, ‘Model’ : Unresolved object

  • What do you think is wrong?

Sincerely thanks
Damon

Damon,

P.S. I have done this example based on the StandingModel, this batch file was added next to the main file - so please adjust paths yourself.

Main.Studies.InverseDynamicStudy = {
    InitialConditions.PreOperation ={
      AnyOperationShellExec TimeBefore = {
        FileName = "time.bat";
        Arguments = "before";
        WorkDir=".\ ";
      };
    };
    InverseDynamics.PostOperation ={
      AnyOperationShellExec TimeAfer = {
        FileName = "time.bat";
        Arguments = "after";
        WorkDir=".\ ";
      };
    };
};

Regards,
Pavel

Hi Pavel

When I look at the StandingModel I only see this code about dynamic.
[SIZE=3]“AnyOperation[/SIZE] &InvAnal=Main.Study.InverseDynamics.” So I’m not sure if this code goes in the main AB file?

Or is all this code done in Python. I still haven’t learned how to do the batch files in Python because I began working on the box for the model. So Id rather us code in the AB instead of Python for now.

Sincerely thanks
Damon

Damon,

No, i realized that the Python code would be more difficult - so i proposed an alternative and cheap solution using the batch file, which is a script file that instructs Windows to perform a set of operations, which are built-in into the operation system. batch file on wikipedia

So please create a text file, named time.bat, containing the “echo” line from the previous posts.

You can test this file in the command line.

The AnyScript code goes into the AnyBody model (into your InverseDynamicsStudy folder - please adjust if this doesnt match):

Main.Studies.InverseDynamicStudy = {
    InitialConditions.PreOperation ={
      AnyOperationShellExec TimeBefore = {
        FileName = "time.bat";
        Arguments = "before";
        WorkDir=".\ ";
      };
    };
    InverseDynamics.PostOperation ={
      AnyOperationShellExec TimeAfer = {
        FileName = "time.bat";
        Arguments = "after";
        WorkDir=".\ ";
      };
    };
};

P.

Thanks Pavel

Its working :slight_smile:

Here is the code for the bones, at least I have some programming skills…

[SIZE=3][/SIZE]Main.Studies.MotionOptimization[SIZE=3] [/SIZE]=[SIZE=3] [/SIZE]{
[SIZE=3][/SIZE]InitialConditions.PreOperation[SIZE=3] [/SIZE]={
[SIZE=3][/SIZE][SIZE=3]AnyOperationShellExec[/SIZE][SIZE=3] [/SIZE]TimeBefore[SIZE=3] [/SIZE]=[SIZE=3] [/SIZE]{
[SIZE=3][/SIZE]FileName[SIZE=3] [/SIZE]=[SIZE=3] [/SIZE]“2time.bat”;
[SIZE=3][/SIZE]Arguments[SIZE=3] [/SIZE]=[SIZE=3] [/SIZE]“before”;
[SIZE=3][/SIZE]WorkDir=".[SIZE=3] [/SIZE]";
[SIZE=3][/SIZE]};
[SIZE=3][/SIZE]};
[SIZE=3][/SIZE]Kinematics.PostOperation[SIZE=3] [/SIZE]={
[SIZE=3][/SIZE][SIZE=3]AnyOperationShellExec[/SIZE][SIZE=3] [/SIZE]TimeAfer[SIZE=3] [/SIZE]=[SIZE=3] [/SIZE]{
[SIZE=3][/SIZE]FileName[SIZE=3] [/SIZE]=[SIZE=3] [/SIZE]“2time.bat”;
[SIZE=3][/SIZE]Arguments[SIZE=3] [/SIZE]=[SIZE=3] [/SIZE]“after”;
[SIZE=3][/SIZE]WorkDir=".[SIZE=3] [/SIZE]";
[SIZE=3][/SIZE]};
[SIZE=3][/SIZE]};
};[SIZE=3]

[/SIZE]
Having programming abilities can really help in AB, I 'll make sure to review the wiki pages on batches.

Sincerely thanks
Damon

Hi Pavel

Happy new year!

I’ve been trying to do a validation of the UM lifting model, and so far my values are not matching, so I’m wondering if I’m using the correct methods.

I found this in the FAQ AnyScript wiki “The model predicts muscle activations that are mathematically defined as the muscle force divided by the strength of the muscle”.

q1- Can you please help me with how to see what the value of the “strength of the muscle” for individual muscles?

q2- How can the value of the strength of the muscle be changed, for individual muscles?

Also, can you please help me with where I can find examples (AB webinars, papers, etc) of comparing muscle activity in the AB model to electromyography(EMG) muscle activity?

Sincerely thanks
Damon

Hi Damon,

  1. You should read the tutorial chapter ‘Muscle Modeling-> Lesson 5: Muscle Models’ to figure out how you can find the ‘strength of the muscle’ from a muscle.
    http://www.anybodytech.com/fileadmin/AnyBody/Docs/Tutorials/chap5_Muscle_modeling/lesson5.html
    It depends on which muscle model(AnyMuscleModel / AnyMuscleModelUsr1 / AnyMuscleModel3E) is used for a specific muscle.
    For some muscle like AnyMuscleModel3E, the muscle strength will vary according to time.
    So you can check ‘Strength’ property of a muscle at a specific moment.
    Also there is a webcast about this:
    https://www.youtube.com/watch?v=H4AdfD1Vd_w

  2. If your model is based on the length-mass-fat scaling, here is a good video for your understanding:
    http://youtu.be/oJNaLEWq-DA
    Each muscle’s strength will be determined by the strength scaling factor(which you can see in the above video), PCSA and the muscle strength reference value in the AMMR.

  3. For comparing the muscle activation of AnyBody models with EMG, you can try to use the ‘Activity’ value of a muscle.

I hope these may be helpful to you.

Best regards,
Moonki

Hi Moonki

My model uses the muscles from the GaitFullBody model.

I have compared the EMG with the AB muscle activity for the lower back for 7 subjects. And for all of these the EMG is about 4 times higher than the AB muscle activity. See the attachment showing one subject.

What do you think can be done to adjust the AB muscle activity so it is closer to the EMG?

Sincerely thanks
Damon

Hi Damon,

Try to define this BM statement as less than 1.0 :
BM_LEG_STRENGTH_INDEX

Also there are some publications regarding how to compare EMG and the muscle activations from musculoskeletal simulation software.

Best regards,
Moonki

Hi Moonki

In which AB file is this located? "BM_LEG_STRENGTH_INDEX?

Also, I’d like to increase the time steps of the AB data, so I can match it with the time steps of the EMG. Can you please give me advice how to accomplish this?

For example the EMG is 3000 rows of data, and the AB is only 250 rows of data. This makes it difficult to compare in statistics. So id like to increase the AB to 3000 rows of data.

Sincerely thanks
Damon