pingspice.ngspice.cmd.Commander(object)
class documentation
Part of pingspice.ngspice.cmd
(View In Hierarchy)
I handle sending each of NgspiceRunner
's
orders to Ngspice and returning it the Result
.
Every command sent to Ngspice goes through the NgspiceProtocol.cmd
method, which is called when you call an instance of me.
Before using me, call my setup
method. NgspiceRunner
does this as part of its constructor startup, right after spawning an
Ngspice process.
Class Variable | initSet | A sequence of 2-tuples each containing the name and value of Ngspice
settings. A value of None indicates that the setting is a flag
that is set with just its name and no further argument. |
Instance Variable | sentLine | The last line sent to Ngspice, with trailing newline stripped. Also
referenced by the cmd attribute of Result . |
Method | __init__ | Undocumented |
Method | setup | This should be the first method called once Ngspice starts running. |
Method | __call__ | The workhorse of Python-Ngspice integration: Call me to get a (deferred)
Ngspice Result . A
lock/release mechanism ensures that only one call is active at once. |
Method | _error | Called by __call__
with the Result object it
constructed when Ngspice had an error, timed out, or is dead. |
Method | _alert | Called by __call__
when Ngspice is taking a while. |
Method | _done | Called by __call__
when Ngspice is done with its command. |
None
indicates that the setting is a flag
that is set with just its name and no further argument.
Result
.
def setup(self):
This should be the first method called once Ngspice starts running.
Waits for the 'started' event of the shared waiter. Then sets initial Ngspice parameters and waits until repeated calls to 'set' with no args indicate that all the settings have been registered. Then sets the waiter's 'ready' event.
Called by __call__
when Ngspice is taking a while.
Prints a "waiting..." message and sets a flag indicating that a follow-up messageshould be printed when Ngspice finally finishes.
def __call__(self, *args, **kw):
The workhorse of Python-Ngspice integration: Call me to get a (deferred)
Ngspice Result
. A
lock/release mechanism ensures that only one call is active at once.
Registers a fresh instance of ErrorHandler
to process a possible error from Ngspice and then sends it a command
defined by the args and keywords.
Returns a Deferred
that fires with a Result
of the
command, which doesn't begin until any pending other commands have
completed.
See NgspiceRunner.call
for the public API and details about *args and **kw.