---
url: /dyad/dev/stdlib/MultibodyComponents/examples/tests.JointUSRTest.md
description: >-
  Dyad tests.JointUSRTest docs.  Ported from the Multibody.jl test suite
  (TestUSR). A JointUSR joint assembly closes a kinematic loop together with a
  prismatic joint: the wo...
---

# `tests.JointUSRTest` {#tests.JointUSRTest}

# JointUSR test {#JointUSR-test}

Ported from the Multibody.jl test suite (`TestUSR`). A `JointUSR` joint assembly closes a kinematic loop together with a prismatic joint: the world, the universal-joint side of `j1`, and a fixed translation share a node; the fixed translation drives a prismatic joint whose `frame_b` connects to the revolute side of `j1`. A body hangs from the middle frame `frame_im`.

The loop is solved analytically by `JointUSR`, so the only state is the prismatic coordinate. At t = 1 s the prismatic displacement should be about -2.8 (validated against OpenModelica in Multibody.jl).

## Usage {#Usage}

`MultibodyComponents.tests.JointUSRTest()`

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
# JointUSR test

Ported from the Multibody.jl test suite (`TestUSR`). A `JointUSR` joint
assembly closes a kinematic loop together with a prismatic joint: the world,
the universal-joint side of `j1`, and a fixed translation share a node; the
fixed translation drives a prismatic joint whose `frame_b` connects to the
revolute side of `j1`. A body hangs from the middle frame `frame_im`.

The loop is solved analytically by `JointUSR`, so the only state is the
prismatic coordinate. At t = 1 s the prismatic displacement should be about
-2.8 (validated against OpenModelica in Multibody.jl).
"""
example component JointUSRTest
  world = MultibodyComponents.World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 120, "x2": 120, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
  j1 = MultibodyComponents.JointUSR(positive_branch = true) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 120, "x2": 500, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
  fixed = MultibodyComponents.FixedTranslation(r = [1, 0, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 145, "y1": 226, "x2": 245, "y2": 326, "rot": 0}
      },
      "tags": []
    }
  }
  b1 = MultibodyComponents.Body(m = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 525, "y1": 20, "x2": 625, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  p1 = MultibodyComponents.Prismatic(n = [1, 0, 0], statePriority = 100, s(initial = 0), v(initial = 0)) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 270, "y1": 226, "x2": 370, "y2": 326, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(world.frame_b, j1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(world.frame_b, fixed.frame_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [{"x": 135, "y": 276}], "E": 2}],
      "junctions": [{"x": 135, "y": 170}],
      "renderStyle": "standard"
    }
  }
  connect(fixed.frame_b, p1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(p1.frame_b, j1.frame_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 515, "y": 276}, {"x": 515, "y": 170}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(j1.frame_im, b1.frame_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 450, "y": 170}, {"x": 450, "y": 70}], "E": 2}],
      "renderStyle": "standard"
    }
  }
end
```

```dyad
"""
# JointUSR test

Ported from the Multibody.jl test suite (`TestUSR`). A `JointUSR` joint
assembly closes a kinematic loop together with a prismatic joint: the world,
the universal-joint side of `j1`, and a fixed translation share a node; the
fixed translation drives a prismatic joint whose `frame_b` connects to the
revolute side of `j1`. A body hangs from the middle frame `frame_im`.

The loop is solved analytically by `JointUSR`, so the only state is the
prismatic coordinate. At t = 1 s the prismatic displacement should be about
-2.8 (validated against OpenModelica in Multibody.jl).
"""
example component JointUSRTest
  world = MultibodyComponents.World() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 20, "y1": 120, "x2": 120, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
  j1 = MultibodyComponents.JointUSR(positive_branch = true) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 400, "y1": 120, "x2": 500, "y2": 220, "rot": 0}
      },
      "tags": []
    }
  }
  fixed = MultibodyComponents.FixedTranslation(r = [1, 0, 0]) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 145, "y1": 226, "x2": 245, "y2": 326, "rot": 0}
      },
      "tags": []
    }
  }
  b1 = MultibodyComponents.Body(m = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 525, "y1": 20, "x2": 625, "y2": 120, "rot": 0}
      },
      "tags": []
    }
  }
  p1 = MultibodyComponents.Prismatic(n = [1, 0, 0], statePriority = 100, s(initial = 0), v(initial = 0)) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 270, "y1": 226, "x2": 370, "y2": 326, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(world.frame_b, j1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(world.frame_b, fixed.frame_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [], "E": -1}, {"S": -1, "M": [{"x": 135, "y": 276}], "E": 2}],
      "junctions": [{"x": 135, "y": 170}],
      "renderStyle": "standard"
    }
  }
  connect(fixed.frame_b, p1.frame_a) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(p1.frame_b, j1.frame_b) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 515, "y": 276}, {"x": 515, "y": 170}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(j1.frame_im, b1.frame_a) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 450, "y": 170}, {"x": 450, "y": 70}], "E": 2}],
      "renderStyle": "standard"
    }
  }
metadata {}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
