model AbsolutePosition "Measure absolute position vector of the origin of a frame connector"
extends Internal.PartialAbsoluteSensor;
Blocks.Interfaces.RealOutput r[3](each final quantity = "Length", each final unit = "m") "Absolute position vector resolved in frame defined by resolveInFrame"
annotation (Placement(transformation(
extent = {
{-10, -10},
{10, 10}},
origin = {110, 0})));
Modelica.Mechanics.MultiBody.Interfaces.Frame_resolve frame_resolve if resolveInFrame == Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_resolve "Coordinate system in which output vector r is optionally resolved"
annotation (Placement(transformation(
extent = {
{-16, -16},
{16, 16}},
rotation = -90,
origin = {0, -100})));
parameter Modelica.Mechanics.MultiBody.Types.ResolveInFrameA resolveInFrame = Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_a "Frame in which output vector r shall be resolved (world, frame_a, or frame_resolve)";
protected
Internal.BasicAbsolutePosition position(resolveInFrame = resolveInFrame) annotation (Placement(transformation(extent = {
{-10, -10},
{10, 10}})));
Modelica.Mechanics.MultiBody.Interfaces.ZeroPosition zeroPosition if not resolveInFrame == Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_resolve annotation (Placement(transformation(extent = {
{20, -40},
{40, -20}})));
equation
connect(position.r,r) annotation (Line(
points = {
{11, 0},
{110, 0}},
color = {0, 0, 127}));
connect(position.frame_a,frame_a) annotation (Line(
points = {
{-10, 0},
{-100, 0}},
color = {95, 95, 95},
thickness = 0.5));
connect(position.frame_resolve,frame_resolve) annotation (Line(
points = {
{0, -10},
{0, -100}},
color = {95, 95, 95},
pattern = LinePattern.Dot));
connect(zeroPosition.frame_resolve,position.frame_resolve) annotation (Line(
points = {
{20, -30},
{0, -30},
{0, -10}},
color = {95, 95, 95},
pattern = LinePattern.Dot));
annotation (
Icon(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Line(
points = {
{70, 0},
{100, 0}},
color = {0, 0, 127}),
Text(
extent = {
{-127, 95},
{134, 143}},
textString = "%name",
lineColor = {0, 0, 255}),
Text(
extent = {
{62, 46},
{146, 16}},
textString = "r"),
Text(
extent = {
{15, -67},
{146, -92}},
lineColor = {95, 95, 95},
textString = "resolve"),
Line(
points = {
{0, -96},
{0, -96},
{0, -70},
{0, -70}},
pattern = LinePattern.Dot)}),
Documentation(info = "<html>\n<p>\nThe absolute position vector of the origin of frame_a is\ndetermined and provided at the output signal connector <strong>r</strong>.\n</p>\n\n<p>\nVia parameter <strong>resolveInFrame</strong> it is defined, in which frame\nthe position vector is resolved:\n</p>\n\n<table border=1 cellspacing=0 cellpadding=2>\n<tr><th><strong>resolveInFrame =<br>Types.ResolveInFrameA.</strong></th><th><strong>Meaning</strong></th></tr>\n<tr><td>world</td>\n <td>Resolve vector in world frame</td></tr>\n\n<tr><td>frame_a</td>\n <td>Resolve vector in frame_a</td></tr>\n\n<tr><td>frame_resolve</td>\n <td>Resolve vector in frame_resolve</td></tr>\n</table>\n\n<p>\nIf resolveInFrame = Types.ResolveInFrameA.frame_resolve, the conditional connector\n\"frame_resolve\" is enabled and r is resolved in the frame, to\nwhich frame_resolve is connected. Note, if this connector is enabled, it must\nbe connected.\n</p>\n\n<h4>Example</h4>\n<p>\nIf resolveInFrame = Types.ResolveInFrameA.frame_a, the output vector is\ncomputed as:\n</p>\n\n<blockquote><pre>\nr = MultiBody.Frames.resolve2(frame_a.R, frame_b.r_0);\n</pre></blockquote>\n</html>"));
end AbsolutePosition;