Skip to main content

pwl_devices/
lib.rs

1//! Piecewise-linear device companion models.
2//!
3//! Each device exposes a Chua-Lin canonical decomposition of its I-V curve into a reference
4//! linear term plus `max(0, ...)` terms at each breakpoint. Those `max(0, ...)` terms are
5//! exactly the `z` variables of a Linear Complementarity Problem (solved by `lcp-solver`) that
6//! picks out, per timestep, which segment of every PWL device in a circuit is active — this is
7//! what replaces Newton-Raphson + voltage limiting. See `docs/architecture.md` in this
8//! repository for the full derivation.
9//!
10//! This crate only defines device *curves* (pure functions of a device's own terminal
11//! voltage/current); folding a set of devices into a whole circuit's `(M, q)` LCP is
12//! `dae-runtime`'s job (a later milestone). See `tests/two_ideal_diode_circuit.rs` for a
13//! hand-worked example of that folding done manually, as the first end-to-end proof this
14//! approach works.
15
16mod ideal_diode;
17mod ideal_switch;
18
19pub use ideal_diode::{IdealDiode, IdealDiodeCanonical};
20pub use ideal_switch::IdealSwitch;