Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

create a delay block for discrete signals

0 votes

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.

asked Jul 4, 2022 by fire (73 points)

1 Answer

+1 vote
Best 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 (, 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. (

If you would like to make a more general purpose discrete delay, then you should direct your question towards
answered Jul 5, 2022 by Bryan Lieblick (1,995 points)
selected Jul 6, 2022 by fire
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!