VNA SWR mathematics

Applications, development tools, FPGA, C, WEB
Post Reply
drdieter
Posts: 7
Joined: Wed Jan 10, 2018 9:42 am

VNA SWR mathematics

Post by drdieter » Sun Sep 02, 2018 5:31 pm

Hi
can you help please!

yesterday we were in the field for some QSOs. Even it rained, I could measure some antennas with the RP VNA. After calibration (ShortOpenLoad, SOL), I saw how excellent our 80m loop antenna was.

I save the data with the "Write .csv" key.

Today I would like to recreate the diagram. The VNA software cannot reimport the data to show them, so I imported them to EXCEL. Unfortunately, only the raw data were saved (komplex calibration data with komplex impedance values).

But what ist the mathematics behind to recalculate the VSWR from Impedance Load Short an Open values? Are the saved Impedance values already corrected by SOL ?

Dieter

pavel
Posts: 520
Joined: Sat May 23, 2015 5:22 pm

Re: VNA SWR mathematics

Post by pavel » Sun Sep 02, 2018 10:48 pm

drdieter wrote:
Sun Sep 02, 2018 5:31 pm
I save the data with the "Write .csv" key.

Today I would like to recreate the diagram. The VNA software cannot reimport the data to show them, so I imported them to EXCEL. Unfortunately, only the raw data were saved (komplex calibration data with komplex impedance values).
Only the cfg files can be re-imported. So, I'd suggest to use the 'Write cfg.' button to save the data that you want to read using the VNA client.
drdieter wrote:
Sun Sep 02, 2018 5:31 pm
But what ist the mathematics behind to recalculate the VSWR from Impedance Load Short an Open values?
Here is a link to the code that calculates the SWR values:
https://github.com/pavel-demin/red-pita ... #L696-L713

Here are the essential expressions:

Code: Select all

z = (50.0 * (open - load) * (dut - short)) / ((load - short) * (open - dut))
gamma = (z - 50.0) / (z + 50.0)
swr = (1.0 + abs(gamma)) / (1.0 - abs(gamma))
drdieter wrote:
Sun Sep 02, 2018 5:31 pm
Are the saved Impedance values already corrected by SOL ?
The csv file contains the open, short, load and dut values that can be used to calculate the SWR values.

To calculate SWR in Excel, you'll probably need the COMPLEX, IMABS and IMDIV functions described at the following links:
https://support.office.com/en-us/articl ... 9362fa4128
https://support.office.com/en-us/articl ... b351d765a1
https://support.office.com/en-us/articl ... ec3d74d83f

Here is how these functions can be used to convert the columns read from the csv file to the complex numbers and then to calculate z, gamma and swr:

Code: Select all

open = COMPLEX(B1,C1)
short = COMPLEX(D1,E1)
load = COMPLEX(F1,G1)
dut = COMPLEX(H1,I1)
z = IMDIV(IMPRODUCT(50.0, IMSUB(open, load), IMSUB(dut, short)), IMPRODUCT(IMSUB(load, short), IMSUB(open, dut)))
gamma = IMDIV(IMSUB(z, 50.0), IMSUM(z, 50.0))
swr = (1.0 + IMABS(gamma)) / (1.0 - IMABS(gamma))
open, short, load, dut, z, gamma, swr should be replaced by the correct column names.
Last edited by pavel on Mon Sep 03, 2018 8:47 am, edited 1 time in total.

pavel
Posts: 520
Joined: Sat May 23, 2015 5:22 pm

Re: VNA SWR mathematics

Post by pavel » Sun Sep 02, 2018 11:09 pm

Looks like it's possible to change the names of the columns in Excel:
https://support.office.com/en-us/articl ... d7ff379c64

So, it would be probably easier to rename the columns with the calculated values to open, short, load, dut, z, gamma, swr. This way the formulas from my previous post can be used unchanged.

drdieter
Posts: 7
Joined: Wed Jan 10, 2018 9:42 am

Re: VNA SWR mathematics

Post by drdieter » Mon Sep 03, 2018 8:06 am

Hi Pavel
many thanks for your answer and explanation!
I will read the links and try the given formulars. :D

My problem is not on the EXCEL side, I'm very familar with that including the VBA.
I already tried the complex calculation bei using the simple formular
VSWR= (|Z+50|)+|Z-50|)/(|Z+50|-|Z-50|) which didn't show what I measured the day before.
(including negative and huge numbers)


I also will doublecheck the data import because sometimes leading zeros or decimal indentifiers are critical.

Dieter

pavel
Posts: 520
Joined: Sat May 23, 2015 5:22 pm

Re: VNA SWR mathematics

Post by pavel » Mon Sep 03, 2018 8:24 am

drdieter wrote:
Mon Sep 03, 2018 8:06 am
(including negative and huge numbers)
In the VNA code the SWR value is constrained to the range [1.0, 99.99]. Here is a link to the code (line 713 in vna.py):
https://github.com/pavel-demin/red-pita ... na.py#L713

in Excel, you can try to use the MEDIAN function:

Code: Select all

=MEDIAN(swr, 1.0, 99.99)

drdieter
Posts: 7
Joined: Wed Jan 10, 2018 9:42 am

Re: VNA SWR mathematics

Post by drdieter » Mon Sep 03, 2018 8:37 am

Success!! :D :D :D

Hi Pavel, that was really helpful.
many , many thanks agian. So, I can send my friends the promised charts.

Things I made wrong:
I used the DUT value als the impedance.

For others locals who may use Pavels input:
Take care to use ; instead of ,
And I had to indroduce IMsub and IMsumme and IMprodukt instead of +,-,*
(I have the english function names no more in mind)


Dieter

pavel
Posts: 520
Joined: Sat May 23, 2015 5:22 pm

Re: VNA SWR mathematics

Post by pavel » Mon Sep 03, 2018 8:49 am

drdieter wrote:
Mon Sep 03, 2018 8:37 am
And I had to indroduce IMsub and IMsumme and IMprodukt instead of +,-,*
I didn't realize that +,-,* didn't work with the complex numbers. I've just updated the formulas in my previous post.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 6 guests