modelRelativeSensor

Measure relative kinematic quantities between two frame connectors

Extends from Modelica.Mechanics.MultiBody.Sensors.Internal.PartialRelativeSensor (Base class for relative sensor models).

Information

Relative kinematic quantities between frame_a and frame_b are determined and provided at the conditional output signal connectors. For example, if parameter "get_r_rel = true", the connector "r_rel" is enabled and contains the relative vector from frame_a to frame_b. The following quantities can be provided as output signals:

  1. Relative position vector (= r_rel)
  2. Relative velocity vector (= v_rel)
  3. Relative acceleration vector (= a_rel)
  4. Three angles to rotate frame_a into frame_b (= angles)
  5. Relative angular velocity vector (= w_rel)
  6. Relative angular acceleration vector (= z_rel)

Via parameter resolveInFrame it is defined, in which frame a vector is resolved (before differentiation):

resolveInFrame =
Types.ResolveInFrameAB.
Meaning
world Resolve vectors in world frame
frame_a Resolve vectors in frame_a
frame_b Resolve vectors in frame_b
frame_resolve Resolve vectors in frame_resolve

If resolveInFrame = Types.ResolveInFrameAB.frame_resolve, the conditional connector "frame_resolve" is enabled and the vectors are resolved in the frame, to which frame_resolve is connected. Note, if this connector is enabled, it must be connected.

In the following figure the animation of a RelativeSensor component is shown. The light blue coordinate system is frame_a, the dark blue coordinate system is frame_b, and the yellow arrow is the animated sensor.

Note, derivatives of relative kinematic quantities are always performed with respect to the frame, in which the vector to be differentiated is resolved. After differentiation, it is possible via parameter resolveInFrameAfterDifferentiation (in the "Advanced" menu) to resolve the differentiated vector in another frame.

For example, if resolveInFrame = Types.ResolveInFrameAB.frame_b, then

r_rel = resolve2(frame_b.R, frame_b.r_0 - frame_a.r0);
v_rel = der(r_rel);

is returned (r_rel = resolve2(frame_b.R, frame_b.r_0 - frame_a.r0)), i.e., the derivative of the relative distance from frame_a to frame_b, resolved in frame_b. If resolveInFrameAfterDifferentiation = Types.ResolveInFrameAB.world, then v_rel is additionally transformed to:

v_rel = resolve1(frame_b.R, der(r_rel))

The cut-force and the cut-torque in frame_resolve are always zero, whether frame_resolve is connected or not.

If get_angles = true, the 3 angles to rotate frame_a into frame_b along the axes defined by parameter sequence are returned. For example, if sequence = {3,1,2} then frame_a is rotated around angles[1] along the z-axis, afterwards it is rotated around angles[2] along the x-axis, and finally it is rotated around angles[3] along the y-axis and is then identical to frame_b. The 3 angles are returned in the range

-π <= angles[i] <= π

There are two solutions for "angles[1]" in this range. Via parameter guessAngle1 (default = 0) the returned solution is selected such that |angles[1] - guessAngle1| is minimal. The relative transformation matrix between frame_a and frame_b may be in a singular configuration with respect to "sequence", i.e., there is an infinite number of angle values leading to the same relative transformation matrix. In this case, the returned solution is selected by setting angles[1] = guessAngle1. Then angles[2] and angles[3] can be uniquely determined in the above range.

The parameter sequence has the restriction that only values 1,2,3 can be used and that sequence[1] ≠ sequence[2] and sequence[2] ≠ sequence[3]. Often used values are:

sequence = {1,2,3}  // Cardan or Tait-Bryan angle sequence
         = {3,1,3}  // Euler angle sequence
         = {3,2,1}

Parameters

TypeNameDefaultDescription
Booleananimationtrue= true, if animation shall be enabled (show arrow)
Modelica.Mechanics.MultiBody.Types.ResolveInFrameABresolveInFrameModelica.Mechanics.MultiBody.Types.ResolveInFrameAB.frame_aFrame in which vectors are resolved before differentiation (world, frame_a, frame_b, or frame_resolve)
Booleanget_r_relfalse= true, to measure the relative position vector from the origin of frame_a to frame_b
Booleanget_v_relfalse= true, to measure the relative velocity of the origin of frame_b with respect to frame_a
Booleanget_a_relfalse= true, to measure the relative acceleration of the origin of frame_b with respect to frame_a
Booleanget_w_relfalse= true, to measure the relative angular velocity of frame_b with respect to frame_a
Booleanget_z_relfalse= true, to measure the relative angular acceleration of frame_b with respect to frame_a
3 angles to rotate frame_a into frame_b along the axes defined in "sequence"
Booleanget_anglesfalse= true, to measure the 3 rotation angles
Types.RotationSequencesequence{1, 2, 3}If get_angles=true: Angles are returned to rotate frame_a around axes sequence[1], sequence[2] and finally sequence[3] into frame_b
SI.AngleguessAngle10If get_angles=true: Select angles[1] such that abs(angles[1] - guessAngle1) is a minimum
Advanced › if get_v_rel or get_a_rel or get_z_rel
Modelica.Mechanics.MultiBody.Types.ResolveInFrameABresolveInFrameAfterDifferentiationresolveInFrameFrame in which vectors are resolved after differentiation (world, frame_a, frame_b, or frame_resolve)

Connectors

TypeNameDefaultDescription
Modelica.Mechanics.MultiBody.Interfaces.Frame_aframe_a (from PartialRelativeSensor)Coordinate system a
Modelica.Mechanics.MultiBody.Interfaces.Frame_bframe_b (from PartialRelativeSensor)Coordinate system b
Interfaces.Frame_resolveframe_resolveIf resolveInFrame = Types.ResolveInFrameAB.frame_resolve, the output signals are resolved in this frame
Blocks.Interfaces.RealOutput[3]r_relRelative position vector frame_b.r_0 - frame_a.r_0 resolved in frame defined by resolveInFrame
Blocks.Interfaces.RealOutput[3]v_relRelative velocity vector
Blocks.Interfaces.RealOutput[3]a_relRelative acceleration vector
Blocks.Interfaces.RealOutput[3]anglesAngles to rotate frame_a into frame_b via 'sequence'
Blocks.Interfaces.RealOutput[3]w_relRelative angular velocity vector
Blocks.Interfaces.RealOutput[3]z_relRelative angular acceleration vector

Components

TypeNameDefaultDescription
Types.ColorarrowColorModelica.Mechanics.MultiBody.Types.Defaults.SensorColorColor of relative arrow from frame_a to frame_b
Types.SpecularCoefficientspecularCoefficientworld.defaultSpecularCoefficientReflection of ambient light (= 0: light is completely absorbed)