I suspect that QSpice uses 32 bit math, and the reason I suspect that is that I saw an example of the harmonics created by distorting a sine wave. The amplitudes of the harmonics didn’t concern me, but the phasesstrong text**** did. I do very similar experiments in Excel and I have found that the harmonics of any distorted sine wave always have either a 0°, 90°, 180° or 270° phase relationship to the fundamental,. That never varies, ever. But here is a screenshot of the harmonic content of a distorted sine wave showing phases that are closeemphasized text** to those values, but slightly off.
Excel uses 64 bith math, and those phases I mentioned are alwaysstrong text**** integers, even though they are the result of an FFT which is an intense mathematical endeavor, then converted to Polar from CRECT into radians, then converted to degrees. The results of all those math operations are integersstrong text****, not floating point numbers, and no, I do not use any rounding. The raw numbers from Excel are integers.
Two simulators in Qspice, Qspice64.exe (.option fastmath=1) or Qspice80.exe (.option fastmath=0), .option fastmath statement allows selection of which one to be used.
.four is run with Qpost.exe (not in Qspice64.exe or Qspice80.exe). This is a post processing process from the computed data from simulator (i.e. post processing data in .qraw file). There is no reference what precision is used in Qpost.exe, but we have .option MEASDGT can specify number of significant figures in post processing output.
32 bits single precision floating point number with approximately 7 decimal digits of precision. In Qspice, you can specify to return number in measurement with up to 15 significant figures, therefore, I think we expect Qpost runs with 64 bits double precision.
Here is an example to generate a distorted sine wave with harmonics, with 15 significant figures specified.
Based on your screen capture, I believe you post video to compare excel and Qspice (https://www.youtube.com/watch?v=NcomvddNjb0), and I have a feeling that you quote results from other instead of running your own test. Therefore, I also upload this .qsch file and you can download Qspice and run a test on it.
I can’t imagine how you get 32 degrees out of THD, although I suspect that is an average of all the harmonic phases. You are right, I didn’t do my own experiment, I used the results from someone else, and as I don’t trust your software based on what I’ve seen so far, I maintain my skepticism. If you distort the sine wave with a real transfer function like I do (10,001 points) then it’s impossible to get any of those numbers show in the QSpice results, but I have no idea how QSpice distorts sine wave. I use a mechanism that accurately simulates a real device’s transfer function, and having tested millions of real electronic devices using mixed signal ATE for 30 years, I know how electronic devices from Analog Devices to Zilog work.
The distorted waveform generated through multiple sine wave voltage sources in series (i.e. add sine wave at different frequency together). fundamental at 0 degree, 2nd harmonic at -90, 3rd harmonic at 90, 4th harmonic at 32.
.four is a post-processing, it based on generated waveform data and compute fourier.
Well… this is not my software, I am just a community member and user.
Chips do not “add harmonics,” they distort sine waves by applying the input against a non-linear transfer function. I have created many thousands of waveforms with harmonics at various phases using a random number generator, and I wrote an article on it that was published in Evaluation Engineering, it’s called Periodic White Noise and it’s pretty good for testing filters, but that’s not what your typical transistor or tube amplifier does. In a typical amplifier the input wave is applied to a device that translates the input through a transfer function, and if it’s linear, everyone is happy because no the waveform mimics the input wave and no additional harmonics are added to the wave. If there is a problem, harmonics are the RESULT of a distorted wave, the non-linearity does not pick and choose which harmonics to “add,” it’s a purely non-random process governed by laws of physics. I’m really hoping QSpice does it the right way, but as sheriff Bart stated “I ain’t hold my breath bro.”
Dan, telling us about your expertise isn’t going to solve your issue.
Please contact Mike. He’s the only one who can fix things (if broken) or explain any misunderstandings (if not broken). He does not regularly monitor this forum so you’ll need to contact him directly.