pingspice.lib.active.Capacitance_Meter(Subcircuit)
class documentation
Part of pingspice.lib.active
(View In Hierarchy)
Capacitance meter using a DC bias that ramps up and a sinusoidal signal source, with current sensing on return leg.
Use this to measure capacitance of an active circuit, e.g., MOSFET ciss, coss, and crss.
Construct and use only via the mc_addedBias
or mc_separateBias
class method.
The subcircuit has six external subcircuit nodes:
- npos: The positive node at which AC (and possibly also DC bias) current emerges to the device under test.
- nneg: The negative node for return of the test current.
- bias: A positive node for DC bias output, ground referenced.
- cap: Output with voltage representing the calculated capacitance in Farads.
- filt_in: Input of an RC lowpass filter with the same S-response as the one used in the RMS current calculation. In most cases, you will short this to bias.
- filt_out: Output of the RC lowpass filter. Use observations of this for the independent vector in dynamically measured capacitance setups.
- xl: Input with voltage representing the series inductance in Henries. Makes capacitance calculation more accurate if series inductance is at least partially known.
Parameters | fa | The AC signal frequency. (type: float) |
Na | Number of AC signal cycles in the bias sweep. (type: int) | |
Nd | Number of AC signal cycles to delay before starting the bias sweep. (type: int) | |
Vac | The AC signal voltage (peak-to-peak). (type: float) | |
Vdc | A 2-sequence with (1) the starting and (2) ending DC bias voltage. | |
bias_add | Set True to have the DC bias voltage added to the AC signal at
npos. It will appear by itself, with no AC component, at the
bias terminal regardless. Default: False . (type: bool) | |
Ls | If at least some of the series inductance is known, set this to it to make the capacitance calculation more accurate. AV compatible. Default: 0 Henries. | |
invert_bias | Set True to invert the voltage applied as bias, for P-channel
MOSFETs. The bias output remains positive. (type: bool) |
Class Method | correct | Returns an approximate correction factor to account for high capacitance readings due to imperfect sampling of the AC test signal. |
Class Method | mc_addedBias | Makes an instance of me with bias added to the AC test signal and sent through the matching filter, and connects it to the specified nodes. |
Class Method | mc_separateBias | Makes an instance of me with a separate bias output (also sent through the matching filter) and connects it to the specified nodes. |
Method | sources | Undocumented |
Method | lpf | Makes a lowpass filter following the cosine product and for the matched copy between filt_in and filt_out. |
Method | v_x | Makes a voltage source v_x with the calculated reactance (90-degree current flow vs voltage), based on current through zero-voltage source Vsh. |
Method | v_capacitance | Makes a voltage source cap with calculated capacitance, based on squared impedance indicated at node z2 and known series resistance and inductance. |
Method | setup | Subcircuit definition. |
Class Method | _xl | Called by mc_addedBias
and mc_separateBias
to make voltage source cmv_xl. |
Inherited from NodeStuff (via Subcircuit):
Instance Variable | shunts | A dict of current sensing V elements with the pairs of nodes they connect. |
Class Variable | debug | A Bag that gets set
True for all instances to log info about each setup
call. |
Class Method | autoName | Undocumented |
Method | setupResults | Undocumented |
Method | fill | Undocumented |
Method | nodeCheck | Call with the circuit building tool f and a sequence of
nodes provided to this Include or
Subcircuit . |
Method | rawNetlist | Get lines of a raw netlist from a search hierarchy of possible sources. |
Method | shunt | Call to insert a current-measuring shunt and add an entry to my Elements
baton's dict of shunts. |
Method | raw | See Elements.raw . |
Method | iNode | See Elements.iNode . |
Method | ground | See Elements.ground . |
Method | sca | See Elements.sca . |
Method | sca6 | See Elements.sca6 . |
Class Method | _libDir | Undocumented |
Method | _strippedLines | Undocumented |
Method | _call_setup | Calls my setup
method (almost always your override of that method, actually) and processes
any return value. |
Inherited from NodeStuff (via Subcircuit):
Instance Variable | shunts | A dict of current sensing V elements with the pairs of nodes they connect. |
Class Variable | debug | A Bag that gets set
True for all instances to log info about each setup
call. |
Class Method | autoName | Undocumented |
Method | setupResults | Undocumented |
Method | fill | Undocumented |
Method | nodeCheck | Call with the circuit building tool f and a sequence of
nodes provided to this Include or
Subcircuit . |
Method | rawNetlist | Get lines of a raw netlist from a search hierarchy of possible sources. |
Method | shunt | Call to insert a current-measuring shunt and add an entry to my Elements
baton's dict of shunts. |
Method | raw | See Elements.raw . |
Method | iNode | See Elements.iNode . |
Method | ground | See Elements.ground . |
Method | sca | See Elements.sca . |
Method | sca6 | See Elements.sca6 . |
Class Method | _libDir | Undocumented |
Method | _strippedLines | Undocumented |
Method | _call_setup | Calls my setup
method (almost always your override of that method, actually) and processes
any return value. |
def correct(cls, Ns):
Returns an approximate correction factor to account for high capacitance readings due to imperfect sampling of the AC test signal.
Call with the number of Ngspice time steps per AC test signal cycle.
def _xl(cls, f, kw):
Called by mc_addedBias
and mc_separateBias
to make voltage source cmv_xl.
def mc_addedBias(cls, f, npos, nneg, bias, cap, **kw):
Makes an instance of me with bias added to the AC test signal and sent through the matching filter, and connects it to the specified nodes.
Supply the circuit generation tool f as the first argument, followed by the nodes npos, nneg, bias (output, filtered) and cap (output).
Makes a voltage source cmv_xl external to the subcircuit, with DC voltages based on the keyword Ls. AV compatible.
Only call this once per circuit.
Parameters | invert_bias | Set True to invert voltage applied as bias, for P-channel
MOSFETs. The bias output remains positive. (type: bool) |
def mc_separateBias(cls, f, npos, nneg, bias_out, cap, bias_m, bias, **kw):
Makes an instance of me with a separate bias output (also sent through the matching filter) and connects it to the specified nodes.
Supply the circuit generation tool f as the first argument, followed by the nodes npos, nneg, bias_out (output, non-filtered), bias_m (measurement point, filter input), bias (output, filtered), and cap (output).
Makes a voltage source cmv_xl external to the subcircuit, with DC voltages based on the keyword Ls. AV compatible.
Only call this once per circuit.
Parameters | invert_bias | Set True to invert voltage of bias_out, for P-channel
MOSFETs. The bias output remains positive. (type: bool) |
Makes a lowpass filter following the cosine product and for the matched copy between filt_in and filt_out.
The filter is Chebychev II. Its frequency response is monotonic in the passband and equiripple in the stopband, which begins at half the frequency of the AC test signal.
Makes a voltage source v_x with the calculated reactance (90-degree current flow vs voltage), based on current through zero-voltage source Vsh.
If the bias is separate, its current is subtracted from what goes through Vsh, improving accuracy.
Internal nodes:
- v_sc: Behavioral voltage soruce for the current multiplied by (mixed with) a 90-degree phase-shifted version (cosine) of the AC test signal.
-
v_scf: Lowpass filtered version of v_sc, substantially
rejecting frequency components
fa
(non-subtracted DC bias current after mixing) and2*fa
(the sum component of AC current with cosine "local oscillator").
Called by, and only by, v_capacitance
.
Makes a voltage source cap with calculated capacitance, based on squared impedance indicated at node z2 and known series resistance and inductance.
Subcircuit definition.
Why use f? Because it's short and a conveniently typed letter on the keyboard.
Override this if your subclass does not reference a param.ParameterFinder
subclass via the Finder class attribute. As with Include.setup
,
your override method can return a dict of attribute names and values to set
in my instance.