Using Weight functions in GaitLowerExtremityModel

Hi,

This is my code now in the CreateMarkerclasstd.Any

[SIZE=3][SIZE=1]AnyFolder[/SIZE][/SIZE] &DriverFolder =Main.Studies.KinematicStudyForParameterIdentification.ModelEnvironmentConnection.Drivers;
DriverFolder ={

AnyFolder MarkerName ={

AnyParamFun &WeightFun = Main.ModelSetup.LTH.SW3;
AnyParamFun &WeightFuna = Main.ModelSetup.RTH.SW3;
AnyParamFun &WeightFunb = Main.ModelSetup.LKNE.SW3;
AnyParamFun &WeightFunc = Main.ModelSetup.RKNE.SW3;
AnyParamFun &WeightFund = Main.ModelSetup.LANK.SW3;
AnyParamFun &WeightFune = Main.ModelSetup.RANK.SW3;
AnyParamFun &WeightFunf = Main.ModelSetup.LHEE.SW3;
AnyParamFun &WeightFung = Main.ModelSetup.RHEE.SW3;
AnyParamFun &WeightFunh = Main.ModelSetup.LTIB.SW3;
AnyParamFun &WeightFuni = Main.ModelSetup.RTIB.SW3;
AnyParamFun &WeightFunj = Main.ModelSetup.LTOE.SW3;
AnyParamFun &WeightFunk = Main.ModelSetup.RTOE.SW3;
AnyParamFun &WeightFunl = Main.ModelSetup.LASI.SW3;
AnyParamFun &WeightFunm = Main.ModelSetup.RASI.SW3;
AnyKinDriverMarker Driver = {

AnyDrawKinMeasure Draw = {
Visible = Off;
Opacity = 1;
Label = Off;
Size = 0.01;
Line = Off;
Text = “”;
TextSize = 30;
};

Linear.Ref=0;
AnyRefFrame &ref1 = …InsertionNode1.MarkerName;
AnyParamFun &ref2 = Main.ModelSetup.C3DFileData.Points.Markers.MarkerName.PosInterpol;

};
};

But it still did not ignore the data gap

Best regards,

Hans

Hi,

The affected marker has this code now

[SIZE=2]CreateMarkerTD LTH (
MarkerName=PrefixDef(LTH) ,
MarkerPlacement=Left.Leg.Seg.Thigh,
OptX=“Off”,OptY=“Off”,OptZ=“Off”,
WeightX=1.0,WeightY=1.0,WeightZ=1.0,

Model1=MotionAndParameterOptimizationModel, Model2= InverseDynamicModel
) = {
sRelOpt= {0.067238141, -0.3055959, 0.00793496};
[/SIZE]AnyFunSquareWave[SIZE=2] SW3 =
{
InitialValues = {1.0,1.0,1.0};
Ts = {3.02,4.11};
Values = {{0.0,1.0},{0.0,1.0},{0.0,1.0}};
dT = {0.01,0.02};
};
};

Is this code correct?

Best regards,

Hans
[/SIZE]

Hi Hans,

the code for the marker in the ModelSetup file is ok, but the code in the CreateMarker file is not. You should have this:

AnyFolder MarkerName ={

AnyParamFun &WeightFun = Main.ModelSetup.MarkerName.SW3;

AnyKinDriverMarker Driver = {

AnyDrawKinMeasure Draw = {
Visible = Off;
Opacity = 1;
Label = Off;
Size = 0.01;
Line = Off;
Text = “”;
TextSize = 30;
};

Linear.Ref=0;
AnyRefFrame &ref1 = …InsertionNode1.MarkerName;
AnyParamFun[SIZE=2] &ref2 = Main.ModelSetup.C3DFileData.Points.Markers.MarkerN ame.PosInterpol;
WeightFun={&.WeightFun};
};

};
[/SIZE]
And that means that each marker in the ModelSetup file needs to have a SW3 function as you did for the LTH marker. And as i said previously, if some markers are not dropping and you don’t want to construct a square wave function for them, you can create an SW3 function like this:
[SIZE=2]AnyFunConst SW3 ={Value = {1,1,1};};[/SIZE]
[SIZE=2][/SIZE]
[SIZE=2]Best regards, Sylvain.
[/SIZE]

Hi,

I have replace the code in de Markerclass,

But it said now this error

osition analysis failed : 472 independent constraints and 491 unknowns
- attempts to continue (attempt no. 1)
Failed to resolve kinematic constraints. Newton relaxation too small. (final kin. error = 3.583434E+000)
Constraint no. 262 above error tolerance 0.200000, error = 3.583434.
Constraint no. 268 above error tolerance 0.200000, error = 3.560333.
Constraint no. 274 above error tolerance 0.200000, error = 3.509632.
Constraint no. 280 above error tolerance 0.200000, error = 3.229758.
Constraint no. 286 above error tolerance 0.200000, error = 2.882306.
Constraint no. 292 above error tolerance 0.200000, error = 2.943724.
Constraint no. 298 above error tolerance 0.200000, error = 2.913529.
Constraint no. 304 above error tolerance 0.200000, error = 3.163569.
Constraint no. 310 above error tolerance 0.200000, error = 3.026093.
Constraint no. 316 above error tolerance 0.200000, error = 3.152217.
Constraint no. 322 above error tolerance 0.200000, error = 3.162473.
Constraint no. 330 above error tolerance 0.200000, error = 0.440655.
Constraint no. 336 above error tolerance 0.200000, error = 0.218691.
Constraint no. 340 above error tolerance 0.200000, error = 0.367261.
Constraint no. 341 above error tolerance 0.200000, error = 0.303671.
Constraint no. 346 above error tolerance 0.200000, error = 0.415193.
Constraint no. 347 above error tolerance 0.200000, error = 0.250889.
Constraint no. 354 above error tolerance 0.200000, error = 0.898239.
Constraint no. 358 above error tolerance 0.200000, error = 0.294852.
Constraint no. 359 above error tolerance 0.200000, error = 0.231172.
Constraint no. 360 above error tolerance 0.200000, error = 0.905984.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RTOE.LinDrv’ above error tolerance 0.200000, error = 3.583434.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RHEE.LinDrv’ above error tolerance 0.200000, error = 3.560333.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RANK.LinDrv’ above error tolerance 0.200000, error = 3.509632.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RTH.LinDrv’ above error tolerance 0.200000, error = 3.229758.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LTOE.LinDrv’ above error tolerance 0.200000, error = 2.882306.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LKNE.LinDrv’ above error tolerance 0.200000, error = 2.943724.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LTIB.LinDrv’ above error tolerance 0.200000, error = 2.913529.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LASI.LinDrv’ above error tolerance 0.200000, error = 3.163569.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LTH.LinDrv’ above error tolerance 0.200000, error = 3.026093.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RSHO.LinDrv’ above error tolerance 0.200000, error = 3.152217.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LSHO.LinDrv’ above error tolerance 0.200000, error = 3.162473.
Constraint no. #2 in ‘Main.ModelSetup.C3DFileData.Model.RKNE.LinDrv’ above error tolerance 0.200000, error = 0.440655.
Constraint no. #2 in ‘Main.ModelSetup.C3DFileData.Model.RTIB.LinDrv’ above error tolerance 0.200000, error = 0.218691.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LANK.LinDrv’ above error tolerance 0.200000, error = 0.367261.
Constraint no. #1 in ‘Main.ModelSetup.C3DFileData.Model.LANK.LinDrv’ above error tolerance 0.200000, error = 0.303671.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LHEE.LinDrv’ above error tolerance 0.200000, error = 0.415193.
Constraint no. #1 in ‘Main.ModelSetup.C3DFileData.Model.LHEE.LinDrv’ above error tolerance 0.200000, error = 0.250889.
Constraint no. #2 in ‘Main.ModelSetup.C3DFileData.Model.RASI.LinDrv’ above error tolerance 0.200000, error = 0.898239.
Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.SACR.LinDrv’ above error tolerance 0.200000, error = 0.294852.
Constraint no. #1 in ‘Main.ModelSetup.C3DFileData.Model.SACR.LinDrv’ above error tolerance 0.200000, error = 0.231172.
Constraint no. #2 in ‘Main.ModelSetup.C3DFileData.Model.SACR.LinDrv’ above error tolerance 0.200000, error = 0.905984.
ERROR(OBJ.MCH.KIN3) : H:/J…s/C…d/A…n/E…s/G…b/GaitLowerExtremity.main.any : MotionOptimization.InitialConditions : Kinematic analysis failed in time s

Best regards,

Hans

Hi,

If I make some SW3 functions constant I get huge kinematic errors


  1. Kinematics (Operation: Main.Studies.KinematicStudyForParameterIdentification.Kinematics):
    0.0) PreOperation (Operation: Main.Studies.KinematicStudyForParameterIdentification.Kinematics.PreOperation):
    0.0) InitialConditions (Operation: Main.Studies.KinematicStudyForParameterIdentification.InitialConditions):
    0.0) …Design variables have been updated.
    0.1) …Load time positions have been re-established.
    Failed to resolve kinematic constraints. Newton relaxation too small. (final kin. error = 9.864722E+015)
    Constraint no. 198 above error tolerance 0.200000, error = 0.217250.
    Constraint no. 201 above error tolerance 0.200000, error = 0.237268.
    Constraint no. 202 above error tolerance 0.200000, error = 0.338700.
    Constraint no. 262 above error tolerance 0.200000, error = 3.583434.
    Constraint no. 268 above error tolerance 0.200000, error = 3.560332.
    Constraint no. 274 above error tolerance 0.200000, error = 3.509632.
    Constraint no. 280 above error tolerance 0.200000, error = 3.229758.
    Constraint no. 286 above error tolerance 0.200000, error = 2.882306.
    Constraint no. 292 above error tolerance 0.200000, error = 2.943724.
    Constraint no. 298 above error tolerance 0.200000, error = 2.913529.
    Constraint no. 304 above error tolerance 0.200000, error = 3.163569.
    Constraint no. 310 above error tolerance 0.200000, error = 3.026093.
    Constraint no. 316 above error tolerance 0.200000, error = 3.152217.
    Constraint no. 322 above error tolerance 0.200000, error = 3.162472.
    Constraint no. 330 above error tolerance 0.200000, error = 0.440655.
    Constraint no. 336 above error tolerance 0.200000, error = 0.218691.
    Constraint no. 340 above error tolerance 0.200000, error = 0.367261.
    Constraint no. 341 above error tolerance 0.200000, error = 0.303671.
    Constraint no. 346 above error tolerance 0.200000, error = 0.415193.
    Constraint no. 347 above error tolerance 0.200000, error = 0.250889.
    Constraint no. 354 above error tolerance 0.200000, error = 0.898239.
    Constraint no. 358 above error tolerance 0.200000, error = 0.294852.
    Constraint no. 359 above error tolerance 0.200000, error = 0.231172.
    Constraint no. 360 above error tolerance 0.200000, error = 0.905984.
    Constraint no. 415 above error tolerance 0.200000, error = 6482491.419286.
    Constraint no. 416 above error tolerance 0.200000, error = 1571992.729238.
    Constraint no. 417 above error tolerance 0.200000, error = 9229092.837645.
    Constraint no. 420 above error tolerance 0.200000, error = 11387274.069678.
    Constraint no. 471 above error tolerance 0.200000, error = 9853092019848640.000000.
    Constraint no. 484 above error tolerance 0.200000, error = 9864722163685468.000000.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RTOE.LinDrv’ above error tolerance 0.200000, error = 3.583434.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RHEE.LinDrv’ above error tolerance 0.200000, error = 3.560333.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RANK.LinDrv’ above error tolerance 0.200000, error = 3.509632.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RTH.LinDrv’ above error tolerance 0.200000, error = 3.229758.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LTOE.LinDrv’ above error tolerance 0.200000, error = 2.882306.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LKNE.LinDrv’ above error tolerance 0.200000, error = 2.943724.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LTIB.LinDrv’ above error tolerance 0.200000, error = 2.913529.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LASI.LinDrv’ above error tolerance 0.200000, error = 3.163569.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LTH.LinDrv’ above error tolerance 0.200000, error = 3.026093.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.RSHO.LinDrv’ above error tolerance 0.200000, error = 3.152217.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LSHO.LinDrv’ above error tolerance 0.200000, error = 3.162473.
    Constraint no. #2 in ‘Main.ModelSetup.C3DFileData.Model.RKNE.LinDrv’ above error tolerance 0.200000, error = 0.440655.
    Constraint no. #2 in ‘Main.ModelSetup.C3DFileData.Model.RTIB.LinDrv’ above error tolerance 0.200000, error = 0.218691.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LANK.LinDrv’ above error tolerance 0.200000, error = 0.367261.
    Constraint no. #1 in ‘Main.ModelSetup.C3DFileData.Model.LANK.LinDrv’ above error tolerance 0.200000, error = 0.303671.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.LHEE.LinDrv’ above error tolerance 0.200000, error = 0.415193.
    Constraint no. #1 in ‘Main.ModelSetup.C3DFileData.Model.LHEE.LinDrv’ above error tolerance 0.200000, error = 0.250889.
    Constraint no. #2 in ‘Main.ModelSetup.C3DFileData.Model.RASI.LinDrv’ above error tolerance 0.200000, error = 0.898239.
    Constraint no. #0 in ‘Main.ModelSetup.C3DFileData.Model.SACR.LinDrv’ above error tolerance 0.200000, error = 0.294852.
    Constraint no. #1 in ‘Main.ModelSetup.C3DFileData.Model.SACR.LinDrv’ above error tolerance 0.200000, error = 0.231172.
    Constraint no. #2 in ‘Main.ModelSetup.C3DFileData.Model.SACR.LinDrv’ above error tolerance 0.200000, error = 0.905984.
    ERROR(OBJ.MCH.KIN3) : H:/J…s/C…d/A…n/E…s/G…b/GaitLowerExtremity.main.any : KinematicStudyForParameterIdentification.InitialConditions : Kinematic analysis failed in time step 0

Best regards,

Hans

Hi,

I have uploaded the complete model in the attachment.

Best regards,

Hans

Hi Hans,

The problem is that you have created the exact same SW3 function for all markers. That means all markers have zero weight during the interval {3.02, 4.11}. This is equivalent to having no driver at all and of course the simulation will not run. Most of the markers should have a constant weight of 1 (AnyFunConst SW3 ={Value = {1,1,1};};). Only few of them that are dropping should have their weight controlled by the square wave function.
Also i noticed that the time interval {3.02, 4.11} of the square function correspond to the entire simulation time, that means the marker will be out for the entire simulation. Maybe this is not what you want, because in that case you could simply remove the marker from the list.

So what i suggest you to do is check for each marker if they are dropping or not during the simulation. If the marker drop set the SW3 function of this particular marker to be zero only during the dropping interval. If the marker do not drop use the constant function.

Best regards, Sylvain.

Hi,

I have adjusted all Squarewave functions but my model isn’t moving . What is still wrong. I have included all markers and I only use a weight function for the dropping trajectories of two markers.

Best regards,

Hans

Hi,

Update of the situation. i have adjusted the starting time of the weight function it is working now.

Best regards,

Hans