# Pseudo-transient DC continuation (`.option pstran` / `.option dptran`)

Last-resort operating-point method for circuits where Newton, gmin
stepping, source stepping and optran all fail (latches with no set
condition, high-gain feedback loops, quasi-floating nodes).

```
.option pstran                  enable, tried after every other OP method
.option dptran                  damped variant (implies pstran)
.option pstrancp=1n             artificial capacitance per node [F]
.option pstrandtinit=1n         initial pseudo timestep [s]
.option pstrandtmax=<auto>      final pseudo timestep (default pstrancp/gmin)
.option pstranmaxsteps=200      pseudo-step budget
```

Both options default to **off**; a deck without them behaves exactly as
before.

## How it works

An artificial capacitor `Cp` is attached from every node to ground and
the system is integrated in a *pseudo* time with backward Euler and no
truncation-error control -- only the stationary point matters, not the
path. The BE companion of the pseudo capacitor is a conductance
`g = Cp/dt` on the matrix diagonal (the same augmentation gmin stepping
uses, `CKTdiagGmin`) plus a current `g*v_accepted[n]` on the RHS.

The pseudo timestep grows aggressively after accepted steps (x2, x10
after a streak) and shrinks (x1/8, with rollback to the last accepted
solution) after rejected ones. As `dt -> infinity` the artificial stamps
vanish, so the stationary point is the exact DC solution of the original
circuit; a final Newton solve without the stamp confirms it.

`dptran` additionally clamps the Newton voltage update to 0.3 V per
iteration while the continuation is active, trading iterations for
robustness on circuits with strong positive feedback.

## Escalation ladder

With these options set, a failing `.op` escalates through:

```
Newton -> dynamic gmin -> true gmin -> source stepping -> optran -> pstran/dptran
```

Each stage reports start/failure on the console; a final failure names
the worst node or instance of the last attempted method.

Note that optran is armed by default (`optran 1 1 1 100n 10u 0`, see
`README.optran`); it can be disabled from a `.control` section or
`.spiceinit` with `optran 1 1 1 0 0 0`, which is also the way to test
pstran in isolation.

## Implementation

* `src/spicelib/analysis/cktpstran.c` -- the continuation loop
  (`CKTpstranOP`), structured after `dynamic_gmin()` in `cktop.c`.
* `src/maths/ni/niiter.c` -- the RHS history term and the dptran
  update clamp, both gated by `CKTpstranG > 0`.
* `src/spicelib/analysis/cktop.c` -- ladder wiring.
* Tests: `tests/regression/pstran/` (consistency against plain Newton;
  a B-source tanh ring on which every other ladder stage fails).
