I was hoping to get the same result as the api at around 165 degrees.
Maybe I’m using the wrong calculator for the purpose? Or is one of the values returned by the api wrong?
A lag of 166 degrees is the same as a lead of 194 degrees (and vice versa). 360-166 = 194. So, they are saying the same thing. There is an issue in the QA401 where there’s a 180 degree inversion due to hardware. Probably this should be fixed before the 1.0 release.
Phase is a simple concept but in practice can be tricky. You need to specify a reference point. What the QA401 (and QA401H) both use is the input to the DAC as the reference point. This means you have prop delay through the DAC, the DUT and the ADC all contributing to the phase. The QA401 has a plug-in where you can specify the right channel as the phase reference. There you can take the output, split it into a BNC T, run one output to the DUT, and run the other output to the right channel and more sensible reading.