MagneticPotentialDifferenceSensor

model MagneticPotentialDifferenceSensor "Sensor to measure magnetic potential difference"
    extends Modelica.Icons.RotationalSensor;
    extends Modelica.Magnetic.FundamentalWave.Interfaces.PartialTwoPort;

    Modelica.ComplexBlocks.Interfaces.ComplexOutput V_m "Complex magnetic potential difference between port_p and port_n as output signal"
        annotation (Placement(transformation(
            origin = {0, -100},
            extent = {
                {10, -10}, 
                {-10, 10}},
            rotation = 90)));
    Modelica.SIunits.ComplexMagneticFlux Phi "Complex magnetic flux";
equation
    port_p.Phi + port_n.Phi = Complex(0, 0);
    Phi = Complex(0, 0);
    port_p.Phi = Phi;
    port_p.V_m - port_n.V_m = V_m;

    annotation (
        defaultComponentName = "magVoltageSensor",
        Icon(
            coordinateSystem(
                preserveAspectRatio = false,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Text(
                    extent = {
                        {-52, 1}, 
                        {48, -57}},
                    textString = "V_m"), 
                Line(points = {
                    {-70, 0}, 
                    {-90, 0}}), 
                Line(points = {
                    {70, 0}, 
                    {90, 0}}), 
                Line(points = {
                    {0, -90}, 
                    {0, -70}}), 
                Text(
                    extent = {
                        {-140, 120}, 
                        {140, 80}},
                    textString = "%name",
                    lineColor = {0, 0, 255})}),
        Documentation(info = "<html>\n<p>Sensor for magnetic potential difference.</p>\n\n<h4>See also</h4>\n<p>\n<a href=\"modelica://Modelica.Magnetic.FundamentalWave.Sensors.MagneticFluxSensor\">MagneticFluxSensor</a>\n</p></html>"));
end MagneticPotentialDifferenceSensor;