Create a delay block for discrete signals

I want to create a delay block like transport delay which is used for continue signals, and didn’t find solutions in the FAQ, so how ? I wish the delay block can delay the discrete signals with a external signals, like transport delay bolck does. Can you create the block both in c-script and existed blocks?

I would appreciate your answer.

A general purpose Pulse Delay with a variable delay could lead to the situation where the order of events (rising/falling edges) is reversed when the delay time is reduced. PLECS therefore does not provide such a block.

If the rate of change of the input signal and delay period are subject to certain constraints, then a workable solution could be possible. Could you better describe exactly the kind of signal you are delaying? Is it binary or real-valued? How does the signal input change relative to the delay period? Does the input have a fixed sample time?

Assuming this relates to your previous question about a phase-shift modulator (PLECS User Forum), you can use the turn-on delay blocks along with additional logic to implement a variable phase delay. See the “Switch Delay” block in “Subsystem 1”.

For a C-Script implementation - see this previous answer which includes an example of a variable turn-on delay with comments. You can build on this to implement your desired functionality. (PLECS User Forum).

If you would like to make a more general purpose discrete delay, then you should direct your question towards support@plexim.com.

DAB_delay.plecs (45.7 KB)

Hi, Bryan, thank you very much, I appreciate you crew’s help for me, solved my problems that have plagued me for some days, and I learn more from your answer.

you are smart and dedicated guys.

Thank you again!

Best wishes!