HIOKI 3193-10 power analyzer GPIB/USB control tools

Python driver and CLI for solar MPPT converter efficiency testing.
Features: measure, monitor, live graph, auto-ranging V/I on both
channels, efficiency calculation, display configuration, integration
control, and CSV logging with voltage/current range tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-10 17:11:50 +07:00
commit 3ed39b2ac7
10 changed files with 2687 additions and 0 deletions

195
README.md Normal file
View File

@@ -0,0 +1,195 @@
# HIOKI 3193-10 Power Analyzer Tools
GPIB/USB control tools for the HIOKI 3193-10 power analyzer, built for solar MPPT converter efficiency testing.
## Requirements
- Python 3.12+
- [uv](https://docs.astral.sh/uv/) package manager
- NI-VISA runtime (already installed if `visa32.dll` exists)
- HIOKI 3193-10 connected via USB
## Install
```bash
cd C:\dev\hioki_3193-10
uv sync
```
## Quick Start
```bash
# 1. Verify connection
uv run hioki identify
# 2. Configure for MPPT testing (Ch5=solar input, Ch6=MPPT output)
uv run hioki setup-mppt
# 3. Take a single reading
uv run hioki measure
# 4. Monitor continuously (prints to terminal)
uv run hioki monitor
# 5. Monitor with live graph
uv run hioki live
```
## Commands
### `hioki identify`
Show instrument identity, installed options, clock, wiring mode, and response speed.
### `hioki setup-mppt`
One-command setup for MPPT efficiency testing:
- Ch5: 150V, 10A, DC coupling, SLOW (solar panel input)
- Ch6: 30V, 50A, DC coupling, SLOW (MPPT converter output)
- EFF1 = P6/P5 x 100%
### `hioki measure [items...]`
Take a single measurement. Default items: `U5 I5 P5 U6 I6 P6 EFF1`
```bash
# Default (MPPT channels)
uv run hioki measure
# Custom items
uv run hioki measure U1 I1 P1 FA
# All 6 channels
uv run hioki measure U1 I1 P1 U2 I2 P2 U3 I3 P3 U4 I4 P4 U5 I5 P5 U6 I6 P6
```
### `hioki monitor [items...]`
Continuous text-based monitoring with optional CSV logging.
```bash
# Default 1-second interval
uv run hioki monitor
# Fast polling, 100 readings, save to CSV
uv run hioki monitor -i 0.5 -n 100 -o data.csv
# Monitor specific items
uv run hioki monitor P5 P6 EFF1
```
Options:
- `-i, --interval` - Seconds between readings (default: 1.0)
- `-n, --count` - Number of readings, 0 = infinite (default: 0)
- `-o, --output` - CSV output file path
### `hioki live [items...]`
Real-time graphing monitor. Opens a matplotlib window with live-updating plots grouped by type (voltage, current, power, efficiency).
```bash
# Default view
uv run hioki live
# Power and efficiency only, log to file
uv run hioki live -o test_log.csv P5 P6 EFF1
# Fast updates, shorter history
uv run hioki live -i 0.5 --history 100 U5 U6 P5 P6 EFF1
```
Options:
- `-i, --interval` - Seconds between readings (default: 1.0)
- `-o, --output` - CSV output file path
- `--history` - Max data points on graph (default: 300)
### `hioki efficiency`
Configure efficiency calculation formula.
```bash
# EFF1 = P6/P5 (default from setup-mppt)
uv run hioki efficiency --numerator P6 --denominator P5
# EFF2 for a different pair
uv run hioki efficiency -f 2 -n P4 -d P3
```
### `hioki integration <action>`
Control energy integration (Wh, Ah totals).
```bash
uv run hioki integration start # Reset and start integrating
uv run hioki integration status # Check which channels are running
uv run hioki integration stop # Stop and print Wh/Ah/time results
uv run hioki integration reset # Reset counters
```
### `hioki send <command>`
Send raw SCPI/GPIB commands. Queries (containing `?`) return the response.
```bash
uv run hioki send *IDN?
uv run hioki send :VOLTage5:RANGe?
uv run hioki send :VOLTage5:RANGe 300
uv run hioki send *RST
```
## Global Options
- `-a, --address` - VISA address (auto-detects HIOKI USB if omitted)
- `--timeout` - Communication timeout in ms (default: 5000)
## Python API
Use the driver directly in your own scripts:
```python
from hioki3193 import Hioki3193
with Hioki3193("USB0::0x03EB::0x2065::HIOKI_3193-10_140110825_V1.50::INSTR") as meter:
print(meter.idn())
# Configure
meter.set_wiring_mode("1P2W")
meter.set_coupling(5, "DC")
meter.set_voltage_range(5, 150)
meter.set_current_range(5, 10)
meter.set_coupling(6, "DC")
meter.set_voltage_range(6, 30)
meter.set_current_range(6, 50)
meter.set_response_speed("SLOW")
meter.set_efficiency(1, "P6", "P5")
# Read
result = meter.measure("U5", "I5", "P5", "U6", "I6", "P6", "EFF1")
print(f"Input: {result.values['P5']:.2f} W")
print(f"Output: {result.values['P6']:.2f} W")
print(f"Efficiency: {result.values['EFF1']:.1f}%")
```
## Measurement Items
| Code | Description | Code | Description |
|------|-------------|------|-------------|
| U1-U6 | Voltage per channel | I1-I6 | Current per channel |
| P1-P6 | Active power | S1-S6 | Apparent power |
| Q1-Q6 | Reactive power | PF1-PF6 | Power factor |
| DEG1-DEG6 | Phase angle | PK1-PK6 | Peak value |
| FA,FB,FC | Frequency | EFF1-EFF3 | Efficiency |
| U12,P12... | Sum pairs | U123,P123... | Sum triples |
| WP1-WP6 | Integrated Wh | IH1-IH6 | Integrated Ah |
| TIME | Integration elapsed time | | |
## Error Values
When reading data, these special values indicate errors:
- `+6666.6E+99` - Display blank (no data)
- `+7777.7E+99` - Scaling error (e.g., division by zero in efficiency)
- `+9999.9E+99` - Input over range
## Reference
See `GPIB_COMMAND_REFERENCE.txt` for the complete command reference extracted from the HIOKI 3193-10 manual.