CurrentSource

model CurrentSource "Constant AC current"
    extends Interfaces.Source;

    parameter Modelica.SIunits.Frequency f(start = 1) "Frequency of the source";
    parameter Modelica.SIunits.Current I(start = 1) "RMS current of the source";
    parameter Modelica.SIunits.Angle phi(start = 0) "Phase shift of the source";
equation
    i = Complex(I * cos(phi), I * sin(phi));
    omega = 2 * Modelica.Constants.pi * f;

    annotation (
        Icon(graphics = {
            Polygon(
                points = {
                    {90, 0}, 
                    {60, 10}, 
                    {60, -10}, 
                    {90, 0}},
                lineColor = {85, 170, 255},
                fillColor = {85, 170, 255},
                fillPattern = FillPattern.Solid), 
            Line(
                points = {
                    {0, 50}, 
                    {0, -50}},
                color = {85, 170, 255})}),
        Documentation(info = "<html>\n\n<p>\nThis is a constant current source, specifying the complex current by the RMS current and the phase shift.\n</p>\n\n<h4>See also</h4>\n\n<p>\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Sources.VoltageSource\">VoltageSource</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Sources.VariableVoltageSource\">VariableVoltageSource</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Sources.VariableCurrentSource\">VariableCurrentSource</a>\n</p>\n</html>"));
end CurrentSource;