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?
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.
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.
It is limited to 0.5 phase shift because the pulse delay immediately turns the output to zero when the input is zero, which is the case when the input signal is 180 degrees out of phase with the output and 0.5 duty cycle.
If you are simply doing phase shift modulation, then use the block in the PLECS library, as the approach done in the attached model is not ideal.
If you are facing some other challenge then post a new question with more context.