RelPositionSensor

model RelPositionSensor "Ideal sensor to measure the relative position"
    extends Translational.Interfaces.PartialRelativeSensor;

    Modelica.Blocks.Interfaces.RealOutput s_rel(unit = "m") "Distance between two flanges (= flange_b.s - flange_a.s) as output signal"
        annotation (Placement(transformation(
            extent = {
                {-10, -10}, 
                {10, 10}},
            rotation = 270,
            origin = {0, -110})));
equation
    0 = flange_a.f;
    s_rel = flange_b.s - flange_a.s;

    annotation (
        Documentation(info = "<html>\n<p>\nMeasures the <em>relative position s</em> of a flange in an ideal way and provides the result as\noutput signals (to be further processed with blocks of the\nModelica.Blocks library).\n</p>\n\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Text(
                    extent = {
                        {8, -68}, 
                        {42, -102}},
                    textString = "s"), 
                Line(
                    points = {
                        {0, -99}, 
                        {0, -60}},
                    color = {0, 0, 127})}));
end RelPositionSensor;