/libvna

vector network analyzer 12-term calibration, generalized parameter conversion and touchstone file load/save

Primary LanguageCGNU General Public License v3.0GPL-3.0

LIBVNA: Vector Network Analyzer Library
Copyright © 2020-2022 D Scott Guthridge <scott-guthridge@rompromity.net>

Library for vector network analyzers: provides calibration using 8 and
16 term T parameters, 12-term E parameters (classic SOLT) and others,
parameter conversion, and loading and storing of network parameter data
in Touchstone 1, Touchstone 2 and network parameter data (.npd) formats.

Prerequisites:
  - A C99 level C compiler such as gcc or clang
  - make
  - libyaml development package

    Fedora, RedHat, Centos, SUSE, etc. RPM-based distros
	sudo yum install gcc make libyaml-devel

    Debian, Ubuntu
	sudo apt-get update
	sudo apt-get install gcc make libyaml-dev

   If libyaml-dev isn't available for your system, you can download
   and build the source from here: https://pyyaml.org/wiki/LibYAML


Build, Test and Install:
    - If building from git, you'll need these.  If you already have a
      tarball, you can skip this step.

	Fedora, RedHat, Centos, SUSE
	    sudo yum install git make autoconf automake libtool

	Debian, Ubuntu
	    sudo apt-get update
	    sudo apt-get install git make autoconf automake libtool

	mkdir m4
	./bootstrap

    - All builds...
	./configure
	make
	make -j8 check

    - Install to /usr/local	[But see other options below first.]
	sudo make install

	The files are installed in:
	    /usr/local/include/*.h
	    /usr/local/lib/libvna.so.*
	    /usr/local/share/doc/libvna/*
	    /usr/local/share/man/man3/*.3

	The example programs and README-EXAMPLES files are copied into
	/usr/local/share/doc/libvna.  The README-EXAMPLES is worded for
	someone building the example programs by hand after the library
	has been installed on the system.  After running a make all here,
	though, the examples will already be built in the src/ directory.

	Fixing library path problems:
	    Some Linux distros (such as Fedora 31) don't include
	    /usr/local/lib in the default dyanamic library search path.
	    If you get an error like the following when trying to run
	    a program you linked against libvna:

		error while loading shared libraries: libvna.so.0:
		cannot open shared object file: No such file or directory

	    Add /usr/local/lib to the default library search path:

	    sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/local.conf'
	    sudo chmod 644 /etc/ld.so.conf.d/local.conf
	    sudo ldconfig

    - Build RPM Packages and Install to /usr

	The source RPM appears in rpm/libvna-*.src.rpm.  Binary RPMs
	appear in an architecture-specific subdirectory, e.g. rpm/x86-64/.

	When installing from RPM, the installed files go into the
	standard system directories such as /usr/include, /usr/lib64,
	/usr/share/doc, and /usr/share/man instead of /usr/local/

	sudo yum install rpm-build

	make rpm
	sudo rpm -U rpm/*/*.rpm

	make srcrpm			# optional install source package
	sudo rpm -U rpm/*.src.rpm


    - Build Debian Packages and install to /usr

	sudo apt-get update
	sudo apt-get install build-essential devscripts
	make deb

	( cd deb; sudo apt install ./*.deb )


To build PDF versions of the man pages (requries pdfroff):
    make pdfman

    The .pdf files appear in src/


If you install gnuplot, you can see an interesting example of VNA
calibration at work by running make plot.  The example illustrates
correction of errors from a particularly bad VNA that has a stray parallel
capacitance of 318pF between port 1 and group, and a stray inductance
of 796 nH in series with port 2.  These values were chosen to make the
VNA stray reactances resonate with the DUT.  See src/vnacal-SOLT-example.c
    make plot


Creating a new release (for git developers only)
    Update the version in the AC_INIT macro of configure.ac
    Commit with a message in this format "version 0.0.3"
    Create an annotated tag.  Example:
	git tag -a v0.0.3 -m "v0.0.3"
    Push to github
	git push
	git push --tags


The library is still undergoing some final development.  While the
version remains at 0.x.x, there may be a few compatiblity breaks not
reflected in the library .so version.  Several compatibility breaks were
introduced beween development versions v0.0.6 and v0.1.0 to improve APIs.

If you'd like to help, please contact me.  The main things I could use
help on right now are:

    - A review of the API
    - A review of the code (over 50000 lines of source code)
    - There's a TODO list in src/

Please make suggestions on how the library could be improved.