Name of the device without first-letter designator C.
nm
Name of node connected to negative pin.
np
Name of node connected to positive pin.
Description
Capacitor type could be specified with additional switches: -beh if we want to model circuit's variable dependent capacitor, or -model modelName if we want to simulate capacitor with model card. Simple capacitor:
method constructor {args} {
# Creates object of class `CModel` that describes semiconductor capacitor model.# name - name of the model# args - keyword instance parameters, for details please refer to Xyce reference manual, 2.3.4 section.# Example of class initialization:# ```# CModel new capmod -tc1 1 -tc2 2# ```# Synopsis: name ?-option value ...?next {*}[my ArgsPreprocess {c cj cjsw defw narrow tc1 tc2 tnom} {name type} type {*}[linsert $args 1 c]]
}
method constructor {args} {
# Creates object of class `CSwitchModel` that describes current switch model.# name - name of the model# args - keyword instance parameters, for details please refer to Xyce reference manual, 2.3.22 section.# Example of class initialization:# ```# CSwitchModel new cswmod -ion 1 -ioff 0.5 -ron 1 -roff 1e6# ```# Synopsis: name ?-option value ...?next {*}[my ArgsPreprocess {ioff ion off on roff ron} {name type} type {*}[linsert $args 1 iswitch]]
}
method constructor {args} {
# Creates object of class `GenSwitch` that describes generic switch device.# name - name of the device without first-letter designator S# np - name of node connected to positive pin# nm - name of node connected to negative pin# -model value - model name# -control value - control equation# -on/-off - initial state of switch# ```# S<name> <(+) switch node> <(-) switch node> <model name> [ON] [OFF] <control = =ession># ```# Example of class initialization:# ```# GenSwitch new 1 net1 0 -model sw1 -control {I(VMON)}# ```# Synopsis: name np nm -model value -control value ?-on|off?set arguments [argparse -inline -pfirst -help {Creates object of class 'GenSwitch' that describes generic switch device} {
{-model= -required -help {Model name}}
{-control= -required -help {Control equation}}
{-on -forbid {off} -help {Initial on state of switch}}
{-off -forbid {on} -help {Initial off state of switch}}
{name -help {Name of the device without first-letter designator}}
{np -help {Name of node connected to positive pin}}
{nm -help {Name of node connected to negative pin}}
}]
lappend params [list -posnocheck model [dget $arguments model]]
if {[dexist $arguments on]} {
lappend params {-sw on}
} elseif {[dexist $arguments off]} {
lappend params {-sw off}
}
lappend params [list -eq control [dget $arguments control]]
next s[dget $arguments name] [list [list np [dget $arguments np]] [list nm [dget $arguments nm]]] $params
}
method constructor {args} {
# Creates object of class `Inductor` that describes inductor.# name - name of the device without first-letter designator L# np - name of node connected to positive pin# nm - name of node connected to negative pin# -l value - inductance value# -model value - model of the inductor, optional# -m value - multiplier value, optional# -temp value - device temperature, optional# -tc1 value - linear thermal coefficient, optional# -tc2 value - quadratic thermal coefficient, optional# -ic value - initial current through inductor, optional# Inductor type could be specified with additional switch `-model modelName` if we want to simulate inductor# with model card.# Simple inductor:# ```# L<name> <(+) node> <(-) node> <value> [device parameters]# ```# Example of class initialization as a simple inductor:# ```# Inductor new 1 netp netm -l 1e-6 -tc1 1 -temp {-eq temp}# ```# Inductor with model card:# ```# L<name> <(+) node> <(-) node> [model] <value> [device parameters]# ```# Example of class initialization:# ```# Inductor new 1 netp netm -l 1e-6 -model indm# ```# Synopsis: name np nm -l value ?-tc1 value? ?-tc2 value? ?-m value? ?-temp value? ?-ic value?# Synopsis: name np nm -model value -l value ?-tc1 value? ?-tc2 value? ?-m value? ?-temp value?# ?-ic value?set arguments [argparse -inline -pfirst -help {Creates object of class 'Capacitor' that describes capacitor} {
{-l= -required -help {Inductance value}}
{-model= -help {Model of the inductor}}
{-m= -help {Multiplier value}}
{-temp= -help {Device temperature}}
{-tc1= -help {Linear thermal coefficient}}
{-tc2= -help {Quadratic thermal coefficient}}
{-ic= -help {Initial current through inductor}}
{name -help {Name of the device without first-letter designator}}
{np -help {Name of node connected to positive pin}}
{nm -help {Name of node connected to negative pin}}
}]
if {[dexist $arguments model]} {
lappend params [list -posnocheck model [dget $arguments model]]
}
set lVal [dget $arguments l]
if {([llength $lVal]>1) && ([@ $lVal 0] eq {-eq})} {
lappend params [list -poseq l [@ $lVal 1]]
} else {
lappend params [list -pos l $lVal]
}
dict for {paramName value} $arguments {
if {$paramName ni {l model name np nm}} {
if {[@ $value 0] eq {-eq}} {
lappend params [list -eq $paramName [@ $value 1]]
} else {
lappend params [list $paramName $value]
}
}
}
next l[dget $arguments name] [list [list np [dget $arguments np]] [list nm [dget $arguments nm]]] $params
}
method constructor {args} {
# Creates object of class `LModel` that describes inductor model.# name - name of the model# args - keyword instance parameters, for details please refer to Xyce reference manual, 2.3.5 section.# Example of class initialization:# ```# LModel new indmod -tc1 1 -tc2 2# ```# Synopsis: name ?-option value ...?next {*}[my ArgsPreprocess {ic l tc1 tc2 tnom} {name type} type {*}[linsert $args 1 l]]
}
Name of the device without first-letter designator R.
nm
Name of node connected to negative pin.
np
Name of node connected to positive pin.
Description
Resistor type could be specified with additional switches: -beh if we want to model circuit's variable dependent resistor, or -model modelName if we want to simulate resistor with model card. Simple resistor:
method constructor {args} {
# Creates object of class `Resistor` that describes resistor.# name - name of the device without first-letter designator R# np - name of node connected to positive pin# nm - name of node connected to negative pin# -r value - resistance value or equation# -beh - selects behavioural type of resistor, optional# -model value - model of the resistor, optional# -m value - multiplier value, optional# -temp value - device temperature, optional# -tc1 value - linear thermal coefficient, optional# -tc2 value - quadratic thermal coefficient, optional# -tce value - exponential thermal coefficient, optional# -l value - length of semiconductor resistor, optional# -w value - width of semiconductor resistor, optional# Resistor type could be specified with additional switches: `-beh` if we want to model circuit's variable# dependent resistor, or `-model modelName` if we want to simulate resistor with model card.# Simple resistor:# ```# R<name> <(+) node> <(-) node> <value> [device parameters]# ```# Example of class initialization as a simple resistor:# ```# Resistor new 1 netp netm -r 1e3 -tc1 1 -temp {-eq temp_amb}# ```# Behavioral resistor:# ```# R<name> <(+) node> <(-) node> R ={expression} [device parameters]# ```# Example of class initialization:# ```# Resistor new 1 netp netm -r "V(a)+V(b)+pow(V(c),2)" -beh -tc1 1# ```# Resistor with model card:# ```# R<name> <(+) node> <(-) node> <model name> [value] [device parameters]# ```# Example of class initialization:# ```# Resistor new 1 netp netm -model resm -l 1e-6 -w 10e-6# ```# Synopsis: name np nm -r value ?-tc1 value? ?-tc2 value? ?-tce value? ?-m value? ?-temp value?# Synopsis: name np nm -r value -beh ?-tc1 value? ?-tc2 value? ?-tce value? ?-m value? ?-temp value?# Synopsis: name np nm -r value -model ?-tc1 value? ?-tc2 value? ?-tce value? ?-m value? ?-temp value?# ?-l value? ?-w value?set arguments [argparse -inline -pfirst -help {Creates object of class 'Resistor' that describes resistor} {
{-r= -help {Resistance value or equation}}
{-beh -forbid model -require r -help {Selects behavioural type of resistor}}
{-model= -forbid beh -help {Model of the resistor}}
{-m= -help {Multiplier value}}
{-temp= -help {Device temperature}}
{-tc1= -help {Linear thermal coefficient}}
{-tc2= -help {Quadratic thermal coefficient}}
{-tce= -help {Exponential thermal coefficient}}
{-l= -require model -help {Length of semiconductor resistor}}
{-w= -require model -help {Width of semiconductor resistor}}
{name -help {Name of the device without first-letter designator}}
{np -help {Name of node connected to positive pin}}
{nm -help {Name of node connected to negative pin}}
}]
if {[dexist $arguments model]} {
lappend params [list -posnocheck model [dget $arguments model]]
}
if {[dexist $arguments r]} {
set rVal [dget $arguments r]
if {[dexist $arguments beh]} {
lappend params [list -eq r $rVal]
} elseif {([llength $rVal]>1) && ([@ $rVal 0] eq {-eq})} {
lappend params [list -poseq r [@ $rVal 1]]
} else {
lappend params [list -pos r $rVal]
}
} elseif {![dexist $arguments model]} {
return -code error {Resistor value must be specified with '-r value'}
}
dict for {paramName value} $arguments {
if {$paramName ni {r beh model name np nm}} {
if {[@ $value 0] eq {-eq}} {
lappend params [list -eq $paramName [@ $value 1]]
} else {
lappend params [list $paramName $value]
}
}
}
next r[dget $arguments name] [list [list np [dget $arguments np]] [list nm [dget $arguments nm]]] $params
}
method constructor {args} {
# Creates object of class `RModel` that describes semiconductor resistor model.# name - name of the model# args - keyword instance parameters, for details please refer to Xyce reference manual, 2.3.7 section.# Example of class initialization:# ```# RModel new resmod -tc1 1 -tc2 2# ```# Synopsis: name ?-option value ...?next {*}[my ArgsPreprocess {defw narrow r rsh tc1 tc2 tce tnom} {name type} type {*}[linsert $args 1 r]]
}
method constructor {args} {
# Creates object of class `SubcircuitInstance` that describes subcircuit instance.# name - name of the device without first-letter designator X# pins - list of pins `{{pinName nodeName} {pinName nodeName} ...}`# subName - name of subcircuit definition# params - list of parameters `{{?-eq? paramName paramValue} {?-eq? paramName paramValue}}`# ```# X<name> [nodes] <subcircuit name> [PARAMS: [<name> = <value>] ...]# ```# Example of class initialization:# ```# SubcircuitInstance new 1 {{plus net1} {minus net2}} rcnet {{r 1} {-eq c cpar}}# ```##nagelfar implicitvarcmd {argparse *Creates object of class 'SubcircuitInstance'*} name pins subName params
argparse -pfirst -help {Creates object of class 'SubcircuitInstance' that describes subcircuit instance} {
{name -help {Name of the device without first-letter designator}}
{pins -help {List of pins {{pinName nodeName} {pinName nodeName} ...}}}
{subName -help {Name of subcircuit definition}}
{params -help {List of parameters {{?-eq? paramName paramValue} {?-eq? paramName paramValue}}}}
}
set params [linsert [linsert $params 0 [list -posnocheck model $subName]] 1 {-posnocheck params PARAMS:}]
next x$name $pins $params
}
method constructor {subcktObj name nodes args} {
# Creates object of class `SubcircuitInstanceAuto` that describes subcircuit instance with already created# subcircuit definition object.# subcktObj - object of subcircuit that defines it's pins, subName and parameters# nodes - list of nodes connected to pins in the same order as pins in subcircuit definition `{nodeName1# nodeName2 ...}`# args - parameters as argument in form: `-paramName {?-eq? paramValue} -paramName {?-eq? paramValue}`# ```# X<name> [nodes] <subcircuit name> [PARAMS: [<name> = <value>] ...]# ```# Example of class initialization:# ```# SubcircuitInstanceAuto new $subcktObj 1 {net1 net2} -r 1 -c {-eq cpar}# ```# Synopsis: subcktObj name nodes ?-paramName {?-eq? paramValue} ...?# check that inputs object class is Subcircuitif {[info object class $subcktObj "::SpiceGenTcl::Subcircuit"]!=1} {
set objClass [info object class $subcktObj]
return -code error "Wrong object class '$objClass' is passed as subcktObj, should be '::SpiceGenTcl::Subcircuit'"
}
# get name of subcircuitset subName [$subcktObj configure -name]
# get pins names of subcircuitset pinsNames [dict keys [$subcktObj actOnPin -get -all]]
# check if number of pins in subcircuit definition matchs the number of supplied nodesif {[llength $pinsNames]!=[llength $nodes]} {
return -code error "Wrong number of nodes '[llength $nodes]' in definition, should be '[llength $pinsNames]'"
}
# create list of pins and connected nodesforeach pinName $pinsNames node $nodes {
lappend pinsList [list $pinName $node]
}
# get parameters names of subcircuitif {[$subcktObj actOnParam -get -all] ne {}} {
set paramsNames [dict keys [$subcktObj actOnParam -get -all]]
foreach paramName $paramsNames {
lappend paramDefList -${paramName}=
}
}
if {[info exists paramDefList]} {
# create definition for argparse module for passing parameters as optional argumentsset arguments [argparse -inline "
[join $paramDefList \n]
"]
# create list of parameters and values from which were supplied by argsdict for {paramName value} $arguments {
if {[@ $value 0] eq {-eq}} {
lappend params [list -eq $paramName [@ $value 1]]
} else {
lappend params [list $paramName $value]
}
}
} else {
set params {}
}
set params [linsert $params 0 [list -posnocheck model $subName]]
if {[info exists paramDefList]} {
set params [linsert $params 1 { -posnocheck params PARAMS:}]
}
next x$name $pinsList $params
}
method constructor {args} {
# Creates object of class `VSwitchModel` that describes voltage switch model.# name - name of the model# args - keyword instance parameters, for details please refer to Xyce reference manual, 2.3.22 section.# Example of class initialization:# ```# VSwitchModel new swmod -von 1 -voff 0.5 -ron 1 -roff 1e6# ```# Synopsis: name ?-option value ...?next {*}[my ArgsPreprocess {off on roff ron voff von} {name type} type {*}[linsert $args 1 vswitch]]
}