Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions 2025R2/rigid-bd-25-r2/actuator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Actuator

The actuator is the base class for all
[Loads](load.md),
[Body Loads](bodyload.md), and
[Drivers](driver.md).

ID table: `CS_Actuator`

### Members

`Condition`

All actuators can be conditional. See
[Condition](condition.md) to create this condition.

`AppliedValue`

Measure that stores the evaluation of the actuator variable. Can be useful
when the applied value depends on a measure other than time.

`EnergyMeasure`

Measure that stores the energy generated by the actuator.

### Member functions

There are two ways to define the value of the load: using a variable, or by
defining a table of input measures (in which case a variable is defined
automatically).

`SetVariable(variable)`

`variable` is a list of input measures in table form.

`SetInputMeasure(measure)`

`measure` is typically the time measure object, but other measures can be used
as well. When using an expression to define a load variation, the measure must
have only one component (it cannot be a vector measure). The variation can be
defined by a constant, an expression, or a table.

`SetConstantValues(value)`

`value` is a Python float constant. See
[Relation](relation.md) object for defining a
constant.

`SetTable(table)`

`table` is a `CS_Table` .

`SetFunc(string, is_degree)`

`string` is similar to the expression used in the user interface to define a
joint condition by a function. Note that the literal variable is always called
`time`, even if you are using another measure as input.

`is_degree` is a boolean argument. If the expression uses trigonometric
function, it specifies that the input variable should be expressed in degrees.
18 changes: 18 additions & 0 deletions 2025R2/rigid-bd-25-r2/basis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Basis

A basis is a material frame moving with a body. Each coordinate system has a
basis, but multiple coordinate systems can share the same basis.

ID table: `CS_Basis`

### Constructors

`CS_Basis()`

`CS_Basis(Angle1, Angle2, Angle3)`

### Members

double [,]`Matrix`

Sets or gets function of the transformation matrix
86 changes: 86 additions & 0 deletions 2025R2/rigid-bd-25-r2/body.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Body

A body corresponds to a Part in the geometry node of the Mechanical tree, or
can be created by a command snippet. The preset `_bid` variable can be used to
find a corresponding body.

ID table: `CS_Body`

Example:

MyBody = CS_Body.Find(_bid)
print MyBody.Name

### Constructors

`CS_Body()`

`CS_Body(Id)`

### Members

`Name`

Name of the body.

`Origin`

Origin Coordinate System of the body. This Coordinate System is the moving
coordinate system of one of the joints connected to the body. The choice of
this joint, called parent joint, is the result of an optimization that
minimizes the number of degrees of freedom of the system.

`InertiaBodyCoordinateSystem`

Inertia body coordinate system of the body.

`BodyType`

Type of body, values in `E_UnknownType`, `E_Ground`, `E_Rigid`, `E_CMS`,
`E_General`, `E_Fictitious`, `E_RigidLeaf`, `E_RigidSubModel`, `E_PointMass`,
`E_Beam`

### Member functions

`SetMassAndInertia(double mass, double Ixx, double Iyy, double Izz, double Ixy, double Iyz, double Ixz)`

Overwrites the mass and inertia values of a body.

`SetCenterOfMassAndOrientationAngles(double Xg, double Yg, double Zg, double
XYAngle, double YZAngle, double XZAngle) and
SetCenterOfMassAndOrientationMatrix(double Xg, double Yg, double Zg, double
mxx, double mxy, double mxz, double myx, double myy, double myz, double mzx,
double mzy, double mzz)`

Overwrites the position of the center of mass and the orientation of the
inertia coordinate system.

`SetVariableMassAndPrincipalInertia(CS_Variable mass, CS_Variable Ixx,
CS_Variable Iyy, CS_Variable Izz)`

Overwrites the constant mass and principal inertia properties by variable
properties. During the solution process, the mass and inertia variation rate
needs to be evaluated. Therefore, only Point Table, Polynomial and Function
can be used to define the variation. Python user tables cannot be used to
define kinetic properties variations. You can make some of the properties
(mass, Ixx, Iyy and Izz) constants by using constant variables.

**Note**
The principal axis needs to be defined when the principal inertia is being
assigned. If the body is created by a command,
`SetCenterOfMassAndOrientationAngles` or `SetCenterOfMassAndOrientationMatrix`
must be called before calling `SetVariableMassAndPrincipalInertia`.

This function only applies to rigid bodies.

**Note**
All quantities used in the solver must use a consistent unit system, which
sometimes differs from the user interface unit system. For example if the user
interface unit system is "mm,kg,N,s", the solver unit system will be
"mm,t,N,s". When using `SetMassAndInertia` or
`SetVariableMassAndPrincipalInertia`, the values of mass and inertia have to
be entered using the solver unit system.

### Derived classes

`CS_FlexibleBody`
61 changes: 61 additions & 0 deletions 2025R2/rigid-bd-25-r2/bodycoordinatesystem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# BodyCoordinateSystem

The body coordinate system is used to connect a body to joints, hold the
center of mass, or define a load. See
[Joint](joint.md) or
[Body](body.md) to access existing coordinate
systems. Coordinate systems can also be created.

ID table: `CS_BodyCoordinateSystem`

### Constructors

CS_BodyCoordinateSystem(body, type, xyz, basis)

### Members

[Basis](basis.md)

### Member functions

`RotateArrayThroughTimeToLocal(MeasureValues)`

Rotates the transient values of a measure to a coordinate system.
`MeasureValues` is a python two-dimensional array, such as that coming out of
`FillValuesThroughTime` or `FillDerivativesThroughTime`. This function works
for 3D vectors such as relative translation between two coordinate systems or
6-D vectors such as forces/moments.

`RotateArrayThroughTimeToGlobal(MeasureValues)`

Rotates the transient values of a measure from a coordinate system to the
global coordinate system.

`Type`

Type of coordinate system, values in `E_Unknown`, `E_Ground`, `E_Part`,
`E_Joint`, `E_Inertia`, `E_BodyTransform`, `E_Contact`, `E_SplitJoint`.

### Derived classes

None

### Example

forceInGlobal=joint.GetForce()

valuesInGlobal=forceInGlobal.FillValuesThroughTime()

for i in range(0,valuesInGlobal.GetLength(0)):
print '{0:e} {1:e} {2:e} {3:e}'.format(valuesInGlobal[i,0],
valuesInGlobal[i,1],valuesInGlobal[i,2],valuesInGlobal[i,3])

mobileCS=joint.MobileCoordinateSystem

valuesInLocal=valuesInGlobal.Clone()

mobileCS.RotateArrayThroughTimeToLocal(valuesInLocal)

for i in range(0,valuesInGlobal.GetLength(0)):
print '{0:e} {1:e} {2:e} {3:e}'.format(valuesInLocal[i,0],
valuesInLocal[i,1],valuesInLocal[i,2],valuesInLocal[i,3])
41 changes: 41 additions & 0 deletions 2025R2/rigid-bd-25-r2/bodyload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# BodyLoad

A body load is a load that is applied to all bodies in the system. Gravity or
global acceleration are body loads.

The body load must implement a `GetAccelerationVector` method. This vector is
applied to the center of mass of each body. In order to maintain the energy
balance of the system, the body load must also implement a `ComputeEnergy`
method.

### Example: Acceleration varying with time

HalfTime = 1.0
HalfAmplitude = 10.0

Env=CS_Environment.GetDefault()
Sys=Env.System
(ret,found,time) = Sys.FindOrCreateInternalMeasure(CS_Measure.E_MeasureType.E_Time)

class MyBodyLoad(CS_UserBodyLoad):
def __init__(self):
CS_UserBodyLoad.__init__(self)
self.value = 0.0

def GetAccelerationVector(self,Mass,xyz,vel,bodyLoadForce):
values = time.Values
print 'MyBodyLoad::GetAccelerationVector'
bodyLoadForce[0] = 0.0
bodyLoadForce[1] = 0.0
bodyLoadForce[2] = Mass*HalfAmplitude*math.sin(values[0]*3.14/(2.*HalfTime))

def ComputeEnergy(self,Mass,xyz,vel):
print 'MBodyLoad::ComputeEnergy'
return 0.0

load=MyBodyLoad()
load.value = 10.0

Env=CS_Environment.GetDefault()

Env.BodyLoads.Add(load)
63 changes: 63 additions & 0 deletions 2025R2/rigid-bd-25-r2/breakable-joint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Breakable joint

This example considers a breakable joint. A breakable joint is a joint that
cannot withstand an internal force higher than a given value. To create a
breakable joint:

1. Get the joint by inserting a command on a planar joint:

```
joint=CS_Joint.Find(_jid)
```

2. Create a joint condition to prescribe zero velocity on the two translational degrees of freedom:

```
driver=CS_Driver(Joint,System.Array[int]([0,1]),CS_Driver.E_MotionType.E_Velocity)
```

3. Define the value of the velocity, then retrieve the time measure:

```
Env=CS_Environment.GetDefault()
Sys=Env.System
(ret,found,time)=Sys.FindOrCreateInternalMeasure(CS_Measure.E_MeasureType.E_Time)
```

4. Define the time as a variable, and use constant values for the two components:

```
driver.SetInputMeasure(time)
driver.SetConstantValues(System.Array[float]([0.,0.]))
```

Next, make the driver only active if the force in the joint is less than a
maximum threshold of 3N. To do that, create a [Condition](condition.md) based on the joint
force measure norm.

5. Retrieve the force on the joint:

```
force=joint.GetForce()
```

6. Create a component measure, that is the norm 2 of the force. To be computed at each time step, this measure has to be added to the system.


```
norm=CS_ComponentMeasure(force,-2)
Sys.AddMeasure(norm)
```

7. Now, create the condition and assign it to the driver:

```
cond=CS_Condition(CS_Condition.E_ConditionType.E_LessThan,norm,3.0)
driver.Condition=cond
```

8. Finally, add the driver to the environment:

```
Env.Drivers.Add(driver)
```
5 changes: 5 additions & 0 deletions 2025R2/rigid-bd-25-r2/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## Version 2025 R2

- No changes in this release.
26 changes: 26 additions & 0 deletions 2025R2/rigid-bd-25-r2/cmsbody.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# CMSBody

A CMSBody represents a condensed part in the Mechanical tree.

### Constructors

None

### Members

`CondensedPartId (read only)`

The ID of the condensed part in the Mechanical tree.

`PartIds (read only)`

The vector of the IDs of the Mechanical parts that are used in the condensed
part.

### Member functions

None

### Derived classes

None
17 changes: 17 additions & 0 deletions 2025R2/rigid-bd-25-r2/command-use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Command use examples

The following command use examples are included in this section:

- [Constraint equation](constraint-equation.md)

- [Joint condition: initial velocity](jc-initial-velocity.md)

- [Joint condition: control using linear feedback](jc-linear-feedback.md)

- [Non-linear spring damper](non-linear-spring.md#)

- [Spherical stop](spherical-stop.md)

- [Export of joint forces](export-joint-forces.md)

- [Breakable joint](breakable-joint.md)
Loading