Skip to main content

general_mna/
lib.rs

1//! Modified nodal analysis (MNA) for educational circuit tools.
2//!
3//! The crate consumes the dialect-neutral AST from `general-spice-core` and builds
4//! the descriptor equation
5//!
6//! ```text
7//! A x(t) + K dx(t)/dt = B u(t)
8//! ```
9//!
10//! `A` is the memoryless matrix (often called `G`), `K` is the storage
11//! matrix (often called `C`), and `B` maps independent sources into the
12//! equation. Matrices contain [`Expression`] values so downstream Python,
13//! SymPy, JavaScript, and PDF layers can preserve component names.
14//!
15//! Every public item is documented — `cargo doc --open` is a complete
16//! reference; reading the source should never be necessary just to call
17//! this crate. Start with [`MnaBuilder`] for parsing a netlist into an
18//! [`MnaSystem`], [`average`] for converter-phase averaging, and
19//! [`block_graph`] for the signal-domain block vocabulary consumed by
20//! `dae-runtime`.
21
22#![warn(missing_docs)]
23
24mod averaging;
25pub mod block_graph;
26mod builder;
27mod expression;
28mod hierarchy;
29mod matrix;
30mod numeric;
31mod symbolic;
32mod system;
33mod system_builder;
34mod transient_source;
35
36#[cfg(feature = "python")]
37mod python;
38
39pub use averaging::{average, small_signal_duty_input, AveragingError, WeightedPhase};
40pub use builder::{BuildError, BuildOptions, MnaBuilder, SwitchState, UnsupportedElementPolicy};
41pub use expression::{EvaluationError, Expression};
42pub use matrix::Matrix;
43pub use numeric::{
44    InitialStateError, NumericMnaSystem, NumericStateSpace, StateSpaceError,
45    DEFAULT_INITIAL_STATE_TOLERANCE,
46};
47pub use symbolic::{
48    faddeev_leverrier, SymbolicStateSpace, SymbolicTransferFunction, TransferFunctionError,
49};
50pub use system::{DeviceAnnotation, InitialCondition, MnaSystem, StringMnaSystem};
51pub use system_builder::{build_system, parse_and_flatten, System};
52pub use transient_source::{PwlPoints, TransientFunction};