Expression evaluation failed at moment 'DesignVar'

Hi,

I would like to apply a sinusoidal motion to a driver and thought this could be done with t (Main.Study.t) but I always get the above error. The error sounds logical although I thought this is the method of choice :confused:.

Can someone give me a clue, please?

Thanks, Thomaz

Hi Thomaz,

From the description you have provided, my understanding is that you are assigning time to a variable of type DesignVar.
However, for us to better understand and be able to address the source of the issue more precisely, I highly recommend you post the code snippet.

Best,
Mohammad S. Shourijeh, PhD
AnyBody Support

Hi Mohammad,

this is a part of the modified TrunkDrivers.any with the PelvisThoraxExtension modified to illustrate the problem (without sine here):

  //Thorax pelvis rotation driver
  AnyKinEqSimpleDriver PostureDriver ={
    AnyKinMeasureOrg &Ref2 = ...HumanModel.Interface.Trunk.PelvisThoraxLateralBending;        
    AnyKinMeasureOrg &Ref3 = ...HumanModel.Interface.Trunk.PelvisThoraxRotation;   
    AnyKinMeasureOrg &Ref1 = ...HumanModel.Interface.Trunk.PelvisThoraxExtension;
   
    DriverPos = pi/180*{0,0,-60*Main.Study.t};
    DriverVel = pi/180*{0,0,0};
    Reaction.Type = {Off,Off,Off};  
  };  

Hi Thomaz,

You cannot use a time variable function within the AnyKinEqSimpleDriver. If you want to use a sinusoidal function driver, you can use the AnyKinEqFourierDriver and set the cosine coefficients to zero.

Best,
Mohammad S. Shourijeh, PhD
AnyBody Support

ok, thanks Mohammad,

I thought it is possible because other functions can make use of t like:

AnyMuscleActivityConstraint MuscleLink = {
   AnyMuscle &m0 = .BicepsLong;
   AnyMuscle &m1 = .BicepsShort;
   Coef = {{-1.0, 1.0}};
   Const = {-t+1};
};

(This is an example about linear constraints between muscle activities.)

Why is it possible to use t here? t is not known at this moment as well.

Kind regards,

Thomaz

It is a good question.

Time-variable constraints on the activations can be done because they are at the dynamic level. In other words, β€œConst” in your code snippet is of the VelVar type (evaluated at the velocity (dynamic) level) whereas the DriverPos was of the DesVar type (evaluated at the load time).

Hope it clarifies the point.

Best,
Mohammad

sounds comprehensible, thanks.

(but DriverVel in AnyKinEqSimpleDriver must also not depend on t although DriverVel sounds like a VelVar …)

DriverVel is the velocity of the driven coordinate at t=0 and is a DesignVar.
Please read more about the AnyKinEqSimpleDriver in the reference manual.

Best,
Mohammad