SignalMagneticFlux

model SignalMagneticFlux "Signal-controlled magnetic flux source"
    extends FluxTubes.Interfaces.Source;

    Modelica.Blocks.Interfaces.RealInput f annotation (Placement(transformation(
        origin = {60, 120},
        extent = {
            {-20, -20}, 
            {20, 20}},
        rotation = 270)));
    Modelica.SIunits.ComplexMagneticPotentialDifference V_m "Magnetic potential difference between both ports";
    Modelica.ComplexBlocks.Interfaces.ComplexInput Phi annotation (Placement(transformation(
        origin = {-60, 120},
        extent = {
            {-20, -20}, 
            {20, 20}},
        rotation = 270)));
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 = "magFluxSource",
        Icon(
            coordinateSystem(
                preserveAspectRatio = false,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Polygon(
                    points = {
                        {80, 0}, 
                        {60, 6}, 
                        {60, -6}, 
                        {80, 0}},
                    lineColor = {255, 170, 85},
                    fillColor = {255, 170, 85},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-90, 0}, 
                        {-50, 0}},
                    color = {255, 170, 85}), 
                Line(
                    points = {
                        {50, 0}, 
                        {90, 0}},
                    color = {255, 170, 85}), 
                Ellipse(
                    extent = {
                        {-50, -50}, 
                        {50, 50}},
                    lineColor = {255, 170, 85},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {0, 50}, 
                        {0, -50}},
                    color = {255, 170, 85})}),
        Documentation(info = "<html>\n<p>\nThis source provides a quasi static magnetic flux with inputs for:\n</p>\n<ul>\n<li>Complex magnetic flux, <code>Phi</code></li>\n<li>Frequency <code>f</code></li>\n</ul>\n</html>"));
end SignalMagneticFlux;