PowerSensor

model PowerSensor "Ideal sensor to measure the power between two flanges (= flange_a.f*der(flange_a.s))"
    extends Translational.Interfaces.PartialRelativeSensor;

    Modelica.Blocks.Interfaces.RealOutput power(unit = "W") "Power in flange flange_a as output signal"
        annotation (Placement(transformation(
            origin = {-80, -110},
            extent = {
                {10, -10}, 
                {-10, 10}},
            rotation = 90)));
equation
    power = flange_a.f * der(flange_a.s);
    flange_a.s = flange_b.s;

    annotation (
        Documentation(info = "<html>\n<p>\nMeasures the <strong>power between two flanges</strong> in an ideal way\nand provides the result as output signal <strong>power</strong>\n(to be further processed with blocks of the Modelica.Blocks library).\n</p>\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Text(
                    extent = {
                        {-75, -79}, 
                        {67, -119}},
                    textString = "power"), 
                Line(
                    points = {
                        {-80, -100}, 
                        {-80, 0}},
                    color = {0, 0, 127})}));
end PowerSensor;