model TrapezoidCurrent "Trapezoidal current source"
parameter SI.Current I(start = 1) "Amplitude of trapezoid";
parameter SI.Time rising(final min = 0, start = 0) "Rising duration of trapezoid";
parameter SI.Time width(final min = 0, start = 0.5) "Width duration of trapezoid";
parameter SI.Time falling(final min = 0, start = 0) "Falling duration of trapezoid";
parameter SI.Time period(final min = Modelica.Constants.small, start = 1) "Time for one period";
parameter Integer nperiod(start = -1) "Number of periods (< 0 means infinite number of periods)";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Trapezoid signalSource(final amplitude = I, final rising = rising, final width = width, final falling = falling, final period = period, final nperiod = nperiod));
annotation (
Icon(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Line(
points = {
{-81, -66},
{-60, -66},
{-30, 74},
{1, 74},
{30, -66},
{51, -66},
{80, 74}},
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, 90},
{-80, -80}},
color = {192, 192, 192}),
Line(
points = {
{-90, -70},
{90, -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 = {
{-45, -30},
{-47, -41},
{-43, -41},
{-45, -30}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Line(
points = {
{-45, -30},
{-45, -70}},
color = {192, 192, 192}),
Polygon(
points = {
{-45, -70},
{-47, -60},
{-43, -60},
{-45, -70},
{-45, -70}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Text(
extent = {
{-86, -43},
{-43, -55}},
lineColor = {160, 160, 164},
textString = "offset"),
Text(
extent = {
{-47, -69},
{-1, -87}},
lineColor = {160, 160, 164},
textString = "startTime"),
Text(
extent = {
{70, -80},
{94, -100}},
lineColor = {160, 160, 164},
textString = "time"),
Line(
points = {
{-30, 79},
{-30, -70}},
color = {192, 192, 192},
pattern = LinePattern.Dash),
Line(
points = {
{-10, 59},
{-10, 40}},
color = {192, 192, 192},
pattern = LinePattern.Dash),
Line(
points = {
{20, 59},
{20, 40}},
color = {160, 160, 164},
pattern = LinePattern.Dash),
Line(
points = {
{40, 59},
{40, -30}},
color = {192, 192, 192},
pattern = LinePattern.Dash),
Line(
points = {
{-21, 75},
{60, 75}},
color = {192, 192, 192}),
Line(
points = {
{-30, 56},
{40, 56}},
color = {192, 192, 192}),
Text(
extent = {
{-9, 88},
{37, 76}},
lineColor = {160, 160, 164},
textString = "period"),
Text(
extent = {
{-8, 70},
{21, 60}},
lineColor = {160, 160, 164},
textString = "width"),
Line(
points = {
{-42, 40},
{-10, 40}},
color = {192, 192, 192},
pattern = LinePattern.Dash),
Line(
points = {
{-39, 40},
{-39, -30}},
color = {192, 192, 192}),
Text(
extent = {
{-77, 14},
{-40, 0}},
lineColor = {160, 160, 164},
textString = "I"),
Polygon(
points = {
{-30, 56},
{-23, 58},
{-23, 54},
{-30, 56}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Polygon(
points = {
{-10, 56},
{-17, 58},
{-17, 54},
{-10, 56}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Polygon(
points = {
{-30, 75},
{-21, 77},
{-21, 73},
{-30, 75}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Polygon(
points = {
{60, 75},
{52, 77},
{52, 73},
{60, 75}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Line(
points = {
{-80, -30},
{-30, -30},
{-10, 40},
{20, 40},
{40, -30},
{60, -30},
{80, 40},
{100, 40}},
thickness = 0.5),
Polygon(
points = {
{-39, 40},
{-41, 30},
{-37, 30},
{-39, 40}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Polygon(
points = {
{-39, -30},
{-41, -20},
{-37, -20},
{-39, -30},
{-39, -30}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Line(
points = {
{60, 80},
{60, -30}},
color = {192, 192, 192},
pattern = LinePattern.Dash),
Polygon(
points = {
{40, 56},
{33, 58},
{33, 54},
{40, 56}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Polygon(
points = {
{20, 56},
{27, 58},
{27, 54},
{20, 56}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Polygon(
points = {
{20, 56},
{13, 58},
{13, 54},
{20, 56}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Polygon(
points = {
{-10, 56},
{-3, 58},
{-3, 54},
{-10, 56}},
lineColor = {192, 192, 192},
fillColor = {192, 192, 192},
fillPattern = FillPattern.Solid),
Text(
extent = {
{-34, 70},
{-5, 60}},
lineColor = {160, 160, 164},
textString = "rising"),
Text(
extent = {
{16, 70},
{45, 60}},
lineColor = {160, 160, 164},
textString = "falling"),
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 TrapezoidCurrent;