Sforce

Model ElementSforce defines a force or torque acting between two Markers.

Class Name

Sforce

Description

The force or torque is characterized by a magnitude and a direction. The direction is pre-defined dependent on TYPE and ACTIONONLY. For details, see the Comments in the Force: Two Body Scalar model statement. 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.

Attribute Summary

Name Property Modifiable by command? Designable?
id Int ()    
label Str ()    
i Reference (Marker) Yes
j Reference (Marker) Yes
type Enum ("TRANSLATION ROTATION")    
actiononly Bool ()  
function Function ("SFOSUB")  
routine Routine ()    
active Bool ()  

Declaration

#1. Force or torque magnitude defined in a MotionSolve expression 
Sforce (i=objMarker, j=objMarker, type=string, function=expressionString, routine=string, optional_attributes)

#2. Force or torque magnitude defined in a compiled DLL
Sforce (i=objMarker, j=objMarker, type=string, function=userString, routine=string, optional_attributes)

#3. Force or torque magnitude defined in a Python/Matlab script
Sforce (i=objMarker, j=objMarker, type=string, function=userString, routine=functionPointer, optional_attributes)

Attributes

Force or torque magnitude defined in a MotionSolve expression.
i
Reference to an existing Marker object.
Specifies the marker at which the force and moment is applied. This is designated as the point of application of the force.
The i attribute is mandatory.
j
Reference to an existing Marker object.
Specifies the marker at which the reaction force and moment is applied. This is designated as the point of reaction of the force.
The j attribute is mandatory.
type
String
Specifies the type of Sforce being defined. Select from "TRANSLATION" and "ROTATION".
  • "TRANSLATION": The element applies a force between the two markers. No torque is applied.
  • "ROTATION": The element applies a torque between the two markers. No force is applied.
function
String defining a valid MotionSolve expression
Specifies the MotionSolve expression that defines the VARIABLE. Any valid run-time MotionSolve expression can be provided as input.
A constant magnitude Sforce can be specified as a constant expression.
The function attribute is mandatory.
Force or torque magnitude defined in a compiled DLL.
i
Reference to an existing Marker object
Specifies the marker at which the force and moment is applied. This is designated as the point of application of the force.
The i attribute is mandatory.
j
Reference to an existing Marker object.
Specifies the marker at which the reaction force and moment is applied. This is designated as the point of reaction of the force.
The j attribute is mandatory.
type
String
Specifies the type of Sforce being defined. Select from "TRANSLATION" and "ROTATION".
  • "TRANSLATION": The element applies a force between the two markers. No torque is applied.
  • "ROTATION": The element applies a torque between the two markers. No force is applied.
function
String defining a valid user function MotionSolve expression.
The list of parameters that are passed from the data file to the user defined subroutine where the Sforce is defined.
The function attribute is mandatory.
routine
String
Specifies an alternative name for the user subroutine. The name consists of two pieces of information, separated by "::". The first is the pathname to the shared library containing the function that computes the response of the user-defined Variable. The second is the name of the function in the shared library that does the computation.
An example is: routine="/staff/Altair/engine.dll::mySforce"
  • "/staff/Altair/ engine.dll is the DLL
  • "mySforce" is the function within this DLL that performs the calculations
The attribute routine is optional.
When not specified, routine defaults to SFOSUB.
Force or torque magnitude defined in a Python function.
i
Reference to an existing Marker object
Specifies the marker at which the force and moment is applied. This is designated as the point of application of the force.
The i attribute is mandatory.
j
Reference to an existing Marker object.
Specifies the marker at which the reaction force and moment is applied. This is designated as the point of reaction of the force.
The j attribute is mandatory.
type
String
Specifies the type of Sforce being defined. Select from "TRANSLATION" and "ROTATION".
  • "TRANSLATION": The element applies a force between the two markers. No torque is applied.
  • "ROTATION": The element applies a torque between the two markers. No force is applied.
function
String defining a valid user function MotionSolve expression.
The list of parameters that are passed from the data file to the user defined subroutine where the Sforce is defined.
The function attribute is mandatory.
routine
Pointer to a callable function in Python.
An example is: routine=mySforce.
  • mySforce is a Python function or method that can be called from wherever the model resides.
The attribute routine is optional.
When not specified, routine defaults to SFOSUB.
Optional attributes - Available to all variants.
id
Integer
Specifies the element identification number. This number must be unique among all the Variable objects in the model.
This attribute is optional. MotionSolve will automatically create an ID when one is not specified.
Range of values: id > 0
label
String
Specifies the name of the Variable object.
This attribute is optional. When not specified, MotionSolve will create a label for you.
actiononly
Boolean
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.
active
Bool
Select one from True or False.
  • True indicates that the element is active in the model and it affects the behavior of the system.
  • False indicates that the element is inactive in the model and it does not affect the behavior of the system. It is almost as if the entity was removed from the model, of course with the exception that can be turned "ON" when desirable.
The attribute active is optional. When not specified, active defaults to True.

Example

Model the example below using the Python interface.
#<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) * 0.44"
#/>
#
# Normal force: Fn
Fn = "sqrt (joint(7,2,0,71)**2 + joint(7,3,0,71)**2) + 1167)"

# Coefficient of friction: Mu
Mu = "step (0.044*wz(71,72,72),-0.01,0.3,0.01,-0.3)"

# Friction Torque = Pin_Radius  * Fn * Mu
pinRad = "0.44"
fricTorque = pinRad  + " * " + Fn + " * " + Mu

# Sforce
sf07 = Sforce (id=7, label= "sfo7", i=m71, j=m81, type="ROTATION", function=fricTorque)

Comments

  1. The table below summarizes the direction of the force or torque that is applied by an Sforce.
    Type ActionOnly Direction
    "TRANSLATION" True The direction of the force on Marker I is defined by the unit vector along the z-axis of Marker J.

    There is no reaction force on the body containing Marker J.

    "TRANSLATION" False The direction of the force on Marker I is defined by the unit vector from Marker J to Marker I.

    The force on Marker J is equal and opposite.

    "ROTATION" True The direction of the torque is also defined by the z-axis of Marker J.

    There is no reaction torque on the body containing Marker J.

    "ROTATION" False The direction of the torque is defined by the z-axis of Marker J.

    The z-axis of Marker I and Marker J are required to always be parallel.

  2. See Properties for an explanation about what properties are, why they are used, and how you can extend these.
  3. For a more detailed explanation about Sforce, see Force: Two Body Scalar model statement.