CreateConstraintClass#

Collection of class templates for adding constraints between design variables in Parameter optimization studies.

Listing 5 Include this file this file to use#
#include "<AMMR_TOOLS>\AnyMocap/CreateConstraintClass.any"`

#LinkDesignVars#

Add a constraint to AnyMoCap models between two design variables in the parameter identification study. By default the Design variables are linked to be equal by adding a constraint Coef1*DesVar1 - Coef2*DesVar2 = 0

It is also possible change the link by setting Coef1 and Coef2, and the Constraint_Type argument.

Example:

 LinkDesignVars EqualThighLength (
   Desvar1=RightThighLength,
   Desvar2=LeftThighLength,
 ) = {};

The constraint can be changed by changing the Constraint_Type argument.

Full signature

LinkDesignVars <ObjectName>(
  DesVar1=<required>,
  DesVar2=<required>,
  Constraint_Type=EqualToZero,
  Coef1=1,
  Coef2=1,
  PARAMETER_OPT_STUDY=Main.Studies.ParameterIdentification,
) = {};

Arguments

__CLASS__:

AnyFolder

DesVar1:

The first design variable to link. (Required)

DesVar2:

The second design variable to link. (Required)

Constraint_Type:

The type of constraint to add between the design variables. Possible values are: EqualToZero, LessThanZero, GreaterThanZero (Default: EqualToZero)

Coef1:

The coefficient of the first design variable in the constraint equation. (Default: 1)

Coef2:

The coefficient of the second design variable in the constraint equation. (Default: 1)

PARAMETER_OPT_STUDY:

The parameter optimization study to add the constraint to. (Default: Main.Studies.ParameterIdentification)

#CreateConstraint#

Small convenience class to quickly add an AnyDesMeasure constraint to the Main.ModelSetup.ParameterIdentification folder and link it to the parameter optimization study.

Example:

Here is an example of adding a constraints which forces the pelvis width to follow the overall body scale.

Note

The following assumes the pelvis width is a design variable, and a model which uses the ScaleXYZ scaling law.

CreateConstraint ScaleHeadWithBody(
  Constraint_Type = EqualToZero,
) = 
{
  Value = Main.HumanModel.Anthropometrics.SegmentScaleFactors.BodyScale 
         - Main.HumanModel.Anthropometrics.SegmentScaleFactors.Pelvis.WidthScale;
};

Full signature

CreateConstraint <ObjectName>(
  Constraint_Type=EqualToZero,
  PARAMETER_OPT_STUDY=Main.Studies.ParameterIdentification,
) = {
  Value = <Required>; 
};

Arguments

__CLASS__:

AnyFolder

Constraint_Type:

The type of constraint to add between the design variables. Possible values are: EqualToZero, LessThanZero, GreaterThanZero (Default: EqualToZero)

PARAMETER_OPT_STUDY:

The parameter optimization study to add the constraint to. (Default: Main.Studies.ParameterIdentification)

Required initialization members

Value = <Required>;
class type:

AnyFloat

The value used in constraint. This is usually set to some expression between other variables.

#Create4clusterRectangleConstraint#

Convenience class to quickly add an constraints to markers in a cluster. The constraints ensures the markers remain in a rectangular shape.

Note

Adding such a constraint is often not be necessary and may make it more difficult for the optimizer.

Example:

Create4clusterRectangleConstraint ThighClusterConstraint(
  marker1 = RThigh1,
  marker2 = RThigh2,
  marker3 = RThigh3,
  marker4 = RThigh4,
) = {};

Full signature

Create4clusterRectangleConstraint <ObjectName>(
  marker1=<required>,
  marker2=<required>,
  marker3=<required>,
  marker4=<required>,
  PARAMETER_OPT_STUDY=Main.Studies.ParameterIdentification,
) = {};

Arguments

__CLASS__:

AnyFolder

marker1:

The first marker in the cluster. (Required)

marker2:

The second marker in the cluster. (Required)

marker3:

The third marker in the cluster. (Required)

marker4:

The fourth marker in the cluster. (Required)

PARAMETER_OPT_STUDY:

The parameter optimization study to add the constraint to. (Default: Main.Studies.ParameterIdentification)