Bike 2D model optimization

kinematics
#1

Hello,

I was wondering if it is possible that I use the knee joint reaction force as the vertical value instead of the MAX muscle activity, I tried to add the force, It didn’t load right.

Any help would be appreciated!

Lee

#2

Hi Lee,

This should in principle be possible.

I think the problem might have been that you did not specify an AnyOutPutFun containing the force component of interest in the AnyBodyStudy used for the optimization study.

So first make an AnyOutputFun with the force include this in the study
Then in then opt study make an AnyDesMeasure using this function.

Hope it helps

Best regards
Søren

#3

Hello,
this is the anyscript I used.

AnyBodyStudy Study = {
AnyFolder &Model = .Model;
nStep = 50;

AnyFolder &kf = Main.Model.Leg2D.Right.Jnt.Knee.Constraints.Reaction.Fout;
AnyVar F = kf;


AnyOutputFun RKneeforce = {
Val = Main.Study.F;
};
};

AnyParamStudy ParamStudy = {
Analysis = {
AnyOperation &Operation = …Study.InverseDynamics;
};
nStep = {10,10};

AnyDesVar SaddleHeight = {
  Val = Main.BikeParameters.SaddleHeight;
    Min = 0.60;
    Max = 0.689 /*+ 0.02*/;
};

AnyDesVar SaddlePos = {
  Val = Main.BikeParameters.SaddlePos;
    Min = -0.22 /*-0.03*/;
    Max = -0;
};
 ..... 
AnyDesMeasure Metab = {
  Val = secint(..Study.Metabolism(),..Study.tArray);
};

AnyDesMeasure RKneeJoint = {
  Val = Main.Study.RKneeforce;  
};

};

It didn’t run right. It shows:

Loading Main : “F:\ANYBODY\AMMR2.1.1_ZhangShiyu\Application\Examples\OptimBike2\BikeModel2D.main.any”
Scanning…
Parsing…
Constructing model tree…
Linking identifiers…
ERROR(SYS1): Model load: Unknown error

Closing model…
Deleting loaded model…

Another question: there are 3 forces and 2 moments in the knee joint, how should I do to investigate the AP force, for example.
And I don’t think I write the right AnyDesMeasure. Don’t know where the Val point to?

Any help would be appreciated.
Thank you again!

BW
Lee

#4

Hi Lee,

Here is the code needed minimize optimize knee force y component

These lines goes into the study

//Pick the y componenet and make output function
AnyOutputFun RKneeforce = {
Val = Main.Model.Leg2D.Right.Jnt.Knee.Constraints.Reaction.Fout[1];
};

These lines into the opt study

AnyDesMeasure RKneeJoint = {
Val = -min(Main.Study.RKneeforce());
Type = ObjectiveFun;
};

the minus is because the force is negative and the optimizer will minimize… so we need to change sign. The min() function is becuase we minimize the largest negative number over the time interval.

I ran the optimization and it lower knee force from round 920 to 887 i three iterations.

The unknown error you got is this line
“AnyFolder &kf = Main.Model.Leg2D.Right.Jnt.Knee.Constraints.Reaction.Fout;”

This not allowed, you can not make a reference to an output variable.…. but you should not get unknown error… we will try to have that fixed.

Best regards
Søren

#5

Hello,

Thank you for your response.
The problem has been solved. And it runs perfectly.

Thank you again.

BW,
Lee