HyperWorks Solvers

COUSUB/COUXX/COUXX2

COUSUB/COUXX/COUXX2

Previous topic Next topic No expanding text in this topic  

COUSUB/COUXX/COUXX2

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Subroutine Type

Modeling

Definition

Used to specify a user coupler element. Coupler constraints are used to constrain the relative translational and/or the rotational motion of two or three joints.  By using a subroutine-based formulation, for example, you can specify a variable coupler ratio based on system states, relational operators, and logical expressions.  A typical example is a nonlinear coupler multiplier ratio defined as a function of an input joint velocity.

Use

User-defined coupler entity example:

 

<Constraint_UserConstr

    id                  = id

    ...

    usrsub_param_string = "USER(r1,… r30)"

    usrsub_dll_name     = "NULL">

 </Constraint_UserConstr>

Calling Syntax

Fortran

SUBROUTINE COUSUB (ID, TIME, PAR, NPAR, DISP, NDISP, IFLAG, PHI)

SUBROUTINE COUXX (ID, TIME, PAR, NPAR, DISP, NDISP, IFLAG, DFDA)

SUBROUTINE COUXX2 (ID, TIME, PAR, NPAR, DISP, NDISP, IFLAG, D2FDA2)

 

C

void  STDCALL  COUSUB (int *id, double *time, double *par, int *npar, double *disp, int *ndisp, int *iflag, double *phi)

void  STDCALL  COUXX (int *id, double *time, double *par, int *npar, double *disp, int *ndisp, int *iflag, double *DFDA)

void  STDCALL  COUXX2 (int *id, double *time, double *par, int *npar, double *disp, int *ndisp, int *iflag, double *D2FDA2)

 

Python

def COUSUB(id, time, par, npar, disp, ndisp, iflag):

    return phi

def COUXX(id, time, par, npar, disp, ndisp, iflag):

    return dfda

def COUXX2(id, time, par, npar, disp, ndisp, iflag):

    return dfda2

 

MATLAB

function phi = COUSUB(id, time, par, npar, disp1, ndisp, iflag)

function dfda = COUSUBXX(id, time, par, npar, disp1, ndisp, iflag)

function d2fda2 = COUSUBXX2(id, time, par, npar, disp1, ndisp, iflag)

Input Arguments

[integer] ID

The coupler element identifier.

 

[double precision] TIME

The current simulation time.

 

[double precision] PAR

An array that contains the constant arguments from the list provided in the user-defined statement.

 

[integer] NPAR

The number of entries in the PAR array.

 

[double precision] DISP

The array of instantaneous joint displacements.

 

[integer] NDISP

The size of the DISP array.

 

[logical] IFLAG

The initialization flag.

Output Values

[double precision] PHI

The scalar output value of the coupler subroutine.

 

[double precision] DFDA

The vector output value of dimension NDISP that contains the partial derivative of PHI with respect to the displacement DISP.

 

[double precision] D2FDA2

The vector output value of dimension NDISP that contains the second partial derivative of PHI with respect to the displacement DISP.

Example

def COUSUB(id, time, par, npar, disp, ndisp, iflag):

    phi = disp[0]+par[0]*disp[1]

    return phi

def COUXX(id, time, par, npar, disp, ndisp, iflag):

    dfda = 2*[0]

    dfda[0] = 1.0

    dfda[1] = par[0]

    return dfda

def COUXX2(id, time, par, npar, disp, ndisp, iflag):

    d2fda2 = 2*[0]

    return d2fda2

See Also:

Modeling Subroutines