ConstantMagneticPotentialDifference

model ConstantMagneticPotentialDifference "Constant magnetomotive force"
    extends FluxTubes.Interfaces.Source;

    parameter Modelica.SIunits.Frequency f(start = 1) "Frequency of the source";
    parameter Modelica.SIunits.ComplexMagneticPotentialDifference V_m "Magnetic potential difference";
    Modelica.SIunits.ComplexMagneticFlux Phi(re(start = 0), im(start = 0)) "Magnetic flux from port_p to port_n";
equation
    Phi = port_p.Phi;
    V_m = port_p.V_m - port_n.V_m;
    omega = 2 * Modelica.Constants.pi * f;
    Complex(0) = port_p.Phi + port_n.Phi;

    annotation (
        defaultComponentName = "magVoltageSource",
        Icon(
            coordinateSystem(
                preserveAspectRatio = false,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {90, 0}, 
                        {50, 0}},
                    color = {255, 170, 85}), 
                Line(
                    points = {
                        {-50, 0}, 
                        {-90, 0}},
                    color = {255, 170, 85}), 
                Line(
                    points = {
                        {-50, 0}, 
                        {50, 0}},
                    color = {255, 170, 85}), 
                Line(
                    points = {
                        {-80, 20}, 
                        {-60, 20}},
                    color = {255, 170, 85}), 
                Line(
                    points = {
                        {-70, 30}, 
                        {-70, 10}},
                    color = {255, 170, 85}), 
                Line(
                    points = {
                        {60, 20}, 
                        {80, 20}},
                    color = {255, 170, 85})}),
        Documentation(info = "<html>\n<p>\nThis source provides a constant quasi static magnetic potential difference <code>V_m</code> (or magnetomotive force, mmf),\nat fixed frequency, <code>f</code>.\n</p>\n</html>"));
end ConstantMagneticPotentialDifference;