Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TDR math again #724

Merged
merged 2 commits into from
Nov 26, 2024
Merged

Fix TDR math again #724

merged 2 commits into from
Nov 26, 2024

Conversation

EnPassant123
Copy link
Contributor

Pull Request type

Please check the type of change your PR introduces:

  • [*] Bugfix
  • [*] Feature
  • [] Code style update (formatting, renaming)
  • [] Refactoring (no functional changes, no API changes)
  • [] Build-related changes
  • [] Documentation content changes
  • [] Other (please describe):

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:

image
image

What is the new behavior?

After changing it, I get these plots:

image

image

The load seems good:

image

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:

image

The bandpass mode shows the correct reflection response. I think the peak is a bit below 1 because of cable loss.

image

Just like with traditional TDR methods, 1 means complete reflection.

image

Does this introduce a breaking change?

  • [] Yes
  • [*] No

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

@EnPassant123 EnPassant123 requested a review from zarath as a code owner November 24, 2024 01:36
Copy link
Collaborator

@zarath zarath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for improving TDR abilities

@zarath zarath merged commit 561b1de into NanoVNA-Saver:main Nov 26, 2024
2 checks passed
zarath pushed a commit to zarath/nanovna-saver that referenced this pull request Nov 30, 2024
* Update TDR.py

* Update TDR.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants