# Force: Two Body Scalar

Model ElementForce_Scalar_TwoBody defines a force or torque acting between two Reference_Markers.

## Description

The force or torque is characterized by a magnitude and a direction. The direction is pre-defined (see Comments 2 - 6 for more information). The magnitude may be defined using a function expression, a user-defined subroutine, a Python script or a MATLAB script. The magnitude can be a function of any system state and time.

## Format

<Force_Scalar_TwoBody
id                   = "integer"
label                = "Name of Force"
i_marker_id          = "integer"
j_marker_id          = "integer"
is_action_only       = "TRUE | FALSE"
type                 = { "FORCE" | "TORQUE" }

{
val                  = "real"
|
val_expression       = "motionsolve_expression"
|
usrsub_dll_name      = "valid_path_name"
usrsub_param_string  = "USER( [[par_1 [, ...][,par_n]] )"
usrsub_fnc_name      = "fnc_name"
|
script_name          = "valid_path_name"
interpreter          = "string"
usrsub_param_string  = "USER( [[par_1 [, ...][,par_n]] )"
usrsub_fnc_name      = "fnc_name"
}
/>

## Attributes

id
Element identification number (integer>0). This number is unique among all Force_Scalar_TwoBody elements. It uniquely identifies the modeling element.
label
The name of the Force_Scalar_TwoBody element.
i_marker_id
Specifies the Reference_Marker at which the force is applied. This is designated as the point of application of the force.
j_marker_id
Specifies the Reference_Marker at which an equal and opposite reaction force is applied.
is_action_only
Boolean variable. Select from "TRUE" and "FALSE".
"TRUE"
The element applies a force/torque on the I marker but no reaction on the J marker.
"FALSE"
The element applies a force/torque on the I marker and also a reaction force/torque on the J marker.

Default value is FALSE.

type
Specifies the type of Force_Scalar_TwoBody being defined. Select from "FORCE" and "TORQUE".
"FORCE"
The element applies a force between the two Reference_Markers. No torque is applied.
"TORQUE"
The element applies a torque between the two Reference_Markers. No force is applied.
val
Specifies the magnitude of a constant valued force.
val_expression
Specifies the magnitude of the force vector as a function expression in the XML input file.
usrsub_param_string
The list of parameters that are passed from the data file to the user defined subroutine, SFOSUB. This attribute is common to all types of user subroutines and scripts.
usrsub_dll_name
Specifies the path and name of the DLL or shared library containing the user subroutine. MotionSolve uses this information to load the user subroutine in the DLL at run time.
usrsub_fnc_name
Specifies an alternative name for the user subroutine SFOSUB.
script_name
Specifies the path and name of the user written script that contains the routine specified by usrsub_fnc_name.
interpreter
Specifies the interpreted language that the user script is written in (example: "PYTHON"). See User-Written Subroutines for a choice of valid interpreted languages.

## Example

The example below shows how a simple friction model in a revolute joint may be modeled using this component.

The first static friction model was developed by Leonardo Da Vinci. Friction force is proportional to load, opposes the direction of motion, and is independent of contact area. Coulomb (1785) further developed this model and the friction phenomena described by the model became known as Coulomb friction.

The Coulomb friction model is shown in Figure 1a below. This model, however, is hard to implement numerically because of the infinite slope (discontinuity) at zero velocity. It is common practice to approximate the infinite slope using the step function when the relative slip in the joint is less than a transition value Vs. This is shown in figure 1b. Our goal is to model the friction model in Figure 1b.

Assume for the purpose of this example:
• joint_id = 7
• i_marker_id = 71; BODY1_ID = 7
• j_marker_id = 81; BODY2_ID = 8
• Radius of the joint = 0.44 m
• µs = 0.3
• Vsub = 0.01 m/s
The normal force in the joint may be calculated as:
• Fx = JOINT(7, 2, 0, 81)
• Fy = JOINT(7, 3, 0, 81)
• Fn = SQRT (JOINT(7, 2, 0, 81)**2 + JOINT(7, 3, 0, 81)**2) + 1167
The slip velocity in the joint may be calculated as:
• Slip velocity = 0.44*WZ(71,81,81)
The smoothed coefficient of friction may be calculated as:
• m = STEP (0.044*WZ(71,81,81), -0.01, 0.3, 0.01, -0.3)
The smoothed Coulomb Friction Force is:
• Ff = Fn * STEP (0.044*WZ(71,81,81), -0.01, 0.3, 0.01, -0.3)

The Force_Scalar_TwoBody modeling element for this scenario is:

<Force_Scalar_TwoBody
id             = "7"
type           = "TORQUE"
i_marker_id    = "71"
j_marker_id    = "81"
val_expression = "(SQRT(JOINT(7, 2, 0, 71)**2 + JOINT(7, 3, 0, 71)**2) + 1167)*STEP(0.044*WZ(71,72,72),-0.01,0.3,0.01,-0.3)"
/>
• The simple model does not account for stiction, variation of friction with velocity (Stribeck effect), and hysteresis.
• If you are interested in modeling stiction, hysteresis and friction compensation, please refer to the implementations suggested in: "Friction Models and Friction Compensation", H. Olsson, K.J. Åström, C. Canudas de Wit, M. Gäfvert and P. Lischinsky, 1997. These can be easily implemented in MotionSolve.
• The friction force contribution of the reaction torque in the joint is ignored in the example. This may be incorporated by assuming a transverse force distribution in the revolute joint along the joint axis and an axial length.
• The friction force caused by axial forces is not modeled. This could be incorporated by assuming an axial force distribution in the annulus shape between the joint inner and outer radii.