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 |
|---|---|
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. |
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.
The caller supplies an independent-source RHS, leaving DC bias intact. Native AC charge registrations, delays and frequency-domain admittances use the same assembly as scattering analysis.
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
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 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 | |