Triggered Delay Component
The following example implements a triggered delay component:
component Triggered
inputs
u = 0; % input signal
triggered = 0; % control signal
end
variables(Event=true)
x = 0;
end
outputs
y = 0;
end
events
when edge(triggered>0)
x = u;
end
end
equations
y == x;
end
end
When the control signal becomes positive, the event variable x gets
updated to the current value of the input signal u.
Output y outputs the value of x.
Therefore, the output signal y gets updated to
the current value of the input signal u on the
rising edge of the control signal, and then holds that value between
the events.