method constructor {args} {
# Creates object of class `Bjt` that describes semiconductor bipolar junction transistor device.# name - name of the device without first-letter designator Q# nc - name of node connected to collector pin# nb - name of node connected to base pin# ne - name of node connected to emitter pin# -model value - name of the model# -area value - scale factor, optional# -m value - multiplier of area and perimeter, optional# -temp value - device temperature, optional# -ns value - name of node connected to substrate pin, optional# ```# Qxxx Collector Base Emitter [Substrate ] model [area] [off] [temp=<T>]# ```# Example of class initialization:# ```# Bjt new 1 netc netb nete -model bjtmod -ns nets -area 1e-3# ```# Synopsis: name nc nb ne -model value ?-ns value? ?-area value? ?-m value? ?-temp value?set arguments [argparse -inline -pfirst -help {Creates object of class 'Bjt' that describes semiconductor bipolar junction transistor device} {
{-model= -required -help {Name of the model}}
{-area= -help {Emitter scale factor}}
{-off -boolean}
{-m= -help {Multiplier of area and perimeter}}
{-temp= -help {Device temperature}}
{-ns= -help {Name of node connected to substrate pin}}
{name -help {Name of the device without first-letter designator}}
{nc -help {Name of node connected to collector pin}}
{nb -help {Name of node connected to base pin}}
{ne -help {Name of node connected to emitter pin}}
}]
lappend params [list -posnocheck model [dget $arguments model]]
if {[dexist $arguments area]} {
set areaVal [dget $arguments area]
if {([llength $areaVal]>1) && ([@ $areaVal 0] eq {-eq})} {
lappend params [list -poseq area [@ $areaVal 1]]
} else {
lappend params [list -pos area $areaVal]
}
}
if {[dget $arguments off]==1} {
lappend params {-sw off}
}
dict for {paramName value} $arguments {
if {$paramName ni {model area off ns name nc nb ne}} {
if {[@ $value 0] eq {-eq}} {
lappend params [list -eq $paramName [@ $value 1]]
} else {
lappend params [list $paramName $value]
}
}
}
set pinList [my FormPinNodeList $arguments {nc nb ne}]
if {[dexist $arguments ns]} {
lappend pinList [list ns [dget $arguments ns]]
}
next q[dget $arguments name] $pinList $params
}
method constructor {args} {
# Creates object of class `BjtGPModel` that describes Gummel-Poon model of semiconductor bipolar transistor.# name - name of the model# type - `npn` or `pnp`# args - keyword model parameters, for details please see LTspice manual.# Example of class initialization:# ```# DiodeModel new bjtmod npn -is 1e-15 -bf 200 -vaf 100 -cje 1e-10# ```# Synopsis: name type ?-option value ...?set paramsNames {is ibc ibe bf nf vaf ikf nk ise ne br nr var ikr isc nc rb irb rbm re rc cje vje mje tf xtf vtf itf ptf cjc vjc mjc xcjc xcjc2 extsub tr cjs xcjs vjs mjs xtb eg xti kf af fc subs bvcbo nbvcbo bvbe ibvbe nbvbe tnom cn d gamma qco quasimod rco vg vo tre1 tre2 trb1 trb2 trc1 trc2 trm1 trm2 iss ns tvaf1 tvaf2 tvar1 tvar2 tikf1 tikf2 trbm1 trbm2 tbvcbo1 tbvcbo2}
next {*}[my ArgsPreprocess $paramsNames {name type} {} {*}$args]
}
method constructor {args} {
# Creates object of class `Diode` that describes semiconductor diode device.# name - name of the device without first-letter designator D# np - name of node connected to positive pin# nm - name of node connected to negative pin# -model value - name of the model# -area value - area scale factor, optional# -m value - number of parallel devices, optional# -n value - number of series devices, optional# -temp value - device temperature, optional# -off - initial state, optional# ```# Dnnn anode cathode <model> [area] [off] [m=<val>] [n=<val>] [temp=<value>]# ```# Example of class initialization:# ```# Diode new 1 netp netm -model diomod -area 1e-6# ```# Synopsis: name np nm -model value ?-area value? ?-off? ?-m value? ?-n value? ?-temp value?set arguments [argparse -inline -pfirst -help {Creates object of class 'Diode' that describes diode} {
{-model= -required -help {Name of the model}}
{-area= -help {Area scale factor}}
{-off -boolean -help {Initial state}}
{-m= -help {Multiplier of area and perimeter}}
{-n= -help {Number of series devices}}
{-temp= -help {Device temperature}}
{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 area]} {
set areaVal [dget $arguments area]
if {([llength $areaVal]>1) && ([@ $areaVal 0] eq {-eq})} {
lappend params [list -poseq area [@ $areaVal 1]]
} else {
lappend params [list -pos area $areaVal]
}
}
if {[dget $arguments off]==1} {
lappend params {-sw off}
}
dict for {paramName value} $arguments {
if {$paramName ni {model area off name np nm}} {
if {[@ $value 0] eq {-eq}} {
lappend params [list -eq $paramName [@ $value 1]]
} else {
lappend params [list $paramName $value]
}
}
}
next d[dget $arguments name] [my FormPinNodeList $arguments {np nm}] $params
}
method constructor {args} {
# Creates object of class `DiodeIdealModel` that describes semiconductor diode model.# name - name of the model# args - keyword model parameters, for details please see LTspice manual.# Example of class initialization:# ```# DiodeIdealModel new diodemod -ron 1e-2 -roff 1e8# ```# Synopsis: name ?-option value ...?set paramsNames {ron roff vfwd vrev rrev ilimit revilimit epsilon revepsilon}
next {*}[my ArgsPreprocess $paramsNames {name type} type {*}[linsert $args 1 d]]
}
method constructor {args} {
# Creates object of class `DiodeModel` that describes semiconductor diode model.# name - name of the model# args - keyword model parameters, for details please see LTspice manual.# Example of class initialization:# ```# DiodeModel new diodemod -is 1e-14 -n 1.2 -rs 0.01 -cjo 1e-9# ```# Synopsis: name ?-option value ...?set paramsNames {is rs n tt cjo vj m eg xti kf af fc bv nbv ibv ibvl nbvl tnom isr nr ikf tikf trs1 trs2 tbv1 tbv2 perim isw ns rsw cjsw vjsw mjsw fcs vp}
next {*}[my ArgsPreprocess $paramsNames {name type} type {*}[linsert $args 1 d]]
}
method constructor {args} {
# Creates object of class `Jfet` that describes semiconductor junction FET device.# name - name of the device without first-letter designator J# nd - name of node connected to drain pin# ng - name of node connected to gate pin# ns - name of node connected to source pin# -model value - name of the model# -area value - emitter scale factor, optional# -temp value - device temperature, optional# -m value - parallel device multiplier, optional# -off - initial state, optional# ```# JXXXXXXX nd ng ns mname <area> <off> <temp =t># ```# Example of class initialization:# ```# Jfet new 1 netd netg nets -model jfetmod -area {-eq area*2} -temp 25# ```# Synopsis: name nd ng ns -model value ?-area value? ?-off? ?-temp value?set arguments [argparse -inline -pfirst -help {Creates object of class 'Jfet' that describes semiconductor junction FET device} {
{-model= -required}
{-area= -help {Scale factor}}
{-m= -help {Parallel device multiplier}}
{-off -boolean -help {Initial state}}
{-temp= -help {Device temperature}}
{name -help {Name of the device without first-letter designator}}
{nd -help {Name of node connected to drain pin}}
{ng -help {Name of node connected to gate pin}}
{ns -help {Name of node connected to source pin}}
}]
lappend params [list -posnocheck model [dget $arguments model]]
if {[dexist $arguments area]} {
set areaVal [dget $arguments area]
if {([llength $areaVal]>1) && ([@ $areaVal 0] eq {-eq})} {
lappend params [list -poseq area [@ $areaVal 1]]
} else {
lappend params [list -pos area $areaVal]
}
}
if {[dget $arguments off]==1} {
lappend params {-sw off}
}
dict for {paramName value} $arguments {
if {$paramName ni {model area off name nd ng ns}} {
if {[@ $value 0] eq {-eq}} {
lappend params [list -eq $paramName [@ $value 1]]
} else {
lappend params [list $paramName $value]
}
}
}
next j[dget $arguments name] [my FormPinNodeList $arguments {nd ng ns}] $params
}
method constructor {args} {
# Creates object of class `JfetModel` that describes JFET level 1 model with Parker Skellern modification.# name - name of the model# type - `njf` or `pjf`# args - keyword model parameters, for details please see LTspice manual.# Example of class initialization:# ```# JfetModel new jfetmod njf -vto 2 -beta 1e-3 -lambda 1e-4 -cgd 1e-12# ```# Synopsis: name type ?-option value ...?set paramsNames {vto beta lambda rd rs cgs cgd pb m is b kf af nlev gdsnoi fc tnom vtotc n isr nr alpha vk xti mfg}
next {*}[my ArgsPreprocess $paramsNames {name type} {} {*}$args]
}
method constructor {args} {
# Creates object of class `Mesfet` that describes semiconductor MESFET device.# name - name of the device without first-letter designator Z# nd - name of node connected to drain pin# ng - name of node connected to gate pin# ns - name of node connected to source pin# -model value - name of the model# -area value - emitter scale factor, optional# -m value - parallel device multiplier, optional# -temp value - device temperature, optional# -off - initial state, optional# ```# ZXXXXXXX ND NG NS MNAME <AREA> <OFF> <IC=VDS,VGS># ```# Example of class initialization:# ```# Mesfet new 1 netd netg nets -model mesfetmod -area {-eq area*2}# ```# Synopsis: name nd ng ns -model value ?-area value? ?-off? ?-ic \{value value\} ?set arguments [argparse -inline -pfirst -help {Creates object of class 'Mesfet' that describes semiconductor junction FET device} {
{-model= -required -help {Name of the model}}
{-area= -help {Scale factor}}
{-m= -help {Parallel device multiplier}}
{-off -boolean -help {Initial state}}
{-temp= -help {Device temperature}}
{name -help {Name of the device without first-letter designator}}
{nd -help {Name of node connected to drain pin}}
{ng -help {Name of node connected to gate pin}}
{ns -help {Name of node connected to source pin}}
}]
lappend params [list -posnocheck model [dget $arguments model]]
if {[dexist $arguments area]} {
set areaVal [dget $arguments area]
if {([llength $areaVal]>1) && ([@ $areaVal 0] eq {-eq})} {
lappend params [list -poseq area [@ $areaVal 1]]
} else {
lappend params [list -pos area $areaVal]
}
}
if {[dget $arguments off]==1} {
lappend params {-sw off}
}
dict for {paramName value} $arguments {
if {$paramName ni {model area off name nd ng ns}} {
if {[@ $value 0] eq {-eq}} {
lappend params [list -eq $paramName [@ $value 1]]
} else {
lappend params [list $paramName $value]
}
}
}
next z[dget $arguments name] [my FormPinNodeList $arguments {nd ng ns}] $params
}
method constructor {args} {
# Creates object of class `MesfetModel` that describes MESFET model by Statz e.a..# name - name of the model# type - `nmf` or `pmf`# args - keyword model parameters, for details please see LTspice manual, chapter 10.# Example of class initialization:# ```# Jfet2Model new jfetmod njf -vto -2 -beta 10e-4 -rs 1e-4 -vbi 1.2# ```# Synopsis: name type ?-option value ...?set paramsNames {vto beta b alpha lambda rd rs cgs cgd pb kf af fc is}
next {*}[my ArgsPreprocess $paramsNames {name type} {} {*}$args]
}
Creates object of class Mosfet that describes semiconductor MOSFET device.
OBJECT constructorname nd ng ns -model value -n4|nb value ?-n5 value ?-n6 value ?-n7 value??? ?-m value? ?-l value? ?-w value? ?-ad value|-nrd value? ?-as value|-nrs value? ?-temp value? ?-off? ?-pd value? ?-ps value? ?-ic {value value value}? ?-custparams param1 {?-eq|-poseq|-posnocheck|-pos|-nocheck? param1Val} ...? OBJECT constructorname nd ng ns -model value ?-m value? ?-l value? ?-w value? ?-temp value? ?-off? ?-custparams param1 {?-eq|-poseq|-posnocheck|-pos|-nocheck? param1Val} ...?
Parameters
-ad value
Diffusion area of drain, optional, forbid -nrd, require -n4
-area value
Area of VDMOS device, optional.
-as value
Diffusion area of source, optional, forbid -nrs, require -n4
-custparams list
Key that collects all arguments at the end of device definition, to provide an ability to add custom parameters in form -custparams param1 param1Val param2 {-eq param2eq} param3 param3Val ... Must be specified after all others options. Optional.
-ic value
Initial conditions for vds, vgs and vbs, in form of three element list, optional, require -n4
-l value
Length of channel, optional.
-m value
Multiplier, optional.
-model value
Name of the model.
-n4 value
Name of substrate node.
-n5 value
Name of 5th node, require -n4, optional.
-n6 value
Name of 6th node, require -n5, optional.
-n7 value
Name of 7th node, require -n6, optional.
-nrd value
Equivalent number of squares of the drain diffusions, forbid -ad, require -n4
-nrs value
Equivalent number of squares of the source diffusions, forbid -as, require -n4
-off
Initial state, optional.
-pd value
Perimeter area of drain, optional, require -n4
-ps value
Perimeter area of source, optional, require -n4
-temp value
Device temperature.
-w value
Width of channel, optional.
name
Name of the device without first-letter designator M.
method constructor {args} {
# Creates object of class `Mosfet` that describes semiconductor MOSFET device.# name - name of the device without first-letter designator M# nd - name of node connected to drain pin# ng - name of node connected to gate pin# ns - name of node connected to source pin# -model value - name of the model# -m value - multiplier, optional# -l value - length of channel, optional# -w value - width of channel, optional# -area value - area of VDMOS device, optional# -ad value - diffusion area of drain, optional, forbid `-nrd`, require `-n4`# -as value - diffusion area of source, optional, forbid `-nrs`, require `-n4`# -pd value - perimeter area of drain, optional, require `-n4`# -ps value - perimeter area of source, optional, require `-n4`# -nrd value - equivalent number of squares of the drain diffusions, forbid `-ad`, require `-n4`# -nrs value - equivalent number of squares of the source diffusions, forbid `-as`, require `-n4`# -temp value - device temperature# -ic value - initial conditions for vds, vgs and vbs, in form of three element list, optional, require# `-n4`# -off - initial state, optional# -n4 value - name of substrate node# -n5 value - name of 5th node, require `-n4`, optional# -n6 value - name of 6th node, require `-n5`, optional# -n7 value - name of 7th node, require `-n6`, optional# -custparams list - key that collects all arguments at the end of device definition, to provide an ability# to add custom parameters in form `-custparams param1 param1Val param2 {-eq param2eq} param3 param3Val# ...` Must be specified after all others options. Optional.# ```# Mxxx Nd Ng Ns Nb <model> [m=<value>] [L=<len>]# + [W=<width>] [AD=<area>] [AS=<area>]# + [PD=<perim>] [PS=<perim>] [NRD=<value>]# + [NRS=<value>] [off] [IC=<Vds, Vgs, Vbs>]# + [temp=<T>]# ```# ```# Mxxx Nd Ng Ns <model> [L=<len>] [W=<width>]# + [area=<value>] [m=<value>] [off]# + [temp=<T>]# ```# Example of class initialization:# ```# Mosfet new 1 netd netg nets -model mosfetmod -l 1e-6 -w 10e-3 -n4 netsub -n5 net5# ```# Synopsis: name nd ng ns -model value -n4|nb value ?-n5 value ?-n6 value ?-n7 value???# ?-m value? ?-l value? ?-w value? ?-ad value|-nrd value? ?-as value|-nrs value? ?-temp value? ?-off?# ?-pd value? ?-ps value? ?-ic \{value value value\}?# ?-custparams param1 \{?-eq|-poseq|-posnocheck|-pos|-nocheck? param1Val\} ...?# Synopsis: name nd ng ns -model value ?-m value? ?-l value? ?-w value?# ?-temp value? ?-off? ?-custparams param1 \{?-eq|-poseq|-posnocheck|-pos|-nocheck? param1Val\} ...?set arguments [argparse -inline -pfirst -help {Creates object of class `Mosfet` that describes semiconductor MOSFET device} {
{-model= -required -help {Name of the model}}
{-m= -help Multiplier}
{-l= -help {Length of channel}}
{-w= -help {Width of channel}}
{-ad= -forbid {nrd} -help {Diffusion area of drain}}
{-as= -forbid {nrs} -help {Diffusion area of source}}
{-pd= -help {Perimeter area of drain}}
{-ps= -help {Perimeter area of source}}
{-nrd= -forbid {ad} -help {Equivalent number of squares of the drain diffusions}}
{-nrs= -forbid {as} -help {Equivalent number of squares of the source diffusions}}
{-temp= -help {Device temperature}}
{-off -boolean -help {Initial state}}
{-ic= -validate {[llength $arg]==3} -require n4 -help {Initial conditions for vds, vgs and vbs, in form of three element list}}
{-n4= -help {Name of 4th node}}
{-n5= -require {n4} -help {Name of 5th node}}
{-n6= -require {n5} -help {Name of 6th node}}
{-n7= -require {n7} -help {Name of 7th node}}
{-custparams -catchall -help {Key that collects all arguments at the end of device definition, to provide an ability to add custom parameters in form '-custparams param1 param1Val param2 {-eq param2eq} param3 param3Val ...'}}
{name -help {Name of the device without first-letter designator}}
{nd -help {Name of node connected to drain pin}}
{ng -help {Name of node connected to gate pin}}
{ns -help {Name of node connected to source pin}}
}]
lappend params [list -posnocheck model [dget $arguments model]]
if {[dget $arguments off]==1} {
lappend params {-sw off}
}
if {[dexist $arguments ic]} {
lappend params [list -nocheck ic [join [dget $arguments ic] ,]]
}
dict for {paramName value} $arguments {
if {$paramName ni {model off ic n4 n5 n6 n7 custparams name nd ng ns}} {
if {[@ $value 0] eq {-eq}} {
lappend params [list -eq $paramName [@ $value 1]]
} else {
lappend params [list $paramName $value]
}
}
}
if {[dget $arguments custparams] ne {}} {
if {[llength [dget $arguments custparams]]%2!=0} {
return -code error {Custom parameters list must be even length}
}
set custParamDict [dcreate {*}[dget $arguments custparams]]
dict for {paramName value} $custParamDict {
if {[@ $value 0] eq {-eq}} {
lappend params [list -eq $paramName [@ $value 1]]
} else {
lappend params [list $paramName $value]
}
}
}
set pinList [my FormPinNodeList $arguments {nd ng ns}]
if {[dexist $arguments n4]} {
lappend pinList [list n4 [dget $arguments n4]]
if {[dexist $arguments n5]} {
lappend pinList [list n5 [dget $arguments n5]]
if {[dexist $arguments n6]} {
lappend pinList [list n6 [dget $arguments n6]]
if {[dexist $arguments n7]} {
lappend pinList [list n7 [dget $arguments n7]]
}
}
}
}
next m[dget $arguments name] $pinList $params
}