SignalCurrent

model SignalCurrent "Generic current source using the input signal as source current"
    Interfaces.PositivePin p annotation (Placement(transformation(extent = {
        {-110, -10}, 
        {-90, 10}})));
    Interfaces.NegativePin n annotation (Placement(transformation(extent = {
        {110, -10}, 
        {90, 10}})));
    SI.Voltage v "Voltage drop between the two pins (= p.v - n.v)";
    Modelica.Blocks.Interfaces.RealInput i(unit = "A") "Current flowing from pin p to pin n as input signal"
        annotation (Placement(transformation(
            origin = {0, 120},
            extent = {
                {-20, -20}, 
                {20, 20}},
            rotation = 270)));
equation
    0 = p.i + n.i;
    i = p.i;
    v = p.v - n.v;

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Ellipse(
                    extent = {
                        {-50, 50}, 
                        {50, -50}},
                    lineColor = {0, 0, 255},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-90, 0}, 
                        {-50, 0}},
                    color = {0, 0, 255}), 
                Line(
                    points = {
                        {50, 0}, 
                        {90, 0}},
                    color = {0, 0, 255}), 
                Line(
                    points = {
                        {0, -50}, 
                        {0, 50}},
                    color = {0, 0, 255}), 
                Text(
                    extent = {
                        {-150, 50}, 
                        {150, 90}},
                    textString = "%name",
                    lineColor = {0, 0, 255}), 
                Polygon(
                    points = {
                        {90, 0}, 
                        {60, 10}, 
                        {60, -10}, 
                        {90, 0}},
                    lineColor = {0, 0, 255},
                    fillColor = {0, 0, 255},
                    fillPattern = FillPattern.Solid)}),
        Documentation(
            revisions = "<html>\n<ul>\n<li><em> 1998   </em>\n       by Martin Otter<br> initially implemented<br>\n       </li>\n</ul>\n</html>",
            info = "<html>\n<p>The signal current source is a parameterless converter of real valued signals into a the source current. No further effects are modeled. The real valued signal has to be provided by components of the blocks library. It can be regarded as the &quot;Opposite&quot; of a current sensor.</p>\n</html>"));
end SignalCurrent;