Change muscle activity

Hello.

I would like to know about "IF … then … else … " function.
Many programming languages have “IF…” function.
I would like to change the muscle activity in optimization. I know that I can change the UpperBound and LowerBound. It is important for me that these bound will not constant. However I want that the muscle works for some time (e.g to 1.6 s) according to the function x, and at other times (e.g. after 1.6 s) according to the function y.

I use this simple code:
AnyMuscleActivityBound GasMed1R = {
AnyMuscle &muscle = Main.HumanModel.BodyModel.Right.Leg.Mus.GastrocnemiusMedialis1;
#if Main.Studies.InverseDynamicStudy.t > 1.6
LowerBoundOnOff = On;
LowerBound = 7.6Main.Studies.InverseDynamicStudy.t^2 - 7.9Main.Studies.InverseDynamicStudy.t
#else
LowerBoundOnOff = On;
LowerBound = 0.5;
#endif
};

However I recived error:
Scanning...
ERROR(SCR.SCN6) : C:/PO..A/A..i/A..o/T..s/A..p/AnyMocapModel.any(83) : 'Main.Studies.InverseDynamicStudy.t' : Unexpected character.
Model loading skipped

What I doing wrong? How can I correct this code?
Thank you very much for help.
Monika

Hi Monika,

  AnyMuscleActivityConstraint MyMuscleLink = 
  {
    AnyMuscle &muscle0 = .MyMuscle;
    Coef = {{-1.0}};
    AnyFunPolynomial fun_mus_act = {
      PolyCoef = {{0, -7.9, 7.6}};          
    };
    Const = { iffun(gtfun(t,1.6), 0.5, fun_mus_act(t)) }; 
    CType = NonNegative;
  };

Try using the code above with necessary modifications. Effectively what it does it constrains the muscle activation using the following expression:
(if t >1.6: 0.5 else: 7.6t^2-7.9t ) - triceps.Activity > 0

Please adjust it using your specific needs and correct expressions. Be aware you cannot constrain a muscle activation to be negative, or in certain cases constraining muscle activation could lead to problem in balance. For example, your polynomial at 1.6 seconds would be 6.81 - meaning that you constrain the muscle not to exert forces over 681% of maximum force. Please make sure your units and expressions make sense.

Kind regards,
Pavel

Dear Pavel,
Thank you for your answer.
The function which I wrote in last message was only example, I kwnow that, the muscle activity shouldn't be more than 100%.

I'm not sure what is difference between "AnyMuscleActivityBound " and "AnyMuscleActivityConstraint". I modified your function and used it to "AnyMuscleActivityBound". The activity in AnyBody and should be same that EMG activity, or is it completely different parameter?

Thank you very much for help.
Monika

Dear Monika,

AnyMuscleActivityConstraint is a class to constrain variables in the muscle recruitment optimization the way you would want. It can be setting threshold like you do, or linking two variables to be equal, or anything else. The AnyMuscleActivityBound is a derived class, where selected variable constrained not to exceed certain limits (bounds). I provided you with a more general definition in case you want to try something more complex, but if your code works - great.

Muscle activity represents the force needed to be produced by the muscle as a percentage of the maximum possible force. In order words, Activity = f/f_max. This has similarities to EMG, but also there are differences. Comparing EMG to muscle activity is, for example, discussed in this validation paper by Morten Lund, section: Better comparison of EMG with data. If you are planning to constrain muscle activity with an EMG signal - try searching if people did this before and what kind of challenges they faced.

Kind regards,
Pavel

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