PulseCurrent

model PulseCurrent "Pulse current source"
    parameter SI.Current I(start = 1) "Amplitude of pulse";
    parameter Real width(final min = Modelica.Constants.small, final max = 100, start = 50) "Width of pulse in % of period";
    parameter SI.Time period(final min = Modelica.Constants.small, start = 1) "Time for one period";

    extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Pulse signalSource(final amplitude = I, final width = width, final period = period));

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-80, -67}, 
                        {-50, -67}, 
                        {-50, 73}, 
                        {-10, 73}, 
                        {-10, -67}, 
                        {30, -67}, 
                        {30, 73}, 
                        {70, 73}},
                    color = {192, 192, 192})}),
        Diagram(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Polygon(
                    points = {
                        {-80, 90}, 
                        {-88, 68}, 
                        {-72, 68}, 
                        {-80, 90}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-80, 68}, 
                        {-80, -80}},
                    color = {192, 192, 192}), 
                Line(
                    points = {
                        {-90, -70}, 
                        {82, -70}},
                    color = {192, 192, 192}), 
                Polygon(
                    points = {
                        {90, -70}, 
                        {68, -62}, 
                        {68, -78}, 
                        {90, -70}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {-34, 0}, 
                        {-37, -13}, 
                        {-31, -13}, 
                        {-34, 0}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-34, 0}, 
                        {-34, -70}},
                    color = {192, 192, 192}), 
                Polygon(
                    points = {
                        {-34, -70}, 
                        {-37, -57}, 
                        {-31, -57}, 
                        {-34, -70}, 
                        {-34, -70}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {-78, -24}, 
                        {-35, -36}},
                    lineColor = {160, 160, 164},
                    textString = "offset"), 
                Text(
                    extent = {
                        {-42, -69}, 
                        {4, -87}},
                    lineColor = {160, 160, 164},
                    textString = "startTime"), 
                Text(
                    extent = {
                        {70, -80}, 
                        {94, -100}},
                    lineColor = {160, 160, 164},
                    textString = "time"), 
                Line(
                    points = {
                        {-19, 0}, 
                        {-19, -70}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {-80, 0}, 
                        {-19, 0}, 
                        {-19, 50}, 
                        {21, 50}, 
                        {21, 0}, 
                        {41, 0}, 
                        {41, 51}, 
                        {80, 51}},
                    thickness = 0.5), 
                Line(
                    points = {
                        {-19, 88}, 
                        {-19, 49}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {21, 74}, 
                        {21, 50}},
                    color = {160, 160, 164},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {41, 88}, 
                        {41, 51}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {-19, 83}, 
                        {41, 83}},
                    color = {192, 192, 192}), 
                Line(
                    points = {
                        {-19, 69}, 
                        {21, 69}},
                    color = {192, 192, 192}), 
                Text(
                    extent = {
                        {-9, 97}, 
                        {37, 85}},
                    lineColor = {160, 160, 164},
                    textString = "period"), 
                Text(
                    extent = {
                        {-18, 81}, 
                        {21, 69}},
                    lineColor = {160, 160, 164},
                    textString = "width"), 
                Line(
                    points = {
                        {-52, 50}, 
                        {-19, 50}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {-34, 50}, 
                        {-34, 1}},
                    color = {192, 192, 192}), 
                Text(
                    extent = {
                        {-78, 34}, 
                        {-37, 20}},
                    lineColor = {160, 160, 164},
                    textString = "I"), 
                Polygon(
                    points = {
                        {-34, 50}, 
                        {-37, 37}, 
                        {-31, 37}, 
                        {-34, 50}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {-34, 0}, 
                        {-37, 13}, 
                        {-31, 13}, 
                        {-34, 0}, 
                        {-34, 0}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {80, 51}, 
                        {80, 0}, 
                        {90, 0}},
                    thickness = 0.5), 
                Polygon(
                    points = {
                        {-19, 69}, 
                        {-10, 71}, 
                        {-10, 67}, 
                        {-19, 69}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {21, 69}, 
                        {13, 71}, 
                        {13, 67}, 
                        {21, 69}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {-19, 83}, 
                        {-10, 85}, 
                        {-10, 81}, 
                        {-19, 83}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {41, 83}, 
                        {33, 85}, 
                        {33, 81}, 
                        {41, 83}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {-73, 75}, 
                        {-53, 95}},
                    lineColor = {192, 192, 192},
                    textString = "i")}),
        Documentation(
            revisions = "<html>\n<ul>\n<li><em> 1998   </em>\n       by Christoph Clauss<br> initially implemented<br>\n       </li>\n</ul>\n</html>",
            info = "<html>\n<p>This current source uses the corresponding signal source of the Modelica.Blocks.Sources package. Care for the meaning of the parameters in the Blocks package. Furthermore, an offset parameter is introduced, which is added to the value calculated by the blocks source. The startTime parameter allows to shift the blocks source behavior on the time axis.</p>\n</html>"));
end PulseCurrent;