¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Estimating coaxial cable length - using TDR


 

On Fri, Jun 9, 2023 at 09:21 AM, Anne Ranch wrote:


the task is -
is the unknown length of cable in multiples of 1/4 wavelength @ 14 MHz band,?
To directly answer this, what you need to know is the electrical length of the cable, not the physical length. And nanovna-saver can directly display this without the complication of TDR and VF estimates.
Select a graph type of S11 phase, and connect your cable to the nanovna with the far end of the cable open. Then first select a frequency range like 50kHz to 15MHz. You will see the phase start at near 0, then the phase will reverse every quarter wavelength (based on the true electrical cable length). The waveform looks like a sawtooth, because of the open cable end. Count the number of quarter wavelengths up to your desired operating frequency. Then change the frequency range to zoom in on the 14MHz band to get a detail view of the additional phase offset. Then you can trim or add to your cable to move the quarter wavelength point to your desired frequency.
I attached photos of this approach using an RG8 foam cable approximately 30M long.


 

On Fri, Jun 9, 2023 at 09:21 AM, Anne Ranch wrote:


I shall repeat
the task is -
is the unknown length of cable in multiples of 1/4 wavelength @ 14 MHz band,?

hence

what should the sweep frequencies be ?
Why are you using TDR to do this task? Just sweep from 50 kHz to 20 MHz and set yellow trace to s11 Phase and Green to Smith chart. Then just spin the marker and you can see what you want. Attached is a plot of a 9.4 meter long piece of RG58. The markers show the 1/4, 1/2, and 3/4 wavelength frequencies. At 14.16 MHz. this cable is about 0.5 +.25(144/180) = 0.7 wavelengths long


 

On 6/9/23 11:12 AM, Anne Ranch wrote:
Here is a new twist ....
I replaced current , unknown type , unmarked type of coax with
known, good RG6 length plainly marked in cubits and converted them to meters - approximately 35 meters.
Now when I set sweep to 10 to 60 MHz TDR "estimated length" is around 28 meters - with open ended coax.
( Not even close to 35 meters ...)
Is your coax foam or solid dielectric - RG-6 comes in both forms.

What does the trace look like? (can you save it and post it?) I'd expect around 41-42 meters if set to VF=1 (or 100%).

if it's set to, say, 0.66 VF and it's actually 0.84 (first google hit for RG-6 VF), then it will give you a shorter than real length
(35 *.66/.84 = 27.5 meters which is pretty close to what you got.

some RG-6 is foam dielectric so the epsilon of the dielectric is smaller.

The other way it can get fooled is if there's a place where the cable is damaged, causing a discontinuity that's big enough to fool the algorithm.



The algorithm does a simple argmax to find the peak
s11 = []
for d in self.app.data11:
s11.append(np.complex(d.re, d.im))

window = np.blackman(len(self.app.data11))

windowed_s11 = window * s11
self.td = np.abs(np.fft.ifft(windowed_s11, FFT_POINTS))
step = np.ones(FFT_POINTS)
self.step_response = signal.convolve(self.td, step)

self.step_response_Z = 50 * (1 + self.step_response) / (1 - self.step_response)

time_axis = np.linspace(0, 1/step_size, FFT_POINTS)
self.distance_axis = time_axis * v * c
# peak = np.max(td)
# We should check that this is an actual *peak*, and not just a vague maximum
index_peak = np.argmax(self.td)

cable_len = round(self.distance_axis[index_peak]/2, 3)
feet = math.floor(cable_len / 0.3048)
inches = round(((cable_len / 0.3048) - feet)*12, 1)

self.tdr_result_label.setText(f"{cable_len}m ({feet}ft {inches}in)")
self.app.tdr_result_label.setText(str(cable_len) + " m")
self.updated.emit()

I started looking at the software and so far it looks as there is "the original " nanoVNASaver and several "forks", some for windoze only.
It would be nice if somebody who KNOWS where " TDR" software resides help me and point me in the right direction.
YES, I can download all and then I can search but if somebody already knows where to look , let's share that info, please...
and thanks
...


 

On 6/9/23 12:01 PM, Roger Need via groups.io wrote:
On Fri, Jun 9, 2023 at 09:21 AM, Anne Ranch wrote:

I shall repeat
the task is -
is the unknown length of cable in multiples of 1/4 wavelength @ 14 MHz band,?

hence

what should the sweep frequencies be ?
Why are you using TDR to do this task? Just sweep from 50 kHz to 20 MHz and set yellow trace to s11 Phase and Green to Smith chart. Then just spin the marker and you can see what you want. Attached is a plot of a 9.4 meter long piece of RG58. The markers show the 1/4, 1/2, and 3/4 wavelength frequencies. At 14.16 MHz. this cable is about 0.5 +.25(144/180) = 0.7 wavelengths long
It's useful to know how to make the TDR work - I've found more than one feedline problem by using TDR - yeah, sometimes if there's combinations of solid, foam, and air dielectric, the distances don't work out, but you can still see the discontinuities from connectors.

Attached is a TDR plot with a feedline to an S-band antenna with multiple segments, and the actual antenna at the end.


 

On Fri, Jun 9, 2023 at 01:26 PM, Jim Lux wrote:


It's useful to know how to make the TDR work - I've found more than one
feedline problem by using TDR - yeah, sometimes if there's combinations
of solid, foam, and air dielectric, the distances don't work out, but
you can still see the discontinuities from connectors.
The TDR feature in NanoVNA Saver has some issues. In 5.5 it does not plot the time graph correctly. In all versions the impedance graph was not correct in the initial release and still has problems. I find doing TDR on the NanoVNA itself is easier and the NanoVNA app TDR display plots impedance much better. Take a look at the attached plots from a NanoVNA-H4 , NanoVNA App and Saver. The first scan is 25 feet (7.62 meters) of RG58 and the second is with 8 feet (2.4 meters) of RG6 added on the end. Nominal impedance of the RG58 is 50 ohms and the RG6 is 75. Note how NanoVNA App resolves the impedance of the two transmission lines

Roger


Anne Ranch
 

On Fri, Jun 9, 2023 at 04:46 PM, Roger Need wrote:


The TDR feature in NanoVNA Saver has some issues
Allow me to discourage you from such posting... you will get crucified by "guardians of purity of nanoVNA" , but I assume you are an adult and can take it.
Yes, the nanoVNASaver is a challenge , to put it mildly. ( and I will leave it at that...)
I am still searching for a clue where to find at least some of the TDR code.
I got sidetracked actually calculating the REAL RG6 cable length to act as "in line transformer".
And it is too hot to work on the antenna....


 

On 6/9/23 6:19 PM, Anne Ranch wrote:
On Fri, Jun 9, 2023 at 04:46 PM, Roger Need wrote:


The TDR feature in NanoVNA Saver has some issues
Allow me to discourage you from such posting... you will get crucified by "guardians of purity of nanoVNA" , but I assume you are an adult and can take it.
Yes, the nanoVNASaver is a challenge , to put it mildly. ( and I will leave it at that...)
I am still searching for a clue where to find at least some of the TDR code.
I got sidetracked actually calculating the REAL RG6 cable length to act as "in line transformer".
And it is too hot to work on the antenna....
-=-=

The calculations are in ./Windows/TDR.py (not ./Charts/TDR.py, that's what actually does the plotting)

It's pretty straightforward in function updateTDR() - blackman window, ifft, convolution with 1s to turn impulse response into step response, then calculate Z from the step response
self.step_response_Z = 50 * (1 + self.step_response) / (1 - self.step_response)


I posted the source snippet an hour or so ago.

The length you posted seems to be about right, if you had entered 0.66 for the VF and the RG-6 was actually foam dielectric with a VF of 0.84


__init__() sets up the defaults and populates the cable type dropdown with corresponding velocity factors.

the only tricky part is where it concatenates a series of smaller sweep segments.
s11 = []
for d in self.app.data11:
s11.append(np.complex(d.re, d.im))

app.data11 is a list of data sets.

One area where it could foul up is if the points aren't equally spaced, or if the segments have any overlap. The other place where a hiccup could occur is if there's a truncation issue in setting the frequencies of the segments. I've been bitten by that when trying to do log sweeps and the step size at the low end is < minimum step size.


 

On Thu, Jun 8, 2023 at 01:53 PM, Jim VE7RF wrote:


<Before the VNA was available, I would just measure the C between center conductor + braid. Knowing how many pf per foot the cable was, it's a simple math calculation for the physical length. Knowing the VF, the electrical length is also calculated.

This works very good on a known length of coax...dead on actually. On coax that you don't know how many pf per foot, cut exactly 1'-2'-3' of coax off the end of the run / roll...and measure it.


Anne Ranch
 

The calculations are in ./Windows/TDR.py (not ./Charts/TDR.py, that's what actually does the plotting)

Little discouraging, but I found the same "source code ".....
I also realized that , also little to late nanoVNASaver is "just the GUI" , but I had to start somewhere...
My next step is to find the actual TDR processing,,,
Maybe after I muddle thru the nanoVNASaver TDR undocumented / uncommented source code
( quite expected ) I will make (some) more progress.
BTW - for all those who keep telling me to "use S11 " phase reversal " - this TDR GUI does use S11 , so
it looks as TDR GUI is "just another layer" of software...

I am still in KISS mode - TDR in principle is
" start timer, then send a pulse and measure time when such pulse returns "
it cannot be much simpler,

As of today - I still do not know how nanoVNA generates such pulse and how "sweep" frequency (?) setup
is related to this simple principle of sending a pulse down the line.

PS
When this is all done I may break down and
open the RG6 I have
observe the dielectric - my guess it is poly-whatever
and actually use nanoVNA to measure the VF...

what a goal...

ah yes - my current cable is 9 (nine) times of 1/4 wavelength long @ 14MHz....
Purfect for Field Day...


 

On 6/10/23 7:36 AM, Anne Ranch wrote:
The calculations are in ./Windows/TDR.py (not ./Charts/TDR.py, that's what actually does the plotting)
Little discouraging, but I found the same "source code ".....
I also realized that , also little to late nanoVNASaver is "just the GUI" , but I had to start somewhere...
Not at all - NanoVNA-Saver also does the calculations - for calibration, for instance, as well as TDR.


My next step is to find the actual TDR processing,,,
It's in ./Windows/TDR.py

Maybe after I muddle thru the nanoVNASaver TDR undocumented / uncommented source code
If you know how inverse FFT to generate the time domain works, there's really not a lot of commenting needed.

There's the following steps:

1) concatenate all the segment sweeps into one array
2) apply a suitable window (it uses the blackman window from numpy)

3) do the inverse FFT (also in numpy)


Now you've got the time domain impulse response
4) To convert that to a step response (because that's what you need for a impedance display) you convolve it with a step (array of all ones) (yeah, using numpy )

5) Then convert the step response to impedance using the usual Z0 * (1+rho)/(1-rho) formula.







( quite expected ) I will make (some) more progress.
BTW - for all those who keep telling me to "use S11 " phase reversal " - this TDR GUI does use S11 , so
it looks as TDR GUI is "just another layer" of software...
I am still in KISS mode - TDR in principle is
" start timer, then send a pulse and measure time when such pulse returns "
it cannot be much simpler,

That's one way to do TDR - but that's now how VNAs do it. What a VNA does is measure the reflection coefficient at a series of frequencies. That gives you a frequency domain response. Then, you use the Fourier transform to turn that into the time domain response.


As of today - I still do not know how nanoVNA generates such pulse and how "sweep" frequency (?) setup
is related to this simple principle of sending a pulse down the line.
It's not.

That pulse down the line is (idealized) an "impulse" which contains all frequencies. The impulse response (what you get with classic TDR) is the reflected voltage vs time from that pulse. The challenge is that you want a fair amount of energy in the pulse (so your reflection measurement has good SNR) AND you want it to be really narrow, which means a high voltage fast pulse, which is hard to generate. It also might "break" something in the system to put a HV pulse. The problem with a short pulse is that although it's "wideband" the energy is spread out, so the power at any one frequency is small.

What the VNA does is rather than send an infinitesimally short pulse, it sends single frequencies, for a long time, at lower power. It eventually sends "all frequencies" (or, at least enough different frequencies) so it's spanning the spectrum, just like the short impulse did. Even better, each of those individual measurements has more energy, hence better SNR. The Fourier Transform lets you convert all those individual measurements spanning the frequency into an equivalent time response.

For what it's worth, a similar technique is used in modern radars - A radar is just TDR through the air. The shorter the pulse, the higher the resolution, the more power in the pulse, the better the SNR. But the problem is that there's a maximum power (can't keep building bigger tubes or amplifiers - and high power breakdown limits how much power you can push) - so they do what's called pulse compression - they turn the short impulse into a little FM chirp - same average power, but lower peak power. Then on receipt of the signal, they dechirp it to generate the time domain response. In traditional pulse compression they use dispersive delay lines (or these days DSP) - and, as a practical matter, you don't have to use chirps, you can use PSK coding too. But overall, it's the same general idea you use the time domain/frequency domain swap.



PS
When this is all done I may break down and
open the RG6 I have
observe the dielectric - my guess it is poly-whatever
and actually use nanoVNA to measure the VF...
what a goal...
ah yes - my current cable is 9 (nine) times of 1/4 wavelength long @ 14MHz....
Purfect for Field Day...


 

Jim Lux,

That was a well written explanation of how "TDR" is done in the NanoVNA. Thanks for taking the time to write it up.

Roger


 

Those interested in how the TDR was implemented in NanoVNA Saver will find the details in this groups.io post by Herb Walker.

/g/nanovna-users/message/9651

For more details on how the S11/IFFT method of TDR works this tutorial by Agilent is quite informative. It includes details on why "windowing" the data is necessary, how to determine the upper stop frequency required based on estimated cable length, why the lower start frequency should be close to DC and other considerations.



Roger


Anne Ranch
 

Jim Lux,
as always, your replies are clearing few of mine misconceptions, thanks.
With all this FFT (frequency to pulse and time ) it is still unclear how CHANGING the "sweep" changes the "estimated cable length".

...and how it still "calculates" the cable length AFTER it is hooked to the actual load / antenna (variable with frequency ) - assuming that TDR can be calculated from open , shorted and "real terminated" but unknown and variable with frequency termination.

With real load connected the calculation must include "real load" somehow...


 

On 6/10/23 11:04 AM, Roger Need via groups.io wrote:
Those interested in how the TDR was implemented in NanoVNA Saver will find the details in this groups.io post by Herb Walker.
/g/nanovna-users/message/9651
For more details on how the S11/IFFT method of TDR works this tutorial by Agilent is quite informative. It includes details on why "windowing" the data is necessary, how to determine the upper stop frequency required based on estimated cable length, why the lower start frequency should be close to DC and other considerations.

Roger
The Keysight Ap Note is a good reference.

For what it's worth, in the older NanoVNA-Saver version I have, there are some problems in the implementation, specifically because it does not deal with the "non zero" starting frequency. If you set 10 MHz to 60 MHz sweep, I don't know that you'd get the right results, because it just assumes that you're feeding the IFFT evenly spaced points from 0-{highest freq}.

It is possible that when you select TDR mode it changes how it builds the measurement segments so that the lowest frequency is equal to the spacing between frequencies, and then puts in a zero for the DC term.

I do know that the Keysight boxes (e.g. the fieldfox) do handle both lowpass and bandpass correctly. When you pay $20k, that's something you get. For other applications, with uneven spacing, I've written code to deal with it.


 

On 6/10/23 11:22 AM, Anne Ranch wrote:
Jim Lux,
as always, your replies are clearing few of mine misconceptions, thanks.
With all this FFT (frequency to pulse and time ) it is still unclear how CHANGING the "sweep" changes the "estimated cable length".
...and how it still "calculates" the cable length AFTER it is hooked to the actual load / antenna (variable with frequency ) - assuming that TDR can be calculated from open , shorted and "real terminated" but unknown and variable with frequency termination.
The open/short/load just makes sure the reflection measurement is correct. It has nothing to do with the actual measurement of a feedline.

The reason you can "see" connectors and the antenna in the TDR is that they are not exactly the same impedance, so you see the discontinuity. If you had a single length of coax, and a load that was well matched to the coax, you probably wouldn't be able to measure the length.

Think of it as estimating the size of a room with your eyes closed by listening how long it takes for the echo to come back when you clap your hands. Easy in a boxlike room with hard walls. Impossible in an acoustically dead room, because the sound just goes out and is absorbed.

It is the rare antenna that is matched at all frequencies. So even it's a good match (and has no reflection) at a few frequencies, for most of the other frequencies, it reflects back significant energy. And that's enough to make the TDR work.

To kind of use a different conceptual view, imagine that you measure the phase shift (and ignore amplitude) for a series of frequencies. You plot those on a graph (unwrapping where needed), and then fit a straight line to the points. The slope of that line corresponds to the length of the cable. And even if there's some missing points (because the amplitude is small where the antenna is well matched) you can still fit the line. So you get a more accurate measurement - sort of like averaging.

The cool thing about the FFT approach or the "fit a straight line" (versus the "look for zero or 180 phase in the reflection and it's a multiple of 1/4 wavelength" ) is that it combines multiple measurements into what you want - the delta phase vs delta frequency. (FWIW, Delta phase/delta frequency is "group delay")

It also lets you know if you're measuring something that's dispersive (where the delay varies with frequency), because then, the plot of phase vs frequency won't be a straight line. That's important for things like waveguides, ionized media, traveling wave tube amplifiers, etc - because a group delay that's not flat means that pulsed waveforms will be distorted.






With real load connected the calculation must include "real load" somehow...


Anne Ranch
 

On Sat, Jun 10, 2023 at 11:44 AM, Jim Lux wrote:


Jim Lux,
I got a break from TDR by seeing "Swan Lake" , enjoyed the music , not sure about the ballet.
My XYL comment was "woman body legs are not attached to the body..."

BTW the antenna "mast" fell in recent windstorm, dummy forgot to add hose clamp to the first cammo pol;e and it broke .
No damage to anything, just pride.

I found a short piece of same, labelled RG6 cable so I can compare it with the unlabeled one.

I need to go back to grammar school and study Fourier to make sense of all of this.

I still believe the nanoVNASaver has an issue with using the "sweep" entries...
Also the "TDR" and the TDR display options do not match - the "POP up sub menu in particular.

PS
During my college study there was a joke going around with one of the professors pet question
"draw me a graph..."... if you forgot to add dimensions to either axis you have failed the exam.
TDR graph is missing the "y axis" dimension.
73 Vaclav AA7EJ

of this.


 

On Saturday 10 June 2023 02:04:13 pm Roger Need via groups.io wrote:
For more details on how the S11/IFFT method of TDR works this tutorial by Agilent is quite informative. ?It includes details on why "windowing" the data is necessary, how to determine the upper stop frequency required based on estimated cable length, why the lower start frequency should be close to DC and other considerations.


Some intersting reading, there.

--
Member of the toughest, meanest, deadliest, most unrelenting -- and
ablest -- form of life in this section of space, ?a critter that can
be killed but can't be tamed. ?--Robert A. Heinlein, "The Puppet Masters"
-
Information is more dangerous than cannon to a society ruled by lies. --James
M Dakin


Anne Ranch
 

Roy J. Tellason, Sr
It looks as "this TDR" subject has life of its own,,,
The Agilent article will take me some time to digest...

At present I am trying to "run the source code of nanoVNASaver" in Qt debug mode.
Tentatively I will try to make "TDR" and "TDR display " to match...

My last test - finding known length of my "fancy digital RG6" of VF . 82 ( VF value thanks to the group replies, appreciate that )
matches my inch stick when I set the VF to .66 !

So... is it real or Memorex?
Is my fancy RG6 mislabeled and it is really plain RG6 of .66 VF?

Where is the problem ?


 

I'm trying to fathom the reason for knowing the exact physical length of a piece of coax, or it's exact electrical length. What are you trying to do here, phase yagis on 14 mhz.... or building a 4 square vertical array for 80m ?
Even if building stacked yagis, and the coax is all coming off the same reel, it's a moot point. All that is required is equal lengths of coax from the L network, to each yagi.


Clint Sharp
 

I don't know the OP's reasons for wanting to know but I'd think it useful
for knowing how much is used on a run, how much is left on a reel and for
tracking down faults to think of just a few.

"Precise" is of course variable by application, from back when 10b2
ethernet was a thing and dinosaurs roamed the earth within a metre was
excellent because I can eyeball and inspect for faults at that sort of
distance, YMMV.

On Mon, 12 Jun 2023, 07:35 Jim VE7RF, <jim.thom@...> wrote:

I'm trying to fathom the reason for knowing the exact physical length of
a piece of coax, or it's exact electrical length. What are you trying to
do here, phase yagis on 14 mhz.... or building a 4 square vertical array
for 80m ?
Even if building stacked yagis, and the coax is all coming off the same
reel, it's a moot point. All that is required is equal lengths of coax
from the L network, to each yagi.