A library version of vny/J is available here for download.

You can embed this library in your own JAVA application and execute scans.

The usage is straight forward. For conveniece I've added two Windows command files:

  • compile.cmd - to compile the sample LibrarySampleRunner
  • run.cmd - to run the sample

Simply dig into the command files and the LibrarySampleRunner.java to get an idea.

import krause.vna.data.calibrated.VNACalibratedSampleBlock;
import krause.vna.library.VNALibrary;

public class LibrarySampleRunner {

	/**
	 * Run some sample scans
	 * 
	 * @param args [0] driver name, [1] serial port
	 */
	public static void main(String[] args) {
		VNALibrary lib = null;
		VNACalibratedSampleBlock rc = null;
		try {
			lib = new VNALibrary();
			//
			lib.loadDriverByName(args[0], args[1]);
			// lib.loadDriverByName("miniVNA-pro", "COM3");
			// lib.loadDriverByName("miniVNA-pro-extender", "COM3");
			// lib.loadDriverByName("miniVNA", "COM3");

			//
			// test for reflection scan
			lib.loadCalibrationFile("C:/Users/dietmar/vnaJ.3.1/calibration/REFL_miniVNA-pro.cal");
			rc = lib.scan(1000000, 2000000, 100, "REFL");
			System.out.printf("num REFL samples read = %d\n", rc.getCalibratedSamples().length);

			//
			// test for transmission scan
			lib.loadCalibrationFile("C:/Users/dietmar/vnaJ.3.1/calibration/TRAN_miniVNA-pro.cal");
			rc = lib.scan(1000000, 2000000, 100, "TRAN");
			System.out.printf("num TRAN samples read = %d\n", rc.getCalibratedSamples().length);

			lib.loadCalibrationFile("C:/Users/dietmar/vnaJ.3.1/calibration/REFL_miniVNA-pro.cal");
			rc = lib.scan(1000000, 2000000, 1, "REFL");
			System.out.printf("num TRAN samples read = %d\n", rc.getCalibratedSamples().length);
			System.out.printf("[0] f =%d\n", rc.getCalibratedSamples()[0].getFrequency());
			System.out.printf("[0] rl=%f\n", rc.getCalibratedSamples()[0].getReflectionLoss());
			System.out.printf("[0] rp=%f\n", rc.getCalibratedSamples()[0].getReflectionPhase());

			lib.loadCalibrationFile("C:/Users/dietmar/vnaJ.3.1/calibration/TRAN_miniVNA-pro.cal");
			rc = lib.scan(1000000, 2000000, 1, "TRAN");
			System.out.printf("num TRAN samples read = %d\n", rc.getCalibratedSamples().length);
			System.out.printf("[0] f =%d\n", rc.getCalibratedSamples()[0].getFrequency());
			System.out.printf("[0] tl=%f\n", rc.getCalibratedSamples()[0].getTransmissionLoss());
			System.out.printf("[0] tp=%f\n", rc.getCalibratedSamples()[0].getTransmissionPhase());

		} catch (Exception e) {
			System.out.println("failed with " + e.getMessage());
		} finally {
			if (lib != null) {
				lib.shutdown();
			}
		}
	}
}

The calibration files must be created with the vna/J GUI. Currently only three analysers are supported

  • miniVNA
  • miniVNApro
  • miniVNAtiny

For scan mode you can set "TRAN" for transmission measurement and "REFL" for reflection measurement.

The scan data is returned in a so called VNACalibratedSampleBlock that contains the array of calibrated samples. You can get the calibrated samples using getCalibratedSamples() on the VNACalibratedSampleBlock.

Each of the returned VNACalibratedSample contains the calibrated measurement data like transmissionLoss, transmissionPhase, ...

The complete JavaDOC can be found in the "javadoc.zip" file. 

If you need more functions, please let me know.


You can buy the author a beer to support the further development of vna/J.

Please use this PayPal link.

Many thanks in advance for this donation!


You can contact me by email icon or 

2014 CW (Morse Telegraphy) was added to the German Nationwide Inventory of Intangible Cultural Heritage.

Logo