I provide circuitry for a capacitance that can get charged to a steady-state or desired voltage quickly.

I overcome some huge Ngpsice limitations with initial capacitor voltages, including convergence problems while using the 'v0' option for the 'capacitance' model provided by XSPICE. (I can still use that option if you wish, however. Sometimes it works.)

Instead, to have me fast-charge myself to an initial capacitor voltage, supply a third node to my constructor, referred to locally as nv0, with the desired voltage. My capacitor will then get fast-charged within a few multiples of the simulation timestep specified in pingspice-only simulation variable ts. Happily, due to the way Ngspice computes a DC solution prior to a TRAN analysis, just having the Initializer circuitry present will bring the initial voltage to what you desire at the very first simulation step.

You should keep the pingspice-only simulation option timeWarp consistent for all thermal subcircuits in a given simulation. Define it as a constructor keyword for your Netlist.

You can use either inital-voltage setting technique with or without a fast initialing voltage interval set by fivi.

Instance Variable C The capacitance value. Can be an AV object.
Instance Variable tcon Set to an RC time constant that this capacitance is part of to avoid having it scaled down so far that the time constant is less than the ts pingspice-only simulation option value. Can be an AV object, though with some substantial limitiations.
Instance Variable timeWarp Set this to a time speed-up factor to make things charge up (and down) x times faster. The speed-up will be limited to tcon if it is set. Default is 1.0, for no time warp.
Instance Variable fivi Set to the initial time allocated for fast initialing voltage interval, for irregular but simulation-friendly initial charge-up. Set to None for no such irregular warm-up (the default). If set True or to a value less than 10x the pingspice-only simulation variable ts, will be forced to 10x ts. NOTE: timeWarp, if any, still applies.
Instance Variable faster The ratio of how much faster the voltage increases if fivi is set. Default is 100.
Instance Variable V0s Set True to cause the capacitance to be subject to an initial voltage-zeroing short circuit. Not compatible with using fivi or supplying a third node with a fast-charge initial voltage.
Instance Variable V0 Set to an initial voltage to use the XSPICE capacitance model with an initial voltage. Not compatible with supplying a third node with a fast-charge initial voltage.
Instance Variable ti The time you should set aside for my initial and/or fast charging at the beginning of your TRAN simulation for the capacitor. (Read-only.) Also appears as the 'ti' entry of my setupResults.
Method tryMakeFaster Tries to return a ratio that makes my time constant tcon faster.
Method setup Using the circuit generation tool f, implements a thermal capacitance element between nodes referred to locally as n1 and n2.

Inherited from NodeStuff (via Include):

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 Include):

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.
C =
The capacitance value. Can be an AV object.
tcon =
Set to an RC time constant that this capacitance is part of to avoid having it scaled down so far that the time constant is less than the ts pingspice-only simulation option value. Can be an AV object, though with some substantial limitiations.
timeWarp =
Set this to a time speed-up factor to make things charge up (and down) x times faster. The speed-up will be limited to tcon if it is set. Default is 1.0, for no time warp.
fivi =
Set to the initial time allocated for fast initialing voltage interval, for irregular but simulation-friendly initial charge-up. Set to None for no such irregular warm-up (the default). If set True or to a value less than 10x the pingspice-only simulation variable ts, will be forced to 10x ts. NOTE: timeWarp, if any, still applies.
faster =
The ratio of how much faster the voltage increases if fivi is set. Default is 100.
V0s =
Set True to cause the capacitance to be subject to an initial voltage-zeroing short circuit. Not compatible with using fivi or supplying a third node with a fast-charge initial voltage.
V0 =
Set to an initial voltage to use the XSPICE capacitance model with an initial voltage. Not compatible with supplying a third node with a fast-charge initial voltage.
ti =
The time you should set aside for my initial and/or fast charging at the beginning of your TRAN simulation for the capacitor. (Read-only.) Also appears as the 'ti' entry of my setupResults.
def tryMakeFaster(self, ts, ratio, prevRatio=1):

Tries to return a ratio that makes my time constant tcon faster.

If the pingspice simulation option ts is specified and you set tcon to an RC time constant that my capacitance forms in conjunction with some resistance, I will ensure that the timeWarp version of C is not scaled down so far that tcon is less than ts.

This is done by keeping the returned ratio as big as possible to reduce tcon to just over ts. The value of tcon divided by ratio (further divided by prevRatio if specified) will be kept at least as large as ts.

If tcon is an AV object, I use its known float value (after doing mods). If it doesn't have a known value, it is disregarded; there's no lower capacitance limit during parameter finding. (You shouldn't be using timeWarp for that.)

def setup(self, f, *nodes):

Using the circuit generation tool f, implements a thermal capacitance element between nodes referred to locally as n1 and n2.

If I was constructed with a third node, that is referred to locally as nv0 and causes me to fast-charge my capacitance to the voltage at that node.

API Documentation for pingspice, generated by pydoctor at 2021-09-18 08:41:11.