For this week’s QSPICE schematic capture, we have “Z Difference Equation” by our friend Kelvin Leung. “This is an example utilizing a DLL block (C++) for implementing a difference equation. The analog transfer function represents a second-order system with a natural frequency of 1k and a damping factor of 0.7. This transfer function is converted to a Z-domain transfer function with a sampling time of 10us (100kHz). Rearrange this transfer function to derive a difference equation.
In QSPICE, the DLL block is an excellent method for implementing a difference equation. This DLL block includes an internal clock and outputs discrete results at a sampling rate of 100kHz. The code is designed to enable users to modify coefficients in the difference equation. Additionally, a custom symbol for a 2nd-order analog transfer function is included, allowing the output responses of analog and discrete implementations to be compared in a single simulation. The .cpp code can serve as an entrance example of how to work on discrete time control in QSPICE.”
Please send any schematic capture submissions to me at tim.mccune@qorvo.com (Schematic Capture Post #064).
zdifferenceeqn.dll (20.0 KB)
zdifferenceeqn.cpp (6.3 KB)
example.zDifferenceEqn.qsch (13.9 KB)
