better handle xyce nodes in ngspice:: functions
This commit is contained in:
parent
4bb321af68
commit
98d59cd8e9
|
|
@ -704,7 +704,7 @@ namespace eval ngspice {
|
|||
}
|
||||
|
||||
proc ngspice::get_current {n} {
|
||||
global path graph_raw_level
|
||||
global graph_raw_level
|
||||
set path [string range [xschem get sch_path] 1 end]
|
||||
# skip hierarchy components above the level where raw file has been loaded.
|
||||
# node path names to look up in raw file begin from there.
|
||||
|
|
@ -714,9 +714,13 @@ proc ngspice::get_current {n} {
|
|||
incr skip
|
||||
}
|
||||
set n [string tolower $n]
|
||||
set prefix [string range $n 0 0]
|
||||
#puts "ngspice::get_current: path=$path n=$n"
|
||||
set prefix $n
|
||||
# if xm1.rd is given get prefix (r) by removing path components (xm1.)
|
||||
regsub {.*\.} $prefix {} prefix
|
||||
set prefix [string range $prefix 0 0]
|
||||
# puts "ngspice::get_current: path=$path n=$n prefix=$prefix"
|
||||
set n $path$n
|
||||
set currname i
|
||||
if { ![sim_is_xyce] } {
|
||||
if {$path ne {} } {
|
||||
set n $prefix.$n
|
||||
|
|
@ -724,9 +728,16 @@ proc ngspice::get_current {n} {
|
|||
if { ![regexp $prefix {[ve]}] } {
|
||||
set n @$n
|
||||
}
|
||||
set n i($n)
|
||||
} else {
|
||||
if { [regexp {\[i[bcedgsb]\]$} $n] } {
|
||||
regexp {\[(i[bcesdgb])\]$} $n curr1 currname
|
||||
regsub {\[(i[bcesdgb])\]$} $n {} n
|
||||
}
|
||||
regsub {\[i\]} $n {} n
|
||||
set n $currname\($n\)
|
||||
}
|
||||
set n i($n)
|
||||
#puts "ngspice::get_current --> $n"
|
||||
# puts "ngspice::get_current --> $n"
|
||||
set err [catch {set ngspice::ngspice_data($n)} res]
|
||||
if { $err } {
|
||||
set res {?}
|
||||
|
|
@ -736,7 +747,7 @@ proc ngspice::get_current {n} {
|
|||
}
|
||||
|
||||
proc ngspice::get_diff_voltage {n m} {
|
||||
global path graph_raw_level
|
||||
global graph_raw_level
|
||||
set path [string range [xschem get sch_path] 1 end]
|
||||
# skip hierarchy components above the level where raw file has been loaded.
|
||||
# node path names to look up in raw file begin from there.
|
||||
|
|
@ -767,7 +778,7 @@ proc ngspice::get_diff_voltage {n m} {
|
|||
|
||||
|
||||
proc ngspice::get_voltage {n} {
|
||||
global path graph_raw_level
|
||||
global graph_raw_level
|
||||
set path [string range [xschem get sch_path] 1 end]
|
||||
# skip hierarchy components above the level where raw file has been loaded.
|
||||
# node path names to look up in raw file begin from there.
|
||||
|
|
@ -779,6 +790,7 @@ proc ngspice::get_voltage {n} {
|
|||
set n [string tolower $n]
|
||||
# puts "ngspice::get_voltage: path=$path n=$n"
|
||||
set node $path$n
|
||||
# puts "ngspice::get_voltage: trying $node"
|
||||
set err [catch {set ngspice::ngspice_data($node)} res]
|
||||
if {$err} {
|
||||
set node v(${path}${n})
|
||||
|
|
@ -792,7 +804,7 @@ proc ngspice::get_voltage {n} {
|
|||
}
|
||||
|
||||
proc ngspice::get_node {n} {
|
||||
global path graph_raw_level
|
||||
global graph_raw_level
|
||||
set path [string range [xschem get sch_path] 1 end]
|
||||
# skip hierarchy components above the level where raw file has been loaded.
|
||||
# node path names to look up in raw file begin from there.
|
||||
|
|
|
|||
|
|
@ -316,8 +316,6 @@ tclcommand="
|
|||
xschem redraw
|
||||
"
|
||||
}
|
||||
C {ngspice_get_value.sym} 1130 -870 0 0 {name=nmos1 node=i(@r.$\{path\}xm1.rd[i])
|
||||
descr="Id="}
|
||||
C {ngspice_get_expr.sym} 800 -1090 0 1 {name=r8
|
||||
node="[format %.4g [expr [ngspice::get_voltage e4] - [ngspice::get_voltage c7]]]"
|
||||
descr = veb
|
||||
|
|
@ -398,8 +396,6 @@ C {ngspice_get_expr.sym} 1210 -1240 0 1 {name=r40
|
|||
node="[ngspice::get_current \{d1[id]\}]"
|
||||
descr = current
|
||||
}
|
||||
C {ngspice_get_value.sym} 1130 -550 0 0 {name=r41 node=i(@r.$\{path\}xm2.rd[i])
|
||||
descr="Id="}
|
||||
C {ngspice_get_expr.sym} 160 -320 0 0 {name=r42
|
||||
node="[format %.4g [expr ([ngspice::get_node v(vpp)] - [ngspice::get_voltage b3]) * [ngspice::get_current \{r1[i]\}]]] W"
|
||||
descr = power
|
||||
|
|
@ -450,3 +446,11 @@ tclcommand="textwindow $netlist_dir/[file tail [file rootname [ xschem get schna
|
|||
}
|
||||
C {spice_probe.sym} 790 -690 0 0 {name=p60 analysis=tran voltage=-0.1364}
|
||||
C {ipin.sym} 0 -1270 0 0 {name=p11 lab=VPP}
|
||||
C {ngspice_get_expr.sym} 1130 -550 0 0 {name=r19
|
||||
node="[ngspice::get_current \{xm2.rd[i]\}]"
|
||||
descr = current
|
||||
}
|
||||
C {ngspice_get_expr.sym} 1130 -860 0 0 {name=r22
|
||||
node="[ngspice::get_current \{xm1.rd[i]\}]"
|
||||
descr = current
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,21 +19,21 @@ B 2 2520 -210 3200 -20 {flags=graph
|
|||
y1 = -0.0035
|
||||
y2 = 11
|
||||
divy = 6
|
||||
x1=0.019472
|
||||
x2=0.0205918
|
||||
x1=0.0176314
|
||||
x2=0.0183299
|
||||
divx=10
|
||||
node="i(v.x1.vu)
|
||||
i(v.x0.vu)
|
||||
i(v.x1.vd)
|
||||
i(v.x0.vd)"
|
||||
color="11 13 12 7"
|
||||
unitx=m}
|
||||
unitx=1}
|
||||
B 2 2520 -540 3200 -230 {flags=graph
|
||||
y1 = -49
|
||||
y2 = 59
|
||||
divy = 12
|
||||
x1=0.019472
|
||||
x2=0.0205918
|
||||
x1=0.0176314
|
||||
x2=0.0183299
|
||||
divx=10
|
||||
node="outp
|
||||
outm
|
||||
|
|
@ -42,18 +42,18 @@ vnn
|
|||
x1.vboost
|
||||
x0.vboost"
|
||||
color="4 15 6 12 7 4"
|
||||
unitx=m
|
||||
unitx=1
|
||||
hilight_wave=-1}
|
||||
B 2 2520 -730 3200 -540 {flags=graph
|
||||
y1 = 0
|
||||
y2 = 840
|
||||
divy = 6
|
||||
x1=0.019472
|
||||
x2=0.0205918
|
||||
x1=0.0176314
|
||||
x2=0.0183299
|
||||
divx=10
|
||||
|
||||
|
||||
unitx=m
|
||||
unitx=1
|
||||
color="4 7"
|
||||
node="\\"supply power;i(vcurrvnn) vnn * i(vcurrvpp) vpp * +\\"
|
||||
\\"running average supply power;i(vcurrvnn) vnn * i(vcurrvpp) vpp * + 200u ravg()\\""
|
||||
|
|
@ -62,12 +62,12 @@ B 2 2520 -20 3200 170 {flags=graph
|
|||
y1 = 0
|
||||
y2 = 850
|
||||
divy = 6
|
||||
x1=0.019472
|
||||
x2=0.0205918
|
||||
x1=0.0176314
|
||||
x2=0.0183299
|
||||
divx=10
|
||||
|
||||
|
||||
unitx=m
|
||||
unitx=1
|
||||
color="4 7"
|
||||
node="\\"Load power;outm outp - i(v.x1.v8) *\\"
|
||||
\\"Running Average Load power;outm outp - i(v.x1.v8) * 200u ravg()\\""}
|
||||
|
|
@ -346,9 +346,7 @@ C {simulator_commands.sym} 2340 -450 0 0 {name=COMMANDS1
|
|||
simulator=xyce
|
||||
only_toplevel=false
|
||||
value="
|
||||
.option ITL4=20000 ITL5=0
|
||||
vvss vss 0 dc 0
|
||||
.temp 30
|
||||
|
||||
.param frequ=5k
|
||||
.param gain=45
|
||||
|
|
@ -361,6 +359,10 @@ vvss vss 0 dc 0
|
|||
* .op
|
||||
.print tran format=raw file=poweramp_lcc_xyce.raw v(*) i(*)
|
||||
+ v(x1:*) v(x0:*) i(x1:*) i(x0:*)
|
||||
+ id(x0:*) ig(x0:*) is(x0:*) ib(x0:*)
|
||||
+ ib(x0:*) ic(x0:*) ie(x0:*)
|
||||
+ id(x1:*) ig(x1:*) is(x0:*) ib(x1:*)
|
||||
+ ib(x1:*) ic(x1:*) ie(x1:*)
|
||||
* .print dc format=raw file=poweramp_op.raw v(*) i(*) v(x1:*) v(x0:*) i(x1:*) i(x0:*)
|
||||
|
||||
"}
|
||||
|
|
|
|||
Loading…
Reference in New Issue