---
url: /dyad/dev/stdlib/MultibodyComponents/components/LineForceBase.md
description: Dyad LineForceBase docs.  Base model for line force components.
---

# `LineForceBase` {#LineForceBase}

Base model for line force components.

Computes the relative position vector, distance, and unit direction between `frame_a` and `frame_b`.

When `fixed_rotation_at_frame_a` / `fixed_rotation_at_frame_b` is true, the corresponding frame's orientation is fixed to the identity rotation. Otherwise, no torque is transmitted (`tau = 0`).

This component extends from [`PartialTwoFrames`](../types/PartialTwoFrames.md)

## Usage {#Usage}

`MultibodyComponents.LineForceBase(s_small=1e-10)`

## Parameters: {#Parameters:}

|                        Name | Description | Units | Default value |
| ---------------------------:| -----------:| -----:| -------------:|
| `fixed_rotation_at_frame_a` |             |     – |         false |
| `fixed_rotation_at_frame_b` |             |     – |         false |
|                   `s_small` |             |     – |         1e-10 |

## Connectors {#Connectors}

* `frame_a` - Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or several `Frame`

connectors that can be connected together ([`Frame3D`](/stdlib/Dyad/connectors/Frame3D#Frame3D))

* `frame_b` - Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or several `Frame`

connectors that can be connected together ([`Frame3D`](/stdlib/Dyad/connectors/Frame3D#Frame3D))

## Variables {#Variables}

|      Name |                                                                                 Description | Units |
| ---------:| -------------------------------------------------------------------------------------------:| -----:|
|  `length` |                            Distance between the origin of frame_a and the origin of frame_b |     m |
|       `s` | (Guarded) distance between the origin of frame_a and the origin of frame_b (>= s_small)) |     m |
| `r_rel_0` |                             Position vector from frame_a to frame_b resolved in world frame |     m |
| `e_rel_0` |                   Unit vector in direction from frame_a to frame_b, resolved in world frame |     – |

## Behavior {#Behavior}

$$ \begin{align}
\mathtt{r_rel_0}\_{1}\left( t \right) &=  - \mathtt{frame_a.r_0}\_{1}\left( t \right) + \mathtt{frame_b.r_0}\_{1}\left( t \right) \\
\mathtt{r_rel_0}\_{2}\left( t \right) &=  - \mathtt{frame_a.r_0}\_{2}\left( t \right) + \mathtt{frame_b.r_0}\_{2}\left( t \right) \\
\mathtt{r_rel_0}\_{3}\left( t \right) &=  - \mathtt{frame_a.r_0}\_{3}\left( t \right) + \mathtt{frame_b.r_0}\_{3}\left( t \right) \\
\mathtt{length}\left( t \right) &= \sqrt{\left|\mathtt{r_rel_0}\_{1}\left( t \right)\right|^{2} + \left|\mathtt{r_rel_0}\_{2}\left( t \right)\right|^{2} + \left|\mathtt{r_rel_0}\_{3}\left( t \right)\right|^{2}} \\
s\left( t \right) &= max\left( \mathtt{length}\left( t \right), \mathtt{s_small} \right) \\
\mathtt{e_rel_0}\_{1}\left( t \right) &= \frac{\mathtt{r_rel_0}\_{1}\left( t \right)}{s\left( t \right)} \\
\mathtt{e_rel_0}\_{2}\left( t \right) &= \frac{\mathtt{r_rel_0}\_{2}\left( t \right)}{s\left( t \right)} \\
\mathtt{e_rel_0}\_{3}\left( t \right) &= \frac{\mathtt{r_rel_0}\_{3}\left( t \right)}{s\left( t \right)} \\
\mathtt{frame_a.tau}\_{1}\left( t \right) &= 0 \\
\mathtt{frame_a.tau}\_{2}\left( t \right) &= 0 \\
\mathtt{frame_a.tau}\_{3}\left( t \right) &= 0 \\
\mathtt{frame_b.tau}\_{1}\left( t \right) &= 0 \\
\mathtt{frame_b.tau}\_{2}\left( t \right) &= 0 \\
\mathtt{frame_b.tau}\_{3}\left( t \right) &= 0
\end{align}
$$

## Source {#Source}

```dyad
"""
Base model for line force components.

Computes the relative position vector, distance, and unit direction
between `frame_a` and `frame_b`.

When `fixed_rotation_at_frame_a` / `fixed_rotation_at_frame_b` is true,
the corresponding frame's orientation is fixed to the identity rotation.
Otherwise, no torque is transmitted (`tau = 0`).
"""
component LineForceBase
  extends PartialTwoFrames
  structural parameter fixed_rotation_at_frame_a::Boolean = false
  structural parameter fixed_rotation_at_frame_b::Boolean = false
  parameter s_small::Real = 1e-10
  "Distance between the origin of frame_a and the origin of frame_b"
  variable length::Length
  "(Guarded) distance between the origin of frame_a and the origin of frame_b (>= s_small))"
  variable s::Length
  "Position vector from frame_a to frame_b resolved in world frame"
  variable r_rel_0::Position[3]
  "Unit vector in direction from frame_a to frame_b, resolved in world frame"
  variable e_rel_0::Real[3]
relations
  # Relative position and distance
  r_rel_0 = frame_b.r_0 - frame_a.r_0
  length = norm_(r_rel_0)
  assert(length > s_small, "The distance between the origin of frame_a and the origin of frame_b of a line force component became smaller than parameter s_small.")
  s = max(length, s_small)
  e_rel_0 = r_rel_0 / s
  # frame_a: fix rotation to identity or set tau = 0
  if fixed_rotation_at_frame_a
    frame_a.R = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
  else
    frame_a.tau = [0, 0, 0]
  end
  # frame_b: fix rotation to identity or set tau = 0
  if fixed_rotation_at_frame_b
    frame_b.R = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
  else
    frame_b.tau = [0, 0, 0]
  end
end
```

```dyad
"""
Base model for line force components.

Computes the relative position vector, distance, and unit direction
between `frame_a` and `frame_b`.

When `fixed_rotation_at_frame_a` / `fixed_rotation_at_frame_b` is true,
the corresponding frame's orientation is fixed to the identity rotation.
Otherwise, no torque is transmitted (`tau = 0`).
"""
component LineForceBase
  frame_a = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  frame_b = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  structural parameter fixed_rotation_at_frame_a::Boolean = false
  structural parameter fixed_rotation_at_frame_b::Boolean = false
  parameter s_small::Real = 1e-10
  "Distance between the origin of frame_a and the origin of frame_b"
  variable length::Length
  "(Guarded) distance between the origin of frame_a and the origin of frame_b (>= s_small))"
  variable s::Length
  "Position vector from frame_a to frame_b resolved in world frame"
  variable r_rel_0::Position[3]
  "Unit vector in direction from frame_a to frame_b, resolved in world frame"
  variable e_rel_0::Real[3]
relations
  # Relative position and distance
  r_rel_0 = frame_b.r_0 - frame_a.r_0
  length = norm_(r_rel_0)
  assert(length > s_small, "The distance between the origin of frame_a and the origin of frame_b of a line force component became smaller than parameter s_small.")
  s = max(length, s_small)
  e_rel_0 = r_rel_0 / s
  # frame_a: fix rotation to identity or set tau = 0
  if fixed_rotation_at_frame_a
    frame_a.R = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
  else
    frame_a.tau = [0, 0, 0]
  end
  # frame_b: fix rotation to identity or set tau = 0
  if fixed_rotation_at_frame_b
    frame_b.R = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
  else
    frame_b.tau = [0, 0, 0]
  end
metadata {}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
