modelDistance
Extends from Interfaces.PartialTwoFrames (Base model for components providing two frame connectors + outer world + assert to guarantee that the component is connected), Modelica.Icons.RectangularSensor (Icon representing a linear measurement device).
Information
The distance between the origins of frame_a and of frame_b are determined and provided at the output signal connector distance. This distance is always positive. Derivatives of this signal can be easily obtained by connecting the block Modelica.Blocks.Continuous.Der to "distance" (this block performs analytic differentiation of the input signal using the der(…) operator).
In the following figure the animation of a Distance sensor 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.
If the distance is smaller as parameter s_small (in the "advanced" menu), it is approximated such that its derivative is finite for zero distance. Without such an approximation, the derivative would be infinite and a division by zero would occur. The approximation is performed in the following way: If distance > s_small, it is computed as sqrt(r*r) where r is the position vector from the origin of frame_a to the origin of frame_b. If the distance becomes smaller as s_small, the "sqrt()" function is approximated by a second order polynomial, such that the function value and its first derivative are identical for sqrt() and the polynomial at s_small. Furthermore, the polynomial passes through zero. The effect is, that the distance function is continuous and differentiable everywhere. The derivative at zero distance is 3/(2*s_small).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | animation | true | = true, if animation shall be enabled (show arrow) |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| Interfaces.Frame_a | frame_a (from PartialTwoFrames) | Coordinate system a fixed to the component with one cut-force and cut-torque | |
| Interfaces.Frame_b | frame_b (from PartialTwoFrames) | Coordinate system b fixed to the component with one cut-force and cut-torque | |
| Modelica.Blocks.Interfaces.RealOutput | distance | Distance between the origin of frame_a and the origin of frame_b |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Types.Color | arrowColor | Modelica.Mechanics.MultiBody.Types.Defaults.SensorColor | Color of relative arrow from frame_a to frame_b |
| Types.SpecularCoefficient | specularCoefficient | world.defaultSpecularCoefficient | Reflection of ambient light (= 0: light is completely absorbed) |
| SI.Position | s_small | 1e-10 | Prevent zero-division if distance between frame_a and frame_b is zero |