Simulations suddenly not working (Jupyter + AB)

Hello,

I am trying to automate some simulations using AnyBody and Jupyter and I am getting an error in Jupyter which I am not getting in AB.

The error is the following (from Jupyer):

#### Macro command : UpdateValues(1:1)> classoperation Main "Update Values"
Updating expressions...
...Finished updating expressions
0.0.2) ...Kinematic analysis completed.
0.0.3) ...Dependent variables are fully updated.
0) Inverse dynamic analysis...
ERROR(OBJ.MCH.MUS4) :   C:\Users\....\kneemodel.main.any(317)  :   'MyStudy.InverseDynamics'  :  Muscle recruitment solver :  solver aborted after maximum number of line-search iterations
0) ...Inverse dynamic analysis terminated
ERROR(OBJ.MCH.KIN3) :   C:\Users\....\kneemodel.main.any(317)  :   'MyStudy.InverseDynamics'  :  Kinematic analysis failed in time step 0

It only happens when I run the inverse dynamics.

I thought that I was doing something wrong, but if I just plug in the same variables which I am passing through Jupyter manually in AB and start the simulation, then it is working without any errors. I also performed multiple simulations before with different variables and it was working perfectly, but for some reason it suddenly stopped working and I am not sure why.

Thanks in advance for any advice!

Best regards,
Diana

Hi @diana

Can you post a example macro you are parsing to AMS?
And maybe a full log file from anypytools?
Is it a MotionCapture model you have?
Is it only certain simulations that fail or is it all simulations you call from jupyter?

Best regards,
Bjørn

Hi Bjørn,

The following is the macro:

macro = [
    Load("main.any"),
    SetValue('Main.KneeFDKModel.Right.Ligaments.ACL.attachments_T', acl_ap),
    SetValue('Main.KneeFDKModel.Right.Ligaments.PCL.attachments_T', pcl_ap),
    SetValue('Main.KneeFDKModel.Right.Ligaments.dMCL.vt', dmcl_ap),
    SetValue('Main.KneeFDKModel.Right.Ligaments.MedMenAnt.attachments_T', medMenAnt_ap),
    SetValue('Main.KneeFDKModel.Right.Ligaments.MedMenPost.attachments_T', medMedPost_ap),
    SetValue('Main.KneeFDKModel.Right.Ligaments.LatMenAnt.attachments_T', latMenAnt_ap),
    SetValue('Main.KneeFDKModel.Right.Ligaments.LatMenPost.attachments_T', medMedPost_ap),
    SetValue('Main.KneeFDKModel.Right.Ligaments.TransverseLig.attachments_MM', transvLigMeniscMedial_ap),
    SetValue('Main.KneeFDKModel.Right.Ligaments.TransverseLig.attachments_MT', transvLigMeniscLateral_ap),
    SetValue('Main.KneeFDKModel.Right.Ligaments.PL.pt_attach', patella_ap),
    SetValue('Main.SubjectSpecificData.AnatomicalFrame_MRI_Shank.sRel_us_cylinder',anatomical_SREL),
    SetValue('Main.SubjectSpecificData.AnatomicalFrame_MRI_Shank.rotation_angle', rotation_angle),
    
    OperationRun('Main.KneeFDKModel.CalibrateLigaments'),
    OperationRun('Main.KneeFDKModel.LoadLigParFromFile'),
    OperationRun('Main.MyStudy.InverseDynamics'),
    
    SaveData('Main.MyStudy', saveFileAs),
    
    SetValue('Main.MyCam.VideoName', video_frontal),
    SetValue('Main.MyCam.CameraDirection', camera_frontal),
    
    UpdateValues(),
    
    OperationRun('MyCam.Create_Video'),
    
]

This is the log file from anypytools:

simplified leg model-c926b-0_(1pu0hhkk).zip (2.4 KB)

No, it is not the motion capture model. I am using the simplified leg model, which was working before.

The simulations fail only if I run them from Jupyter (all the simulations). If I run them in AB, they run without any errors.

I used before the exact same Jupyter-AB files and it was working, but for some reason, last week it stopped working and gave me the above errors.

Best regards,
Diana

Thank you for the info.

I do not see an immediate reason as to why it fails.
Have you tried using a UpdateValues() after loading the LoadingParFromFile operation?

Other than that, I would suggest to try and simplify the macro.
Start with one that only loads the model and runs it with the values hardcoded in the script.
Remove all SetValue, UpdateValue, SaveData etc. So it only performs the neccesary steps to run the InverseDynamics study.

If that works then gradually add the remaning steps and add some Dump("path.to.variable") on the variables you are setting as a check that they are actually set to the intended value.

Best regards,
Bjørn

Hi Bjørn,

Ok, thank you, I will do that!

Best regards,
Diana

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.