Resources:
Packages Required:
- pyvisa
- pyvisa-py
- pyusb
Helpful Commands in Terminal Emulator with access to the Python interpreter:
- pyvisa-info
- pyvisa-shell
Confirmed to work with:
- BK Precision 9801
- Keysight EDUX1052A
On Linux, you may come across a udev
issue, preventing you from having permissions to communicate with the device. The solution can be found here.
Installation and setup for the program goes as follows (installing on Pop!_OS):
- Install Julia with apt:
sudo apt install julia
- Enter the Julia REPL:
julia
- Enter the package subspace:
]
- Add the Julia packages:
add Conda PyCall DataFrames ArgParse CSV Plots
- Go back to the Julia REPL and set the Python environment to Julia's internal Python:
ENV["PYTHON"]=""
- Rebuild PyCall in the package subspace:
]build PyCall
- Back in the Julia REPL, use Conda:
using Conda
- Add pyvisa-py and dependancies to the environment:
Conda.add("pyvisa-py")
- Exit the Julia REPL:
exit()
- Change
udev
permissions, if not done already, and then reboot:sudo echo 'SUBSYSTEM=="usb", MODE="0666", GROUP="usbusers"' >> /etc/udev/rules.d/99-com.rules
Virtual Instrument Software Architecture (VISA) in the standardized protocol for connecting to test instruments. The IVI Foundation maintains the standard drivers.
Standard Commands for Programmable Instruments (SCPI) is a standardized set of commands to program test instruments. IEEE defined the standard syntax and commands for programming test instruments.
Recognizing your USBTMC connection is critical, especially if you have multiple VISA devices connected. An example USBTMC connection is USB0::65535::38912::802XXXXXXX::0::INSTR
In the pyvisa-shell, one can open an USB connection and query the instrument's product information (manufacturer, model number, serial number, and firmware revision number) with the following command:
query *IDN?
Within the pyvisa-shell, one can run the following:
query MEAS:VOLT?;:MEAS:FREQ?;:MEAS:POW:REAL?;:MEAS:POW:APP?
This line breaks down output into the Output Voltage, Frequency, Real Power and Apparent Power.
Within the pyvisa-shell, one can do the following:
query MEAS:VRMS? DISP,AC,CHAN1
This line outputs the AC RMS Voltage within the DISPlay window and from CHANnel 1.
The Device Under Test (DUT) will connect to the AC-out of the AC Power Source which should have the following requirements fulfilled:
True RMS Voltage | 115V ± 1% |
Frequency | 60Hz ± 1% |
Total Harmonic Distortion (THD) | <2% for PSU <1,500W ; <5% for PSU >1,500W |
The THD (%) is calculated as the root-sum-square (RSS) of the harmonic voltages divided by the fundamental voltage:
Importance of True RMS measurements can be explained here.
This Julia program is used to query, plot and save data from the BK Precision 9801 AC Power Source used for power testing/monitor.
The inputs are as follows:
usage: 9801 Logger [-c] [-g] [-t TITLE] [-o CSV-NAME]
[-p POLLING-RATE] [-r RUN-TIME] [--pretty] [-h]
Connect to BK precision power supply and log recordings in both GUI
and CSV
optional arguments:
-c, --no-csv Skip saving output to a csv file
-g, --no-gui Do not create a GUI ouput. Information will be
printed via CLI.
-t, --title TITLE Set a super title for the gui graph output
-o, -n, --csv-name CSV-NAME
The name given to the generated csv output.
-p, --polling-rate POLLING-RATE
The rate the 9801 is polled in Hertz (Hz).
Also increases gui update rate and output
lines output to csv. Too high of a value can
waste memory and cause race conditions. No
higher than 10 is recommended. Must be evenly
divisible into 1 second (1, 2, 5 or 10).
(type: Int64, default: 2)
-r, --run-time RUN-TIME
The length of time the test will run in
seconds. This may be adjusted automatically to
match the polling rate. (type: Int64, default:
330)
--pretty Make the graph theme dark
-h, --help show this help message and exit
Example command in the terminal that creates the plot's supertitle "2022/07/27 MEER5 Power Off", outputs the data to "20220727_MEER5FNH_Off.csv", and has a polling rate of 10Hz:
julia 9801-logger.jl -t "2022/07/27 MEER5 Power Off" -o "20220727_MEER5FNH_Off.csv" -p 10