Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛜⚡ WPT Lab

License: MIT Python 3.13+ PySide6 Version

Wireless Power Transfer Simulation & Analysis

An engineering laboratory for resonant inductive wireless power transfer: a typed, testable phasor simulation engine paired with an interactive desktop UI. Built to answer the questions that show up early in WPT design—How much power transfers at this frequency and coupling? Where are the resonance features? What happens if the receiver moves?—without pretending to be a full EM field solver or switched-circuit simulator.

✨ Why this project exists

Real WPT work usually jumps between spreadsheets, SPICE, and expensive FEM tools. Those are all valuable, but they leave a gap for fast, inspectable system-level exploration where the model is honest about its limits.

WPT Lab fills that gap. The core is a first-harmonic (FHA) coupled-coil solver with clear assumptions, SI units, and no GUI dependency—so the same physics that drives the desktop app can be scripted, tested, and reused. The UI is a laboratory, not a black box: you edit parameters, watch operating points update, run sweeps and a PID frequency controller, and export results.

What a technical reviewer should notice:

  • Separation of concernswpt_lab.core is pure numerical / domain logic; wpt_lab.app only edits parameters and displays results
  • Engineering honesty — filament coupling, Biot–Savart field views, and algebraic control plants are labelled as such; infeasible optimizer constraints are reported, not faked
  • Software craft — Pydantic parameter trees, cooperative background jobs, project save/load, and a pytest suite covering analytical SS cases and regressions
Included Not included
FHA coupled-coil steady-state (SS / SP / PS / PP / LCC-S) Switched time-domain inverter or rectifier waveforms
Frequency and parameter sweeps; SciPy SLSQP optimizer Maxwell / FEM magnetics
Filament Biot–Savart field map (educational) CFD thermal simulation
Algebraic-plant PID frequency control Switching-period control transients
PySide6 GUI and headless Python API Inflated accuracy claims

Internal quantities use SI units. The UI presents engineering units (mm, kHz, µH, nF).

🚀 Features

  • Steady-state FHA solver with loss breakdown and lumped thermal RC
  • Compensation: series–series (primary path), SP / PS / PP, LCC-S; LCC-LCC rejected until modelled
  • Coupling via user $k$ or filament geometry estimate ($M = k\sqrt{L_1 L_2}$)
  • Frequency sweeps, 1-D / 2-D parameter grids, constrained optimizer with honest infeasibility reporting
  • Control lab: discrete PID on switching frequency; geometry movement disturbances
  • Desktop UI: parameter forms, experiment sliders, coil views, field map, FHA waveform reconstruction
  • .wptlab JSON projects; CSV and summary export
  • Background worker for sweeps, optimizer, and control (progress; Escape to cancel)

🏗️ Architecture

flowchart LR
  subgraph UI["wpt_lab.app (PySide6)"]
    MW[MainWindow]
    Sess[SimulationSession]
    Jobs[JobController / QThread]
    MW --> Sess
    Sess --> Jobs
  end
  subgraph Core["wpt_lab.core (no Qt)"]
    Models[models / Pydantic SI params]
    Phys[physics]
    Solve[solvers]
    Opt[optimization]
    Models --> Phys --> Solve
    Solve --> Opt
  end
  Sess -->|solve / apply| Solve
  Jobs -->|deep-copied params| Solve
  Jobs --> Opt
Loading
Layer Role
wpt_lab.core.models Typed SI parameters (WPTSystemParameters)
wpt_lab.core.physics Coils, coupling, two-port Z, power, losses, thermal, field
wpt_lab.core.solvers Steady-state, frequency sweep, PID control
wpt_lab.core.optimization 1-D / 2-D sweeps, SciPy SLSQP
wpt_lab.app GUI edits parameters and displays results only

Further detail: docs/.

🧠 Theory

The tank is driven by the first harmonic of the inverter waveform (FHA). Coils are treated as lumped impedances, mutual inductance follows the usual coupling definition, and a diode bridge with a large capacitive filter is replaced by its classic FHA equivalent resistance:

$$ Z_L = R + j\omega L,\qquad M = k\sqrt{L_1 L_2},\qquad R_{\mathrm{eq}} = \frac{8}{\pi^2} R_{\mathrm{dc}} $$

flowchart TB
  Vdc[DC supply] --> Inv[Inverter FHA V1]
  Inv --> Comp[Compensation Z-network]
  Comp --> TX[TX coil L1 R1]
  TX -.->|M = k√L1L2| RX[RX coil L2 R2]
  RX --> Rec[Rectifier FHA Req]
  Rec --> Load[DC load]
Loading
Model What it is What it is not
Inverter First-harmonic RMS phasor Switched time-domain circuit
Coils Lumped $R + j\omega L$; Mohan spiral if $L$ omitted 3-D electromagnetic coil model
Coupling $M = k\sqrt{L_1 L_2}$; optional coaxial-filament $k$ FEM / Maxwell solver
Magnetic field view Filament Biot–Savart loops FEM field solution
Rectifier FHA $R_{\mathrm{eq}} = 8 R_{\mathrm{dc}} / \pi^2$ Switched diode-bridge simulation
Thermal Lumped $T = T_{\mathrm{amb}} + P R_{\mathrm{th}}$ and RC CFD
Control Algebraic plant + discrete PID on frequency Switching-period transient

See docs/theory.md for the full derivation notes and limitations.

📦 Installation

Requires Python 3.13+ (syntax remains largely 3.11-compatible).

git clone https://github.com/TeslaNeuro/WPT-Lab.git
cd WPT-Lab
python3 -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install -e ".[dev]"

On macOS, wpt_lab.app.main clears a known Qt cocoa-plugin hidden-file flag before QApplication starts so the desktop UI launches under common python.org + pip layouts.

⚡ Quick start

Desktop laboratory

python -m wpt_lab.app
# or
wpt-lab

Left: system / lab / analysis navigation. Centre: editors and plots. Right: live results. Presets, projects, and export are on the menu and toolbar. Experiment sliders update the operating point live; sweeps and the optimizer run on a worker thread.

Command-line 100 W demo

python -m wpt_lab.examples.basic_100w
# or
wpt-lab-demo

Engine API

from wpt_lab.core.presets import system_100w
from wpt_lab.core.solvers import solve_steady_state, sweep_frequency
from wpt_lab.core.solvers.control import simulate_frequency_control
from wpt_lab.core.optimization import sweep_parameter, optimize_system
from wpt_lab.core.project import save_project, load_project

params = system_100w()
result = solve_steady_state(params)
print(result.output_power_w, result.efficiency)

sweep = sweep_frequency(params)
save_project(params, "case.wptlab")

📚 Documentation

Document Contents
docs/README.md Documentation index
docs/architecture.md Package layout, data flow, design rules
docs/theory.md FHA, coupling, compensation, thermal, control
docs/gui.md Session, workers, units, projects
docs/extending.md Adding topologies, models, and UI pages

🧪 Testing

pytest -q

Coverage includes analytical series–series cases, coupling estimators, sweeps, optimizer constraint reporting, control, projects, and LCC-S power balance.

Optional (if Ruff is installed):

ruff check wpt_lab tests

🗂️ Repository layout

wpt_lab/
  core/models/          parameters (SI, Pydantic)
  core/physics/         coils, coupling, impedance, power, losses, field
  core/solvers/         steady-state, frequency sweep, PID control
  core/optimization/    1-D / 2-D sweeps, SciPy optimizer
  core/project.py       .wptlab JSON
  app/                  PySide6 GUI (calls the engine only)
  visualization/        Matplotlib helpers (headless)
  examples/
docs/
tests/

📄 License

Released under the MIT License.

Copyright © 2026 Arshia Keshvari (@TeslaNeuro).

👤 Author

Arshia Keshvari (@TeslaNeuro)

Built as a serious engineering / teaching laboratory for resonant inductive WPT— clean architecture, documented physics assumptions, and a UI that does not oversell the model.

About

Wireless Power Transfer Simulation & Analysis using PyQT & Matplotlib

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages