MultiSensor

model MultiSensor "Ideal sensor to measure the torque and power between two flanges (= flange_a.tau*der(flange_a.phi)) and the absolute angular velocity"
    extends Modelica.Mechanics.Rotational.Interfaces.PartialRelativeSensor;

    Modelica.Blocks.Interfaces.RealOutput power(unit = "W") "Power in flange flange_a as output signal"
        annotation (Placement(transformation(
            origin = {-60, -110},
            extent = {
                {10, -10}, 
                {-10, 10}},
            rotation = 90)));
    Modelica.Blocks.Interfaces.RealOutput w(unit = "rad/s") "Absolute angular velocity of flange_a as output signal"
        annotation (Placement(transformation(
            extent = {
                {-10, 10}, 
                {10, -10}},
            rotation = 270,
            origin = {60, -110})));
    Modelica.Blocks.Interfaces.RealOutput tau(unit = "N.m") "Torque in flange flange_a and flange_b (tau = flange_a.tau = -flange_b.tau) as output signal"
        annotation (Placement(transformation(
            origin = {0, -110},
            extent = {
                {10, -10}, 
                {-10, 10}},
            rotation = 90)));
equation
    w = der(flange_a.phi);
    power = tau * w;
    tau = flange_a.tau;
    flange_a.phi = flange_b.phi;

    annotation (
        Documentation(info = "<html>\n<p>Measures the <strong>absolute angular velocity</strong> of a flange_a, the <strong>cut-torque</strong> and <strong>power</strong> between two flanges in an ideal way and provides the results as output signals <strong>w</strong>, <strong>tau</strong> and <strong>power</strong>, respectively.\n</p>\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Text(
                    extent = {
                        {60, -68}, 
                        {100, -96}},
                    textString = "w"), 
                Text(
                    extent = {
                        {-140, -68}, 
                        {-60, -96}},
                    textString = "power"), 
                Text(
                    extent = {
                        {-30, -68}, 
                        {30, -96}},
                    textString = "tau"), 
                Line(points = {
                    {-60, -100}, 
                    {-60, -60}, 
                    {-94, -2}}), 
                Line(
                    points = {
                        {0, -100}, 
                        {0, -70}},
                    color = {0, 0, 127}), 
                Line(
                    points = {
                        {60, -100}, 
                        {60, -60}, 
                        {50, -50}},
                    color = {0, 0, 127})}));
end MultiSensor;