17 Commits

Author SHA1 Message Date
903fa78585 Add tune-param-vsweep command for parameter sweeps across voltage range
Automates running tune-param at multiple voltages, saves per-voltage
CSVs compatible with plot-tune, and prints a summary table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 15:51:59 +07:00
ce493204cb Add plot-tune command for multi-voltage parameter sweep analysis
Overlays efficiency curves from multiple CSV files (one per voltage),
finds per-voltage best and overall sweetspot (best average across all
voltages), and generates efficiency overlay, heatmap, and loss plots.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:40:42 +07:00
657ff27845 Rename CLI entry points from mppt/mppt-gui to bench/bench-gui
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 19:46:38 +07:00
1c41910c1e Add STM32 tuning integration and rewrite README with step-by-step guide
- stm32_link.py: synchronous serial interface to STM32 debug protocol
  (ping, telemetry read/avg, param read/write, frame parser)
- tuner.py: automated tuning combining HIOKI + STM32 measurements
  (param sweep, deadtime optimization, multi-point sweep, CSV/plot output)
- CLI commands: stm32-read, stm32-write, tune-param, tune-deadtime
- README: complete step-by-step guide covering setup, sweeps, analysis,
  tuning, shade profiles, debug console, and parameter reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 16:52:09 +07:00
e7a23a3c7e Add LVSolarBuck64 firmware and debug console with uv support
STM32G474RB firmware for solar buck converter with MPPT, CC control,
Vfly compensation, and adaptive deadtime. Includes Textual TUI debug
console for real-time telemetry, parameter tuning, and SQLite logging.

Added pyproject.toml for uv: `cd code64 && uv run debug-console`

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 16:38:23 +07:00
3f65b5f2f2 Add plot-sweep command, degauss buttons, sweep ramp-down, and time estimate
- Add offline `plot-sweep` CLI command: generates efficiency overlay,
  heatmap, and power loss plots from sweep CSV (no instruments needed)
- Add degauss buttons to CH5/CH6 in GUI (sends :DEMAg SCPI command)
- Gradual load ramp-down at end of 2D sweep to avoid transients
- Live sweep time estimate in GUI based on grid size × settle time
- Update HIOKI submodule to include degauss CLI command

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 16:31:33 +07:00
5fe2ec4556 Fix VOLTage:RANGe? timeout and EFF overflow blocking sweeps
- Wrap get_voltage_range() in try/except since VOLTage:RANGe? is not
  supported on IT6537D — skip range check gracefully if unavailable
- Exclude derived EFF* values from auto-range error threshold check
  in _wait_meter_ready(), as efficiency overflows at near-zero power

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:06:13 +07:00
04191259d6 Fix VISA timeout in 2D sweep: join worker thread before starting sweep
The worker thread was signaled to stop but never joined, causing bus
collisions when the sweep thread started talking to instruments while
the worker was still mid-query. Now:

- worker.join(timeout=10) before sweep starts
- 0.5s delay + clear supply error queue before first command
- join sweep thread before restarting worker after sweep completes
- Also join worker on disconnect

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:11:55 +07:00
a0795302a9 Add CP mode sanity check: validate current limit vs power at min voltage
CP=500W at V=50V needs 10A on the load side — if the supply I_limit
is only 20A and the MPPT has conversion losses, this can cause the
supply to current-limit and timeout. The check now catches this upfront:

  CP check: 500W / 50V = 10.0A (limit 20.0A) OK

Also raises ValueError if the worst-case current exceeds the limit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:06:48 +07:00
3f46029204 Fix NameError in sweep error handler lambda
Python 3.13 deletes exception variables after the except block.
Capture the error string before passing to the lambda.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:02:16 +07:00
aced4f1e23 Add CP load mode to 2D sweep and supply sanity checks
- 2D sweep now supports CC (constant current) and CP (constant power)
  load modes via --load-mode flag (CLI) and combobox (GUI)
- Supply capability check before all sweeps: validates max voltage
  against supply range and prints V/I/P summary
- Renamed sweep-vi args from --i-start/stop/step to --l-start/stop/step
  to reflect that the load setpoint can be current or power
- GUI labels update dynamically based on selected load mode

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:57:44 +07:00
05f23d6417 Add HIOKI channel range controls and live range display
- GUI: voltage/current range selectors for Ch5 and Ch6 with AUTO option
- Worker: queries current V/I ranges each poll cycle, pushes to GUI
- Setting a fixed range automatically disables auto-range for that channel
- Live display shows current range values below each channel's readout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:30:10 +07:00
956be4b77a Add shade profiles, 2D V×I sweep, meter format toggle, ON/OFF indicators, and GUI console
- Shade profile: CSV-driven irradiance/voltage sequences with load control
  (bench.run_shade_profile, CLI shade-profile command, GUI profile panel)
- 2D sweep: voltage × load current efficiency map with live graph updates
  (bench.sweep_vi, CLI sweep-vi command, GUI sweep panel with background thread)
- GUI: meter format selector (scientific/normal), supply/load ON/OFF indicators,
  console log with stdout redirect and color-coded messages
- Sample profiles: cloud_pass, partial_shade, intermittent_clouds

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:27:48 +07:00
74917e05f2 Arrange GUI controls in two columns: supply+load (left), meter (right)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:49:29 +07:00
e2be7109b7 Add GUI control panel with live measurements and full instrument control
New `mppt-gui` command launches a tkinter app with:
- Live numeric readouts for all 13 measurement channels
- 4-panel real-time matplotlib graphs (power, efficiency, voltage, current)
- Full supply control: voltage, current, OVP, slew, output on/off
- Full load control: mode (CC/CR/CV/CP), setpoint, slew, load on/off
- Meter settings: wiring mode, response speed, coupling per channel
- CSV data logging with start/stop control
- Red SAFE OFF button (also Escape key) bypasses command queue
- Threaded architecture: instrument I/O never blocks the GUI
- Fix apply() silently failing: use set_current + set_voltage instead

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:42:07 +07:00
c50c09a148 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>
2026-03-11 13:21:09 +07:00
e55caa59b1 Initial MPPT testbench: unified CLI for IT6500D + Prodigit 3366G + HIOKI 3193-10
Combines three instrument drivers (as git submodules) into a single
testbench for MPPT tracker efficiency testing. Features:
- Voltage sweep and load current sweep with CSV export
- Auto-range aware meter polling (waits for HIOKI to settle)
- Supply keepalive during long meter waits to prevent USB-TMC timeouts
- Live monitoring with real-time 4-panel matplotlib graphs
- Safe shutdown (load first, then supply)
- Post-sweep returns to 75V idle with supply ON

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:19:18 +07:00