pub enum DaeError {
Show 32 variants
Parse(String),
Io(String),
StopRequested,
Build(BuildError),
InitialCondition(InitialStateError),
Evaluate(EvaluationError),
Linear(SingularMatrix),
Lcp(LcpError),
UnknownDiodeInput(String),
UnknownBlockInput(String),
AlgebraicLoop {
cycle: Vec<String>,
},
CScript(CScriptError),
CScriptRequiresCloneForAdaptiveStep {
block_name: String,
},
CScriptRequiresNextSampleHitForVariableSampleTime {
block_name: String,
},
CScriptArityMismatch {
block_name: String,
declared_inputs: Option<usize>,
declared_outputs: Option<usize>,
netlist_inputs: usize,
netlist_outputs: usize,
},
PythonSupportNotCompiledIn {
block_name: String,
},
Octave(OctaveError),
OctBlockMissingRequiredFile {
block_name: String,
expected_path: PathBuf,
},
OctBlockRequiresNextSampleHitForVariableSampleTime {
block_name: String,
},
OctBlockDoesNotSupportAdaptiveStep {
block_name: String,
},
AdaptiveStepStalled {
steps_taken: usize,
t_reached: f64,
t_final: f64,
},
GateTargetNotSig2Voltage {
gate: String,
block: String,
found_kind: &'static str,
},
SourceNotSig2PhysicalConverter {
source: String,
block: String,
expected_kind: &'static str,
found_kind: &'static str,
},
Sig2PhysUsedAsCircuitNode {
block: String,
element: String,
node: String,
},
DuplicateBlockName(String),
CheckpointFormat(String),
CheckpointIo {
path: PathBuf,
message: String,
},
CheckpointDeckMismatch {
unknowns_in_checkpoint: Vec<String>,
unknowns_in_deck: Vec<String>,
},
CheckpointUnsupportedBlock {
block: String,
kind: &'static str,
},
BlockInitialConditionLength {
block: String,
expected: usize,
got: usize,
},
VectorSignalNotSupported {
block: String,
},
VectorSignalSizeMismatch {
block: String,
expected: usize,
got: usize,
},
}Variants§
Parse(String)
Parsing/hierarchy-flattening the netlist itself failed — see
general_mna::parse_and_flatten; a .subckt/X structural error (undefined
subcircuit, node-count mismatch, a recursive instantiation, …) surfaces here, distinct
from DaeError::Build’s “parsed fine, but this statement has no valid electrical
stamp” class of error.
Io(String)
A streaming on_step callback’s own I/O failed (writing a CSV/raw row straight to a
file/stream as it’s produced — see block_graph::simulate_transient_with_blocks_streamed).
Carries the formatted underlying std::io::Error as a string rather than the error type
itself, since DaeError derives PartialEq and io::Error doesn’t implement it.
StopRequested
A streaming on_step callback asked the run to end here, and not because anything
failed.
The loop treats it as the end of the run rather than as an error: it finishes the current step, leaves the loop normally and still builds the final checkpoint, so a run a rule stopped can be resumed from exactly where it stopped once the rule is adjusted. Returning any other error aborts, which loses that state – correctly, since a genuine failure leaves state nobody should continue from.
Build(BuildError)
InitialCondition(InitialStateError)
The netlist declares ic= initial conditions that could not be assigned — see
general_mna::MnaSystem::initial_state, whose own error explains the two ways that
fails: conditions that contradict each other (a loop of ic-bearing capacitors whose
declared voltages do not sum to zero), and an assignment that violates one of the
circuit’s own algebraic equations in which every unknown is already fixed by an ic=
(an ic on a capacitor across an ideal voltage source; series inductors declaring
different currents).
Evaluate(EvaluationError)
Linear(SingularMatrix)
Lcp(LcpError)
UnknownDiodeInput(String)
UnknownBlockInput(String)
A block_graph::BlockInstance’s input, or a block_graph::GateBinding, names a
block that doesn’t exist anywhere in the graph (a typo, or a genuinely undeclared name)
— declaration position is no longer a possible cause: [block_graph::topological_order]
derives each step’s evaluation order from the Signal::Block dependency graph itself, so
a block may reference another declared anywhere in the same slice, before or after it.
AlgebraicLoop
The Signal::Block dependency graph among a block_graph::BlockInstance slice
contains a genuine same-step cycle — computed once, upfront, by
[block_graph::topological_order] (a DFS-based topological sort; a cycle shows up as a
back-edge into a node still on the current recursion path) before any step is solved.
cycle is the exact closing path, block names in dependency order with the first name
repeated at the end to show the loop closing (e.g. ["A", "B", "C", "A"]); a
self-referencing block reports ["A", "A"]. Fix by inserting a Signal::BlockPrev
somewhere in the cycle — the one-sample delay that turns a same-step algebraic loop into
a legitimate sampled-data feedback path.
CScript(CScriptError)
Loading or resolving symbols in a block_graph::BlockKind::CScript’s shared library
failed — see cscript_ffi::CScriptError.
CScriptRequiresCloneForAdaptiveStep
A netlist declares a block_graph::BlockKind::CScript block whose library doesn’t
export cscript_clone, but the run was requested with TimeStep::Adaptive, which
needs to clone every block’s state before each trial step — see cscript_ffi’s own
module doc comment, “Adaptive step-size control and instance cloning.” Pass a fixed
TimeStep::Fixed instead, or add cscript_clone to the library.
CScriptRequiresNextSampleHitForVariableSampleTime
A netlist declares a block_graph::BlockKind::CScript block with ts=variable
(block_graph::SampleTimeSpec::Variable), but its library doesn’t export
cscript_next_sample_hit — the required function for a block that computes its own
schedule; see cscript_ffi’s own module doc comment, “The optional block-controlled
sample time.” Checked once, up front, the same “checked once, up front” discipline
CScriptRequiresCloneForAdaptiveStep already uses.
CScriptArityMismatch
A cscript library exported cscript_arity and what it declared does not match the
port counts the netlist declares for this block.
Only possible when the library opts in. Without the symbol, in_len/out_len are
whatever the netlist said and a disagreement is an out-of-bounds C array access — a
silent corruption rather than an error, which is the whole reason the symbol exists.
Fields
PythonSupportNotCompiledIn
A netlist declares a block_graph::BlockKind::PyBlock/[block_graph::BlockKind:: PyFunction] block, but this build of dae-runtime was compiled without the optional
python feature (which pulls in pyblock-ffi, and through it a build-time dependency
on a discoverable Python/libpython) — unconditional, unlike the two variants above,
specifically so a build without that feature can still report a clear, actionable error
instead of failing to compile at all or panicking.
Octave(OctaveError)
Spawning the shared octave-cli subprocess, adding a block_graph::BlockKind::OctFunc
block’s own .m file directory to its path, or calling into it failed — see
octave_ffi::OctaveError’s own three cases (not found on PATH, the process died, or
an ordinary Octave-side runtime error the session survives). Unlike
Self::PythonSupportNotCompiledIn, there is no “not compiled in” counterpart for this
variant — octave-ffi is an unconditional dependency of this crate (a pure subprocess
manager, never linking against Octave itself), so kind=octfunc is always available to
parse and construct; only an actually-missing octave-cli binary on PATH at runtime
surfaces here, as octave_ffi::OctaveError::NotFound.
OctBlockMissingRequiredFile
A block_graph::BlockKind::OctBlock’s own path= directory is missing one of the
.m files its declared contract requires (see that variant’s own doc comment for the
full file-per-function table) — checked once, up front at construction, the same
“checked once, up front” discipline Self::CScriptRequiresCloneForAdaptiveStep
already uses, and deliberately before ever spawning octave-cli for this block, since
the filesystem already has the answer without needing a round trip through Octave’s own
“undefined function” error.
OctBlockRequiresNextSampleHitForVariableSampleTime
A netlist declares a block_graph::BlockKind::OctBlock block with ts=variable
(block_graph::SampleTimeSpec::Variable), but <function>_next_sample_hit.m doesn’t
exist in its own path= directory — the OctBlock counterpart to
Self::CScriptRequiresNextSampleHitForVariableSampleTime/
[Self::PyBlockRequiresNextSampleHitForVariableSampleTime].
OctBlockDoesNotSupportAdaptiveStep
A netlist declares a block_graph::BlockKind::OctBlock block, but the run was
requested with TimeStep::Adaptive, which clones the whole block_states vector
before every trial step and simply discards a rejected trial’s clone (see
Self::CScriptRequiresCloneForAdaptiveStep’s own doc comment). That protocol depends
on a block’s own state living entirely inside the cloned Rust value – true for
CScript/PyBlock (an owned, independently-cloned native/Python state), but not
true for OctBlock: its own opaque per-instance state lives inside the one shared
octave-cli session itself (see [block_graph::BlockState::OctBlock]’s own doc
comment), which is never cloned, so a rejected trial’s own state-mutating calls
(output/output_xc/update) would silently persist in the real Octave-side state
with no way to roll them back. Unlike CScriptRequiresCloneForAdaptiveStep (opt-in,
satisfiable by exporting cscript_clone), this restriction is unconditional – there is
no .m-file convention that could make Octave’s own shared global-struct state
trial-cloneable. Use a fixed TimeStep::Fixed for any netlist using kind=octblock.
AdaptiveStepStalled
TimeStep::Adaptive took more than ADAPTIVE_STEP_HARD_CAP accepted steps without
reaching t_final — a hard safety ceiling, not a normal error a well-behaved run should
ever hit. Exists because the adaptive loop accumulates one row per accepted step into an
in-memory trace with no other bound, and a genuinely stalled step controller (e.g. a
near-zero-dt loop that never makes real forward progress — the exact class of bug
next_pwm_edge_dt’s own THETA_EPS guards against, see its doc comment) would otherwise
grow that trace without limit until the process — and, on the real run that first hit
this, the whole machine — ran out of memory. steps_taken is how many were accepted
before the cap tripped; t_reached/t_final show how far the run actually got.
GateTargetNotSig2Voltage
A block_graph::GateBinding names a block that exists but isn’t a domain=voltage
block_graph::BlockKind::Sig2Phys — the enforced physical/signal-domain boundary:
an ideal switch’s gate is itself a voltage, so any signal driving it must first pass through
the same domain=voltage Sig2Phys converter a V-source’s own magnitude uses, never a
raw Pid/Vco/Hysteresis/etc. block directly, and never a domain=current Sig2Phys
either. gate is the ideal switch this binding belongs to; block and found_kind name
the offending target and (for a human-readable message) what it actually is.
SourceNotSig2PhysicalConverter
An independent V/I source’s own literal value in the netlist is a bare symbol that
names a declared block, but that block isn’t a block_graph::BlockKind::Sig2Phys of
the matching domain (V needs domain=voltage, I needs domain=current) — the
enforced Signal-to-PS boundary for driving a source’s own magnitude from the block graph.
Sig2PhysUsedAsCircuitNode
A block_graph::BlockKind::Sig2Phys converter’s own name is also used as an ordinary
circuit node on an element line — i.e. the converter was wired into the physical
network instead of being referenced by name from the one place that can consume it.
A kind=sig2phys block has no terminals and stamps nothing into the MNA system; it is
purely a named Signal-to-PS value another statement substitutes. So a net that happens to
share its name is just an ordinary, otherwise-undriven node: its KCL row is solved
consistently at 0 (a resistor to ground is a perfectly non-singular
G·v = 0) and the run silently reports V(<name>) = 0 next to the block’s own,
correct, non-zero output column. That silent wrong answer is exactly what this variant
exists to turn into a build-time error, before any step is solved.
The two legitimate ways to consume a Sig2Phys are both by name, never by wire:
an independent V/I source’s own value field (V1 a 0 VDRV, see
DaeError::SourceNotSig2PhysicalConverter) and an ideal switch’s gate=/ctrl= field
(see DaeError::GateTargetNotSig2Voltage).
block is the converter as declared, element the first element line that wires it, and
node that element’s node token as written. Node names are matched case-insensitively,
matching how the netlist grammar itself treats them (A and a are one node).
DuplicateBlockName(String)
Two blocks in the same slice resolve to the same name — either two
block_graph::BlockInstances declared with the same .name, or one block’s own
extra output_names entry (a block_graph::BlockKind::CScript/CoordinateTransform/
Pmsm/Pwm/PhaseShiftPwm’s secondary output alias) colliding with another block’s
name. Without this check, block_index_by_name’s BTreeMap::insert would silently let
the later one win, so a Signal::Block(name) reference would silently resolve to the
wrong block instead of failing loudly.
CheckpointFormat(String)
A checkpoint file is not one, or is a version this build does not read — see
checkpoint’s own module doc comment for the format.
CheckpointIo
Reading or writing a checkpoint file failed.
CheckpointDeckMismatch
A checkpoint was loaded into a deck it was not taken from: a different netlist, block
list, device model, or unknown ordering. unknowns_in_checkpoint versus the deck’s own
unknowns is reported to make the usual cause (an edited netlist) visible at a glance.
CheckpointUnsupportedBlock
A block whose state this crate cannot read is in a run being checkpointed: a cscript
whose library exports none of the cscript_state_size/_write/_read triple (its
state is an opaque C heap object only that library can lay out). Refused whole, never
written partially. See checkpoint’s own module doc comment.
BlockInitialConditionLength
A hand-built block_graph::BlockInstance carries an ic whose length is not its
block’s own state count. Unreachable from a netlist — general-mna checks the same thing
at parse time, with a line number — so this only guards callers that construct blocks
directly.
VectorSignalNotSupported
A block_graph::BlockKind that requires a SignalValue::Scalar input (or a specific
operand shape, e.g. Sum/Product’s “all-scalar or all-vector, never mixed” rule, or a
matrix Gain’s own required vector length) received a SignalValue::Vector it can’t
accept — the default, fail-closed rule for any block kind without an elementwise/
broadcast rule of its own. See book/dev-guide/src/vector-signals.md for exactly which
block kinds accept a Vector and under what rule.
VectorSignalSizeMismatch
Two (or more) SignalValue::Vectors feeding the same block disagree in length (e.g.
Sum’s own inputs, MathFn2’s two operands), or a Vector’s own length doesn’t match
a fixed arity the block itself declares (a matrix Gain’s own column count, a
StateSpace’s own declared input count).