In PWL simulators, there is normally a digital / logic delay block. For example, Time Delay (Logic) in PSIM or Pulse Delay in PLECS.
Such a device would not be implemented in hardware, but is used to prototype conceptual logic. In the past, engineers used the B-source delay(x,y,z) function to achieve an equivalent simulation setup in SPICE. However, this is a memory-inefficient and computationally heavyweight function, resulting in much slower simulation speeds compared to PWL simulators.
As Qspice offers DLL (C++) block, as discussed with Mike Engelhardt, a DelayedPulseTrain.cpp (.dll) was developed and is in the Qspice Demo directory. The idea is simply to memorize input pulse toggle times and recreate the pulse from memory. As a result, this is a memory-efficient and computationally lightweight DLL.
Revision History: 07/22/2026 Added an example of a digital pulse train delay.
File > Open Demo… > DelayedPulseTrain.qsch
Example of Phase-Shifted Full-Bridge Inverter
This will benefit conceptual simulation. As in power electronics, many of us tend to use SPICE as a replacement for expensive PWL simulators. Logic delay is a critical key that has been missing so far. But with DelayedPulseTrain, we can have a memory-efficient and computationally lightweight digital delay block.
I prepared a phase-shifted full-bridge inverter which uses DelayedPulseTrain for simulation. Since DelayedPulseTrain.dll is in the Qspice demo directory, any DLL in the demo directory can be loaded by Qspice directly. In this case, I redrew a custom symbol to make everything look good, and this schematic can be run directly in Qspice.
example(DelayedPulseTrain).Phase-Shifted-Full-Bridge.qsch (16.7 KB)
download KSKelvin DelayedPulseTrain.qsym from Github
This simulation runs 500 pulses, and the total elapsed time is less than 0.2 seconds.
And if I replace DelayedPulseTrain with the B-source delay(x,y,z), the total elapsed time increases to 10 seconds. I also uploaded this delay function example so that you can compare it on your computer. (**compare with fastmath disable, i.e. QSPICE80.exe)
example(DelayFunction).Phase-Shifted-Full-Bridge.qsch (15.5 KB)



