ac_sweep ¤
AC small-signal frequency sweep returning S-parameters.
AC analysis linearises the circuit DAE at a DC operating point and sweeps a range of frequencies, returning the N-port scattering parameters S(f).
The DAE F(y) + dQ/dt = 0 is linearised at y_dc:
- G = ∂F/∂y|_{y_dc} (conductance matrix)
- C = ∂Q/∂y|_{y_dc} (capacitance matrix)
The complex nodal admittance matrix at angular frequency ω is::
Y(jω) = G + jωC
For N circuit ports with reference impedance Z0::
Y_total = Y(jω) + diag(1/Z0 at port nodes)
RHS[:, p] = 2/Z0 at port_nodes[p], zero elsewhere
V = solve(Y_total, RHS) # shape (num_vars, N_ports)
S = V[port_nodes, :] - I # I = N_ports × N_ports identity
Frequency-domain components contribute Y_fdomain(f) to Y_total at each frequency point and are evaluated inside the frequency sweep loop.
Example::
groups, num_vars, pmap = compile_netlist(net_dict, models)
linear_strat = analyze_circuit(groups, num_vars)
y_dc = linear_strat.solve_dc(groups, jnp.zeros(num_vars))
port_nodes = [pmap["R1,p1"]]
run_ac = setup_ac_sweep(groups, num_vars, port_nodes, z0=50.0)
freqs = jnp.logspace(6, 10, 100) # 1 MHz to 10 GHz
S = run_ac(y_dc, freqs) # shape (100, 1, 1) complex
# JIT for repeated sweeps:
S = jax.jit(run_ac)(y_dc, freqs)
Functions:
| Name | Description |
|---|---|
ac_admittance | Add frequency-dependent physics and reference constraints to G + jwC. |
linearize_ac | Assemble frequency-independent derivatives with a shared COO layout. |
renormalize | Renormalize S-parameters from one reference impedance to another. |
setup_ac_response | Linearize physical response without scattering-port terminations. |
setup_ac_sweep | Configure and return a callable for AC small-signal S-parameter sweep. |
ac_admittance ¤
ac_admittance(
conductance: Array,
capacitance: Array,
groups: dict[str, Any],
y_dc: Array,
freq: Array,
*,
num_vars: int,
is_complex: bool = False,
quadratures: bool = False
) -> Array
Add frequency-dependent physics and reference constraints to G + jwC.
Source code in circulax/solvers/ac_sweep.py
linearize_ac ¤
linearize_ac(
groups: dict[str, Any],
num_vars: int,
y_dc: Array,
*,
is_complex: bool = False,
quadratures: bool = False,
dc_groups: dict[str, Any] | None = None
) -> tuple[Array, Array]
Assemble frequency-independent derivatives with a shared COO layout.
Quadrature assembly retains all four real derivative blocks. Native AC registrations supply C; optional DC registrations supply G.
Source code in circulax/solvers/ac_sweep.py
renormalize ¤
Renormalize S-parameters from one reference impedance to another.
Transforms S-parameters computed at impedance z0_from to the equivalent S-parameters at impedance z0_to, using the standard power-wave renormalization formula.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
S | Array | S-parameter array of shape | required |
z0_from | float | Array | Original reference impedance. Scalar or | required |
z0_to | float | Array | Target reference impedance, same shape options as | required |
Returns:
| Type | Description |
|---|---|
Array | Renormalized S-parameter array, same shape as |
Source code in circulax/solvers/ac_sweep.py
setup_ac_response ¤
setup_ac_response(
groups: dict[str, Any],
num_vars: int,
*,
is_complex: bool = False,
dc_groups: dict[str, Any] | None = None
) -> Callable[[Array, Array, Array], Array]
Linearize physical response without scattering-port terminations.
This legacy interface retains the N-sized holomorphic complex response. SmallSignalModel uses the same assembly helpers with full quadratures.
Source code in circulax/solvers/ac_sweep.py
setup_ac_sweep ¤
setup_ac_sweep(
groups: dict[str, Any],
num_vars: int,
port_nodes: list[int],
*,
z0: float | Array = 50.0,
is_complex: bool = False,
holomorphic: bool = False,
dc_groups: dict[str, Any] | None = None
) -> Callable[[Array, Array], Array]
Configure and return a callable for AC small-signal S-parameter sweep.
Linearises the circuit DAE at the DC operating point and sweeps over an array of frequencies, returning the complex S-parameter matrix at each frequency. The returned callable is compatible with :func:jax.jit and :func:jax.vmap.
The analysis solves Y(jω) · V = RHS at each frequency, where::
Y(jω) = G + jωC + Y_fdomain(f) + port_terminations + ground_penalty
G = ∂F/∂y and C = ∂Q/∂y are extracted once at the DC operating point. Y_fdomain(f) is the admittance contribution from frequency-domain components, re-evaluated at each frequency.
S-parameter convention — matched-load verification:
- Matched load (Z_circuit = Z0) → S11 = 0
- Open circuit (Z_circuit → ∞) → S11 = +1
- Short circuit (Z_circuit = 0) → S11 = −1
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
groups | dict[str, Any] | Compiled component groups from :func: | required |
dc_groups | dict[str, Any] | None | Optional groups registered for DC, providing conductance while | None |
num_vars | int | Total number of scalar unknowns (second return value of :func: | required |
port_nodes | list[int] | Global node indices for each circuit port, in the desired port ordering. Obtain from the port-to-node map returned by :func: | required |
z0 | float | Array | Reference impedance in ohms. Accepts:
For frequency-dependent impedance, solve at a fixed z0 and use :func: | 50.0 |
is_complex | bool | If | False |
holomorphic | bool | If | False |
Returns:
| Type | Description |
|---|---|
Callable[[Array, Array], Array] | A callable |
Callable[[Array, Array], Array] |
|
Callable[[Array, Array], Array] | circuits or |
Callable[[Array, Array], Array] |
|
Callable[[Array, Array], Array] |
|
Callable[[Array, Array], Array] |
|
Callable[[Array, Array], Array] | Compatible with :func: |
Source code in circulax/solvers/ac_sweep.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |