Argument will not be ready for evaluation until moment

Hi guys:
I would like to applied moment on exoskeleton, the magnitude is accociated with joint acceleration.
To solve this, First, I used Mocap data by Vicon to drive the model, then connected the EXO and the human kinematically and kinetically well.
but when i applied moment on the exo joint by using Anyforce, it failed and arose following error
ERROR(SCR.EXP10) : F:/A..o/A..n/M..s/M..l/LowerExtremity.main.any(125) : 'F' : Expression evaluation failed at moment 'VelVar' :
VelFactor : argument will not be ready for evaluation until moment 'AccVar'
The code is as follows:
AnyForce RHipAbduction =
AnyKinMeasureOrg &ref = ..RHipExoAbduction;

       AnyVar Sign = iffun(gtfun(ref.Acc), 1.0, -1.0);
       AnyFloat AccLimit = 10;
       AnyVar VelFactor = iffun(gteqfun(abs(ref.Acc), AccLimit), 6, abs(ref.Acc*0.3) );
       F = Sign * VelFactor ;


Would you please let me know a good idea to do it?

Best regards,

Hi @Felix

The error you are getting is because the acceleration of your ref object is not ready when the force F needs to be computed.

One way to overcome this is by running the simulation twice; one to find the acceleration and save it in a text file or something, and the next where you use it in the force calculation. A little tedious but manageable

Best regards,
AnyBody Technology