Skip to content

Unified Circuit DSL

velo-circuit and velo-spectroz share the same Boukamp-compatible element vocabulary (11 kinds). velo-circuit owns editing, validation, serialization, and rendering; velo-spectroz owns numerical impedance, fitting, and validation against experimental data.

Grammar

text
circuit   ::= element | series | parallel
series    ::= circuit "-" circuit
parallel  ::= "p(" circuit ("," circuit)+ ")"
element   ::= CODE ID param_block?
param_block ::= "{" number ("," number)* "}" | "[" number ("," number)* "]"
CODE      ::= "Pdw" | "Ws" | "Wo" | "CC" | "HN" | "R" | "C" | "L" | "Q" | "W" | "G"

Elements

CodeLabelShort params
RResistorR
CCapacitorC
LInductorL
QCPEQ₀, n
WWarburg (infinite)σ
WsWarburg (short)Y₀, B
WoWarburg (open)Y₀, B
GGerischerY₀, K
PdwParallel Diffusion WarburgD1, D2, θ, Λ
CCCole-ColeR, τ, α
HNHavriliak-NegamiR, τ, α, β

Parameter titles and units match ELEMENT_KINDS in both projects.

Parameter embedding

text
R0{50}-Q1{5e-5,0.8}
G0{1e-3,0.1}
Pdw0{1e-8,1e-9,0.5,1e-3}
CC1{50,1e-3,0.8}
HN1{50,1e-3,0.8,0.9}
R0[50]    # bracket alias

Serialization prefers {}; the parser accepts [] as well.

Compatibility examples

These expressions should parse and serialize identically in both projects:

text
R0
G0
Pdw0
CC1{50,1e-3,0.8}
R0-p(Q1,R2-Pdw3)
R0-p(Ws1,Wo2)-G3