PlanarMechanics.WorldForceTorque
External force and torque acting at frame_b, defined by input signals.
The force inputs (force_x, force_y) and torque input are resolved in either the world frame or frame_b, controlled by the structural parameter resolve_in_frame.
This component extends from MultibodyComponents.Renderable
Usage
MultibodyComponents.PlanarMechanics.WorldForceTorque(render=true, color=[0, 1, 0, 0.5], specular_coefficient=0.7, scale=0.1, arrow_diameter=0.05, z_position=0)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
resolve_in_frame | – | MultibodyComponents.ResolveInFrame.World() | |
render | – | true | |
color | – | [0, 1, 0, 0.5] | |
specular_coefficient | – | 0.7 | |
scale | Scale factor for force visualization (length = force * scale) | – | 0.1 |
arrow_diameter | Diameter of the force arrow shaft | – | 0.05 |
z_position | z-position of the arrow in animations | – | 0 |
Connectors
frame_b- Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.
All variables are resolved in the planar world frame. (Frame2D)
force_x- This connector represents a real signal as an input to a component (RealInput)force_y- This connector represents a real signal as an input to a component (RealInput)torque- This connector represents a real signal as an input to a component (RealInput)
Variables
| Name | Description | Units |
|---|---|---|
phi | Angle of resolution frame | rad |
Behavior
Dict{MIME{Symbol("text/plain")}, String} with 1 entry: MIME type text/plain => "Error displaying result"
Source
"""
External force and torque acting at frame_b, defined by input signals.
The force inputs (force_x, force_y) and torque input are resolved in either the
world frame or frame_b, controlled by the structural parameter `resolve_in_frame`.
"""
component WorldForceTorque
extends MultibodyComponents.Renderable(color = [0, 1, 0, 0.5])
frame_b = Frame2D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
},
"tags": []
}
}
force_x = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 100, "x2": 50, "y2": 200, "rot": 0}
},
"tags": []
}
}
force_y = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
},
"tags": []
}
}
torque = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 780, "x2": 50, "y2": 880, "rot": 0}
},
"tags": []
}
}
"Force arrow visualization"
force_arrow = MultibodyComponents.ArrowShape(render = render, color = color, head_at_origin = true, diameter = arrow_diameter)
structural parameter resolve_in_frame::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.World()
"Scale factor for force visualization (length = force * scale)"
parameter scale::Real = 0.1
"Diameter of the force arrow shaft"
parameter arrow_diameter::Real = 0.05
"z-position of the arrow in animations"
parameter z_position::Real = 0
"Angle of resolution frame"
variable phi::Angle
relations
if resolve_in_frame == MultibodyComponents.ResolveInFrame.World()
phi = 0
end
if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameB()
phi = frame_b.phi
end
frame_b.fx + cos(phi) * force_x - sin(phi) * force_y = 0
frame_b.fy + sin(phi) * force_x + cos(phi) * force_y = 0
frame_b.tau + torque = 0
# Force arrow: display the applied force vector at frame_b
force_arrow.r = [frame_b.x, frame_b.y, z_position]
force_arrow.R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, phi))
force_arrow.r_shape = [0, 0, 0]
force_arrow.length_direction = [force_x, force_y, 0]
force_arrow.width_direction = [0, 0, 1]
force_arrow.length = sqrt(force_x ^ 2 + force_y ^ 2) * scale
force_arrow.width = arrow_diameter
force_arrow.height = arrow_diameter
metadata {
"Dyad": {"icons": {"default": "dyad://MultibodyComponents/WorldForceTorque.svg"}}
}
endFlattened Source
"""
External force and torque acting at frame_b, defined by input signals.
The force inputs (force_x, force_y) and torque input are resolved in either the
world frame or frame_b, controlled by the structural parameter `resolve_in_frame`.
"""
component WorldForceTorque
parameter render::Boolean = true
parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
parameter specular_coefficient::Real = 0.7
frame_b = Frame2D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
},
"tags": []
}
}
force_x = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 100, "x2": 50, "y2": 200, "rot": 0}
},
"tags": []
}
}
force_y = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
},
"tags": []
}
}
torque = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 780, "x2": 50, "y2": 880, "rot": 0}
},
"tags": []
}
}
"Force arrow visualization"
force_arrow = MultibodyComponents.ArrowShape(render = render, color = color, head_at_origin = true, diameter = arrow_diameter)
structural parameter resolve_in_frame::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.World()
"Scale factor for force visualization (length = force * scale)"
parameter scale::Real = 0.1
"Diameter of the force arrow shaft"
parameter arrow_diameter::Real = 0.05
"z-position of the arrow in animations"
parameter z_position::Real = 0
"Angle of resolution frame"
variable phi::Angle
relations
if resolve_in_frame == MultibodyComponents.ResolveInFrame.World()
phi = 0
end
if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameB()
phi = frame_b.phi
end
frame_b.fx + cos(phi) * force_x - sin(phi) * force_y = 0
frame_b.fy + sin(phi) * force_x + cos(phi) * force_y = 0
frame_b.tau + torque = 0
# Force arrow: display the applied force vector at frame_b
force_arrow.r = [frame_b.x, frame_b.y, z_position]
force_arrow.R = MultibodyComponents.RR(MultibodyComponents.axis_rotation(3, phi))
force_arrow.r_shape = [0, 0, 0]
force_arrow.length_direction = [force_x, force_y, 0]
force_arrow.width_direction = [0, 0, 1]
force_arrow.length = sqrt(force_x ^ 2 + force_y ^ 2) * scale
force_arrow.width = arrow_diameter
force_arrow.height = arrow_diameter
metadata {
"Dyad": {"icons": {"default": "dyad://MultibodyComponents/WorldForceTorque.svg"}}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses
Tests