ConstantMagneticPotentialDifference

model ConstantMagneticPotentialDifference "Source with constant magnetic potential difference"
    extends Modelica.Magnetic.FundamentalWave.Interfaces.PartialTwoPort;

    parameter Modelica.SIunits.ComplexMagneticPotentialDifference V_m = Complex(re = 1, im = 0) "Complex magnetic potential difference";
    Modelica.SIunits.MagneticPotentialDifference abs_V_m = Modelica.ComplexMath.'abs'(V_m) "Magnitude of complex magnetic potential difference";
    Modelica.SIunits.Angle arg_V_m = Modelica.ComplexMath.arg(V_m) "Argument of complex magnetic potential difference";
    Modelica.SIunits.ComplexMagneticFlux Phi "Complex magnetic flux";
    Modelica.SIunits.MagneticPotentialDifference abs_Phi = Modelica.ComplexMath.'abs'(Phi) "Magnitude of complex magnetic flux";
    Modelica.SIunits.Angle arg_Phi = Modelica.ComplexMath.arg(Phi) "Argument of complex magnetic flux";
equation
    port_p.Phi + port_n.Phi = Complex(0, 0);
    port_p.Phi = Phi;
    port_p.V_m - port_n.V_m = V_m;

    annotation (
        defaultComponentName = "magVoltageSource",
        Icon(
            coordinateSystem(
                preserveAspectRatio = false,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Ellipse(
                    extent = {
                        {-50, -50}, 
                        {50, 50}},
                    lineColor = {255, 128, 0},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {100, 0}, 
                        {50, 0}},
                    color = {255, 128, 0}), 
                Line(
                    points = {
                        {-50, 0}, 
                        {-100, 0}},
                    color = {255, 128, 0}), 
                Line(
                    points = {
                        {-50, 0}, 
                        {50, 0}},
                    color = {255, 128, 0}), 
                Text(
                    extent = {
                        {-150, 70}, 
                        {150, 110}},
                    lineColor = {0, 0, 255},
                    textString = "%name"), 
                Line(
                    points = {
                        {-80, 20}, 
                        {-60, 20}},
                    color = {255, 128, 0}), 
                Line(
                    points = {
                        {-70, 30}, 
                        {-70, 10}},
                    color = {255, 128, 0}), 
                Line(
                    points = {
                        {60, 20}, 
                        {80, 20}},
                    color = {255, 128, 0})}),
        Documentation(info = "<html>\n<p>\nSource of constant magnetomotive force.\n</p>\n\n<h4>See also</h4>\n<p>\n<a href=\"modelica://Modelica.Magnetic.FundamentalWave.Sources.SignalMagneticPotentialDifference\">SignalMagneticPotentialDifference</a>,\n<a href=\"modelica://Modelica.Magnetic.FundamentalWave.Sources.ConstantFlux\">ConstantFlux</a>,\n<a href=\"modelica://Modelica.Magnetic.FundamentalWave.Sources.SignalFlux\">SignalFlux</a>\n</p>\n</html>"));
end ConstantMagneticPotentialDifference;