block UnitDelay "Unit Delay Block"
parameter Real y_start = 0 "Initial value of output signal";
extends Interfaces.DiscreteSISO;
initial equation
y = y_start;
equation
when sampleTrigger then
y = pre(u);
end when;
annotation (
Documentation(info = "<html>\n<p>\nThis block describes a unit delay:\n</p>\n<pre>\n 1\n y = --- * u\n z\n</pre>\n<p>\nthat is, the output signal y is the input signal u of the\nprevious sample instant. Before the second sample instant,\nthe output y is identical to parameter yStart.\n</p>\n\n</html>"),
Icon(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Line(
points = {
{-30, 0},
{30, 0}},
color = {0, 0, 127}),
Text(
lineColor = {0, 0, 127},
extent = {
{-90, 10},
{90, 90}},
textString = "1"),
Text(
lineColor = {0, 0, 127},
extent = {
{-90, -90},
{90, -10}},
textString = "z")}),
Diagram(
coordinateSystem(
preserveAspectRatio = true,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Rectangle(
extent = {
{-60, 60},
{60, -60}},
lineColor = {0, 0, 255}),
Text(
extent = {
{-160, 10},
{-140, -10}},
textString = "u",
lineColor = {0, 0, 255}),
Text(
extent = {
{115, 10},
{135, -10}},
textString = "y",
lineColor = {0, 0, 255}),
Line(
points = {
{-100, 0},
{-60, 0}},
color = {0, 0, 255}),
Line(
points = {
{60, 0},
{100, 0}},
color = {0, 0, 255}),
Line(points = {
{40, 0},
{-40, 0}}),
Text(
extent = {
{-55, 55},
{55, 5}},
textString = "1"),
Text(
extent = {
{-55, -5},
{55, -55}},
textString = "z")}));
end UnitDelay;