*SetCoupler() - asymmetric coupler pair with user subroutine

Sets the properties of an asymmetric coupler pair with a user subroutine.

Syntax

*SetCoupler(coupler_name, , USER,`left_expr`, `right_expr`) 
*SetLocalUserDLLFlag(coupler_name.l,TRUE|FALSE) 
*SetLocalUserDLLFlag(coupler_name.r,TRUE|FALSE) 

*SetLocalUserDLL(coupler_name.l,"string") 
*SetLocalUserDLL(coupler_name.r,"string") 

*SetLocalUserFuncname(coupler_name.l,"functionname") 
*SetLocalUserFuncname(coupler_name.r,"functionname")

Arguments

coupler_name
The variable name of the coupler pair.
Data type: varname
USER
Indicates the user-written subroutine used to model the coupler pair.
left expr
The solver expression that sets the arguments for the left side of the user defined coupler pair.
Data type: string
right expr
The solver expression that sets the arguments for the right side of the user defined coupler pair.
Data type: string

Example

*BeginMDL(the_model, "Model", "11.0.0.130-HWDesktop")
 *BodyPair(b_0, "Body 0", p_0, , , , , false, false)
 *PointPair(p_0, "Point 0")
 *SetPoint(p_0, LEFT, , -50)
 *SetBodyInertia(b_0, LEFT)
 *Set(b_0.usecm, true)
 *SetOrientation(b_0.cm.l, TWOAXES, ZX, DXDYDZ, , , , DXDYDZ)
 *PointPair(p_1, "Point 1" )
 *SetPoint(p_1, LEFT, 50, -50)
 *BodyPair(b_1, "Body 1", p_1, , , , , false, false)
 *Set(b_1.usecm, true)
 *RevJointPair(j_0, "Joint 0", b_0, B_Ground, p_0, VECTOR, V_Global_Y)
 *TransJointPair(j_1, "Joint 1", b_1, B_Ground, p_1, POINT, p_0)
 *CouplerPair(c_0, "Coupler 0", 2JOINT, j_0, j_1, TRANS, TRANS)
 *SetCoupler(c_0, LEFT)
 *SetCoupler(c_0, , -5 , -5)
 *SetCoupler(c_0, , USER, `USER(500)` , `USER(500)`)
 *SetLocalUserDLLFlag(c_0.l, true)
 *SetLocalUserFunction(c_0.l, PYTHON)
 *SetLocalUserDLL(c_0.l, mycoupler.py)
 *SetLocalUserDLLFlag(c_0.r, true)
 *SetLocalUserFunction(c_0.r, PYTHON)
 *SetLocalUserDLL(c_0.r, "mycoupler.py")
 *SetLocalUserFuncname(c_0.l, "COUSUB1")
 *SetLocalUserFuncname(c_0.r, "COUSUB2")
 *Set(c_0.l.local_der1_funcname, COUXX)
 *Set(c_0.1.local_der2_funcname, COUXX2)
 *Set(c_0.r.local_der1_funcname, COUXX)
 *Set(c_0.r.local_der2_funcname, COUXX2)
 
*EndMDL()

Context

*BeginContext()

*BeginMdl()

*DefineAnalysis()

*DefineAssembly()

*DefineSystem()

Comments

User-defined couplers are generally accompanied with *SetLocalUserDLLFlag, *SetLocalUserDLL, *SetLocalUserFunction, and *SetLocalUserFuncname statements to specify the local subroutines used by the coupler.

The first and second order derivative subroutines can be set using the *Set statement (as shown in the example above).