---
url: /dyad/dev/stdlib/MultibodyComponents/components/WorldForce.md
description: >-
  Dyad WorldForce docs.  External force acting at frame_b, defined by 3 input
  signals.
---

# `WorldForce` {#WorldForce}

External force acting at `frame_b`, defined by 3 input signals.

Resolved in the world frame (default) or `frame_b`. No torque is applied.

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

## Usage {#Usage}

`MultibodyComponents.WorldForce(render=true, color=world_default_force_color(), specular_coefficient=1.5, scale=0.1, radius=world_default_arrow_diameter())`

## Parameters: {#Parameters:}

|                   Name |                    Description | Units |             Default value |
| ----------------------:| ------------------------------:| -----:| -------------------------:|
|     `resolve_in_frame` |                                |     – |    ResolveInFrame.World() |
|               `render` |                                |     – |                      true |
|                `color` |                                |     – | world_defau...rce_color() |
| `specular_coefficient` |                                |     – |                       1.5 |
|                `scale` | Scale factor for visualization |     – |                       0.1 |
|               `radius` |          Radius of force arrow |     – | world_defau...\_diameter() |

## Connectors {#Connectors}

* `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))

* `force_x` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `force_y` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

* `force_z` - This connector represents a real signal as an input to a component ([`RealInput`](/stdlib/Dyad/connectors/RealInput#RealInput))

## Variables {#Variables}

|      Name |                                      Description | Units |
| ---------:| ------------------------------------------------:| -----:|
| `f_world` | Applied force in world frame (for visualization) |     N |

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
External force acting at `frame_b`, defined by 3 input signals.

Resolved in the world frame (default) or `frame_b`.
No torque is applied.
"""
component WorldForce
  extends Renderable(color = world_default_force_color())
  frame_b = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 700, "y1": 450, "x2": 800, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  force_x = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 90, "y1": -50, "x2": 190, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  force_y = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": -50, "x2": 550, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  force_z = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 810, "y1": -50, "x2": 910, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  # Visualization shape
  force_arrow = ArrowShape(render = render, color = color, head_at_origin = false, diameter = 2 * radius, r = frame_b.r_0, length_direction = f_world, length = scale * norm_(f_world), width = 2 * radius, height = 2 * radius)
  structural parameter resolve_in_frame::ResolveInFrame = ResolveInFrame.World()
  "Scale factor for visualization"
  parameter scale::Real = 0.1
  "Radius of force arrow"
  parameter radius::Real = world_default_arrow_diameter()
  "Applied force in world frame (for visualization)"
  variable f_world::Dyad.Force[3]
relations
  frame_b.tau = [0, 0, 0]
  switch resolve_in_frame
    case World
      f_world = [force_x, force_y, force_z]
      frame_b.f = -resolve2(frame_b.R, [force_x, force_y, force_z])
    case FrameB
      f_world = resolve1(frame_b.R, [force_x, force_y, force_z])
      frame_b.f = -[force_x, force_y, force_z]
  end
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/WorldForce.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 150,
        "rot": 0,
        "attrs": {"font-size": "140"}
      }
    ]
  }
}
end
```

```dyad
"""
External force acting at `frame_b`, defined by 3 input signals.

Resolved in the world frame (default) or `frame_b`.
No torque is applied.
"""
component WorldForce
  parameter render::Boolean = true
  parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
  parameter specular_coefficient::Real = 1.5
  frame_b = Frame3D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 700, "y1": 450, "x2": 800, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  force_x = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 90, "y1": -50, "x2": 190, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  force_y = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": -50, "x2": 550, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  force_z = RealInput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 810, "y1": -50, "x2": 910, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  # Visualization shape
  force_arrow = ArrowShape(render = render, color = color, head_at_origin = false, diameter = 2 * radius, r = frame_b.r_0, length_direction = f_world, length = scale * norm_(f_world), width = 2 * radius, height = 2 * radius)
  structural parameter resolve_in_frame::ResolveInFrame = ResolveInFrame.World()
  "Scale factor for visualization"
  parameter scale::Real = 0.1
  "Radius of force arrow"
  parameter radius::Real = world_default_arrow_diameter()
  "Applied force in world frame (for visualization)"
  variable f_world::Dyad.Force[3]
relations
  frame_b.tau = [0, 0, 0]
  switch resolve_in_frame
    case World
      f_world = [force_x, force_y, force_z]
      frame_b.f = -resolve2(frame_b.R, [force_x, force_y, force_z])
    case FrameB
      f_world = resolve1(frame_b.R, [force_x, force_y, force_z])
      frame_b.f = -[force_x, force_y, force_z]
  end
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/WorldForce.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 150,
        "rot": 0,
        "attrs": {"font-size": "140"}
      }
    ]
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
