MOTSUB

ModelingUsed to compute displacement, velocity, or acceleration for a Motion entity.

Use

User-defined motion using displacement and computed in a MOTSUB:

<Motion_Joint
     id                  = "301001"
     type                = "USERSUB"
     val_type            = "D"
     usrsub_param_string = "USER(5,2)"
     usrsub_dll_name     = "NULL"
     joint_id            = "301002"
     joint_type          = "R"
     motion_type         = "R"
     ic_disp             = "0."
     ic_vel              = "0."
  />

Format

Fortran Calling Syntax
SUBROUTINE MOTSUB (ID, TIME, PAR, NPAR, IORD, IFLAG, VALUE)
C/C++ Calling Syntax
void STDCALL MOTSUB (ID, TIME, PAR, NPAR, IORD, IFLAG, VALUE)
Python Calling Syntax
def MOTSUB(id, time, par, npar, iord, iflag):
    return value
MATLAB Calling Syntax
function value = MOTSUB(id, time, par, npar, iord, iflag)

Attributes

ID
[integer]
The user-defined motion element identifier.
TIME
[double precision]
The current simulation time.
PAR
[double precision]
An array that contains the constant arguments from the list provided in the user-defined statement.
NPAR
[integer]
The number of entries in the PAR array.
IORD
[integer]
The order of the time derivative.
0
Indicates the 0th order derivative and expects the VALUE as:
  • Displacement if the motion type is Displacement.
  • Velocity if the motion type is Velocity.
  • Acceleration if the motion type is Acceleration.
1
Indicates the 1st order derivative and expects the VALUE as:
  • Velocity if the motion type is Displacement.
  • Acceleration if the motion type is Velocity.
  • Not called if the motion type is Acceleration.
2
Indicates the 2nd order derivative and expects the VALUE as:
  • Acceleration if the motion type is Displacement.
  • Not called if the motion type is Velocity or Acceleration.
IFLAG
[logical]
The initialization flag.

Output

VALUE
[double precision]
The output value that contains the computed displacement, velocity, or acceleration of the I marker with respect to the J marker.

Example

def MOTSUB(id, time, par, npar, iord, iflag):

    if par[0]==100001:
        if iflag!=0:
            return -1.0
        if iord==0:
            value = par[1]*pow(time,par[2])
        elif iord==1:
            value = par[1]*par[2]*pow(time,(par[2]-1.0))
        elif iord==2:
            value = par[1]*par[2]*(par[2]-1.0)*pow(time,(par[2]-2.0))
        else:
            value = 0.0
        return value