RampCurrent

model RampCurrent "Ramp current source"
    parameter SI.Current I(start = 1) "Height of ramp";
    parameter SI.Time duration(min = Modelica.Constants.small, start = 2) "Duration of ramp";

    extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Ramp signalSource(final height = I, final duration = duration));

    annotation (
        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 = {
                        {-80, -20}, 
                        {-20, -20}, 
                        {50, 50}},
                    thickness = 0.5), 
                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 = {
                        {-40, -20}, 
                        {-42, -30}, 
                        {-38, -30}, 
                        {-40, -20}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {-40, -20}, 
                        {-40, -70}},
                    color = {192, 192, 192}), 
                Polygon(
                    points = {
                        {-40, -70}, 
                        {-42, -60}, 
                        {-38, -60}, 
                        {-40, -70}, 
                        {-40, -70}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {-80, -33}, 
                        {-41, -49}},
                    lineColor = {160, 160, 164},
                    textString = "offset"), 
                Text(
                    extent = {
                        {-40, -70}, 
                        {6, -88}},
                    lineColor = {160, 160, 164},
                    textString = "startTime"), 
                Text(
                    extent = {
                        {70, -80}, 
                        {94, -100}},
                    lineColor = {160, 160, 164},
                    textString = "time"), 
                Line(
                    points = {
                        {-20, -20}, 
                        {-20, -70}},
                    color = {192, 192, 192},
                    pattern = LinePattern.Dash), 
                Line(
                    points = {
                        {-19, -20}, 
                        {50, -20}},
                    color = {192, 192, 192}), 
                Line(
                    points = {
                        {50, 50}, 
                        {100, 50}},
                    thickness = 0.5), 
                Line(
                    points = {
                        {50, 50}, 
                        {50, -20}},
                    color = {192, 192, 192}), 
                Polygon(
                    points = {
                        {50, -20}, 
                        {42, -18}, 
                        {42, -22}, 
                        {50, -20}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {-20, -20}, 
                        {-11, -18}, 
                        {-11, -22}, 
                        {-20, -20}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {50, 50}, 
                        {48, 40}, 
                        {53, 40}, 
                        {50, 50}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {50, -20}, 
                        {47, -10}, 
                        {52, -10}, 
                        {50, -20}, 
                        {50, -20}},
                    lineColor = {192, 192, 192},
                    fillColor = {192, 192, 192},
                    fillPattern = FillPattern.Solid), 
                Text(
                    extent = {
                        {53, 25}, 
                        {82, 7}},
                    lineColor = {160, 160, 164},
                    textString = "I"), 
                Text(
                    extent = {
                        {0, -17}, 
                        {35, -37}},
                    lineColor = {160, 160, 164},
                    textString = "duration"), 
                Text(
                    extent = {
                        {-73, 75}, 
                        {-53, 95}},
                    lineColor = {192, 192, 192},
                    textString = "i")}),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-80, -60}, 
                        {-50, -60}, 
                        {50, 60}, 
                        {80, 60}},
                    color = {192, 192, 192})}),
        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 RampCurrent;