Hello Anybody,
My name is Lin, and I’m a researcher at The Hong Kong Polytechnic University. I’m trying to simulate muscle fatigue by making the muscle strength parameter (F0) decrease over time following a predefined curve.
I tried in a simple model by directly writing F0=1000-t:
AnyViaPointMuscle Quadriceps = {
AnyMuscleModel Model = {
F0 = 1000-t;
};
AnyRefFrame &origin = .Femur.QuadOri;
AnyRefFrame &insertion = .Patella.Quad;
AnyDrawMuscle drw = {};
};
but the model cannot load and I get:
ERROR(SCR.EXP0) : Knee_origin.any(195) : F0 : Error in evaluation. Please refer to the following error messages for details ...
ERROR(SCR.EXP10) : Knee_origin.any(195) : Model.F0 : Expression evaluation failed at moment 'DesignVar' :
Knee_origin.any(194) : Model.t : argument will not be ready for evaluation until moment 'TimeVar'
Model loading skipped
From the forum I learned that AnyFunExMonoPy could be used.
So I wrote a simple Python function in f0_function.py
:
def muscle_force(context,t):
return 100 - t
And made change in AnyScript:
AnyFunEx PyForce = {
AnyFloat Return = 0;
AnyFunExMonoPy muscle_force = {
ModuleFile = "f0_function.py";
ArgList = {
AnyFloat t = 0;
};
};
};
AnyViaPointMuscle Quadriceps = {
AnyMuscleModel Model = {
F0 = Main.MyModel.PyForce(Main.MyModel.Quadriceps.t);
};
AnyRefFrame &origin = .Femur.QuadOri;
AnyRefFrame &insertion = .Patella.Quad;
AnyDrawMuscle drw = {};
};
Unfortunately, this still gives me an error:
ERROR(SCR.EXP0) : Knee.any(206) : F0 : Error in evaluation. Please refer to the following error messages for details ...
ERROR(SCR.EXP10) : Knee.any(206) : Model.F0 : Expression evaluation failed at moment 'DesignVar' :
Knee.any(204) : Quadriceps.t : argument will not be ready for evaluation until moment 'TimeVar'
Anybody also provides built-in fatigue models (AnyFatigueModelM and AnyFatigueModel3CM), but they don’t allow me to impose a specific fatigue curve.
When I try to add time as a parameter, I still not work.
Question: What is the correct way to make F0 time-dependent in Anybody? Ideally, I’d like to prescribe a custom function of time to represent fatigue.
Any hints, explanations, or sample code would be greatly appreciated. If anyone could kindly point me in the right direction, I would be truly grateful.
Lin