Tcl SpiceGenTcl package (v0.71)

::SpiceGenTclTop, Main, Index

CommandsTop, Main, Index

forgetCommon [::SpiceGenTcl]Top, Main, Index

Forgets all ::SpiceGenTcl::Common commands from caller namespace

forgetCommon
Details
proc ::SpiceGenTcl::forgetCommon {} {

    # Forgets all ::SpiceGenTcl::Common commands from caller namespace
    uplevel 1 {foreach nameSpc [namespace children ::SpiceGenTcl::Common] {
        namespace forget ${nameSpc}::*
    }}
}

forgetLtspice [::SpiceGenTcl]Top, Main, Index

Forgets all ::SpiceGenTcl::Ltspice commands from caller namespace

forgetLtspice
Details
proc ::SpiceGenTcl::forgetLtspice {} {

    # Forgets all ::SpiceGenTcl::Ltspice commands from caller namespace
    uplevel 1 {foreach nameSpc [namespace children ::SpiceGenTcl::Ltspice] {
        namespace forget ${nameSpc}::*
    }}
}

forgetNgspice [::SpiceGenTcl]Top, Main, Index

Forgets all ::SpiceGenTcl::Ngspice commands from caller namespace

forgetNgspice
Details
proc ::SpiceGenTcl::forgetNgspice {} {

    # Forgets all ::SpiceGenTcl::Ngspice commands from caller namespace
    uplevel 1 {foreach nameSpc [namespace children ::SpiceGenTcl::Ngspice] {
        namespace forget ${nameSpc}::*
    }}
}

forgetXyce [::SpiceGenTcl]Top, Main, Index

Forgets all ::SpiceGenTcl::Xyce commands from caller namespace

forgetXyce
Details
proc ::SpiceGenTcl::forgetXyce {} {

    # Forgets all ::SpiceGenTcl::Xyce commands from caller namespace
    uplevel 1 {foreach nameSpc [namespace children ::SpiceGenTcl::Xyce] {
        namespace forget ${nameSpc}::*
    }}
}

importCommon [::SpiceGenTcl]Top, Main, Index

Imports all ::SpiceGenTcl::Common commands to caller namespace

importCommon
Details
proc ::SpiceGenTcl::importCommon {} {

    # Imports all ::SpiceGenTcl::Common commands to caller namespace
    uplevel 1 {foreach nameSpc [namespace children ::SpiceGenTcl::Common] {
        namespace import ${nameSpc}::*
    }}
}

importLtspice [::SpiceGenTcl]Top, Main, Index

Imports all ::SpiceGenTcl::Ltspice commands to caller namespace

importLtspice
Details
proc ::SpiceGenTcl::importLtspice {} {

    # Imports all ::SpiceGenTcl::Ltspice commands to caller namespace
    uplevel 1 {foreach nameSpc [namespace children ::SpiceGenTcl::Ltspice] {
        namespace import ${nameSpc}::*
    }}
}

importNgspice [::SpiceGenTcl]Top, Main, Index

Imports all ::SpiceGenTcl::Ngspice commands to caller namespace

importNgspice
Details
proc ::SpiceGenTcl::importNgspice {} {

    # Imports all ::SpiceGenTcl::Ngspice commands to caller namespace
    uplevel 1 {foreach nameSpc [namespace children ::SpiceGenTcl::Ngspice] {
        namespace import ${nameSpc}::*
    }}
}

importXyce [::SpiceGenTcl]Top, Main, Index

Imports all ::SpiceGenTcl::Xyce commands to caller namespace

importXyce
Details
proc ::SpiceGenTcl::importXyce {} {

    # Imports all ::SpiceGenTcl::Xyce commands to caller namespace
    uplevel 1 {foreach nameSpc [namespace children ::SpiceGenTcl::Xyce] {
        namespace import ${nameSpc}::*
    }}
}

ClassesTop, Main, Index

Analysis [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
actOnParamActs on Parameter object with selected action.
configureConfigure properties.
genSPICEStringCreates analysis for SPICE netlist.
Properties

Readable: -name, -type

Writable: -name, -type

Superclasses

SPICEElement

Mixins

Utility

Subclasses

::SpiceGenTcl::Common::Analyses::Dc, ::SpiceGenTcl::Common::Analyses::Ac, ::SpiceGenTcl::Common::Analyses::Tran, ::SpiceGenTcl::Common::Analyses::Op, ::SpiceGenTcl::Ngspice::Analyses::Sp, ::SpiceGenTcl::Ngspice::Analyses::SensAc, ::SpiceGenTcl::Ngspice::Analyses::SensDc, ::SpiceGenTcl::Xyce::Analyses::Sens

constructor [::SpiceGenTcl::Analysis]Analysis, Top, Main, Index

Creates object of class Analysis.

OBJECT constructor type params ?-name value?
Details
Parameters
-nameName of the string that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
paramsList of instance parameters in form {{name value} {name -sw} {name Value -eq} {name Value -posnocheck} ...}
typeType of analysis, for example, tran, ac, dc, etc.
Description

Class models analysis statement.

method constructor {args} {

    # Creates object of class `Analysis`.
    #  type - type of analysis, for example, tran, ac, dc, etc
    #  params - list of instance parameters in form
    #   `{{name value} {name -sw} {name Value -eq} {name Value -posnocheck} ...}`
    #  -name - name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # Class models analysis statement.
    # Synopsis: type params ?-name value?
    my variable name
    set arguments [argparse -inline -help {Creates object of class 'Analysis'} -pfirst {
        {type -help {Type of analysis, for example, tran, ac, dc, etc}}
        {params -help {List of instance parameters in form '{{name value} {name -sw} {name Value -eq} {name Value -posnocheck} ...}'} -type list}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object and its descendants}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    my configure -type [dget $arguments type]
    # create Analysis objects
    foreach param [dget $arguments params] {
        if {[llength $param]<2} {
            return -code error "Value '$param' is not a valid value"
        } else {
            my actOnParam -add {*}$param
        }
    }
}

actOnParam [::SpiceGenTcl::Analysis]Analysis, Top, Main, Index

Acts on Parameter object with selected action

OBJECT actOnParam -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
OBJECT actOnParam -set name value ?name value ...?
OBJECT actOnParam -get name
OBJECT actOnParam -get -all
OBJECT actOnParam -delete name
Details
Parameters
-addAdd new parameter to the device, requires pname argument.
-allOption for getting the dictionary that contains parameters names as keys and parameters values # as the dictionary values, requires -get.
-deleteDelete existing parameter.
-eqParameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}', requires -add.
-getGet parameter value, requires pname argument.
-nocheckNormal parameter without check, requires -add.
-nodeNode parameter, requires -add.
-nodeeqNode parameter equation, requires -add.
-posParameter has strict position and only '$Value' is displayed in netlist, requires -add.
-poseqCombination of both flags, print only, requires -add.
-posnocheckPositional parameter without check, requires -add.
-setSet (or change) value of particular parameters, requires pname and value arguments.
-swSwitch parameter, requires -add.
argumentsOptional pairs of name-value for -set action, requires -set.
pnameName of parameter.
valueValue of parameter.
method actOnParam {args} {

    # Acts on `Parameter` object with selected action
    #  -add - add new parameter to the device, requires pname argument
    #  -get - get parameter value, requires pname argument
    #  -set - set (or change) value of particular parameters, requires pname and value arguments
    #  -delete - delete existing parameter
    #  -all - option for getting the dictionary that contains parameters names as keys and parameters values #    as the dictionary values, requires -get
    #  -pos - parameter has strict position and only '$Value' is displayed in netlist, requires -add
    #  -eq - Parameter may contain equation in terms of functions and other parameters, printed as
    #    '$name={$equation}', requires -add
    #  -poseq - combination of both flags, print only, requires -add
    #  -posnocheck - positional parameter without check, requires -add
    #  -nocheck - normal parameter without check, requires -add
    #  -sw - switch parameter, requires -add
    #  -node - node parameter, requires -add
    #  -nodeeq - node parameter equation, requires -add
    #  pname - name of parameter
    #  value - value of parameter
    #  arguments - optional pairs of name-value for -set action, requires -set
    # Synopsis: -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
    # Synopsis: -set name value ?name value ...?
    # Synopsis: -get name
    # Synopsis: -get -all
    # Synopsis: -delete name
    argparse -help {Applied selected actions on parameters of the device} {
        # {Actions selectors}
        {-add -key action -value add -require pname -help {Add new parameter to device}}
        {-get -key action -value get -help {Get parameter value}}
        {-set -key action -value set -require {pname value} -help {Sets (or change) value of particular parameters}}
        {-delete -key action -value delete -require pname -help {Delete existing parameter}}
        {-all -require get -forbid {pname value} -help {Option for getting the dictionary that contains parameters names as keys and parameters values as the dictionary values}}
        # {Param qualificators}
        {-pos -key paramQual -value pos -require add -help {Parameter has strict position and only '$Value' is displayed in netlist}}
        {-eq -key paramQual -value eq -require add -help {Parameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}'}}
        {-poseq -key paramQual -value poseq -require add -help {Combination of both flags, print only '{$equation}'}}
        {-posnocheck -key paramQual -value posnocheck -require add -help {Positional parameter without check}}
        {-nocheck -key paramQual -value nocheck -default {} -require add -help {Normal parameter without check}}
        {-sw -key paramQual -value sw -require add -help {Switch parameter}}
        {-node -key paramQual -value node -require add -help {Node parameter}}
        {-nodeeq -key paramQual -value nodeeq -require add -help {Node parameter equation}}
        # {Actual name(s) and value(s) of Param}
        {pname -optional -help {Name of parameter}}
        {value -optional -help {Value of parameter}}
        {arguments -catchall -require set -help {Optional pairs of name-value for -set action}}
    }
    switch $action {
        add {
            set pname [string tolower $pname]
            if {[info exists Params]} {
                set params [dict keys $Params]
            }
            lappend params $pname
            if {[my DuplListCheck $params]} {
                return -code error "Parameters list '$params' has already contains parameter with name '$pname'"
            }
            switch $paramQual {
                sw {
                    dict append Params $pname [::SpiceGenTcl::ParameterSwitch new $pname]
                }
                pos {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositional new $pname $value]
                }
                eq {
                    dict append Params $pname [::SpiceGenTcl::ParameterEquation new $pname $value]
                }
                poseq {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalEquation new $pname $value]
                }
                posnocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalNoCheck new $pname $value]
                }
                nocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterNoCheck new $pname $value]
                }
                node {
                    dict append Params $pname [::SpiceGenTcl::ParameterNode new $pname $value]
                }
                nodeeq {
                    dict append Params $pname [::SpiceGenTcl::ParameterNodeEquation new $pname $value]
                }
                default {
                    dict append Params $pname [::SpiceGenTcl::Parameter new $pname $value]
                }
            }
        }
        get {
            if {![info exists Params]} {
                return
            }
            if {[info exists all]} {
                return [dict map {paramName param} $Params {$param configure -value}]
            } elseif {[info exists pname]} {
                set pname [string tolower $pname]
                if {[dexist $Params $pname]} {
                    return [dget $Params $pname]
                } else {
                    return -code error "Device '$name' doesn't have parameter with name '$pname'"
                }
            } else {
                return -code error "'-get' action requires 'pname' parameter or '-all' option"
            }
        }
        set {
            set arguments [list $pname $value {*}$arguments]
            if {[llength $arguments]%2!=0} {
                return -code error "Number of arguments to method '[dict get [info frame 0] method]' with '-set' switch must be even"
            }
            for {set i 0} {$i<[llength $arguments]} {incr i 2} {
                set paramName [string tolower [@ $arguments $i]]
                set paramValue [@ $arguments [= {$i+1}]]
                if {[catch {dget $Params $paramName}]} {
                    return -code error "Parameter with name '$paramName' was not found in element's '$name' list of parameters '[dkeys $Params]'"
                } else {
                    set param [dget $Params $paramName]
                }
                $param configure -value $paramValue
            }
        }
        delete {
            set pname [string tolower $pname]
            if {[catch {dget $Params $pname}]} {
                return -code error "Parameter with name '$pname' was not found in device's '$name' list of parameters '[dkeys $Params]'"
            } else {
                set Params [dict remove $Params $pname]
            }
        }
    }
    return
}

genSPICEString [::SpiceGenTcl::Analysis]Analysis, Top, Main, Index

Creates analysis for SPICE netlist.

OBJECT genSPICEString
Details
Return value

string SPICE netlist's string

method genSPICEString {} {

    # Creates analysis for SPICE netlist.
    # Returns: string SPICE netlist's string
    if {[info exists Params]} {
        return ".[my configure -type] [join [lmap param [dict values $Params] {$param genSPICEString}]]"
    } else {
        return .[my configure -type]
    }
}

Axis [::SpiceGenTcl]Top, Main, Index

Method summary
appendDataPointsSee Dataset.appendDataPoints
configureConfigure properties.
getDataPointsSee Dataset.getDataPoints
getStrSee Dataset.getStr
setDataPointsSee Dataset.setDataPoints
Properties

Readable: -len, -name, -numtype, -type

Writable: -len, -name, -numtype, -type

Superclasses

Dataset

BinaryReader [::SpiceGenTcl]Top, Main, Index

Method summary
configureConfigure properties.
readComplexReads two 8 byte numbers from file.
readFloat32Reads 4 bytes number from file.
readFloat64Reads 8 bytes number from file .
skip4bytesMoves pointer of position in file forward in 4 bytes.
skip8bytesMoves pointer of position in file forward in 8 bytes.
skip16bytesMoves pointer of position in file forward in 16 bytes.
Subclasses

RawFile

readComplex [::SpiceGenTcl::BinaryReader]BinaryReader, Top, Main, Index

Reads two 8 byte numbers from file.

OBJECT readComplex file
Details
Parameters
fileFile handler.
Return value

list of two values.

method readComplex {file} {

    # Reads two 8 byte numbers from file.
    #  file - file handler
    # Returns: list of two values.
    set s [read $file 16]
    binary scan $s dd re im
    return [list $re $im]
}

readFloat32 [::SpiceGenTcl::BinaryReader]BinaryReader, Top, Main, Index

Reads 4 bytes number from file.

OBJECT readFloat32 file
Details
Parameters
fileFile handler.
Return value

value of number.

method readFloat32 {file} {

    # Reads 4 bytes number from file.
    #  file - file handler
    # Returns: value of number.
    set s [read $file 4]
    binary scan $s f num
    return $num
}

readFloat64 [::SpiceGenTcl::BinaryReader]BinaryReader, Top, Main, Index

Reads 8 bytes number from file .

OBJECT readFloat64 file
Details
Parameters
fileFile handler.
Return value

value of number.

method readFloat64 {file} {

    # Reads 8 bytes number from file .
    #  file - file handler
    # Returns: value of number.
    set s [read $file 8]
    binary scan $s d num
    return $num
}

skip4bytes [::SpiceGenTcl::BinaryReader]BinaryReader, Top, Main, Index

Moves pointer of position in file forward in 4 bytes.

OBJECT skip4bytes file
Details
Parameters
fileFile handler.
method skip4bytes {file} {

    # Moves pointer of position in file forward in 4 bytes.
    #  file - file handler
    read $file 4
    return
}

skip8bytes [::SpiceGenTcl::BinaryReader]BinaryReader, Top, Main, Index

Moves pointer of position in file forward in 8 bytes.

OBJECT skip8bytes file
Details
Parameters
fileFile handler.
method skip8bytes {file} {

    # Moves pointer of position in file forward in 8 bytes.
    #  file - file handler
    read $file 8
    return
}

skip16bytes [::SpiceGenTcl::BinaryReader]BinaryReader, Top, Main, Index

Moves pointer of position in file forward in 16 bytes.

OBJECT skip16bytes file
Details
Parameters
fileFile handler.
method skip16bytes {file} {

    # Moves pointer of position in file forward in 16 bytes.
    #  file - file handler
    read $file 16
    return
}

Circuit [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
addAdds elements object to Circuit Elements dictionary.
configureConfigure properties.
delDeletes elements from the circuit by its name.
detachSimulatorRemoves Simulator object reference from Circuit.
genSPICEStringCreates circuit string for SPICE netlist.
getAllElemNamesSee Netlist.getAllElemNames
getDataCsvReturns string with csv formatting containing all data.
getDataDictGets dictionary with raw data vectors.
getElementSee Netlist.getElement
runAndReadInvokes runAndRead, configure -log and configure -data methods from attached simulator.
Properties

Readable: -data, -log, -name, -simulator

Writable: -data, -log, -name, -simulator

Superclasses

Netlist

constructor [::SpiceGenTcl::Circuit]Circuit, Top, Main, Index

Creates object of class CircuitNetlist.

OBJECT constructor name
Details
Parameters
nameName of the tol-level circuit.
Description

Class implements a top level netlist which is run in SPICE. We should add ::SpiceGenTcl::Simulator object reference to make it able to run simulation.

method constructor {args} {

    # Creates object of class `CircuitNetlist`.
    #  name - name of the tol-level circuit
    # Class implements a top level netlist which is run in SPICE. We should add [::SpiceGenTcl::Simulator]
    # object reference to make it able to run simulation.
    # Synopsis: name
    set arguments [argparse -inline -help {Creates object of class 'CircuitNetlist'} {
        {name -help {Name of the tol-level circuit}}
    }]
    next [dget $arguments name]
}

add [::SpiceGenTcl::Circuit]Circuit, Top, Main, Index

Adds elements object to Circuit Elements dictionary.

OBJECT add element ?element ...?
Details
Parameters
elementsElements objects references.
method add {args} {

    # Adds elements object to Circuit `Elements` dictionary.
    #  elements - elements objects references
    # Synopsis: element ?element ...?
    argparse -help {Adds elements objects to Circuit 'Elements' dictionary} {
        {elements -catchall -help {Elements objects references}}
    }
    foreach element $elements {
        if {([info object class $element {::SpiceGenTcl::Analysis}]) && ([info exists ContainAnalysis])} {
            return -code error "Netlist '[my configure -name]' already contains Analysis element"
        } elseif {[info object class $element {::SpiceGenTcl::Analysis}]} {
            set ContainAnalysis {}
        }
        lappend elementsNamesList [string tolower [$element configure -name]]
    }
    if {[info exists Elements]} {
        lappend elementsNamesList {*}[my getAllElemNames]
    }
    set dup [my DuplListCheckRet $elementsNamesList]
    if {$dup ne {}} {
        return -code error "Netlist '[my configure -name]' already contains element with name $dup"
    }
    foreach element $elements {
        set elemName [$element configure -name]
        dict append Elements $elemName $element
    }
    return
}

del [::SpiceGenTcl::Circuit]Circuit, Top, Main, Index

Deletes elements from the circuit by its name.

OBJECT del elementName ?elementName ...?
Details
Parameters
argsElements names.
method del {args} {

    # Deletes elements from the circuit by its name.
    #  args - elements names
    # Synopsis: elementName ?elementName ...?
    argparse -help {Deletes elements from the circuit by its name} {
        {elementsNames -catchall -help {Elements names}}
    }
    if {![info exists Elements]} {
        return -code error "Netlist '[my configure -name]' doesn't have attached elements"
    }
    foreach elemName $elementsNames {
        set elemName [string tolower $elemName]
        if {[catch {dget $Elements $elemName}]} {
            return -code error "Element with name '$elemName' was not found in circuit's '[my configure -name]' list of elements"
        } else {
            if {[info object class [dget $Elements $elemName] {::SpiceGenTcl::Analysis}]} {
                unset ContainAnalysis
            }
            set Elements [dict remove $Elements $elemName]
        }
    }
    return
}

detachSimulator [::SpiceGenTcl::Circuit]Circuit, Top, Main, Index

Removes Simulator object reference from Circuit.

OBJECT detachSimulator ?args?
Details
Parameters
method detachSimulator {args} {

    # Removes `Simulator` object reference from `Circuit`.
    argparse -help {Removes 'Simulator' object reference from 'Circuit'} {}
    unset simulator
    return
}

genSPICEString [::SpiceGenTcl::Circuit]Circuit, Top, Main, Index

Creates circuit string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates circuit string for SPICE netlist.
    # Returns: SPICE netlist's string
    lappend totalStr [my configure -name] {*}[lmap element [dict values $Elements] {$element genSPICEString}]
    return [join $totalStr \n]
}

getDataCsv [::SpiceGenTcl::Circuit]Circuit, Top, Main, Index

Returns string with csv formatting containing all data

OBJECT getDataCsv ?-all? ?-traces list? ?-sep value?
Details
Parameters
-allSelect all traces.
-sepSeparator of columns, default is comma.
-tracesSelect names of traces to return.
Return value

Returns string with csv formatting containing all data

method getDataCsv {args} {

    # Returns string with csv formatting containing all data
    #  -all - select all traces
    #  -traces - select names of traces to return
    #  -sep - separator of columns, default is comma
    # Synopsis: ?-all? ?-traces list? ?-sep value?
    return [[my configure -data] getTracesCsv {*}$args]
}

getDataDict [::SpiceGenTcl::Circuit]Circuit, Top, Main, Index

Gets dictionary with raw data vectors.

OBJECT getDataDict ?args?
Details
Parameters
Return value

dict with vectors data, keys - names of vectors

method getDataDict {args} {

    # Gets dictionary with raw data vectors.
    # Returns: dict with vectors data, keys - names of vectors
    argparse -help {Gets dictionary with raw data vectors. Returns: dict with vectors data, keys - names of vectors} {}
    return [[my configure -data] getTracesData]
}

runAndRead [::SpiceGenTcl::Circuit]Circuit, Top, Main, Index

Invokes runAndRead, configure -log and configure -data methods from attached simulator.

OBJECT runAndRead ?-nodelete?
Details
Parameters
-nodeleteFlag to forbid simulation file deletion.
method runAndRead {args} {

    # Invokes `runAndRead`, `configure -log` and `configure -data` methods from attached simulator.
    #  -nodelete - flag to forbid simulation file deletion
    # Synopsis: ?-nodelete?
    argparse -help {Invokes 'runAndRead', 'configure -log' and 'configure -data' methods from attached simulator.} {
        {-nodelete -help {Flag to forbid simulation file deletion}}
    }
    if {![info exists simulator]} {
        return -code error "Simulator is not attached to '[my configure -name]' circuit"
    }
    if {[info exists nodelete]} {
        $simulator runAndRead [my genSPICEString] -nodelete
    } else {
        $simulator runAndRead [my genSPICEString]
    }
    my configure -log [$simulator configure -log] -data [$simulator configure -data]
}

Comment [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates comment string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

RawString

constructor [::SpiceGenTcl::Comment]Comment, Top, Main, Index

Creates object of class Comment.

OBJECT constructor value ?-name value?
Details
Parameters
-nameName of the string that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
valueValue of the comment.
Description

Class represent comment string, it can be a multiline comment.

method constructor {args} {

    # Creates object of class `Comment`.
    #  value - value of the comment
    #  -name - name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # Class represent comment string, it can be a multiline comment.
    # Synopsis: value ?-name value?
    set arguments [argparse -inline -pfirst -help {Creates object of class 'Comment'} {
        {value -help {Value of the comment}}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object and its descendants}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    my configure -value [dget $arguments value]
}

genSPICEString [::SpiceGenTcl::Comment]Comment, Top, Main, Index

Creates comment string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates comment string for SPICE netlist.
    # Returns: SPICE netlist's string
    set splitted [split [my configure -value] \n]
    set prepared [join [lmap line $splitted {set result *$line}] \n]
    return $prepared
}

Dataset [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
appendDataPointsMethod to set the data points.
configureConfigure properties.
getDataPointsNot documented.
getStrNot documented.
setDataPointsMethod to set the data points.
Properties

Readable: -len, -name, -numtype, -type

Writable: -len, -name, -numtype, -type

Subclasses

Axis, Trace, EmptyTrace

constructor [::SpiceGenTcl::Dataset]Dataset, Top, Main, Index

initialize dataset

Dataset create OBJNAME ?args?
Dataset new ?args?
Details
Parameters
lenTotal number of points.
nameName of the dataset.
numtypeNumerical type of dataset.
typeType of dataset.
method constructor {args} {

    # initialize dataset
    #  name - name of the dataset
    #  type - type of dataset
    #  len - total number of points
    #  numtype - numerical type of dataset
    set arguments [argparse -inline -help {Initialize object 'Dataset'} {
        {name -help {Name of the dataset}}
        {type -help {Type of dataset}}
        {len -help {Total number of points}}
        {numtype -optional -default real -help {Numerical type of dataset}}
    }]
    dict for {elName elValue} $arguments {
        my configure -$elName $elValue
    }
}

appendDataPoints [::SpiceGenTcl::Dataset]Dataset, Top, Main, Index

method to set the data points

OBJECT appendDataPoints dataPoint
Details
Parameters
dataPointNot documented.
method appendDataPoints {dataPoint} {

    # method to set the data points
    lappend DataPoints $dataPoint
    return
}

getDataPoints [::SpiceGenTcl::Dataset]Dataset, Top, Main, Index

OBJECT getDataPoints ?args?
Details
Parameters
method getDataPoints {args} {

    argparse -help {Gets all data points} {}
    if {[info exists DataPoints]} {
        return $DataPoints
    } else {
        return -code error "Dataset with name '[my configure -name]' doesn't contain non-zero points"
    }
    return
}

getStr [::SpiceGenTcl::Dataset]Dataset, Top, Main, Index

OBJECT getStr
Details
method getStr {} {

    return "Name: '[my configure -name]', Type: '[my configure -type]', Length: '[my configure -len]', Numerical type: '[my configure -numtype]'"
}

setDataPoints [::SpiceGenTcl::Dataset]Dataset, Top, Main, Index

method to set the data points

OBJECT setDataPoints dataPoints
Details
Parameters
dataPointsNot documented.
method setDataPoints {dataPoints} {

    # method to set the data points
    set DataPoints $dataPoints
    return
}

Device [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
actOnParamActs on Parameter object with selected action.
actOnPinActs on Pin object with selected action.
checkFloatingPinsCheck if some pin device doesn't have connected nodes and return list of them.
configureConfigure properties.
genSPICEStringCreates device string for SPICE netlist.
Properties

Readable: -name

Writable: -name

Superclasses

SPICEElement

Mixins

Utility

Subclasses

::SpiceGenTcl::Common::BasicDevices::Resistor, ::SpiceGenTcl::Common::BasicDevices::Capacitor, ::SpiceGenTcl::Common::BasicDevices::Inductor, ::SpiceGenTcl::Common::BasicDevices::SubcircuitInstance, ::SpiceGenTcl::Common::BasicDevices::VSwitch, ::SpiceGenTcl::Common::BasicDevices::CSwitch, ::SpiceGenTcl::Common::BasicDevices::SubcircuitInstanceAuto, ::SpiceGenTcl::Common::Sources::dc, ::SpiceGenTcl::Common::Sources::ac, ::SpiceGenTcl::Common::Sources::pulse, ::SpiceGenTcl::Common::Sources::sin, ::SpiceGenTcl::Common::Sources::exp, ::SpiceGenTcl::Common::Sources::pwl, ::SpiceGenTcl::Common::Sources::sffm, ::SpiceGenTcl::Common::Sources::Vccs, ::SpiceGenTcl::Common::Sources::Vcvs, ::SpiceGenTcl::Common::Sources::Cccs, ::SpiceGenTcl::Common::Sources::Ccvs, ::SpiceGenTcl::Ngspice::BasicDevices::Resistor, ::SpiceGenTcl::Ngspice::BasicDevices::Capacitor, ::SpiceGenTcl::Ngspice::BasicDevices::Inductor, ::SpiceGenTcl::Ngspice::BasicDevices::Coupling, ::SpiceGenTcl::Ngspice::BasicDevices::SubcircuitInstance, ::SpiceGenTcl::Ngspice::BasicDevices::SubcircuitInstanceAuto, ::SpiceGenTcl::Ngspice::BasicDevices::VerilogA, ::SpiceGenTcl::Ngspice::Sources::pulse, ::SpiceGenTcl::Ngspice::Sources::sffm, ::SpiceGenTcl::Ngspice::Sources::am, ::SpiceGenTcl::Ngspice::Sources::Vport, ::SpiceGenTcl::Ngspice::Sources::BehaviouralSource, ::SpiceGenTcl::Ngspice::SemiconductorDevices::Diode, ::SpiceGenTcl::Ngspice::SemiconductorDevices::Bjt, ::SpiceGenTcl::Ngspice::SemiconductorDevices::Jfet, ::SpiceGenTcl::Ngspice::SemiconductorDevices::Mesfet, ::SpiceGenTcl::Ngspice::SemiconductorDevices::Mosfet, ::SpiceGenTcl::Xyce::BasicDevices::Resistor, ::SpiceGenTcl::Xyce::BasicDevices::Capacitor, ::SpiceGenTcl::Xyce::BasicDevices::Inductor, ::SpiceGenTcl::Xyce::BasicDevices::GenSwitch, ::SpiceGenTcl::Xyce::BasicDevices::SubcircuitInstance, ::SpiceGenTcl::Xyce::BasicDevices::SubcircuitInstanceAuto, ::SpiceGenTcl::Xyce::Sources::BehaviouralSource, ::SpiceGenTcl::Xyce::SemiconductorDevices::Diode, ::SpiceGenTcl::Xyce::SemiconductorDevices::Bjt, ::SpiceGenTcl::Xyce::SemiconductorDevices::Jfet, ::SpiceGenTcl::Xyce::SemiconductorDevices::Mesfet, ::SpiceGenTcl::Xyce::SemiconductorDevices::Mosfet, ::SpiceGenTcl::Ltspice::BasicDevices::Capacitor, ::SpiceGenTcl::Ltspice::BasicDevices::Inductor, ::SpiceGenTcl::Ltspice::BasicDevices::SubcircuitInstance, ::SpiceGenTcl::Ltspice::BasicDevices::SubcircuitInstanceAuto, ::SpiceGenTcl::Ltspice::Sources::dc, ::SpiceGenTcl::Ltspice::Sources::ac, ::SpiceGenTcl::Ltspice::Sources::pulse, ::SpiceGenTcl::Ltspice::Sources::sin, ::SpiceGenTcl::Ltspice::Sources::exp, ::SpiceGenTcl::Ltspice::Sources::pwl, ::SpiceGenTcl::Ltspice::Sources::sffm, ::SpiceGenTcl::Ltspice::Sources::BehaviouralSource, ::SpiceGenTcl::Ltspice::SemiconductorDevices::Diode, ::SpiceGenTcl::Ltspice::SemiconductorDevices::Bjt, ::SpiceGenTcl::Ltspice::SemiconductorDevices::Jfet, ::SpiceGenTcl::Ltspice::SemiconductorDevices::Mesfet, ::SpiceGenTcl::Ltspice::SemiconductorDevices::Mosfet

constructor [::SpiceGenTcl::Device]Device, Top, Main, Index

Creates object of class Device.

Device create OBJNAME ?args?
Device new ?args?
Details
Parameters
nameName of the device.
paramsList of instance parameters in form {{Name Value ?-sw|pos|eq|poseq|posnocheck|nocheck?} {Name Value ?-sw|pos|eq|poseq|posnocheck|nocheck?} {Name Value ?-sw|pos|eq|poseq|posnocheck|nocheck?} ...} Parameter list can be empty if device doesn't have instance parameters.
pinsList of pins in the order they appear in SPICE device's definition together with connected node in form: {{Name0 NodeName} {Name1 NodeName} {Name2 NodeName} ...} Nodes string values could be empty.
Description

Class models general device in SPICE, number of which must be assembled (connected) to get the circuit to simulate. This class provides basic machinery for creating any device that can be connected to net in circuit. It can be instantiated to create device that contains:

  • reference name, like R1, L1, M1, etc;
  • list of pins in the order of appearence of device's definition, for example, 'drain gate source' for MOS transistor;
  • list of parameters, that could be positional (+equation), keyword (+equation) parameters, like R1 nm np 100 tc1=1 tc2={tc0*tc12}, where 100 - positional parameter, tc1 - keyword parameters and tc2 - keyword parameter with equation

This class accept definition that contains elements listed above, and generates classes: Pin, Parameter, PositionalParameter with compositional relationship (has a).

Each parameter definition could be modified by optional flags:

-posParameter has strict position and only '$Value' is displayed in netlist.
-eqParameter may contain equation in terms of functions and other parsmeters, printed as '$name={$equation}'
-poseqCombination of both flags, print only '{$equation}'
-posnocheckPositional parameter without check.
-nocheckNormal parameter without check.
method constructor {args} {

    # Creates object of class `Device`.
    #  name - name of the device
    #  pins - list of pins in the order they appear in SPICE device's definition together
    #   with connected node in form: `{{Name0 NodeName} {Name1 NodeName} {Name2 NodeName} ...}`
    #   Nodes string values could be empty.
    #  params - list of instance parameters in form `{{Name Value ?-sw|pos|eq|poseq|posnocheck|nocheck?}
    #   {Name Value ?-sw|pos|eq|poseq|posnocheck|nocheck?} {Name Value ?-sw|pos|eq|poseq|posnocheck|nocheck?} ...}`
    #   Parameter list can be empty if device doesn't have instance parameters.
    # Class models general device in SPICE, number of which
    # must be assembled (connected) to get the circuit to simulate. This class provides basic machinery
    # for creating any device that can be connected to net in circuit. It can be instantiated to create
    # device that contains:
    #  - reference name, like R1, L1, M1, etc;
    #  - list of pins in the order of appearence of device's definition, for example, 'drain gate source' for
    #     MOS transistor;
    #  - list of parameters, that could be positional (+equation), keyword (+equation) parameters, like
    #     `R1 nm np 100 tc1=1 tc2={tc0*tc12}`, where 100 - positional parameter, tc1 - keyword parameters and
    #     tc2 - keyword parameter with equation
    # This class accept definition that contains elements listed above, and generates classes: Pin, Parameter,
    # PositionalParameter with compositional relationship (has a).
    set arguments [argparse -inline -help {Creates object of class 'Device'} {
        {name -help {Name of the device}}
        {pins -help {List of pins in the order they appear in SPICE device's definition together with connected node in form: '{{Name0 NodeName} {Name1 NodeName} {Name2 NodeName} ...}'. Nodes string values could be empty. Nodes list can be empty if device doesn't have pins} -type list}
        {params -help {List of instance parameters in form '{{Name0 Value0 ?-sw|pos|eq|poseq|posnocheck|nocheck?} {Name1 Value1 ?-sw|pos|eq|poseq|posnocheck|nocheck?} {Name2 Value2 ?-sw|pos|eq|poseq|posnocheck|nocheck?} ...}'. Parameter list can be empty if device doesn't have instance parameters} -type list}
    }]
    my configure -name [dget $arguments name]
    # create Pins objects
    foreach pin [dget $arguments pins] {
        my actOnPin -add {*}$pin
    }
    #ruff
    # Each parameter definition could be modified by
    #  optional flags:
    #  -pos - parameter has strict position and only '$Value' is displayed in netlist
    #  -eq - parameter may contain equation in terms of functions and other parsmeters,
    #    printed as '$name={$equation}'
    #  -poseq - combination of both flags, print only '{$equation}'
    #  -posnocheck - positional parameter without check
    #  -nocheck - normal parameter without check
    foreach param [dget $arguments params] {
        my actOnParam -add {*}$param
    }
}

actOnParam [::SpiceGenTcl::Device]Device, Top, Main, Index

Acts on Parameter object with selected action

OBJECT actOnParam -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
OBJECT actOnParam -set name value ?name value ...?
OBJECT actOnParam -get name
OBJECT actOnParam -get -all
OBJECT actOnParam -delete name
Details
Parameters
-addAdd new parameter to the device, requires pname argument.
-allOption for getting the dictionary that contains parameters names as keys and parameters values # as the dictionary values, requires -get.
-deleteDelete existing parameter.
-eqParameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}', requires -add.
-getGet parameter value, requires pname argument.
-nocheckNormal parameter without check, requires -add.
-nodeNode parameter, requires -add.
-nodeeqNode parameter equation, requires -add.
-posParameter has strict position and only '$Value' is displayed in netlist, requires -add.
-poseqCombination of both flags, print only, requires -add.
-posnocheckPositional parameter without check, requires -add.
-setSet (or change) value of particular parameters, requires pname and value arguments.
-swSwitch parameter, requires -add.
argumentsOptional pairs of name-value for -set action, requires -set.
pnameName of parameter.
valueValue of parameter.
method actOnParam {args} {

    # Acts on `Parameter` object with selected action
    #  -add - add new parameter to the device, requires pname argument
    #  -get - get parameter value, requires pname argument
    #  -set - set (or change) value of particular parameters, requires pname and value arguments
    #  -delete - delete existing parameter
    #  -all - option for getting the dictionary that contains parameters names as keys and parameters values #    as the dictionary values, requires -get
    #  -pos - parameter has strict position and only '$Value' is displayed in netlist, requires -add
    #  -eq - Parameter may contain equation in terms of functions and other parameters, printed as
    #    '$name={$equation}', requires -add
    #  -poseq - combination of both flags, print only, requires -add
    #  -posnocheck - positional parameter without check, requires -add
    #  -nocheck - normal parameter without check, requires -add
    #  -sw - switch parameter, requires -add
    #  -node - node parameter, requires -add
    #  -nodeeq - node parameter equation, requires -add
    #  pname - name of parameter
    #  value - value of parameter
    #  arguments - optional pairs of name-value for -set action, requires -set
    # Synopsis: -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
    # Synopsis: -set name value ?name value ...?
    # Synopsis: -get name
    # Synopsis: -get -all
    # Synopsis: -delete name
    argparse -help {Applied selected actions on parameters of the device} {
        # {Actions selectors}
        {-add -key action -value add -require pname -help {Add new parameter to device}}
        {-get -key action -value get -help {Get parameter value}}
        {-set -key action -value set -require {pname value} -help {Sets (or change) value of particular parameters}}
        {-delete -key action -value delete -require pname -help {Delete existing parameter}}
        {-all -require get -forbid {pname value} -help {Option for getting the dictionary that contains parameters names as keys and parameters values as the dictionary values}}
        # {Param qualificators}
        {-pos -key paramQual -value pos -require add -help {Parameter has strict position and only '$Value' is displayed in netlist}}
        {-eq -key paramQual -value eq -require add -help {Parameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}'}}
        {-poseq -key paramQual -value poseq -require add -help {Combination of both flags, print only '{$equation}'}}
        {-posnocheck -key paramQual -value posnocheck -require add -help {Positional parameter without check}}
        {-nocheck -key paramQual -value nocheck -default {} -require add -help {Normal parameter without check}}
        {-sw -key paramQual -value sw -require add -help {Switch parameter}}
        {-node -key paramQual -value node -require add -help {Node parameter}}
        {-nodeeq -key paramQual -value nodeeq -require add -help {Node parameter equation}}
        # {Actual name(s) and value(s) of Param}
        {pname -optional -help {Name of parameter}}
        {value -optional -help {Value of parameter}}
        {arguments -catchall -require set -help {Optional pairs of name-value for -set action}}
    }
    switch $action {
        add {
            set pname [string tolower $pname]
            if {[info exists Params]} {
                set params [dict keys $Params]
            }
            lappend params $pname
            if {[my DuplListCheck $params]} {
                return -code error "Parameters list '$params' has already contains parameter with name '$pname'"
            }
            switch $paramQual {
                sw {
                    dict append Params $pname [::SpiceGenTcl::ParameterSwitch new $pname]
                }
                pos {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositional new $pname $value]
                }
                eq {
                    dict append Params $pname [::SpiceGenTcl::ParameterEquation new $pname $value]
                }
                poseq {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalEquation new $pname $value]
                }
                posnocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalNoCheck new $pname $value]
                }
                nocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterNoCheck new $pname $value]
                }
                node {
                    dict append Params $pname [::SpiceGenTcl::ParameterNode new $pname $value]
                }
                nodeeq {
                    dict append Params $pname [::SpiceGenTcl::ParameterNodeEquation new $pname $value]
                }
                default {
                    dict append Params $pname [::SpiceGenTcl::Parameter new $pname $value]
                }
            }
        }
        get {
            if {![info exists Params]} {
                return
            }
            if {[info exists all]} {
                return [dict map {paramName param} $Params {$param configure -value}]
            } elseif {[info exists pname]} {
                set pname [string tolower $pname]
                if {[dexist $Params $pname]} {
                    return [dget $Params $pname]
                } else {
                    return -code error "Device '$name' doesn't have parameter with name '$pname'"
                }
            } else {
                return -code error "'-get' action requires 'pname' parameter or '-all' option"
            }
        }
        set {
            set arguments [list $pname $value {*}$arguments]
            if {[llength $arguments]%2!=0} {
                return -code error "Number of arguments to method '[dict get [info frame 0] method]' with '-set' switch must be even"
            }
            for {set i 0} {$i<[llength $arguments]} {incr i 2} {
                set paramName [string tolower [@ $arguments $i]]
                set paramValue [@ $arguments [= {$i+1}]]
                if {[catch {dget $Params $paramName}]} {
                    return -code error "Parameter with name '$paramName' was not found in element's '$name' list of parameters '[dkeys $Params]'"
                } else {
                    set param [dget $Params $paramName]
                }
                $param configure -value $paramValue
            }
        }
        delete {
            set pname [string tolower $pname]
            if {[catch {dget $Params $pname}]} {
                return -code error "Parameter with name '$pname' was not found in device's '$name' list of parameters '[dkeys $Params]'"
            } else {
                set Params [dict remove $Params $pname]
            }
        }
    }
    return
}

actOnPin [::SpiceGenTcl::Device]Device, Top, Main, Index

Acts on Pin object with selected action

OBJECT actOnPin -add pin node
OBJECT actOnPin -set pin node
OBJECT actOnPin -get pin
OBJECT actOnPin -get -all
Details
Parameters
-addAdd new pin to the device, requires pin and node arguments.
-allOption for getting the dictionary that contains pin name as keys and connected node name as the values, requires -get.
-getGet node name connected to pin, requires pin argument.
-setSet node name connected to pin, requires pin and node arguments.
nodeName of the node connected to pin.
pinName of the pin.
method actOnPin {args} {

    # Acts on `Pin` object with selected action
    #  -add - add new pin to the device, requires pin and node arguments
    #  -get - get node name connected to pin, requires pin argument
    #  -set - set node name connected to pin, requires pin and node arguments
    #  -all - option for getting the dictionary that contains pin name as keys and connected node name as the
    #    values, requires -get
    #  pin - name of the pin
    #  node - name of the node connected to pin
    # Synopsis: -add pin node
    # Synopsis: -set pin node
    # Synopsis: -get pin
    # Synopsis: -get -all
     argparse -help {Applied selected actions on pin of the device} {
        {-add -key action -value add -require {pin node} -help {Add new pin to the device}}
        {-get -key action -value get -help {Get node name connected to pin}}
        {-set -key action -value set -require {pin node} -help {Set node name connected to pin}}
        {-all -require get -forbid {pin node} -help {Option for getting the dictionary that contains pin name as keys and connected node name as the values}}
        {pin -optional -help {Name of the pin}}
        {node -optional -help {Name of the node connected to pin}}
    }
    switch $action {
        add {
            set pin [string tolower $pin]
            set node [string tolower $node]
            if {[info exists Pins]} {
                set pins [dkeys $Pins]
            }
            lappend pins $pin
            if {[my DuplListCheck $pins]} {
                return -code error "Pins list '$pins' has already contains pin with name '$pin'"
            }
            dappend Pins $pin [::SpiceGenTcl::Pin new $pin $node]
        }
        get {
            if {![info exists Pins]} {
                return
            }
            if {[info exists all]} {
                return [dict map {pinName pin} $Pins {$pin configure -node}]
            } elseif {[info exists pin]} {
                set pin [string tolower $pin]
                if {[dexist $Pins $pin]} {
                    return [dget $Pins $pin]
                } else {
                    return -code error "Device '$name' doesn't have pin with name '$pin'"
                }
            } else {
                return -code error "'-get' action requires 'pin' parameter or '-all' option"
            }
        }
        set {
            set pin [string tolower $pin]
            set node [string tolower $node]
            if {![info exists Pins]} {
                return -code error "Device '$name' doesn't have pins"
            }
            if {[dexist $Pins $pin]} {
                [dget $Pins $pin] configure -node $node
            } else {
                return -code error "Pin with name '$pin' was not found in device's '$name' list of pins '[dkeys $Pins]'"
            }
        }
    }
    return
}

checkFloatingPins [::SpiceGenTcl::Device]Device, Top, Main, Index

Check if some pin device doesn't have connected nodes and return list of them.

OBJECT checkFloatingPins ?args?
Details
Parameters
Return value

list of floating pins

method checkFloatingPins {args} {

    # Check if some pin device doesn't have connected nodes and return list of them.
    # Returns: list of floating pins
    argparse -help {Check if some pin device doesn't have connected nodes and return list of them} {}
    set floatingPins {}
    dict for {pinName pin} $Pins {
        if {[$pin checkFloating]} {
            lappend floatingPins [$pin configure -name]
        }
    }
    return $floatingPins
}

genSPICEString [::SpiceGenTcl::Device]Device, Top, Main, Index

Creates device string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates device string for SPICE netlist.
    # Returns: SPICE netlist's string
    if {[info exists Pins]} {
        dict for {pinName pin} $Pins {
            if {![catch {$pin genSPICEString}]} {
                lappend nodes [$pin genSPICEString]
            } else {
                return -code error "Device '[my configure -name]' can't be netlisted because '$pinName' pin is floating"
            }
        }
    }
    if {[info exists Params]} {
        set params [lmap param [dict values $Params] {$param genSPICEString}]
        if {[info exists Pins]} {
            return "[my configure -name] [join $nodes] [join $params]"
        } else {
            return "[my configure -name] [join $params]"
        }
    } else {
        if {[info exists Pins]} {
            return "[my configure -name] [join $nodes]"
        } else {
            return [my configure -name]
        }
    }
}

EmptyTrace [::SpiceGenTcl]Top, Main, Index

Method summary
appendDataPointsSee Dataset.appendDataPoints
configureConfigure properties.
getDataPointsNot documented.
getStrSee Dataset.getStr
setDataPointsSee Dataset.setDataPoints
Properties

Readable: -len, -name, -numtype, -type

Writable: -len, -name, -numtype, -type

Superclasses

Dataset

getDataPoints [::SpiceGenTcl::EmptyTrace]EmptyTrace, Top, Main, Index

OBJECT getDataPoints
Details
method getDataPoints {} {

    if {[info exists DataPoints]} {
        return {}
    }
    return
}

Global [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
addNetsNot documented.
configureConfigure properties.
deleteNetNot documented.
genSPICEStringCreates global statement string for SPICE netlist.
Properties

Readable: -name

Writable: -name

Superclasses

SPICEElement

Mixins

Utility

constructor [::SpiceGenTcl::Global]Global, Top, Main, Index

Creates object of class Global.

OBJECT constructor nets ?-name value?
Details
Parameters
-nameName of the library that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
netsList of nets in form {net0 net1 ...}
Description

Class represent .global statement.

method constructor {args} {

    # Creates object of class `Global`.
    #  nets - list of nets in form `{net0 net1 ...}`
    #  -name - name of the library that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # Class represent .global statement.
    # Synopsis: nets ?-name value?
    set arguments [argparse -inline -pfirst -help {Creates object of class 'Global'} {
        {nets -help {List of nets in form '{net0 net1 ...}'} -type list}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object and its descendants}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    my addNets [dget $arguments nets]
}

addNets [::SpiceGenTcl::Global]Global, Top, Main, Index

OBJECT addNets ?args?
Details
Parameters
method addNets {args} {

    argparse -help {Adds nets to the class} {
        {nets -help {List of nets} -type list}
    }
    if {[info exists Nets]} {
        set netsList $Nets
    }
    foreach net $nets {
        if {$net ne {}} {
            lappend netsList $net
            if {[my DuplListCheck $netsList]} {
                error "Net with name '$net' is already attached to the object '[my configure -name]'"
            }
        } else {
            return -code error {Net name couldn't be empty}
        }
    }
    set Nets $netsList
    return
}

deleteNet [::SpiceGenTcl::Global]Global, Top, Main, Index

OBJECT deleteNet ?args?
Details
Parameters
method deleteNet {args} {

    argparse -help {Deletes net from the 'Nets' list} {
        {net -help {Name of the net}}
    }
    set netsList $Nets
    if {[set index [lsearch -exact $netsList $net]] !=-1} {
        set netsList [lremove $netsList $index]
    } else {
        error "Global statement '$name' doesn't have attached net with name '$net'"
    }
    set Nets $netsList
    return
}

genSPICEString [::SpiceGenTcl::Global]Global, Top, Main, Index

Creates global statement string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates global statement string for SPICE netlist.
    # Returns: SPICE netlist's string
    return ".global [join $Nets]"
}

Ic [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
actOnParamActs on Parameter object with selected action.
configureConfigure properties.
genSPICEStringCreates ic statement string for SPICE netlist.
Properties

Readable: -name

Writable: -name

Superclasses

SPICEElement

Mixins

Utility

Subclasses

Nodeset

constructor [::SpiceGenTcl::Ic]Ic, Top, Main, Index

Creates object of class Ic.

OBJECT constructor params ?-name value?
Details
Parameters
-nameName of the library that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
paramsList of instance parameters in form {{name value} {name value} {name equation -eq} ...}
Description

Class represent .ic statement.

method constructor {args} {

    # Creates object of class `Ic`.
    #  params - list of instance parameters in form `{{name value} {name value} {name equation -eq} ...}`
    #  -name - name of the library that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # Class represent .ic statement.
    # Synopsis: params ?-name value?
    set arguments [argparse -inline -pfirst -help {Creates object of class 'Ic'} {
        {params -help {list of instance parameters in form '{{name value ?-eq?} {name value ?-eq?} ...}'} -type list}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object and its descendants}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    foreach param [dget $arguments params] {
        if {[llength $param]<2} {
            error "Value '$param' is not a valid value"
        } else {
            if {[@ $param 0] eq {-eq}} {
                my actOnParam -add -nodeeq [@ $param 1] [@ $param 2]
            } else {
                my actOnParam -add -node {*}$param
            }
        }
    }
}

actOnParam [::SpiceGenTcl::Ic]Ic, Top, Main, Index

Acts on Parameter object with selected action

OBJECT actOnParam -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
OBJECT actOnParam -set name value ?name value ...?
OBJECT actOnParam -get name
OBJECT actOnParam -get -all
OBJECT actOnParam -delete name
Details
Parameters
-addAdd new parameter to the device, requires pname argument.
-allOption for getting the dictionary that contains parameters names as keys and parameters values # as the dictionary values, requires -get.
-deleteDelete existing parameter.
-eqParameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}', requires -add.
-getGet parameter value, requires pname argument.
-nocheckNormal parameter without check, requires -add.
-nodeNode parameter, requires -add.
-nodeeqNode parameter equation, requires -add.
-posParameter has strict position and only '$Value' is displayed in netlist, requires -add.
-poseqCombination of both flags, print only, requires -add.
-posnocheckPositional parameter without check, requires -add.
-setSet (or change) value of particular parameters, requires pname and value arguments.
-swSwitch parameter, requires -add.
argumentsOptional pairs of name-value for -set action, requires -set.
pnameName of parameter.
valueValue of parameter.
method actOnParam {args} {

    # Acts on `Parameter` object with selected action
    #  -add - add new parameter to the device, requires pname argument
    #  -get - get parameter value, requires pname argument
    #  -set - set (or change) value of particular parameters, requires pname and value arguments
    #  -delete - delete existing parameter
    #  -all - option for getting the dictionary that contains parameters names as keys and parameters values #    as the dictionary values, requires -get
    #  -pos - parameter has strict position and only '$Value' is displayed in netlist, requires -add
    #  -eq - Parameter may contain equation in terms of functions and other parameters, printed as
    #    '$name={$equation}', requires -add
    #  -poseq - combination of both flags, print only, requires -add
    #  -posnocheck - positional parameter without check, requires -add
    #  -nocheck - normal parameter without check, requires -add
    #  -sw - switch parameter, requires -add
    #  -node - node parameter, requires -add
    #  -nodeeq - node parameter equation, requires -add
    #  pname - name of parameter
    #  value - value of parameter
    #  arguments - optional pairs of name-value for -set action, requires -set
    # Synopsis: -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
    # Synopsis: -set name value ?name value ...?
    # Synopsis: -get name
    # Synopsis: -get -all
    # Synopsis: -delete name
    argparse -help {Applied selected actions on parameters of the device} {
        # {Actions selectors}
        {-add -key action -value add -require pname -help {Add new parameter to device}}
        {-get -key action -value get -help {Get parameter value}}
        {-set -key action -value set -require {pname value} -help {Sets (or change) value of particular parameters}}
        {-delete -key action -value delete -require pname -help {Delete existing parameter}}
        {-all -require get -forbid {pname value} -help {Option for getting the dictionary that contains parameters names as keys and parameters values as the dictionary values}}
        # {Param qualificators}
        {-pos -key paramQual -value pos -require add -help {Parameter has strict position and only '$Value' is displayed in netlist}}
        {-eq -key paramQual -value eq -require add -help {Parameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}'}}
        {-poseq -key paramQual -value poseq -require add -help {Combination of both flags, print only '{$equation}'}}
        {-posnocheck -key paramQual -value posnocheck -require add -help {Positional parameter without check}}
        {-nocheck -key paramQual -value nocheck -default {} -require add -help {Normal parameter without check}}
        {-sw -key paramQual -value sw -require add -help {Switch parameter}}
        {-node -key paramQual -value node -require add -help {Node parameter}}
        {-nodeeq -key paramQual -value nodeeq -require add -help {Node parameter equation}}
        # {Actual name(s) and value(s) of Param}
        {pname -optional -help {Name of parameter}}
        {value -optional -help {Value of parameter}}
        {arguments -catchall -require set -help {Optional pairs of name-value for -set action}}
    }
    switch $action {
        add {
            set pname [string tolower $pname]
            if {[info exists Params]} {
                set params [dict keys $Params]
            }
            lappend params $pname
            if {[my DuplListCheck $params]} {
                return -code error "Parameters list '$params' has already contains parameter with name '$pname'"
            }
            switch $paramQual {
                sw {
                    dict append Params $pname [::SpiceGenTcl::ParameterSwitch new $pname]
                }
                pos {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositional new $pname $value]
                }
                eq {
                    dict append Params $pname [::SpiceGenTcl::ParameterEquation new $pname $value]
                }
                poseq {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalEquation new $pname $value]
                }
                posnocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalNoCheck new $pname $value]
                }
                nocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterNoCheck new $pname $value]
                }
                node {
                    dict append Params $pname [::SpiceGenTcl::ParameterNode new $pname $value]
                }
                nodeeq {
                    dict append Params $pname [::SpiceGenTcl::ParameterNodeEquation new $pname $value]
                }
                default {
                    dict append Params $pname [::SpiceGenTcl::Parameter new $pname $value]
                }
            }
        }
        get {
            if {![info exists Params]} {
                return
            }
            if {[info exists all]} {
                return [dict map {paramName param} $Params {$param configure -value}]
            } elseif {[info exists pname]} {
                set pname [string tolower $pname]
                if {[dexist $Params $pname]} {
                    return [dget $Params $pname]
                } else {
                    return -code error "Device '$name' doesn't have parameter with name '$pname'"
                }
            } else {
                return -code error "'-get' action requires 'pname' parameter or '-all' option"
            }
        }
        set {
            set arguments [list $pname $value {*}$arguments]
            if {[llength $arguments]%2!=0} {
                return -code error "Number of arguments to method '[dict get [info frame 0] method]' with '-set' switch must be even"
            }
            for {set i 0} {$i<[llength $arguments]} {incr i 2} {
                set paramName [string tolower [@ $arguments $i]]
                set paramValue [@ $arguments [= {$i+1}]]
                if {[catch {dget $Params $paramName}]} {
                    return -code error "Parameter with name '$paramName' was not found in element's '$name' list of parameters '[dkeys $Params]'"
                } else {
                    set param [dget $Params $paramName]
                }
                $param configure -value $paramValue
            }
        }
        delete {
            set pname [string tolower $pname]
            if {[catch {dget $Params $pname}]} {
                return -code error "Parameter with name '$pname' was not found in device's '$name' list of parameters '[dkeys $Params]'"
            } else {
                set Params [dict remove $Params $pname]
            }
        }
    }
    return
}

genSPICEString [::SpiceGenTcl::Ic]Ic, Top, Main, Index

Creates ic statement string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates ic statement string for SPICE netlist.
    # Returns: SPICE netlist's string
    return ".ic [join [join [lmap param [dict values $Params] {$param genSPICEString}]]]"
}

Include [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates include string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

RawString

constructor [::SpiceGenTcl::Include]Include, Top, Main, Index

Creates object of class Include.

OBJECT constructor value ?-name value?
Details
Parameters
-nameName of the string that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
valueValue of the include path.
Description

This class represent .include statement.

method constructor {args} {

    # Creates object of class `Include`.
    #  value - value of the include path
    #  -name - name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # This class represent .include statement.
    # Synopsis: value ?-name value?
    set arguments [argparse -inline -pfirst -help {Creates object of class 'Include'} {
        {value -help {Value of the include path}}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object and its descendants}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    my configure -value [dget $arguments value]
}

genSPICEString [::SpiceGenTcl::Include]Include, Top, Main, Index

Creates include string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates include string for SPICE netlist.
    # Returns: SPICE netlist's string
    return ".include [my configure -value]"
}

Library [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates library string for SPICE netlist.
Properties

Readable: -libvalue, -name, -value

Writable: -libvalue, -name, -value

Superclasses

RawString

constructor [::SpiceGenTcl::Library]Library, Top, Main, Index

Creates object of class Library.

OBJECT constructor value libvalue ?-name value?
Details
Parameters
-nameName of the string that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
libvalueValue of selected library.
valueValue of the include file.
Description

Class represent .lib statement.

method constructor {args} {

    # Creates object of class `Library`.
    #  value - value of the include file
    #  libvalue - value of selected library
    #  -name - name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # Class represent .lib statement.
    # Synopsis: value libvalue ?-name value?
    set arguments [argparse -inline -pfirst -help {Creates object of class 'Library'} {
        {value -help {Value of the include path}}
        {libvalue -help {Value of selected library}}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object and its descendants}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    my configure -value [dget $arguments value] -libvalue [dget $arguments libvalue]
}

genSPICEString [::SpiceGenTcl::Library]Library, Top, Main, Index

Creates library string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates library string for SPICE netlist.
    # Returns: SPICE netlist's string
    return ".lib [my configure -value] [my configure -libvalue]"
}

Model [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
actOnParamActs on Parameter object with selected action.
configureConfigure properties.
genSPICEStringCreates model string for SPICE netlist.
Properties

Readable: -name, -type

Writable: -name, -type

Superclasses

SPICEElement

Mixins

Utility

Subclasses

::SpiceGenTcl::Ngspice::BasicDevices::RModel, ::SpiceGenTcl::Ngspice::BasicDevices::CModel, ::SpiceGenTcl::Ngspice::BasicDevices::LModel, ::SpiceGenTcl::Ngspice::BasicDevices::VSwitchModel, ::SpiceGenTcl::Ngspice::BasicDevices::CSwitchModel, ::SpiceGenTcl::Ngspice::SemiconductorDevices::DiodeModel, ::SpiceGenTcl::Ngspice::SemiconductorDevices::BjtGPModel, ::SpiceGenTcl::Ngspice::SemiconductorDevices::Jfet1Model, ::SpiceGenTcl::Ngspice::SemiconductorDevices::Jfet2Model, ::SpiceGenTcl::Ngspice::SemiconductorDevices::Mesfet1Model, ::SpiceGenTcl::Xyce::BasicDevices::RModel, ::SpiceGenTcl::Xyce::BasicDevices::CModel, ::SpiceGenTcl::Xyce::BasicDevices::LModel, ::SpiceGenTcl::Xyce::BasicDevices::VSwitchModel, ::SpiceGenTcl::Xyce::BasicDevices::CSwitchModel, ::SpiceGenTcl::Xyce::SemiconductorDevices::DiodeModel, ::SpiceGenTcl::Xyce::SemiconductorDevices::BjtGPModel, ::SpiceGenTcl::Xyce::SemiconductorDevices::Jfet1Model, ::SpiceGenTcl::Xyce::SemiconductorDevices::Jfet2Model, ::SpiceGenTcl::Xyce::SemiconductorDevices::Mesfet1Model, ::SpiceGenTcl::Ltspice::BasicDevices::VSwitchModel, ::SpiceGenTcl::Ltspice::BasicDevices::CSwitchModel, ::SpiceGenTcl::Ltspice::SemiconductorDevices::DiodeModel, ::SpiceGenTcl::Ltspice::SemiconductorDevices::DiodeIdealModel, ::SpiceGenTcl::Ltspice::SemiconductorDevices::BjtGPModel, ::SpiceGenTcl::Ltspice::SemiconductorDevices::JfetModel, ::SpiceGenTcl::Ltspice::SemiconductorDevices::MesfetModel

constructor [::SpiceGenTcl::Model]Model, Top, Main, Index

Creates object of class Model.

Model create OBJNAME ?args?
Model new ?args?
Details
Parameters
instParamsList of instance parameters in form {{name value ?-pos|eq|poseq?} {name value ?-pos|eq|poseq?} {name value ?-pos|eq|poseq?} ...}
nameName of the model.
typeType of model, for example, diode, npn, etc.
Description

Class represents model card in SPICE netlist.

method constructor {args} {

    # Creates object of class `Model`.
    #  name - name of the model
    #  type - type of model, for example, diode, npn, etc
    #  instParams - list of instance parameters in form `{{name value ?-pos|eq|poseq?}
    #   {name value ?-pos|eq|poseq?} {name value ?-pos|eq|poseq?} ...}`
    # Class represents model card in SPICE netlist.
    set arguments [argparse -inline -help {Creates object of class 'Model'} -pfirst {
        {name -help {Name of the model}}
        {type -help {Type of model, for example, diode, npn, etc}}
        {params -optional -help {{List of instance parameters in form '{{Name0 Value0 ?-pos|eq|poseq|posnocheck|nocheck?} {Name1 Value1 ?-pos|eq|poseq|posnocheck|nocheck?} {Name2 Value2 ?-pos|eq|poseq|posnocheck|nocheck?} ...}'}} -type list}
    }]
    my configure -name [dget $arguments name] -type [dget $arguments type]
    # create Params objects
    if {[dexist $arguments params]} {
        foreach param [dget $arguments params] {
            my actOnParam -add {*}$param
        }
    }
}

actOnParam [::SpiceGenTcl::Model]Model, Top, Main, Index

Acts on Parameter object with selected action

OBJECT actOnParam -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
OBJECT actOnParam -set name value ?name value ...?
OBJECT actOnParam -get name
OBJECT actOnParam -get -all
OBJECT actOnParam -delete name
Details
Parameters
-addAdd new parameter to the device, requires pname argument.
-allOption for getting the dictionary that contains parameters names as keys and parameters values # as the dictionary values, requires -get.
-deleteDelete existing parameter.
-eqParameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}', requires -add.
-getGet parameter value, requires pname argument.
-nocheckNormal parameter without check, requires -add.
-nodeNode parameter, requires -add.
-nodeeqNode parameter equation, requires -add.
-posParameter has strict position and only '$Value' is displayed in netlist, requires -add.
-poseqCombination of both flags, print only, requires -add.
-posnocheckPositional parameter without check, requires -add.
-setSet (or change) value of particular parameters, requires pname and value arguments.
-swSwitch parameter, requires -add.
argumentsOptional pairs of name-value for -set action, requires -set.
pnameName of parameter.
valueValue of parameter.
method actOnParam {args} {

    # Acts on `Parameter` object with selected action
    #  -add - add new parameter to the device, requires pname argument
    #  -get - get parameter value, requires pname argument
    #  -set - set (or change) value of particular parameters, requires pname and value arguments
    #  -delete - delete existing parameter
    #  -all - option for getting the dictionary that contains parameters names as keys and parameters values #    as the dictionary values, requires -get
    #  -pos - parameter has strict position and only '$Value' is displayed in netlist, requires -add
    #  -eq - Parameter may contain equation in terms of functions and other parameters, printed as
    #    '$name={$equation}', requires -add
    #  -poseq - combination of both flags, print only, requires -add
    #  -posnocheck - positional parameter without check, requires -add
    #  -nocheck - normal parameter without check, requires -add
    #  -sw - switch parameter, requires -add
    #  -node - node parameter, requires -add
    #  -nodeeq - node parameter equation, requires -add
    #  pname - name of parameter
    #  value - value of parameter
    #  arguments - optional pairs of name-value for -set action, requires -set
    # Synopsis: -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
    # Synopsis: -set name value ?name value ...?
    # Synopsis: -get name
    # Synopsis: -get -all
    # Synopsis: -delete name
    argparse -help {Applied selected actions on parameters of the device} {
        # {Actions selectors}
        {-add -key action -value add -require pname -help {Add new parameter to device}}
        {-get -key action -value get -help {Get parameter value}}
        {-set -key action -value set -require {pname value} -help {Sets (or change) value of particular parameters}}
        {-delete -key action -value delete -require pname -help {Delete existing parameter}}
        {-all -require get -forbid {pname value} -help {Option for getting the dictionary that contains parameters names as keys and parameters values as the dictionary values}}
        # {Param qualificators}
        {-pos -key paramQual -value pos -require add -help {Parameter has strict position and only '$Value' is displayed in netlist}}
        {-eq -key paramQual -value eq -require add -help {Parameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}'}}
        {-poseq -key paramQual -value poseq -require add -help {Combination of both flags, print only '{$equation}'}}
        {-posnocheck -key paramQual -value posnocheck -require add -help {Positional parameter without check}}
        {-nocheck -key paramQual -value nocheck -default {} -require add -help {Normal parameter without check}}
        {-sw -key paramQual -value sw -require add -help {Switch parameter}}
        {-node -key paramQual -value node -require add -help {Node parameter}}
        {-nodeeq -key paramQual -value nodeeq -require add -help {Node parameter equation}}
        # {Actual name(s) and value(s) of Param}
        {pname -optional -help {Name of parameter}}
        {value -optional -help {Value of parameter}}
        {arguments -catchall -require set -help {Optional pairs of name-value for -set action}}
    }
    switch $action {
        add {
            set pname [string tolower $pname]
            if {[info exists Params]} {
                set params [dict keys $Params]
            }
            lappend params $pname
            if {[my DuplListCheck $params]} {
                return -code error "Parameters list '$params' has already contains parameter with name '$pname'"
            }
            switch $paramQual {
                sw {
                    dict append Params $pname [::SpiceGenTcl::ParameterSwitch new $pname]
                }
                pos {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositional new $pname $value]
                }
                eq {
                    dict append Params $pname [::SpiceGenTcl::ParameterEquation new $pname $value]
                }
                poseq {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalEquation new $pname $value]
                }
                posnocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalNoCheck new $pname $value]
                }
                nocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterNoCheck new $pname $value]
                }
                node {
                    dict append Params $pname [::SpiceGenTcl::ParameterNode new $pname $value]
                }
                nodeeq {
                    dict append Params $pname [::SpiceGenTcl::ParameterNodeEquation new $pname $value]
                }
                default {
                    dict append Params $pname [::SpiceGenTcl::Parameter new $pname $value]
                }
            }
        }
        get {
            if {![info exists Params]} {
                return
            }
            if {[info exists all]} {
                return [dict map {paramName param} $Params {$param configure -value}]
            } elseif {[info exists pname]} {
                set pname [string tolower $pname]
                if {[dexist $Params $pname]} {
                    return [dget $Params $pname]
                } else {
                    return -code error "Device '$name' doesn't have parameter with name '$pname'"
                }
            } else {
                return -code error "'-get' action requires 'pname' parameter or '-all' option"
            }
        }
        set {
            set arguments [list $pname $value {*}$arguments]
            if {[llength $arguments]%2!=0} {
                return -code error "Number of arguments to method '[dict get [info frame 0] method]' with '-set' switch must be even"
            }
            for {set i 0} {$i<[llength $arguments]} {incr i 2} {
                set paramName [string tolower [@ $arguments $i]]
                set paramValue [@ $arguments [= {$i+1}]]
                if {[catch {dget $Params $paramName}]} {
                    return -code error "Parameter with name '$paramName' was not found in element's '$name' list of parameters '[dkeys $Params]'"
                } else {
                    set param [dget $Params $paramName]
                }
                $param configure -value $paramValue
            }
        }
        delete {
            set pname [string tolower $pname]
            if {[catch {dget $Params $pname}]} {
                return -code error "Parameter with name '$pname' was not found in device's '$name' list of parameters '[dkeys $Params]'"
            } else {
                set Params [dict remove $Params $pname]
            }
        }
    }
    return
}

genSPICEString [::SpiceGenTcl::Model]Model, Top, Main, Index

Creates model string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates model string for SPICE netlist.
    # Returns: SPICE netlist's string
    if {![info exists Params]} {
        lappend params {}
        return ".model [my configure -name] [my configure -type]"
    } else {
        set params [lmap param [dict values $Params] {$param genSPICEString}]
        return ".model [my configure -name] [my configure -type]([join $params])"
    }
}

Netlist [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
addAdds elements objects to Elements dictionary.
configureConfigure properties.
delDeletes elements from the netlist by its name.
genSPICEStringCreates netlist string for SPICE netlist.
getAllElemNamesGets names of all elements in netlist.
getElementGets particular element object reference by its name.
Properties

Readable: -name

Writable: -name

Superclasses

SPICEElement

Mixins

Utility

Subclasses

Circuit, Subcircuit

constructor [::SpiceGenTcl::Netlist]Netlist, Top, Main, Index

Creates object of class Netlist.

Netlist create OBJNAME ?args?
Netlist new ?args?
Details
Parameters
nameName of the netlist.
Description

Class implements netlist as a collection of SPICE elements. Any element that has SPICEElement as a parent class can be added to Netlist, except Options and Analysis.

method constructor {args} {

    # Creates object of class `Netlist`.
    #  name - name of the netlist
    # Class implements netlist as a collection of SPICE elements. Any element that has SPICEElement
    # as a parent class can be added to Netlist, except Options and Analysis.
    set arguments [argparse -inline -help {Creates object of class 'Netlist'} {
        {name -help {Name of the netlist}}
    }]
    my configure -name [dget $arguments name]
}

add [::SpiceGenTcl::Netlist]Netlist, Top, Main, Index

Adds elements objects to Elements dictionary.

OBJECT add element ?element ...?
Details
Parameters
elementsElements objects references.
method add {args} {

    # Adds elements objects to Elements dictionary.
    #  elements - elements objects references
    # Synopsis: element ?element ...?
    argparse -help {Adds elements objects to 'Elements' dictionary} {
        {elements -catchall -help {Elements objects references}}
    }
    foreach element $elements {
        lappend elementsNamesList [string tolower [$element configure -name]]
    }
    if {[info exists Elements]} {
        lappend elementsNamesList {*}[my getAllElemNames]
    }
    set dup [my DuplListCheckRet $elementsNamesList]
    if {$dup ne {}} {
        return -code error "Netlist '[my configure -name]' already contains element with name $dup"
    }
    foreach element $elements {
        set elemName [$element configure -name]
        dict append Elements $elemName $element
    }
    return
}

del [::SpiceGenTcl::Netlist]Netlist, Top, Main, Index

Deletes elements from the netlist by its name.

OBJECT del elementName ?elementName ...?
Details
Parameters
elementsNamesNames of elements to delete.
method del {args} {

    # Deletes elements from the netlist by its name.
    #  elementsNames - names of elements to delete
    # Synopsis: elementName ?elementName ...?
    argparse -help {Deletes elements from the netlist by its name} {
        {elementsNames -catchall -help {Elements names}}
    }
    if {![info exists Elements]} {
        return -code error "Netlist '[my configure -name]' doesn't have attached elements"
    }
    foreach elemName $elementsNames {
        set elemName [string tolower $elemName]
        if {[catch {dget $Elements $elemName}]} {
            return -code error "Element with name '$elemName' was not found in netlist's '[my configure -name]' list of elements"
        } else {
            set Elements [dict remove $Elements $elemName]
        }
    }
    return
}

genSPICEString [::SpiceGenTcl::Netlist]Netlist, Top, Main, Index

Creates netlist string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates netlist string for SPICE netlist.
    # Returns: SPICE netlist's string
    if {![info exists Elements]} {
        return -code error "Netlist '[my configure -name]' doesn't have attached elements"
    }
    return [join [lmap element [dict values $Elements] {$element genSPICEString}] \n]
}

getAllElemNames [::SpiceGenTcl::Netlist]Netlist, Top, Main, Index

Gets names of all elements in netlist.

OBJECT getAllElemNames ?args?
Details
Parameters
Return value

list of elements names

method getAllElemNames {args} {

    # Gets names of all elements in netlist.
    # Returns: list of elements names
    argparse -help {Gets names of all elements in netlist. Returns: list of elements names} {}
    if {![info exists Elements]} {
        return -code error "Netlist '[my configure -name]' doesn't have attached elements"
    }
    return [dict keys $Elements]
}

getElement [::SpiceGenTcl::Netlist]Netlist, Top, Main, Index

Gets particular element object reference by its name.

OBJECT getElement elemName
Details
Parameters
elemNameName of element.
method getElement {args} {

    # Gets particular element object reference by its name.
    #  elemName - name of element
    # Synopsis: elemName
    argparse -help {Gets particular element object reference by its name} {
        {elemName -help {Name of element}}
    }
    set elemName [string tolower $elemName]
    if {[catch {dget $Elements $elemName}]} {
        return -code error "Element with name '$elemName' was not found in netlist's '[my configure -name]' list of elements"
    } else {
        set foundElem [dget $Elements $elemName]
    }
    return $foundElem
}

Nodeset [::SpiceGenTcl]Top, Main, Index

Method summary
actOnParamSee Ic.actOnParam
configureConfigure properties.
genSPICEStringCreates nodeset statement string for SPICE netlist.
Properties

Readable: -name

Writable: -name

Superclasses

Ic

Mixins

Utility

genSPICEString [::SpiceGenTcl::Nodeset]Nodeset, Top, Main, Index

Creates nodeset statement string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates nodeset statement string for SPICE netlist.
    # Returns: SPICE netlist's string
    return ".nodeset [join [join [lmap param [dict values $Params] {$param genSPICEString}]]]"
}

Options [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
actOnParamActs on Parameter object with selected action.
configureConfigure properties.
genSPICEStringCreates options string for SPICE netlist.
Properties

Readable: -name

Writable: -name

Superclasses

SPICEElement

Mixins

Utility

Subclasses

::SpiceGenTcl::Ngspice::Misc::OptionsNgspice

constructor [::SpiceGenTcl::Options]Options, Top, Main, Index

Creates object of class Options.

OBJECT constructor params ?-name value?
Details
Parameters
-nameName of the string that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
paramsList of instance parameters in form {{name value ?-sw?} {name value ?-sw?} {name value ?-sw?} ...}
Description

This class represent .options statement.

method constructor {args} {

    # Creates object of class `Options`.
    #  params - list of instance parameters in form `{{name value ?-sw?} {name value ?-sw?}
    #   {name value ?-sw?} ...}`
    #  -name - name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # This class represent .options statement.
    # Synopsis: params ?-name value?
    set arguments [argparse -inline -pfirst -help {Creates object of class 'Options'} {
        {params -help {list of instance parameters in form '{{name value ?-sw?} {name value ?-sw?} {name value ?-sw?} ...}'}}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object and its descendants}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    foreach param [dget $arguments params] {
        if {[llength $param]<2} {
            error "Value '$param' is not a valid value"
        } else {
            my actOnParam -add {*}$param
        }
    }
}

actOnParam [::SpiceGenTcl::Options]Options, Top, Main, Index

Acts on Parameter object with selected action

OBJECT actOnParam -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
OBJECT actOnParam -set name value ?name value ...?
OBJECT actOnParam -get name
OBJECT actOnParam -get -all
OBJECT actOnParam -delete name
Details
Parameters
-addAdd new parameter to the device, requires pname argument.
-allOption for getting the dictionary that contains parameters names as keys and parameters values # as the dictionary values, requires -get.
-deleteDelete existing parameter.
-eqParameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}', requires -add.
-getGet parameter value, requires pname argument.
-nocheckNormal parameter without check, requires -add.
-nodeNode parameter, requires -add.
-nodeeqNode parameter equation, requires -add.
-posParameter has strict position and only '$Value' is displayed in netlist, requires -add.
-poseqCombination of both flags, print only, requires -add.
-posnocheckPositional parameter without check, requires -add.
-setSet (or change) value of particular parameters, requires pname and value arguments.
-swSwitch parameter, requires -add.
argumentsOptional pairs of name-value for -set action, requires -set.
pnameName of parameter.
valueValue of parameter.
method actOnParam {args} {

    # Acts on `Parameter` object with selected action
    #  -add - add new parameter to the device, requires pname argument
    #  -get - get parameter value, requires pname argument
    #  -set - set (or change) value of particular parameters, requires pname and value arguments
    #  -delete - delete existing parameter
    #  -all - option for getting the dictionary that contains parameters names as keys and parameters values #    as the dictionary values, requires -get
    #  -pos - parameter has strict position and only '$Value' is displayed in netlist, requires -add
    #  -eq - Parameter may contain equation in terms of functions and other parameters, printed as
    #    '$name={$equation}', requires -add
    #  -poseq - combination of both flags, print only, requires -add
    #  -posnocheck - positional parameter without check, requires -add
    #  -nocheck - normal parameter without check, requires -add
    #  -sw - switch parameter, requires -add
    #  -node - node parameter, requires -add
    #  -nodeeq - node parameter equation, requires -add
    #  pname - name of parameter
    #  value - value of parameter
    #  arguments - optional pairs of name-value for -set action, requires -set
    # Synopsis: -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
    # Synopsis: -set name value ?name value ...?
    # Synopsis: -get name
    # Synopsis: -get -all
    # Synopsis: -delete name
    argparse -help {Applied selected actions on parameters of the device} {
        # {Actions selectors}
        {-add -key action -value add -require pname -help {Add new parameter to device}}
        {-get -key action -value get -help {Get parameter value}}
        {-set -key action -value set -require {pname value} -help {Sets (or change) value of particular parameters}}
        {-delete -key action -value delete -require pname -help {Delete existing parameter}}
        {-all -require get -forbid {pname value} -help {Option for getting the dictionary that contains parameters names as keys and parameters values as the dictionary values}}
        # {Param qualificators}
        {-pos -key paramQual -value pos -require add -help {Parameter has strict position and only '$Value' is displayed in netlist}}
        {-eq -key paramQual -value eq -require add -help {Parameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}'}}
        {-poseq -key paramQual -value poseq -require add -help {Combination of both flags, print only '{$equation}'}}
        {-posnocheck -key paramQual -value posnocheck -require add -help {Positional parameter without check}}
        {-nocheck -key paramQual -value nocheck -default {} -require add -help {Normal parameter without check}}
        {-sw -key paramQual -value sw -require add -help {Switch parameter}}
        {-node -key paramQual -value node -require add -help {Node parameter}}
        {-nodeeq -key paramQual -value nodeeq -require add -help {Node parameter equation}}
        # {Actual name(s) and value(s) of Param}
        {pname -optional -help {Name of parameter}}
        {value -optional -help {Value of parameter}}
        {arguments -catchall -require set -help {Optional pairs of name-value for -set action}}
    }
    switch $action {
        add {
            set pname [string tolower $pname]
            if {[info exists Params]} {
                set params [dict keys $Params]
            }
            lappend params $pname
            if {[my DuplListCheck $params]} {
                return -code error "Parameters list '$params' has already contains parameter with name '$pname'"
            }
            switch $paramQual {
                sw {
                    dict append Params $pname [::SpiceGenTcl::ParameterSwitch new $pname]
                }
                pos {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositional new $pname $value]
                }
                eq {
                    dict append Params $pname [::SpiceGenTcl::ParameterEquation new $pname $value]
                }
                poseq {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalEquation new $pname $value]
                }
                posnocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalNoCheck new $pname $value]
                }
                nocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterNoCheck new $pname $value]
                }
                node {
                    dict append Params $pname [::SpiceGenTcl::ParameterNode new $pname $value]
                }
                nodeeq {
                    dict append Params $pname [::SpiceGenTcl::ParameterNodeEquation new $pname $value]
                }
                default {
                    dict append Params $pname [::SpiceGenTcl::Parameter new $pname $value]
                }
            }
        }
        get {
            if {![info exists Params]} {
                return
            }
            if {[info exists all]} {
                return [dict map {paramName param} $Params {$param configure -value}]
            } elseif {[info exists pname]} {
                set pname [string tolower $pname]
                if {[dexist $Params $pname]} {
                    return [dget $Params $pname]
                } else {
                    return -code error "Device '$name' doesn't have parameter with name '$pname'"
                }
            } else {
                return -code error "'-get' action requires 'pname' parameter or '-all' option"
            }
        }
        set {
            set arguments [list $pname $value {*}$arguments]
            if {[llength $arguments]%2!=0} {
                return -code error "Number of arguments to method '[dict get [info frame 0] method]' with '-set' switch must be even"
            }
            for {set i 0} {$i<[llength $arguments]} {incr i 2} {
                set paramName [string tolower [@ $arguments $i]]
                set paramValue [@ $arguments [= {$i+1}]]
                if {[catch {dget $Params $paramName}]} {
                    return -code error "Parameter with name '$paramName' was not found in element's '$name' list of parameters '[dkeys $Params]'"
                } else {
                    set param [dget $Params $paramName]
                }
                $param configure -value $paramValue
            }
        }
        delete {
            set pname [string tolower $pname]
            if {[catch {dget $Params $pname}]} {
                return -code error "Parameter with name '$pname' was not found in device's '$name' list of parameters '[dkeys $Params]'"
            } else {
                set Params [dict remove $Params $pname]
            }
        }
    }
    return
}

genSPICEString [::SpiceGenTcl::Options]Options, Top, Main, Index

Creates options string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates options string for SPICE netlist.
    # Returns: SPICE netlist's string
    return ".options [join [lmap param [dict values $Params] {$param genSPICEString}]]"
}

Parameter [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

ParameterSwitch

Subclasses

ParameterNode, ParameterNoCheck, ParameterPositional, ParameterDefault, ParameterEquation

constructor [::SpiceGenTcl::Parameter]Parameter, Top, Main, Index

Creates object of class Parameter with parameter name and value.

Parameter create OBJNAME ?args?
Parameter new ?args?
Details
Parameters
nameName of the parameter.
valueValue of the parameter.
Description

Class models parameter that has a name and a value - the most common type of parameters in SPICE netlist. Its representation in netlist is 'name=value', and can be called "keyword parameter".

method constructor {args} {

    # Creates object of class `Parameter` with parameter name and value.
    #  name - name of the parameter
    #  value - value of the parameter
    # Class models parameter that has a name and a value - the most
    # common type of parameters in SPICE netlist. Its representation in netlist is
    # 'name=value', and can be called "keyword parameter".
    set arguments [argparse -inline -help {Creates object of class 'Parameter' with parameter name and value} {
        {name -help {Name of the parameter}}
        {value -help {Value of the parameter}}
    }]
    dict for {elName elValue} $arguments {
        my configure -$elName $elValue
    }
}

genSPICEString [::SpiceGenTcl::Parameter]Parameter, Top, Main, Index

Creates string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates string for SPICE netlist.
    # Returns: SPICE netlist's string
    return [my configure -name]=[my configure -value]
}

ParameterDefault [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringSee Parameter.genSPICEString
resetValueResets value of the parameter to it's default value.
Properties

Readable: -defvalue, -name, -value

Writable: -defvalue, -name, -value

Superclasses

Parameter

constructor [::SpiceGenTcl::ParameterDefault]ParameterDefault, Top, Main, Index

Creates object of class ParameterDefault with parameter name, value and default value.

ParameterDefault create OBJNAME ?args?
ParameterDefault new ?args?
Details
Parameters
defValueDefault value of the parameter.
nameName of the parameter.
valueValue of the parameter.
Description

Class models parameter that has a name and a value, but it differs from parent class in sense of having default value, so it has special ability to reset its value to default value by special method resetValue.

method constructor {args} {

    # Creates object of class `ParameterDefault` with parameter name, value and default value.
    #  name - name of the parameter
    #  value - value of the parameter
    #  defValue - default value of the parameter
    # Class models parameter that has a name and a value, but it differs from
    # parent class in sense of having default value, so it has special ability to reset its value to default
    # value by special method `resetValue`.
    set arguments [argparse -inline -help {Creates object of class 'ParameterDefault' with parameter name and value} {
        {name -help {Name of the parameter}}
        {value -help {Value of the parameter}}
        {defValue -help {Default of the parameter}}
    }]
    my configure -defvalue [dget $arguments defValue]
    next [dget $arguments name] [dget $arguments value]
}

resetValue [::SpiceGenTcl::ParameterDefault]ParameterDefault, Top, Main, Index

Resets value of the parameter to it's default value.

OBJECT resetValue ?args?
Details
Parameters
method resetValue {args} {

    # Resets value of the parameter to it's default value.
    argparse -help {Resets value of the parameter to it's default value} {}
    my configure -value [my configure -defvalue]
    return
}

ParameterEquation [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

Parameter

Subclasses

ParameterPositionalEquation

constructor [::SpiceGenTcl::ParameterEquation]ParameterEquation, Top, Main, Index

Creates object of class ParameterEquation with parameter name and value as an equation.

ParameterEquation create OBJNAME ?args?
ParameterEquation new ?args?
Details
Parameters
nameName of the parameter.
valueValue of the parameter.
Description

Class models parameter that has representation as an equation. Example: R={R1+R2}

method constructor {args} {

    # Creates object of class `ParameterEquation` with parameter name and value as an equation.
    #  name - name of the parameter
    #  value - value of the parameter
    # Class models parameter that has representation as an equation.
    # Example: R={R1+R2}
    set arguments [argparse -inline -help {Creates object of class 'ParameterEquation' with parameter name and value as an equation} {
        {name -help {Name of the parameter}}
        {value -help {Value of the parameter}}
    }]
    next {*}[dvalues $arguments]
}

genSPICEString [::SpiceGenTcl::ParameterEquation]ParameterEquation, Top, Main, Index

Creates string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates string for SPICE netlist.
    # Returns: SPICE netlist's string
    return [my configure -name]=\{[my configure -value]\}
}

ParameterNoCheck [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringSee Parameter.genSPICEString
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

Parameter

constructor [::SpiceGenTcl::ParameterNoCheck]ParameterNoCheck, Top, Main, Index

Creates object of class ParameterNoCheck with parameter name and value.

ParameterNoCheck create OBJNAME ?args?
ParameterNoCheck new ?args?
Details
Parameters
nameName of the parameter.
valueValue of the parameter.
Description

Class models parameter the same as described by Parameter but without check for value form.

method constructor {args} {

    # Creates object of class `ParameterNoCheck` with parameter name and value.
    #  name - name of the parameter
    #  value - value of the parameter
    # Class models parameter the same as described by `Parameter` but without check for value form.
    set arguments [argparse -inline -help {Creates object of class 'ParameterNoCheck' with parameter name and value} {
        {name -help {Name of the parameter}}
        {value -help {Value of the parameter}}
    }]
    next {*}[dvalues $arguments]
}

ParameterNode [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

Parameter

Subclasses

ParameterNodeEquation

constructor [::SpiceGenTcl::ParameterNode]ParameterNode, Top, Main, Index

Creates object of class ParameterNode with parameter name and value.

ParameterNode create OBJNAME ?args?
ParameterNode new ?args?
Details
Parameters
nameName of the parameter.
valueValue of the parameter.
method constructor {args} {

    # Creates object of class `ParameterNode` with parameter name and value.
    #  name - name of the parameter
    #  value - value of the parameter
    set arguments [argparse -inline -help {Creates object of class 'ParameterNode' with parameter name and value} {
        {name -help {Name of the parameter}}
        {value -help {Value of the parameter}}
    }]
    dict for {elName elValue} $arguments {
        my configure -$elName $elValue
    }
}

genSPICEString [::SpiceGenTcl::ParameterNode]ParameterNode, Top, Main, Index

Creates string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates string for SPICE netlist.
    # Returns: SPICE netlist's string
    return [my configure -name]=[my configure -value]
}

ParameterNodeEquation [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

ParameterNode

constructor [::SpiceGenTcl::ParameterNodeEquation]ParameterNodeEquation, Top, Main, Index

Creates object of class ParameterNodeEquation with parameter name and value.

ParameterNodeEquation create OBJNAME ?args?
ParameterNodeEquation new ?args?
Details
Parameters
nameName of the parameter.
valueValue of the parameter.
method constructor {args} {

    # Creates object of class `ParameterNodeEquation` with parameter name and value.
    #  name - name of the parameter
    #  value - value of the parameter
    set arguments [argparse -inline -help {Creates object of class 'ParameterNodeEquation' with parameter name and value} {
        {name -help {Name of the parameter}}
        {value -help {Value of the parameter}}
    }]
    dict for {elName elValue} $arguments {
        my configure -$elName $elValue
    }
}

genSPICEString [::SpiceGenTcl::ParameterNodeEquation]ParameterNodeEquation, Top, Main, Index

Creates string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates string for SPICE netlist.
    # Returns: SPICE netlist's string
    return "[my configure -name]=\{[my configure -value]\}"
}

ParameterPositional [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

Parameter

Subclasses

ParameterPositionalNoCheck

constructor [::SpiceGenTcl::ParameterPositional]ParameterPositional, Top, Main, Index

Creates object of class ParameterPositional with parameter name and value.

ParameterPositional create OBJNAME ?args?
ParameterPositional new ?args?
Details
Parameters
nameName of parameter.
valueValue of parameter.
Description

Class models parameter that has a name and a value, but it differs from parent class in the sense of netlist representation: this parameter represents only by the value in the netlist. It's meaning for holding element is taken from it's position in the element's definition, for example, R1 np nm 100 tc1=1 tc2=0 - resistor with positional parameter R=100, you can't put it after parameters tc1 and tc2, it must be placed right after the pins definition.

method constructor {args} {

    # Creates object of class `ParameterPositional` with parameter name and value.
    #  name - name of parameter
    #  value - value of parameter
    # Class models parameter that has a name and a value, but it differs from
    # parent class in the sense of netlist representation: this parameter represents only
    # by the value in the netlist. It's meaning for holding element is taken from
    # it's position in the element's definition, for example, R1 np nm 100 tc1=1 tc2=0 - resistor
    # with positional parameter R=100, you can't put it after parameters tc1 and tc2, it must be placed
    # right after the pins definition.
    set arguments [argparse -inline -help {Creates object of class 'ParameterPositional' with parameter name and value} {
        {name -help {Name of the parameter}}
        {value -help {Value of the parameter}}
    }]
    next {*}[dvalues $arguments]
}

genSPICEString [::SpiceGenTcl::ParameterPositional]ParameterPositional, Top, Main, Index

Creates string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates string for SPICE netlist.
    # Returns: SPICE netlist's string
    return [my configure -value]
}

ParameterPositionalEquation [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

ParameterEquation

constructor [::SpiceGenTcl::ParameterPositionalEquation]ParameterPositionalEquation, Top, Main, Index

Creates object of class ParameterPositionalEquation with parameter name and value as an equation in positional form.

ParameterPositionalEquation create OBJNAME ?args?
ParameterPositionalEquation new ?args?
Details
Parameters
nameName of the parameter.
valueValue of the parameter.
Description

Class models parameter that has representation as an equation, but in form of positional parameter. Example: {R1+R2}

method constructor {args} {

    # Creates object of class `ParameterPositionalEquation` with parameter name and value as an equation in
    # positional form.
    #  name - name of the parameter
    #  value - value of the parameter
    # Class models parameter that has representation as an equation, but in form of
    # positional parameter. Example: {R1+R2}
    set arguments [argparse -inline -help {Creates object of class 'ParameterPositionalEquation' with parameter name and value as anequation} {
        {name -help {Name of the parameter}}
        {value -help {Value of the parameter}}
    }]
    next {*}[dvalues $arguments]
}

genSPICEString [::SpiceGenTcl::ParameterPositionalEquation]ParameterPositionalEquation, Top, Main, Index

Creates string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates string for SPICE netlist.
    # Returns: SPICE netlist's string
    return \{[my configure -value]\}
}

ParameterPositionalNoCheck [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates string for SPICE netlist. Results: SPICE netlist's string.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

ParameterPositional

constructor [::SpiceGenTcl::ParameterPositionalNoCheck]ParameterPositionalNoCheck, Top, Main, Index

Creates object of class ParameterPositionalNoCheck.

ParameterPositionalNoCheck create OBJNAME ?args?
ParameterPositionalNoCheck new ?args?
Details
Parameters
nameName of parameter.
valueValue of parameter.
Description

Class models parameter the same as described by ParameterPositional but without check for value form.

method constructor {args} {

    # Creates object of class `ParameterPositionalNoCheck`.
    #  name - name of parameter
    #  value - value of parameter
    # Class models parameter the same as described by `ParameterPositional` but without check for value form.
    set arguments [argparse -inline -help {Creates object of class 'ParameterPositionalNoCheck' with parameter name and value} {
        {name -help {Name of the parameter}}
        {value -help {Value of the parameter}}
    }]
    next {*}[dvalues $arguments]
}

genSPICEString [::SpiceGenTcl::ParameterPositionalNoCheck]ParameterPositionalNoCheck, Top, Main, Index

Creates string for SPICE netlist. Results: SPICE netlist's string

OBJECT genSPICEString
Details
method genSPICEString {} {

    # Creates string for SPICE netlist.
    # Results: SPICE netlist's string
    return [my configure -value]
}

ParameterSwitch [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

SPICEElement

Subclasses

Parameter, ParameterVector

constructor [::SpiceGenTcl::ParameterSwitch]ParameterSwitch, Top, Main, Index

Creates object of class ParameterSwitch with parameter name.

ParameterSwitch create OBJNAME ?args?
ParameterSwitch new ?args?
Details
Parameters
nameName of the parameter.
Description

Class models base parameter acting like a switch - its presence gives us information that something it controls is on. This parameter doesn't have a value, and it is the most basic class in Parameter class family.

method constructor {args} {

    # Creates object of class `ParameterSwitch` with parameter name.
    #  name - name of the parameter
    # Class models base parameter acting like a switch -
    # its presence gives us information that something it controls is on.
    # This parameter doesn't have a value, and it is the most basic class
    # in Parameter class family.
    set arguments [argparse -inline -help {Creates object of class 'ParameterSwitch' with parameter name} {
        {name -help {Name of the parameter}}
    }]
    my configure -name [dget $arguments name] -value {}
}

genSPICEString [::SpiceGenTcl::ParameterSwitch]ParameterSwitch, Top, Main, Index

Creates string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

string '$name'

method genSPICEString {} {

    # Creates string for SPICE netlist.
    # Returns: string '$name'
    return [my configure -name]
}

ParameterVector [::SpiceGenTcl]Top, Main, Index

Method summary
configureConfigure properties.
genSPICEStringSee ParameterSwitch.genSPICEString
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

ParameterSwitch

ParamStatement [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
actOnParamActs on Parameter object with selected action.
configureConfigure properties.
genSPICEStringCreates parameter statement string for SPICE netlist.
Properties

Readable: -name

Writable: -name

Superclasses

SPICEElement

Mixins

Utility

constructor [::SpiceGenTcl::ParamStatement]ParamStatement, Top, Main, Index

Creates object of class ParamStatement.

OBJECT constructor params ?-name value?
Details
Parameters
-nameName of the library that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
paramsList of instance parameters in form {{name value ?-eq?} {name value ?-eq?} ...}
Description

Class represent .param statement.

method constructor {args} {

    # Creates object of class `ParamStatement`.
    #  params - list of instance parameters in form `{{name value ?-eq?} {name value ?-eq?} ...}`
    #  -name - name of the library that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # Class represent .param statement.
    # Synopsis: params ?-name value?
    set arguments [argparse -inline -pfirst -help {Creates object of class 'ParamStatement'} {
        {params -help {list of instance parameters in form '{{name value ?-eq?} {name value ?-eq?} ...}'} -type list}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object and its descendants}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    foreach param [dget $arguments params] {
        if {[llength $param]<2} {
            error "Value '$param' is not a valid value"
        } else {
            my actOnParam -add {*}$param
        }
    }
}

actOnParam [::SpiceGenTcl::ParamStatement]ParamStatement, Top, Main, Index

Acts on Parameter object with selected action

OBJECT actOnParam -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
OBJECT actOnParam -set name value ?name value ...?
OBJECT actOnParam -get name
OBJECT actOnParam -get -all
OBJECT actOnParam -delete name
Details
Parameters
-addAdd new parameter to the device, requires pname argument.
-allOption for getting the dictionary that contains parameters names as keys and parameters values # as the dictionary values, requires -get.
-deleteDelete existing parameter.
-eqParameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}', requires -add.
-getGet parameter value, requires pname argument.
-nocheckNormal parameter without check, requires -add.
-nodeNode parameter, requires -add.
-nodeeqNode parameter equation, requires -add.
-posParameter has strict position and only '$Value' is displayed in netlist, requires -add.
-poseqCombination of both flags, print only, requires -add.
-posnocheckPositional parameter without check, requires -add.
-setSet (or change) value of particular parameters, requires pname and value arguments.
-swSwitch parameter, requires -add.
argumentsOptional pairs of name-value for -set action, requires -set.
pnameName of parameter.
valueValue of parameter.
method actOnParam {args} {

    # Acts on `Parameter` object with selected action
    #  -add - add new parameter to the device, requires pname argument
    #  -get - get parameter value, requires pname argument
    #  -set - set (or change) value of particular parameters, requires pname and value arguments
    #  -delete - delete existing parameter
    #  -all - option for getting the dictionary that contains parameters names as keys and parameters values #    as the dictionary values, requires -get
    #  -pos - parameter has strict position and only '$Value' is displayed in netlist, requires -add
    #  -eq - Parameter may contain equation in terms of functions and other parameters, printed as
    #    '$name={$equation}', requires -add
    #  -poseq - combination of both flags, print only, requires -add
    #  -posnocheck - positional parameter without check, requires -add
    #  -nocheck - normal parameter without check, requires -add
    #  -sw - switch parameter, requires -add
    #  -node - node parameter, requires -add
    #  -nodeeq - node parameter equation, requires -add
    #  pname - name of parameter
    #  value - value of parameter
    #  arguments - optional pairs of name-value for -set action, requires -set
    # Synopsis: -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
    # Synopsis: -set name value ?name value ...?
    # Synopsis: -get name
    # Synopsis: -get -all
    # Synopsis: -delete name
    argparse -help {Applied selected actions on parameters of the device} {
        # {Actions selectors}
        {-add -key action -value add -require pname -help {Add new parameter to device}}
        {-get -key action -value get -help {Get parameter value}}
        {-set -key action -value set -require {pname value} -help {Sets (or change) value of particular parameters}}
        {-delete -key action -value delete -require pname -help {Delete existing parameter}}
        {-all -require get -forbid {pname value} -help {Option for getting the dictionary that contains parameters names as keys and parameters values as the dictionary values}}
        # {Param qualificators}
        {-pos -key paramQual -value pos -require add -help {Parameter has strict position and only '$Value' is displayed in netlist}}
        {-eq -key paramQual -value eq -require add -help {Parameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}'}}
        {-poseq -key paramQual -value poseq -require add -help {Combination of both flags, print only '{$equation}'}}
        {-posnocheck -key paramQual -value posnocheck -require add -help {Positional parameter without check}}
        {-nocheck -key paramQual -value nocheck -default {} -require add -help {Normal parameter without check}}
        {-sw -key paramQual -value sw -require add -help {Switch parameter}}
        {-node -key paramQual -value node -require add -help {Node parameter}}
        {-nodeeq -key paramQual -value nodeeq -require add -help {Node parameter equation}}
        # {Actual name(s) and value(s) of Param}
        {pname -optional -help {Name of parameter}}
        {value -optional -help {Value of parameter}}
        {arguments -catchall -require set -help {Optional pairs of name-value for -set action}}
    }
    switch $action {
        add {
            set pname [string tolower $pname]
            if {[info exists Params]} {
                set params [dict keys $Params]
            }
            lappend params $pname
            if {[my DuplListCheck $params]} {
                return -code error "Parameters list '$params' has already contains parameter with name '$pname'"
            }
            switch $paramQual {
                sw {
                    dict append Params $pname [::SpiceGenTcl::ParameterSwitch new $pname]
                }
                pos {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositional new $pname $value]
                }
                eq {
                    dict append Params $pname [::SpiceGenTcl::ParameterEquation new $pname $value]
                }
                poseq {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalEquation new $pname $value]
                }
                posnocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalNoCheck new $pname $value]
                }
                nocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterNoCheck new $pname $value]
                }
                node {
                    dict append Params $pname [::SpiceGenTcl::ParameterNode new $pname $value]
                }
                nodeeq {
                    dict append Params $pname [::SpiceGenTcl::ParameterNodeEquation new $pname $value]
                }
                default {
                    dict append Params $pname [::SpiceGenTcl::Parameter new $pname $value]
                }
            }
        }
        get {
            if {![info exists Params]} {
                return
            }
            if {[info exists all]} {
                return [dict map {paramName param} $Params {$param configure -value}]
            } elseif {[info exists pname]} {
                set pname [string tolower $pname]
                if {[dexist $Params $pname]} {
                    return [dget $Params $pname]
                } else {
                    return -code error "Device '$name' doesn't have parameter with name '$pname'"
                }
            } else {
                return -code error "'-get' action requires 'pname' parameter or '-all' option"
            }
        }
        set {
            set arguments [list $pname $value {*}$arguments]
            if {[llength $arguments]%2!=0} {
                return -code error "Number of arguments to method '[dict get [info frame 0] method]' with '-set' switch must be even"
            }
            for {set i 0} {$i<[llength $arguments]} {incr i 2} {
                set paramName [string tolower [@ $arguments $i]]
                set paramValue [@ $arguments [= {$i+1}]]
                if {[catch {dget $Params $paramName}]} {
                    return -code error "Parameter with name '$paramName' was not found in element's '$name' list of parameters '[dkeys $Params]'"
                } else {
                    set param [dget $Params $paramName]
                }
                $param configure -value $paramValue
            }
        }
        delete {
            set pname [string tolower $pname]
            if {[catch {dget $Params $pname}]} {
                return -code error "Parameter with name '$pname' was not found in device's '$name' list of parameters '[dkeys $Params]'"
            } else {
                set Params [dict remove $Params $pname]
            }
        }
    }
    return
}

genSPICEString [::SpiceGenTcl::ParamStatement]ParamStatement, Top, Main, Index

Creates parameter statement string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates parameter statement string for SPICE netlist.
    # Returns: SPICE netlist's string
    return ".param [join [join [lmap param [dict values $Params] {$param genSPICEString}]]]"
}

Parser [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
buildTopNetlistBuilds top netlist corresponding to parsed netlist file. For unknowns to SpiceGenTcl models the new model class is created during the parsing and evaluated in a caller context. For each subcircuit (and nested subcircuits) the corresponding class is created and evaluated in a caller context.
configureConfigure properties.
readAndParseCalls methods readFile and buildTopNetlist in a sequence.
readFileNot documented.
Properties

Readable: -definitions, -filepath, -name, -topnetlist

Writable: -definitions, -filepath, -name, -topnetlist

Subclasses

::SpiceGenTcl::Ngspice::NgspiceParser

constructor [::SpiceGenTcl::Parser]Parser, Top, Main, Index

Creates object of class Parser that do parsing of valid simulator netlist.

Parser create OBJNAME ?args?
Parser new ?args?
Details
Parameters
filepathPath to file that should be parsed.
nameName of the object.
method constructor {args} {

    # Creates object of class `Parser` that do parsing of valid simulator netlist.
    #   name - name of the object
    #   filepath - path to file that should be parsed
    set arguments [argparse -inline -help {Creates object of class `Parser` that do parsing of valid simulator netlist} {
        {name -help {Name of the object}}
        {filepath -help {Path to file that should be parsed}}
    }]
    my configure -name [dget $arguments name]
    my configure -filepath [dget $arguments filepath]
    my configure -topnetlist [::SpiceGenTcl::Netlist new [file tail [dget $arguments filepath]]]
}

buildTopNetlist [::SpiceGenTcl::Parser]Parser, Top, Main, Index

Builds top netlist corresponding to parsed netlist file. For unknowns to SpiceGenTcl models the new model class is created during the parsing and evaluated in a caller context. For each subcircuit (and nested subcircuits) the corresponding class is created and evaluated in a caller context.

OBJECT buildTopNetlist ?args?
Details
Parameters
Return value

::SpiceGenTcl::Netlist object with attached elements succesfully parsed in input netlist file.

method buildTopNetlist {args} {

    # Builds top netlist corresponding to parsed netlist file.
    # For unknowns to SpiceGenTcl models the new model class is created during the parsing and evaluated in
    # a caller context. For each subcircuit (and nested subcircuits) the corresponding class is created
    # and evaluated in a caller context.
    # Returns: [::SpiceGenTcl::Netlist] object with attached elements succesfully parsed in input netlist file.
    argparse {
        -noeval
    }
    if {![info exists FileData]} {
        error "Parser object '[my configure -name]' doesn't have prepared data"
    }
    set allLines $FileData
    set topNetlist [my configure -topnetlist]
    my GetSubcircuitLines
    # parse found subcircuits definitions first
    if {[info exists SubcktsTree]} {
        set lines2remove {}
        $SubcktsTree walk / -order post -type bfs node {
            if {$node eq {/}} {
                continue
            }
            my BuildSubcktFromDef $node
            if {[$SubcktsTree parent $node] eq {/}} {
                set definition [$SubcktsTree get $node definition]
                lappend definitions $definition
                if {![info exists noeval]} {
                    uplevel 1 $definition
                }
                set definition [list [string totitle [file tail $node]] new]
                lappend definitions $definition
                if {![info exists noeval]} {
                    $topNetlist add [eval {*}$definition]
                }
            }
            set startLine [$SubcktsTree get $node startLine]
            set endLine [$SubcktsTree get $node endLine]
            set children [$SubcktsTree children $node]
            lappend lines2remove {*}[lseq $startLine $endLine]
        }
        set allLines [lremove $allLines {*}$lines2remove]
    }
    set topDefinitions [my BuildNetlist $allLines]
    lappend definitions {*}$topDefinitions
    if {![info exists noeval]} {
        foreach element $topDefinitions {
            # check the netlist string for presence of class definition
            if {$element eq {}} {
                continue
            }
            if {[regexp {^oo::class\s+(\S+)} $element]} {
                uplevel 1 $element
            } else {
                $topNetlist add [eval $element]
            }
        }
    }
    if {[info exists noeval]} {
        return $definitions
    } else {
        return $topNetlist
    }
}

readAndParse [::SpiceGenTcl::Parser]Parser, Top, Main, Index

Calls methods readFile and buildTopNetlist in a sequence

OBJECT readAndParse ?args?
Details
Parameters
method readAndParse {args} {

    # Calls methods `readFile` and `buildTopNetlist` in a sequence
    my readFile
    return [my buildTopNetlist {*}$args]
}

readFile [::SpiceGenTcl::Parser]Parser, Top, Main, Index

OBJECT readFile
Details
method readFile {} {

    error {Not implemented}
}

Pin [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
checkFloatingDetermines if pin is connected to the node.
configureConfigure properties.
genSPICEStringCreates string for SPICE netlist.
unsetNodeNameMakes pin floating by setting name of the node to empty string.
Properties

Readable: -name, -node

Writable: -name, -node

Superclasses

SPICEElement

constructor [::SpiceGenTcl::Pin]Pin, Top, Main, Index

Creates object of class Pin with name and connected node

OBJECT constructor name node
Details
Parameters
nameName of the pin.
nodeName of the node that connected to pin.
Description

Class models electrical pin of device/subcircuit, it has name and name of the node connected to it. It has general interface method genSPICEString that returns name of the node connected to it, this method must be called only in method with the same name in other classes. We can check if pin is floating by checking the name of connected node in method checkFloating - if is contains empty string it is floating. Floating pin can't be netlisted, so it throws error when try to do so. Set pin name empty by special method unsetNodeName.

method constructor {args} {

    # Creates object of class `Pin` with name and connected node
    #  name - name of the pin
    #  node - name of the node that connected to pin
    # Class models electrical pin of device/subcircuit,
    # it has name and name of the node connected to it.
    # It has general interface method `genSPICEString` that returns
    # name of the node connected to it, this method must be called only
    # in method with the same name in other classes. We can check if pin is
    # floating by checking the name of connected node in method `checkFloating` -
    # if is contains empty string it is floating.
    # Floating pin can't be netlisted, so it throws error when try to
    # do so. Set pin name empty by special method `unsetNodeName`.
    # Synopsis: name node
    set arguments [argparse -inline -help {Creates object of class 'Pin' with name and connected node} {
        {name -help {Name of the pin}}
        {node -help {Name of the node that connected to pin}}
    }]
    dict for {elName elValue} $arguments {
        my configure -$elName $elValue
    }
}

checkFloating [::SpiceGenTcl::Pin]Pin, Top, Main, Index

Determines if pin is connected to the node.

OBJECT checkFloating ?args?
Details
Parameters
Return value

true if connected and false if not

method checkFloating {args} {

    # Determines if pin is connected to the node.
    # Returns: `true` if connected and `false` if not
    argparse -help {Determines if pin is connected to the node. Returns: 'true' if connected and 'false' if not} {}
    if {[my configure -node] eq {}} {
        set floating true
    } else {
        set floating false
    }
    return $floating
}

genSPICEString [::SpiceGenTcl::Pin]Pin, Top, Main, Index

Creates string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates string for SPICE netlist.
    # Returns: SPICE netlist's string
    if {[my checkFloating]} {
        return -code error "Pin '[my configure -name]' is not connected to the node so can't be netlisted"
    }
    return [my configure -node]
}

unsetNodeName [::SpiceGenTcl::Pin]Pin, Top, Main, Index

Makes pin floating by setting name of the node to empty string.

OBJECT unsetNodeName ?args?
Details
Parameters
method unsetNodeName {args} {

    # Makes pin floating by setting name of the node to empty string.
    argparse -help {Makes pin floating by setting name of the node to empty string} {}
    my configure -node {}
    return
}

RawFile [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
getCurrentsNamesReturns list that contains names of all current variables.
getTraceReturns trace object reference by it's name.
getTracesCsvReturns string with csv formatting containing all data.
getTracesDataReturns dictionary that contains all data in value and name as a key.
getTracesStrReturns information about all Traces in raw file in form of string.
getVariablesNamesReturns list that contains names of all variables.
getVoltagesNamesReturns list that contains names of all voltage variables.
measureNot documented.
readComplexSee BinaryReader.readComplex
readFloat32See BinaryReader.readFloat32
readFloat64See BinaryReader.readFloat64
skip4bytesSee BinaryReader.skip4bytes
skip8bytesSee BinaryReader.skip8bytes
skip16bytesSee BinaryReader.skip16bytes
Properties

Readable: -axis, -npoints, -nvariables, -path, -rawparams, -traces

Writable: -axis, -npoints, -nvariables, -path, -rawparams, -traces

Mixins

BinaryReader, Utility

constructor [::SpiceGenTcl::RawFile]RawFile, Top, Main, Index

Creates RawFile object.

RawFile create OBJNAME ?args?
RawFile new ?args?
Details
Parameters
pathPath to raw file including it's file name.
simulatorSimulator that produced this raw file, default is ngspice.
traces2readList of traces that will be readed, default value is *, that means reading all traces.
method constructor {args} {

                # Creates RawFile object.
                #  path - path to raw file including it's file name
                #  traces2read - list of traces that will be readed, default value is \*,
                #   that means reading all traces
                #  simulator - simulator that produced this raw file, default is ngspice
                set arguments [argparse -inline -help {Creates 'RawFile' object} {
                    {path -help {path to raw file including it's file name}}
                    {traces2read -optional -default * -help {List of traces that will be readed, default value is *, that means reading all traces}}
                    {simulator -optional -default ngspice -help {Total number of points}}
                }]
                my configure -path [dget $arguments path]
                set fileSize [file size $path]
                set file [open $path r]
                fconfigure $file -translation binary
    ####   read header
                set ch [read $file 6]
                if {[encoding convertfrom utf-8 $ch] eq {Title:}} {
                    set encSize 1
                    set encode utf-8
                    set line Title:
                } elseif {[encoding convertfrom utf-16le $ch] eq {Tit}} {
                    set encSize 2
                    set encode utf-16le
                    set line Tit
                } else {
                    close $file
                    error {Unknown encoding}
                }
                my configure -rawparams [dcreate Filename $path]
                set header {}
                set binaryStart 6
                while true {
                    set ch [encoding convertfrom $encode [read $file $encSize]]
                    incr binaryStart $encSize
                    if {$ch eq "\n"} {
                        if {$encode eq {utf-8}} {
                            set line [string trimright $line \r]
                        }
                        lappend header $line
                        if {$line in {Binary: Values:}} {
                            set rawType $line
                            break
                        }
                        set line {}
                    } else {
                        append line $ch
                    }
                }
    ####   save header parameters
                foreach line $header {
                    set lineList [split $line :]
                    if {[@ $lineList 0] eq {Variables}} {
                        break
                    }
                    dict append rawparams [@ $lineList 0] [string trim [@ $lineList 1]]
                }
                my configure -npoints [dget [my configure -rawparams] {No. Points}] -nvariables [dget [my configure -rawparams] {No. Variables}]
                if {[dget [my configure -rawparams] Plotname] in {{Operating Point} {Transfet Function}}} {
                    set hasAxis 0
                } else {
                    set hasAxis 1
                }
                set flags [split [dget [my configure -rawparams] Flags]]
                if {({complex} in $flags) || ([dget [my configure -rawparams] Plotname] eq {AC Analysis})} {
                    set numtype complex
                } else {
                    if {({double} in $flags) || ([dget $arguments simulator] eq {ngspice}) || ([dget $arguments simulator] eq {xyce})} {
                        set numtype double
                    } else {
                        set numtype real
                    }
                }
    ####   parse variables
                set i [lsearch $header Variables:]
                set ivar 0
                foreach line [lrange $header [+ $i 1] end-1] {
                    set lineList [split [string trim $line] \t]
                    lassign $lineList idx name varType
                    if {$ivar==0} {
                        if {([dget $arguments simulator] eq {ltspice}) && ($name eq {time})} {
                            # workaround for bug with negative values in time axis
                            set axisIsTime true
                        }
                        if {$numtype eq {real}} {
                            set axisNumType double
                        } else {
                            set axisNumType $numtype
                        }
                        my configure -axis [::SpiceGenTcl::Axis new $name $varType $npoints $axisNumType]
                        ##nagelfar ignore #12 {Found constant "traces"}
                        dappend traces [string tolower $name] [my configure -axis]
                    } elseif {([dget $arguments traces2read] eq {*}) || ($name in [dget $arguments traces2read])} {
                        if {$hasAxis} {
                            dappend traces [string tolower $name] [::SpiceGenTcl::Trace new $name $varType $npoints [[my configure -axis] configure -name] $numtype]
                        } else {
                            dappend traces [string tolower $name] [::SpiceGenTcl::Trace new $name $varType $npoints {} $numtype]
                        }
                    } else {
                        dappend traces [string tolower $name] [::SpiceGenTcl::EmptyTrace new $name $varType $npoints $numtype]
                    }
                    incr ivar
                }
                if {([dget $arguments traces2read] eq {}) || ![llength [dget $arguments traces2read]]} {
                    close $file
                    return
                }
    ####   read data
                if {$rawType eq {Binary:}} {
                    set BlockSize [= {($fileSize - $binaryStart)/$npoints}]
                    set scanFunctions {}
                    set calcBlockSize 0
                    foreach trace [dvalues [my configure -traces]] {
                        if {[$trace configure -numtype] eq {double}} {
                            incr calcBlockSize 8
                            if {[info object class $trace ::SpiceGenTcl::EmptyTrace]} {
                                set fun skip8bytes
                            } else {
                                set fun readFloat64
                            }
                        } elseif {[$trace configure -numtype] eq {complex}} {
                            incr calcBlockSize 16
                            if {[info object class $trace ::SpiceGenTcl::EmptyTrace]} {
                                set fun skip16bytes
                            } else {
                                set fun readComplex
                            }
                        } elseif {[$trace configure -numtype] eq {real}} {
                            incr calcBlockSize 4
                            if {[info object class $trace ::SpiceGenTcl::EmptyTrace]} {
                                set fun skip4bytes
                            } else {
                                set fun readFloat32
                            }
                        } else {
                            close $file
                            error "Invalid data type '[$trace configure -numtype]' for trace '[$trace configure -name]'"
                        }
                        lappend scanFunctions $fun
                    }
                    if {$calcBlockSize!=$BlockSize} {
                        close $file
                        error "Error in calculating the block size. Expected '$BlockSize' bytes, but found '$calcBlockSize' bytes"
                    }
                     for {set i 0} {$i<$npoints} {incr i} {
                        for {set j 0} {$j<[dict size [my configure -traces]]} {incr j} {
                            set value [eval "my [@ $scanFunctions $j]" $file]
                            set trace [@ [dvalues [my configure -traces]] $j]
                            if {$j==0} {
                                # workaround for bug with negative values in time axis
                                if {[info exists axisIsTime]} {
                                    set value [= {abs($value)}]
                                }
                            }
                            if {[info object class $trace] ne {::SpiceGenTcl::EmptyTrace}} {
                                $trace appendDataPoints $value
                            }
                        }
                     }
                } elseif {$rawType eq {Values:}} {
                    for {set i 0} {$i<$npoints} {incr i} {
                        set firstVar true
                        for {set j 0} {$j<[dict size [my configure -traces]]} {incr j} {
                            set line [gets $file]
                            if {$line eq {}} {
                                continue
                            }
                            set lineList [textutil::split::splitx $line]
                            if {$firstVar} {
                                set firstVar false
                                set sPoint [@ $lineList 0]
                                if {$i!=int($sPoint)} {
                                    close $file
                                    error {Error reading file}
                                }
                                if {$numtype eq {complex}} {
                                    set value [split [@ $lineList 1] ,]
                                } else {
                                    set value [@ $lineList 1]
                                }
                            } else {
                                if {$numtype eq {complex}} {
                                    set value [split [@ $lineList 1] ,]
                                } else {
                                    set value [@ $lineList 1]
                                }
                            }
                            set trace [@ [dvalues [my configure -traces]] $j]
                            $trace appendDataPoints $value
                        }
                    }
                }
                close $file
}

getCurrentsNames [::SpiceGenTcl::RawFile]RawFile, Top, Main, Index

Returns list that contains names of all current variables

OBJECT getCurrentsNames ?args?
Details
Parameters
Return value

Returns list that contains names of all current variables

method getCurrentsNames {args} {

    # Returns list that contains names of all current variables
    argparse -help {Returns list that contains names of all current variables} {}
    return [lmap trace [dvalues [my configure -traces]] {expr {[string match -nocase *current* [$trace configure -type]] ? [$trace configure -name] : [continue]}}]
}

getTrace [::SpiceGenTcl::RawFile]RawFile, Top, Main, Index

Returns trace object reference by it's name

OBJECT getTrace traceName
Details
Parameters
traceNameNot documented.
Return value

Returns trace object reference by it's name

method getTrace {traceName} {

    # Returns trace object reference by it's name
    set traceFoundFlag false
    foreach trace [dvalues [my configure -traces]] {
        if {[$trace configure -name] eq $traceName} {
            set traceFound $trace
            set traceFoundFlag true
            break
        }
    }
    if {!$traceFoundFlag} {
        return -code error "Trace with name '$traceName' was not found in raw file '[my configure -path]' list of traces"
    }
    return $traceFound
}

getTracesCsv [::SpiceGenTcl::RawFile]RawFile, Top, Main, Index

Returns string with csv formatting containing all data

OBJECT getTracesCsv ?-all? ?-traces list? ?-sep value?
Details
Parameters
-allSelect all traces, optional.
-sepSeparator of columns, default is comma, optional.
-tracesSelect names of traces to return, optional.
Return value

Returns string with csv formatting containing all data

method getTracesCsv {args} {

    # Returns string with csv formatting containing all data
    #  -all - select all traces, optional
    #  -traces - select names of traces to return, optional
    #  -sep - separator of columns, default is comma, optional
    # Synopsis: ?-all? ?-traces list? ?-sep value?
    set arguments [argparse -inline -help {Returns string with csv formatting containing all data} {
        {-all -forbid traces -help {Select all traces}}
        {-traces -catchall -forbid all -help {Select names of traces to return}}
        {-sep= -default , -help {Separator of columns}}
    }]
    if {[dexist $arguments all]} {
        set tracesDict [my getTracesData]
        set tracesList [list [dict keys $tracesDict]]
        for {set i 0} {$i<[my configure -npoints]} {incr i} {
            lappend tracesList [lmap traceValues [dict values $tracesDict] {@ $traceValues $i}]
        }
    ##nagelfar ignore #12 {Found constant "traces"}
    } elseif {[dget $arguments traces] ne {}} {
        foreach traceName [dget $arguments traces] {
            set traceObj [my getTrace $traceName]
            dict append tracesDict [$traceObj configure -name] [$traceObj getDataPoints]
        }
        set tracesList [list [dict keys $tracesDict]]
        for {set i 0} {$i<[my configure -npoints]} {incr i} {
            lappend tracesList [lmap traceValues [dict values $tracesDict] {@ $traceValues $i}]
        }
    } else {
        return -code error {Arguments '-all' or '-traces traceName1 traceName2 ...' must be provided to 'getTracesCsv' method}
    }
    return [::csv::joinlist $tracesList [dget $arguments sep]]
}

getTracesData [::SpiceGenTcl::RawFile]RawFile, Top, Main, Index

Returns dictionary that contains all data in value and name as a key

OBJECT getTracesData ?args?
Details
Parameters
Return value

Returns dictionary that contains all data in value and name as a key

method getTracesData {args} {

    # Returns dictionary that contains all data in value and name as a key
    argparse -help {Returns dictionary that contains all data in value and name as a key} {}
    set dict {}
    dict for {traceName trace} [my configure -traces] {
        dict append dict $traceName [$trace getDataPoints]
    }
    return $dict
}

getTracesStr [::SpiceGenTcl::RawFile]RawFile, Top, Main, Index

Returns information about all Traces in raw file in form of string

OBJECT getTracesStr ?args?
Details
Parameters
Return value

Returns information about all Traces in raw file in form of string

method getTracesStr {args} {

    # Returns information about all Traces in raw file in form of string
    argparse -help {Returns information about all Traces in raw file in form of string} {}
    return [lmap trace [dvalues [my configure -traces]] {join [list [$trace configure -name] [$trace configure -type] [$trace configure -numtype]]}]
}

getVariablesNames [::SpiceGenTcl::RawFile]RawFile, Top, Main, Index

Returns list that contains names of all variables

OBJECT getVariablesNames ?args?
Details
Parameters
Return value

Returns list that contains names of all variables

method getVariablesNames {args} {

    # Returns list that contains names of all variables
    argparse -help {Returns list that contains names of all variables} {}
    return [dkeys [my configure -traces]]
}

getVoltagesNames [::SpiceGenTcl::RawFile]RawFile, Top, Main, Index

Returns list that contains names of all voltage variables

OBJECT getVoltagesNames ?args?
Details
Parameters
Return value

Returns list that contains names of all voltage variables

method getVoltagesNames {args} {

    # Returns list that contains names of all voltage variables
    argparse -help {Returns list that contains names of all voltage variables} {}
    return [lmap trace [dvalues [my configure -traces]] {expr {[string match -nocase *voltage* [$trace configure -type]] ? [$trace configure -name] : [continue]}}]
}

measure [::SpiceGenTcl::RawFile]RawFile, Top, Main, Index

OBJECT measure ?args?
Details
Parameters
method measure {args} {

    return [::measure::measure -xname [[my configure -axis] configure -name] -data [my getTracesData] {*}$args]
}

RawString [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates raw string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

SPICEElement

Subclasses

Comment, Include, Library

constructor [::SpiceGenTcl::RawString]RawString, Top, Main, Index

Creates object of class RawString.

OBJECT constructor value ?-name value?
Details
Parameters
-nameName of the string that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
valueValue of the raw string.
Description

Class represent arbitary string. It can be used to pass any string directly into netlist, for example, it can add elements that doesn't have dedicated class.

method constructor {args} {

    # Creates object of class `RawString`.
    #  value - value of the raw string
    #  -name - name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # Class represent arbitary string.
    #  It can be used to pass any string directly into netlist,
    #  for example, it can add elements that doesn't have dedicated class.
    # Synopsis: value ?-name value?
    set arguments [argparse -inline -pfirst -help {Creates object of class 'RawString'} {
        {value -help {Value of the raw string}}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] and its descendants object}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    my configure -value [dget $arguments value]
}

genSPICEString [::SpiceGenTcl::RawString]RawString, Top, Main, Index

Creates raw string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlists string

method genSPICEString {} {

    # Creates raw string for SPICE netlist.
    # Returns: SPICE netlists string
    return [my configure -value]
}

Save [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
addVectorAdds new ParameterVector object to the dictionary Vectors.
configureConfigure properties.
deleteVectorDeletes existing ParameterVector object from dictionary Vectors.
genSPICEStringCreates save statement string for SPICE netlist.
getVectorsGets the dictionary of vector names.
Properties

Readable: -name

Writable: -name

Superclasses

SPICEElement

Mixins

Utility

constructor [::SpiceGenTcl::Save]Save, Top, Main, Index

Creates object of class ParamStatement.

OBJECT constructor vectors ?-name value?
Details
Parameters
-nameName of the library that could be used to retrieve element from ::SpiceGenTcl::Netlist object and its descendants, optional.
vectorsList of vectors in form {vec0 vec1 vec2 ...}
Description

Class represent .save statement.

method constructor {args} {

    # Creates object of class `ParamStatement`.
    #  vectors - list of vectors in form `{vec0 vec1 vec2 ...}`
    #  -name - name of the library that could be used to retrieve element from [::SpiceGenTcl::Netlist] object
    #    and its descendants, optional
    # Class represent .save statement.
    # Synopsis: vectors ?-name value?
    set arguments [argparse -inline -pfirst -help {Creates object of class 'ParamStatement'} {
        {vectors -help {List of vectors in form '{vec0 vec1 vec2 ...}'} -type list}
        {-name= -help {Name of the string that could be used to retrieve element from [::SpiceGenTcl::Netlist] object and its descendants}}
    }]
    if {[dexist $arguments name]} {
        my configure -name [dget $arguments name]
    } else {
        my configure -name [self object]
    }
    foreach vector [dget $arguments vectors] {
        if {[llength $vector]>1} {
            error "Name '$vector' is not a valid name of the vector"
        } else {
            my addVector {*}$vector
        }
    }
}

addVector [::SpiceGenTcl::Save]Save, Top, Main, Index

Adds new ParameterVector object to the dictionary Vectors.

OBJECT addVector ?args?
Details
Parameters
vnameName of vector.
method addVector {args} {

    # Adds new `ParameterVector` object to the dictionary Vectors.
    #  vname - name of vector
    argparse -help {Adds new 'ParameterVector' object to the list 'Vectors'} {
        {vname -help {Name of vector}}
    }
    set vname [string tolower $vname]
    if {[info exists Vectors]} {
        set vectors [dict keys $Vectors]
    }
    lappend vectors $vname
    if {[my DuplListCheck $vectors]} {
        return -code error "Vectors list '$vectors' has already contains vector with name '$vname'"
    }
    dict append Vectors $vname [::SpiceGenTcl::ParameterVector new $vname]
    return
}

deleteVector [::SpiceGenTcl::Save]Save, Top, Main, Index

Deletes existing ParameterVector object from dictionary Vectors.

OBJECT deleteVector ?args?
Details
Parameters
vnameName of parameter that will be deleted.
method deleteVector {args} {

    # Deletes existing `ParameterVector` object from dictionary `Vectors`.
    #  vname - name of parameter that will be deleted
    argparse -help {Deletes existing 'ParameterVector' object from dictionary 'Vectors'} {
        {vname -help {Name of vector}}
    }
    set vname [string tolower $vname]
    if {[catch {dget $Vectors $vname}]} {
        return -code error "Vector with name '$vname' was not found in device's '[my configure -name]' list of parameters '[dict keys $Vectors]'"
    } else {
        set Vectors [dict remove $Vectors $vname]
    }
    return
}

genSPICEString [::SpiceGenTcl::Save]Save, Top, Main, Index

Creates save statement string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates save statement string for SPICE netlist.
    # Returns: SPICE netlist's string
    return ".save [join [join [lmap vector [dict values $Vectors] {$vector genSPICEString}]]]"
}

getVectors [::SpiceGenTcl::Save]Save, Top, Main, Index

Gets the dictionary of vector names

OBJECT getVectors ?args?
Details
Parameters
Return value

vectors dictionary

method getVectors {args} {

    # Gets the dictionary of vector names
    # Returns: vectors dictionary
    argparse -help {Gets the dictionary of vector names. Returns: vectors dictionary} {}
    return $Vectors
}

Simulator [::SpiceGenTcl]Top, Main, Index

Method summary
configureConfigure properties.
getLogReturns log file of completed simulations.
readDataReads raw data file of last simulation.
readLogReads log file of completed simulations.
runRuns simulation.
Properties

Readable: -data, -log, -name

Writable: -data, -log, -name

Subclasses

::SpiceGenTcl::Ngspice::Simulators::Batch, ::SpiceGenTcl::Xyce::Simulators::Batch, ::SpiceGenTcl::Ltspice::Simulators::Batch

getLog [::SpiceGenTcl::Simulator]Simulator, Top, Main, Index

Returns log file of completed simulations.

OBJECT getLog
Details
Return value

Returns log file of completed simulations.

method getLog {} {

    # Returns log file of completed simulations.
    error {Not implemented}
}

readData [::SpiceGenTcl::Simulator]Simulator, Top, Main, Index

Reads raw data file of last simulation.

OBJECT readData
Details
method readData {} {

    # Reads raw data file of last simulation.
    error {Not implemented}
}

readLog [::SpiceGenTcl::Simulator]Simulator, Top, Main, Index

Reads log file of completed simulations.

OBJECT readLog
Details
method readLog {} {

    # Reads log file of completed simulations.
    error {Not implemented}
}

run [::SpiceGenTcl::Simulator]Simulator, Top, Main, Index

Runs simulation.

OBJECT run
Details
method run {} {

    # Runs simulation.
    error {Not implemented}
}

SPICEElement [::SpiceGenTcl]Top, Main, Index

Method summary
configureConfigure properties.
genSPICEStringDeclaration of method common for all SPICE elements that generates representation of element in SPICE netlist. Not implemented in abstraction class.
Subclasses

Pin, ParameterSwitch, Device, Model, RawString, Options, ParamStatement, Save, Ic, Global, Temp, Netlist, Analysis

genSPICEString [::SpiceGenTcl::SPICEElement]SPICEElement, Top, Main, Index

Declaration of method common for all SPICE elements that generates representation of element in SPICE netlist. Not implemented in abstraction class.

OBJECT genSPICEString
Details
method genSPICEString {} {

    # Declaration of method common for all SPICE elements that generates
    #  representation of element in SPICE netlist. Not implemented in
    #  abstraction class.
    error {Not implemented}
}

Subcircuit [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
actOnParamActs on Parameter object with selected action.
actOnPinActs on Pin object with selected action.
addAdd elements objects references to Subcircuit, it extends add method to add check of element class because subcircuit can't contain particular elements inside, like ::SpiceGenTcl::Include, ::SpiceGenTcl::Library, ::SpiceGenTcl::Options and ::SpiceGenTcl::Analysis.
configureConfigure properties.
delSee Netlist.del
genSPICEStringCreates subcircuit string for SPICE subcircuit.
getAllElemNamesSee Netlist.getAllElemNames
getElementSee Netlist.getElement
Properties

Readable: -name

Writable: -name

Superclasses

Netlist

constructor [::SpiceGenTcl::Subcircuit]Subcircuit, Top, Main, Index

Creates object of class Subcircuit.

Subcircuit create OBJNAME ?args?
Subcircuit new ?args?
Details
Parameters
nameName of the subcircuit.
paramsList of input parameters in form {{name value} {name value} {name value} ...}
pinsList of pins in the order they appear in SPICE subcircuits definition together in form: {pinName0 pinName1 pinName2 ...}
Description

This class implements subcircuit, it is subclass of netlist because it holds list of elements inside subcircuit, together with header and connection of elements inside.

method constructor {args} {

    # Creates object of class `Subcircuit`.
    #  name - name of the subcircuit
    #  pins - list of pins in the order they appear in SPICE subcircuits definition together
    #   in form: `{pinName0 pinName1 pinName2 ...}`
    #  params - list of input parameters in form `{{name value} {name value} {name value} ...}`
    # This class implements subcircuit, it is subclass of netlist because it holds list of elements
    # inside subcircuit, together with header and connection of elements inside.
    set arguments [argparse -inline -help {Creates object of class 'Device'} {
        {name -help {Name of the subcircuit}}
        {pins -help {List of pins in the order they appear in SPICE subcircuits definition together in form: '{pinName0 pinName1 ...}'} -type list}
        {params -help {List of input parameters in form '{{name value} {name value} {name value} ...}'} -type list}
    }]
    # create Pins objects, nodes are set to empty string
    foreach pin [dget $arguments pins] {
        my actOnPin -add [@ $pin 0] {}
    }
    # create Params objects that are input parameters of subcircuit
    foreach param [dget $arguments params] {
        if {[llength $param]<=2} {
            my actOnParam -add {*}$param
        } else {
            error "Wrong parameter '$param' definition in subcircuit '[dget $arguments name]'"
        }
    }
    next [dget $arguments name]
}

actOnParam [::SpiceGenTcl::Subcircuit]Subcircuit, Top, Main, Index

Acts on Parameter object with selected action

OBJECT actOnParam -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
OBJECT actOnParam -set name value ?name value ...?
OBJECT actOnParam -get name
OBJECT actOnParam -get -all
OBJECT actOnParam -delete name
Details
Parameters
-addAdd new parameter to the device, requires pname argument.
-allOption for getting the dictionary that contains parameters names as keys and parameters values # as the dictionary values, requires -get.
-deleteDelete existing parameter.
-eqParameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}', requires -add.
-getGet parameter value, requires pname argument.
-nocheckNormal parameter without check, requires -add.
-nodeNode parameter, requires -add.
-nodeeqNode parameter equation, requires -add.
-posParameter has strict position and only '$Value' is displayed in netlist, requires -add.
-poseqCombination of both flags, print only, requires -add.
-posnocheckPositional parameter without check, requires -add.
-setSet (or change) value of particular parameters, requires pname and value arguments.
-swSwitch parameter, requires -add.
argumentsOptional pairs of name-value for -set action, requires -set.
pnameName of parameter.
valueValue of parameter.
method actOnParam {args} {

    # Acts on `Parameter` object with selected action
    #  -add - add new parameter to the device, requires pname argument
    #  -get - get parameter value, requires pname argument
    #  -set - set (or change) value of particular parameters, requires pname and value arguments
    #  -delete - delete existing parameter
    #  -all - option for getting the dictionary that contains parameters names as keys and parameters values #    as the dictionary values, requires -get
    #  -pos - parameter has strict position and only '$Value' is displayed in netlist, requires -add
    #  -eq - Parameter may contain equation in terms of functions and other parameters, printed as
    #    '$name={$equation}', requires -add
    #  -poseq - combination of both flags, print only, requires -add
    #  -posnocheck - positional parameter without check, requires -add
    #  -nocheck - normal parameter without check, requires -add
    #  -sw - switch parameter, requires -add
    #  -node - node parameter, requires -add
    #  -nodeeq - node parameter equation, requires -add
    #  pname - name of parameter
    #  value - value of parameter
    #  arguments - optional pairs of name-value for -set action, requires -set
    # Synopsis: -add ?-pos|eq|poseq|posnocheck|nocheck|sw|node|nodeeq? name value
    # Synopsis: -set name value ?name value ...?
    # Synopsis: -get name
    # Synopsis: -get -all
    # Synopsis: -delete name
    argparse -help {Applied selected actions on parameters of the device} {
        # {Actions selectors}
        {-add -key action -value add -require pname -help {Add new parameter to device}}
        {-get -key action -value get -help {Get parameter value}}
        {-set -key action -value set -require {pname value} -help {Sets (or change) value of particular parameters}}
        {-delete -key action -value delete -require pname -help {Delete existing parameter}}
        {-all -require get -forbid {pname value} -help {Option for getting the dictionary that contains parameters names as keys and parameters values as the dictionary values}}
        # {Param qualificators}
        {-pos -key paramQual -value pos -require add -help {Parameter has strict position and only '$Value' is displayed in netlist}}
        {-eq -key paramQual -value eq -require add -help {Parameter may contain equation in terms of functions and other parameters, printed as '$name={$equation}'}}
        {-poseq -key paramQual -value poseq -require add -help {Combination of both flags, print only '{$equation}'}}
        {-posnocheck -key paramQual -value posnocheck -require add -help {Positional parameter without check}}
        {-nocheck -key paramQual -value nocheck -default {} -require add -help {Normal parameter without check}}
        {-sw -key paramQual -value sw -require add -help {Switch parameter}}
        {-node -key paramQual -value node -require add -help {Node parameter}}
        {-nodeeq -key paramQual -value nodeeq -require add -help {Node parameter equation}}
        # {Actual name(s) and value(s) of Param}
        {pname -optional -help {Name of parameter}}
        {value -optional -help {Value of parameter}}
        {arguments -catchall -require set -help {Optional pairs of name-value for -set action}}
    }
    switch $action {
        add {
            set pname [string tolower $pname]
            if {[info exists Params]} {
                set params [dict keys $Params]
            }
            lappend params $pname
            if {[my DuplListCheck $params]} {
                return -code error "Parameters list '$params' has already contains parameter with name '$pname'"
            }
            switch $paramQual {
                sw {
                    dict append Params $pname [::SpiceGenTcl::ParameterSwitch new $pname]
                }
                pos {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositional new $pname $value]
                }
                eq {
                    dict append Params $pname [::SpiceGenTcl::ParameterEquation new $pname $value]
                }
                poseq {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalEquation new $pname $value]
                }
                posnocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterPositionalNoCheck new $pname $value]
                }
                nocheck {
                    dict append Params $pname [::SpiceGenTcl::ParameterNoCheck new $pname $value]
                }
                node {
                    dict append Params $pname [::SpiceGenTcl::ParameterNode new $pname $value]
                }
                nodeeq {
                    dict append Params $pname [::SpiceGenTcl::ParameterNodeEquation new $pname $value]
                }
                default {
                    dict append Params $pname [::SpiceGenTcl::Parameter new $pname $value]
                }
            }
        }
        get {
            if {![info exists Params]} {
                return
            }
            if {[info exists all]} {
                return [dict map {paramName param} $Params {$param configure -value}]
            } elseif {[info exists pname]} {
                set pname [string tolower $pname]
                if {[dexist $Params $pname]} {
                    return [dget $Params $pname]
                } else {
                    return -code error "Device '$name' doesn't have parameter with name '$pname'"
                }
            } else {
                return -code error "'-get' action requires 'pname' parameter or '-all' option"
            }
        }
        set {
            set arguments [list $pname $value {*}$arguments]
            if {[llength $arguments]%2!=0} {
                return -code error "Number of arguments to method '[dict get [info frame 0] method]' with '-set' switch must be even"
            }
            for {set i 0} {$i<[llength $arguments]} {incr i 2} {
                set paramName [string tolower [@ $arguments $i]]
                set paramValue [@ $arguments [= {$i+1}]]
                if {[catch {dget $Params $paramName}]} {
                    return -code error "Parameter with name '$paramName' was not found in element's '$name' list of parameters '[dkeys $Params]'"
                } else {
                    set param [dget $Params $paramName]
                }
                $param configure -value $paramValue
            }
        }
        delete {
            set pname [string tolower $pname]
            if {[catch {dget $Params $pname}]} {
                return -code error "Parameter with name '$pname' was not found in device's '$name' list of parameters '[dkeys $Params]'"
            } else {
                set Params [dict remove $Params $pname]
            }
        }
    }
    return
}

actOnPin [::SpiceGenTcl::Subcircuit]Subcircuit, Top, Main, Index

Acts on Pin object with selected action

OBJECT actOnPin -add pin node
OBJECT actOnPin -set pin node
OBJECT actOnPin -get pin
OBJECT actOnPin -get -all
Details
Parameters
-addAdd new pin to the device, requires pin and node arguments.
-allOption for getting the dictionary that contains pin name as keys and connected node name as the values, requires -get.
-getGet node name connected to pin, requires pin argument.
-setSet node name connected to pin, requires pin and node arguments.
nodeName of the node connected to pin.
pinName of the pin.
method actOnPin {args} {

    # Acts on `Pin` object with selected action
    #  -add - add new pin to the device, requires pin and node arguments
    #  -get - get node name connected to pin, requires pin argument
    #  -set - set node name connected to pin, requires pin and node arguments
    #  -all - option for getting the dictionary that contains pin name as keys and connected node name as the
    #    values, requires -get
    #  pin - name of the pin
    #  node - name of the node connected to pin
    # Synopsis: -add pin node
    # Synopsis: -set pin node
    # Synopsis: -get pin
    # Synopsis: -get -all
     argparse -help {Applied selected actions on pin of the device} {
        {-add -key action -value add -require {pin node} -help {Add new pin to the device}}
        {-get -key action -value get -help {Get node name connected to pin}}
        {-set -key action -value set -require {pin node} -help {Set node name connected to pin}}
        {-all -require get -forbid {pin node} -help {Option for getting the dictionary that contains pin name as keys and connected node name as the values}}
        {pin -optional -help {Name of the pin}}
        {node -optional -help {Name of the node connected to pin}}
    }
    switch $action {
        add {
            set pin [string tolower $pin]
            set node [string tolower $node]
            if {[info exists Pins]} {
                set pins [dkeys $Pins]
            }
            lappend pins $pin
            if {[my DuplListCheck $pins]} {
                return -code error "Pins list '$pins' has already contains pin with name '$pin'"
            }
            dappend Pins $pin [::SpiceGenTcl::Pin new $pin $node]
        }
        get {
            if {![info exists Pins]} {
                return
            }
            if {[info exists all]} {
                return [dict map {pinName pin} $Pins {$pin configure -node}]
            } elseif {[info exists pin]} {
                set pin [string tolower $pin]
                if {[dexist $Pins $pin]} {
                    return [dget $Pins $pin]
                } else {
                    return -code error "Device '$name' doesn't have pin with name '$pin'"
                }
            } else {
                return -code error "'-get' action requires 'pin' parameter or '-all' option"
            }
        }
        set {
            set pin [string tolower $pin]
            set node [string tolower $node]
            if {![info exists Pins]} {
                return -code error "Device '$name' doesn't have pins"
            }
            if {[dexist $Pins $pin]} {
                [dget $Pins $pin] configure -node $node
            } else {
                return -code error "Pin with name '$pin' was not found in device's '$name' list of pins '[dkeys $Pins]'"
            }
        }
    }
    return
}

add [::SpiceGenTcl::Subcircuit]Subcircuit, Top, Main, Index

Add elements objects references to Subcircuit, it extends add method to add check of element class because subcircuit can't contain particular elements inside, like ::SpiceGenTcl::Include, ::SpiceGenTcl::Library, ::SpiceGenTcl::Options and ::SpiceGenTcl::Analysis.

OBJECT add ?args?
Details
Parameters
argsElements objects references.
method add {args} {

    # Add elements objects references to `Subcircuit`, it extends add method to add check of element class because
    # subcircuit can't contain particular elements inside, like [::SpiceGenTcl::Include],
    # [::SpiceGenTcl::Library], [::SpiceGenTcl::Options] and [::SpiceGenTcl::Analysis].
    #  args - elements objects references
    argparse -help {Add elements objects references to 'Subcircuit'} {
        {elements -catchall -help {Elements objects references}}
    }
    foreach element $elements {
        set argClass [info object class $element]
        set argSuperclass [info class superclasses $argClass]
        if {$argClass in {::SpiceGenTcl::Include ::SpiceGenTcl::Library ::SpiceGenTcl::Options}} {
            return -code error "$argClass element can't be included in subcircuit"
        } elseif {[string match *::Analysis* $argSuperclass] || [string match *::Analyses* $argSuperclass]} {
            return -code error "Analysis element can't be included in subcircuit"
        }
    }
    next {*}$elements
}

genSPICEString [::SpiceGenTcl::Subcircuit]Subcircuit, Top, Main, Index

Creates subcircuit string for SPICE subcircuit.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates subcircuit string for SPICE subcircuit.
    # Returns: SPICE netlist's string
    set name [my configure -name]
    set nodes [lmap pin [dict values $Pins] {$pin configure -name}]
    if {![info exists Params]} {
        set header ".subckt $name [join $nodes]"
    } else {
        set params [lmap param [dict values $Params] {$param genSPICEString}]
        set header ".subckt $name [join $nodes] [join $params]"
    }
    # get netlist elements from netlist genSPICEString method
    set resStr [next]
    return [join [list $header $resStr ".ends $name"] \n]
}

Temp [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
configureConfigure properties.
genSPICEStringCreates .temp statement string for SPICE netlist.
Properties

Readable: -name, -value

Writable: -name, -value

Superclasses

SPICEElement

constructor [::SpiceGenTcl::Temp]Temp, Top, Main, Index

Creates object of class Temp.

OBJECT constructor value ?-eq?
Details
Parameters
-eqOptional parameter qualificator.
valueValue of the temperature.
Description

This class represent .temp statement with temperature value.

method constructor {args} {

    # Creates object of class `Temp`.
    #  value - value of the temperature
    #  -eq - optional parameter qualificator
    # This class represent .temp statement with temperature value.
    # Synopsis: value ?-eq?
    set arguments [argparse -inline -help {Creates object of class 'Temp'} {
        {value -help {Value of the temperature}}
        {-eq -help {Optional parameter qualificator}}
    }]
    my configure -name temp
    ##nagelfar variable eq
    if {[dexist $arguments eq]} {
        my AddParam -eq temp [dget $arguments value]
    } else {
        my AddParam temp [dget $arguments value]
    }
}

genSPICEString [::SpiceGenTcl::Temp]Temp, Top, Main, Index

Creates .temp statement string for SPICE netlist.

OBJECT genSPICEString
Details
Return value

SPICE netlist's string

method genSPICEString {} {

    # Creates .temp statement string for SPICE netlist.
    # Returns: SPICE netlist's string
    return ".temp [$value genSPICEString]"
}

Trace [::SpiceGenTcl]Top, Main, Index

Method summary
constructorConstructor for the class.
appendDataPointsSee Dataset.appendDataPoints
configureConfigure properties.
getDataPointsSee Dataset.getDataPoints
getStrSee Dataset.getStr
setDataPointsSee Dataset.setDataPoints
Properties

Readable: -axis, -len, -name, -numtype, -type

Writable: -axis, -len, -name, -numtype, -type

Superclasses

Dataset

constructor [::SpiceGenTcl::Trace]Trace, Top, Main, Index

initialize trace

Trace create OBJNAME ?args?
Trace new ?args?
Details
Parameters
axisName of axis that is linked to trace.
lenTotal number of points.
nameName of the trace.
numtypeNumerical type of trace.
typeType of trace.
method constructor {args} {

    # initialize trace
    #  name - name of the trace
    #  type - type of trace
    #  len - total number of points
    #  axis - name of axis that is linked to trace
    #  numtype - numerical type of trace
    set arguments [argparse -inline -help {Initialize object 'Dataset'} {
        {name -pass rest -help {Name of the trace}}
        {type -pass rest -help {Type of trace}}
        {len -pass rest -help {Total number of points}}
        {axis -help {Name of axis that is linked to trace}}
        {numtype -pass rest -optional -default real -help {Numerical type of trace}}
    }]
    my configure -axis [dget $arguments axis]
    next {*}[dget $arguments rest]
}

Utility [::SpiceGenTcl]Top, Main, Index

Method summary
Subclasses

Device, Model, Options, ParamStatement, Save, Ic, Nodeset, Global, Netlist, Analysis, RawFile, ::SpiceGenTcl::Common::Sources::pulse, ::SpiceGenTcl::Common::Sources::sin, ::SpiceGenTcl::Common::Sources::exp, ::SpiceGenTcl::Common::Sources::sffm, ::SpiceGenTcl::Common::Analyses::Dc, ::SpiceGenTcl::Common::Analyses::Ac, ::SpiceGenTcl::Common::Analyses::Tran, ::SpiceGenTcl::Common::Analyses::Op, ::SpiceGenTcl::Ngspice::Sources::pulse, ::SpiceGenTcl::Ngspice::Sources::sffm, ::SpiceGenTcl::Ngspice::Sources::am, ::SpiceGenTcl::Ngspice::Analyses::Sp, ::SpiceGenTcl::Ngspice::Analyses::SensAc, ::SpiceGenTcl::Ngspice::Analyses::SensDc, ::SpiceGenTcl::Ngspice::Misc::OptionsNgspice, ::SpiceGenTcl::Xyce::Analyses::Sens, ::SpiceGenTcl::Ltspice::Sources::pulse, ::SpiceGenTcl::Ltspice::Sources::sin, ::SpiceGenTcl::Ltspice::Sources::exp, ::SpiceGenTcl::Ltspice::Sources::sffm