Sensitivity can be calculated from a solution of the adjoint system, see “Computer Methods for Circuit Analysis and Design (Vlach and Singhal)”.

Essentially, an (infinitesimal) change in a parameter p can be thought as a (infinitesimal) current injected into the network. an observable can be thought as a function f of the voltage vector v. if f is linear, then, ignoring the offset, it can be written as a scalar product s=< F, v >=<F, Gi>=<G^t^-1 F, i> with some vector F. but then df/dp=<G^t^-1 F, di/dp>

now fix an observable, compute G^t^-1 F (use BSMATRIX::fbsubt), then visit the components that depend on a parameter, get the injected current and evaluate the scalar product. the result is the sensitivity of the observable wrt the parameter…

In gnucap spice mode it may look like this:

include netlist.ckt
.print dc v(nodes)
.print sens R(R1) W(MN1)
.sens v(node0) v(node1)

calculates the sensitivities of node voltages with respect to device parameters.


the .sens command is similar to the ac command. it expects a dc operation point to be computed already. It loads the acx matrix and does an lu decomposition. then for all outputs it solves the adjoint system using Gennadys fbsubt() and iterates the probelist. the solution is stored in double _sim→_sens[numberofnodes].

devices need to provide a XPROBE sens_probe_ext(string) const for this to work. this function uses the adjacent values from sim→_sens.

there's a “sens” command in gnucap-sim, http://git.savannah.gnu.org/cgit/gnucap/gnucap-plugins.git/log/?h=sim. it uses ad hoc modified components exploring the usefulness of the probe rework. needs more thought before porting upstream.

- need new probe semantics, but output rework is not ready yet - parameter sensitivities (derivatives for expressions are not implemented) - need “parameter probes” to maintain spice command semantics.

gnucap/user/sensitivity_command.txt · Last modified: 2018/10/16 15:40 by felixs
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki