Add README and fix sweep reliability
- Add comprehensive README with wiring diagram, CLI reference, and examples - Fix supply VISA timeout during sweeps: read supply/load before meter wait, add retry wrapper for instrument queries, keepalive ping during auto-range - Fix load_setpoint not recorded in voltage sweep CSV - Add load current sweep command (sweep-load) - Increase HIOKI auto-range wait to 30 retries x 2s Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
200
README.md
Normal file
200
README.md
Normal file
@@ -0,0 +1,200 @@
|
||||
# MPPT Testbench
|
||||
|
||||
Unified CLI tool for testing MPPT (Maximum Power Point Tracking) converters using three coordinated instruments:
|
||||
|
||||
| Instrument | Role | Interface |
|
||||
|---|---|---|
|
||||
| **ITECH IT6500D** | DC power supply (solar panel simulator) | USB-TMC / SCPI via PyVISA |
|
||||
| **Prodigit 3366G** | DC electronic load (600V/420A/6kW) | RS-232 (115200 8N1 RTS/CTS) |
|
||||
| **HIOKI 3193-10** | Power analyzer (efficiency measurement) | GPIB via UsbGpib / PyVISA |
|
||||
|
||||
## Wiring
|
||||
|
||||
```
|
||||
┌──────────────────┐
|
||||
IT6500D ──(+/-)──> │ MPPT Tracker │ ──(+/-)──> Prodigit 3366G
|
||||
│ (DUT) │
|
||||
HIOKI Ch5 ──(sense)── │ Input Output │ ──(sense)── HIOKI Ch6
|
||||
└──────────────────┘
|
||||
|
||||
HIOKI EFF1 = P6 / P5 x 100% (output power / input power)
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Requires Python 3.12+, NI-VISA runtime, and `uv`.
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://git.b4l.co.th/B4L/mppt-testbench.git
|
||||
cd mppt-testbench
|
||||
uv venv
|
||||
uv pip install -e .
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# 1. Check all instruments are connected
|
||||
mppt identify
|
||||
|
||||
# 2. Configure everything for MPPT testing
|
||||
# (sets wiring, coupling, auto-range, efficiency formula, display)
|
||||
mppt setup
|
||||
|
||||
# 3. Take a single reading from all instruments
|
||||
mppt measure
|
||||
|
||||
# 4. Continuous monitoring with CSV export
|
||||
mppt monitor --interval 1.0 --output data.csv
|
||||
|
||||
# 5. Live real-time graph (Power, Efficiency, Voltage, Current)
|
||||
mppt live --interval 0.5
|
||||
```
|
||||
|
||||
## Sweep Commands
|
||||
|
||||
### Voltage Sweep
|
||||
|
||||
Sweep supply voltage across a range while the load is held constant. Records efficiency at each point.
|
||||
|
||||
```bash
|
||||
mppt sweep \
|
||||
--v-start 30 --v-stop 100 --v-step 5 \
|
||||
--current-limit 10 \
|
||||
--load-mode CC --load-value 3.0 \
|
||||
--settle 2.0 \
|
||||
-o voltage_sweep.csv
|
||||
```
|
||||
|
||||
After the sweep, the supply returns to 75V and stays ON.
|
||||
|
||||
### Load Current Sweep
|
||||
|
||||
Sweep load current (CC mode) at a fixed supply voltage.
|
||||
|
||||
```bash
|
||||
mppt sweep-load \
|
||||
--voltage 75 --current-limit 10 \
|
||||
--i-start 0.5 --i-stop 8 --i-step 0.5 \
|
||||
--settle 2.0 \
|
||||
-o load_sweep.csv
|
||||
```
|
||||
|
||||
After the sweep, the load turns OFF and the supply returns to 75V (stays ON).
|
||||
|
||||
### Auto-Range Handling
|
||||
|
||||
The HIOKI 3193-10 returns special error values (`+9999.9E+99`) while auto-ranging. The testbench automatically waits for all measurement channels to settle before recording each sweep point. The supply is kept alive with periodic queries during the wait to prevent USB-TMC timeouts.
|
||||
|
||||
## Direct Instrument Control
|
||||
|
||||
```bash
|
||||
# Supply
|
||||
mppt supply set --voltage 48 --current 10
|
||||
mppt supply on
|
||||
mppt supply off
|
||||
|
||||
# Load
|
||||
mppt load set --mode CC --value 5.0
|
||||
mppt load set --mode CR --value 10.0
|
||||
mppt load on
|
||||
mppt load off
|
||||
|
||||
# Emergency shutdown (load first, then supply)
|
||||
mppt safe-off
|
||||
```
|
||||
|
||||
## Efficiency Measurement
|
||||
|
||||
Measure averaged efficiency at a fixed operating point:
|
||||
|
||||
```bash
|
||||
mppt efficiency \
|
||||
--voltage 75 --current-limit 10 \
|
||||
--load-mode CC --load-value 3.0 \
|
||||
--samples 10 --settle 3.0
|
||||
```
|
||||
|
||||
## CLI Reference
|
||||
|
||||
```
|
||||
mppt [-h] [--supply-address ADDR] [--load-port PORT] [--load-baud BAUD]
|
||||
[--meter-address ADDR] [--timeout MS]
|
||||
{identify,setup,measure,monitor,live,sweep,sweep-load,efficiency,
|
||||
supply,load,safe-off}
|
||||
```
|
||||
|
||||
| Command | Description |
|
||||
|---|---|
|
||||
| `identify` | Show identity and status of all instruments |
|
||||
| `setup` | Configure all instruments for MPPT testing |
|
||||
| `measure` | Single measurement from all three instruments |
|
||||
| `monitor` | Continuous text monitoring with optional CSV |
|
||||
| `live` | Real-time 4-panel matplotlib graph |
|
||||
| `sweep` | Voltage sweep with efficiency recording |
|
||||
| `sweep-load` | Load current sweep at fixed voltage |
|
||||
| `efficiency` | Averaged efficiency at a fixed operating point |
|
||||
| `supply` | Direct IT6500D control (on/off/set) |
|
||||
| `load` | Direct Prodigit 3366G control (on/off/set) |
|
||||
| `safe-off` | Emergency shutdown (load first, then supply) |
|
||||
|
||||
### Global Options
|
||||
|
||||
| Option | Default | Description |
|
||||
|---|---|---|
|
||||
| `--supply-address` | auto-detect | IT6500D VISA address |
|
||||
| `--load-port` | `COM1` | Prodigit 3366G serial port |
|
||||
| `--load-baud` | `115200` | Prodigit 3366G baud rate |
|
||||
| `--meter-address` | auto-detect | HIOKI 3193-10 VISA address |
|
||||
| `--timeout` | `5000` | VISA timeout in milliseconds |
|
||||
|
||||
## CSV Output Format
|
||||
|
||||
Sweep CSV files contain the following columns:
|
||||
|
||||
| Column | Description |
|
||||
|---|---|
|
||||
| `voltage_set` | Supply voltage setpoint (V) |
|
||||
| `current_limit` | Supply current limit (A) |
|
||||
| `load_setpoint` | Load setpoint value (A for CC mode) |
|
||||
| `supply_V/I/P` | Supply measured voltage, current, power |
|
||||
| `load_V/I/P` | Load measured voltage, current, power |
|
||||
| `input_power` | HIOKI P5 -- power into MPPT tracker (W) |
|
||||
| `output_power` | HIOKI P6 -- power out of MPPT tracker (W) |
|
||||
| `efficiency` | HIOKI EFF1 -- P6/P5 x 100 (%) |
|
||||
|
||||
## Setup Details
|
||||
|
||||
`mppt setup` configures the instruments as follows:
|
||||
|
||||
- **Supply**: Remote control mode
|
||||
- **Load**: Remote control mode
|
||||
- **Meter**:
|
||||
- Wiring: 1P2W
|
||||
- Ch5 (solar input): DC coupling, voltage and current auto-range
|
||||
- Ch6 (MPPT output): DC coupling, voltage and current auto-range
|
||||
- Response speed: SLOW (best accuracy)
|
||||
- EFF1 = P6 / P5 (output / input)
|
||||
- Display: 16-item SELECT view -- U5, I5, P5, EFF1 (left) | U6, I6, P6 (right)
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
mppt-testbench/
|
||||
├── IT6500D/ git submodule - DC power supply driver
|
||||
├── PRODIGIT-3366G/ git submodule - electronic load driver
|
||||
├── HIOKI-3193-10/ git submodule - power analyzer driver
|
||||
├── testbench/
|
||||
│ ├── __init__.py exports MPPTTestbench
|
||||
│ ├── bench.py orchestrator (sweeps, measurement, auto-range wait)
|
||||
│ └── cli.py unified CLI entry point
|
||||
└── pyproject.toml package config, entry point: mppt
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
- Python >= 3.12
|
||||
- [PyVISA](https://pyvisa.readthedocs.io/) + [pyvisa-py](https://pyvisa.readthedocs.io/projects/pyvisa-py/)
|
||||
- [pyserial](https://pyserial.readthedocs.io/)
|
||||
- [matplotlib](https://matplotlib.org/)
|
||||
- NI-VISA runtime (for GPIB/USB-TMC communication)
|
||||
@@ -2,6 +2,7 @@
|
||||
name = "mppt-testbench"
|
||||
version = "0.1.0"
|
||||
description = "MPPT tracker testbench: IT6500D (solar sim) + Prodigit 3366G (load) + HIOKI 3193-10 (power analyzer)"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"matplotlib>=3.10.8",
|
||||
|
||||
Reference in New Issue
Block a user