Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request type
Please check the type of change your PR introduces:
What is the current behavior?
One of the bugs is that if the length to a discontinuity is small, the TDR does not measure correctly. This is because the impulse response looks like a pulse, and half of the pulse is not integrated because it is centered around zero, and only positive time values are added. I solved this issue by also adding the negative time values. This way, the entire pulse is integrated and we get a step response of 1 instead of 0.5. Normally, the negative time values are very small so it doesn't seem like any bad behavior happens from doing this.
Here's what it looks like before, with an open/short discontinuity that is right at the connector:
What is the new behavior?
After changing it, I get these plots:
The load seems good:
I also added a new feature. It turns out that the old TDR code was partially right, and it implemented something called "bandpass TDR" which is useful for measuring waveguides. Because waveguides have a cutoff frequency, you can't measure the return loss below the cutoff. The current TDR implementation does "lowpass TDR", where you have the entire frequency range from DC to the limit of your VNA. The limitation is that with bandpass TDR, you can only measure the magnitude of the impulse response.
Here is the new feature in action.
The DUT is a transmission line which is open at one end. The VNA is sweeping from 5GHz to 8GHz.
With lowpass mode, you can see the impedance is completely wrong:
The bandpass mode shows the correct reflection response. I think the peak is a bit below 1 because of cable loss.
Just like with traditional TDR methods, 1 means complete reflection.
Does this introduce a breaking change?
Other information
You can read more about the differences between bandpass and lowpass TDR here: https://coppermountaintech.com/wp-content/uploads/2020/01/Time-Domain-Analysis-final.pdf