absscpi¶
The absscpi library provides a fully-featured Python driver for the Bloomy Controls ABS over TCP, UDP, RS-485, and UDP multicast. This library is a wrapper around the native C/C++ SCPI driver for the ABS to avoid unnecessary Python performance overhead.
A simple example showing how to connect to an ABS over UDP and control and measure one cell:
1#!/usr/bin/env python
2
3"""Shows how to control and measure a single cell."""
4
5from absscpi import ScpiClient
6from time import sleep
7import sys
8
9def single_cell_demo(ip: str):
10 """Demonstrates controlling and measuring a single ABS cell.
11
12 Args:
13 ip: The IP address of the ABS.
14 """
15 with ScpiClient() as client:
16 client.open_udp(ip)
17
18 # command cell 0 to 1.5 volts with sourcing and sinking current limits
19 # of 5A each
20 client.set_cell_voltage(0, 1.5)
21 client.set_cell_sourcing(0, 5)
22 client.set_cell_sinking(0, 5)
23
24 # enable the cell
25 client.enable_cell(0, True)
26
27 # give the cell a little time to settle
28 sleep(0.05)
29
30 vmeas = client.measure_cell_voltage(0)
31 imeas = client.measure_cell_current(0)
32
33 print(f"measured: {vmeas:.4f}V at {imeas:.4f}A")
34
35 # disable the cell
36 client.enable_cell(0, False)
37
38if __name__ == "__main__":
39 if len(sys.argv) != 2:
40 print(f"usage: {sys.argv[0]} IP", file=sys.stderr)
41 exit(1)
42
43 single_cell_demo(sys.argv[1])
Known Bugs¶
See the bug tracker on GitHub. Contributions welcome!
Documentation generated
Oct 30, 2024