fix regression in ngspice::get_current, simplified voltage reporting in net label symbols
This commit is contained in:
parent
f73166efd1
commit
7abceb3344
|
|
@ -242,6 +242,7 @@ static void backannotate_at_cursor_b_pos(xRect *r, Graph_ctx *gr)
|
|||
}
|
||||
dbg(1, "xx=%g, p=%d\n", xx, p);
|
||||
tcleval("array unset ::ngspice::ngspice_data");
|
||||
xctx->graph_backannotate_p = p;
|
||||
for(i = 0; i < xctx->graph_nvars; i++) {
|
||||
char s[100];
|
||||
my_snprintf(s, S(s), "%.4g", xctx->graph_values[i][p]);
|
||||
|
|
|
|||
|
|
@ -115,14 +115,16 @@ proc ngspice::get_current {n} {
|
|||
set prefix [string range $n 0 0]
|
||||
set path [string range [xschem get sch_path] 1 end]
|
||||
set n $path$n
|
||||
if { ![sim_is_xyce] && $path ne {} } {
|
||||
set n $prefix.$n
|
||||
if { ![sim_is_xyce] } {
|
||||
if {$path ne {} } {
|
||||
set n $prefix.$n
|
||||
}
|
||||
if { ![regexp $prefix {[ve]}] } {
|
||||
set n @$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 {?}
|
||||
|
|
|
|||
|
|
@ -455,6 +455,7 @@ void free_rawfile(int dr)
|
|||
if(xctx->graph_raw_schname) my_free(1393, &xctx->graph_raw_schname);
|
||||
xctx->graph_datasets = 0;
|
||||
xctx->graph_nvars = 0;
|
||||
xctx->graph_backannotate_p = -1;
|
||||
int_hash_free(xctx->graph_raw_table);
|
||||
if(deleted && dr) draw();
|
||||
}
|
||||
|
|
|
|||
10
src/token.c
10
src/token.c
|
|
@ -3015,6 +3015,16 @@ const char *translate(int inst, const char* s)
|
|||
memcpy(result+result_pos,xctx->inst[inst].prop_ptr, tmp+1);
|
||||
result_pos+=tmp;
|
||||
}
|
||||
else if(strcmp(token,"@spice_get_voltage")==0 )
|
||||
{
|
||||
if(xctx->graph_values && xctx->graph_backannotate_p>=0) {
|
||||
int multip;
|
||||
int no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER];
|
||||
if(no_of_pins>0) {
|
||||
dbg(0, "inst %d, net=%s\n",inst, net_name(inst,0, &multip, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(strcmp(token,"@schvhdlprop")==0 && xctx->schvhdlprop)
|
||||
{
|
||||
tmp=strlen(xctx->schvhdlprop);
|
||||
|
|
|
|||
|
|
@ -450,6 +450,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
xctx->graph_left = 0;
|
||||
xctx->graph_lastsel = -1;
|
||||
xctx->graph_sim_type = 0; /* type of sim, 1: Tran, 2: Dc, 3: Ac */
|
||||
xctx->graph_backannotate_p = -1; /* point in raw file to use for annotating voltages/currents/etc */
|
||||
xctx->graph_struct.hilight_wave = -1; /* index of wave */
|
||||
xctx->graph_raw_schname = NULL;
|
||||
xctx->wires = 0;
|
||||
|
|
|
|||
|
|
@ -909,6 +909,7 @@ typedef struct {
|
|||
int graph_left;
|
||||
int graph_lastsel; /* last graph that was clicked (selected) */
|
||||
int graph_sim_type; /* type of sim, 1: Tran, 2: Dc, 3: Ac */
|
||||
int graph_backannotate_p; /* point in raw file to use for annotating schematic voltages/currents/etc */
|
||||
Int_hashentry **graph_raw_table;
|
||||
/* when descending hierarchy xctx->current_name changes, xctx->graph_raw_schname
|
||||
* holds the name of the top schematic from which the raw file was loaded */
|
||||
|
|
|
|||
|
|
@ -16,5 +16,5 @@ B 5 -2.5 27.5 2.5 32.5 {name=minus dir=inout propag=0}
|
|||
T {@name} 15 -18.75 0 0 0.2 0.2 {}
|
||||
T {@#0:net_name} 10 -28.75 0 0 0.15 0.15 {layer=15}
|
||||
T {@#1:net_name} 10 20 0 0 0.15 0.15 {layer=15}
|
||||
T {tcleval(i=[ngspice::get_current @name\\])} 12.5 0 0 0 0.2 0.2 {layer=15
|
||||
T {tcleval(i=[ ngspice::get_current @name ])} 12.5 0 0 0 0.2 0.2 {layer=15
|
||||
hide=true}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ S {}
|
|||
E {}
|
||||
B 5 -1.25 -1.25 1.25 1.25 {name=p dir=in}
|
||||
T {@lab} -7.5 -8.125 0 1 0.33 0.33 {}
|
||||
T {tcleval( [ ngspice::get_node v($\{path\}@@p\\) ] )} -16.875 17.65625 0 1 0.2 0.2 {vcenter=true layer=15 hide=true}
|
||||
T {tcleval( [ ngspice::get_voltage @@p ] )} -16.875 11.40625 0 1 0.2 0.2 {layer=15 hide=true}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ S {}
|
|||
E {}
|
||||
B 5 -1.25 -1.25 1.25 1.25 {name=p dir=in}
|
||||
T {@lab} -2.5 -1.25 2 0 0.27 0.27 {}
|
||||
T {tcleval( [ ngspice::get_node v($\{path\}@@p\\) ] )} -1.875 -24.84375 0 1 0.2 0.2 {vcenter=true layer=15 hide=true}
|
||||
T {tcleval( [ ngspice::get_voltage @@p ] )} -1.875 -24.84375 0 1 0.2 0.2 {vcenter=true layer=15 hide=true}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@ L 15 21.25 -20 25 -20 {}
|
|||
L 15 25 -23.75 25 -20 {}
|
||||
L 15 25 -23.75 27.8125 -23.75 {}
|
||||
B 5 -0.46875 -0.46875 0.46875 0.46875 {name=p dir=xxx}
|
||||
T {tcleval( [ ngspice::get_node v($\{path\}@@p\\) ] )} 11.875 -34.84375 0 0 0.2 0.2 {vcenter=true layer=15 hide=true}
|
||||
T {tcleval( [ ngspice::get_voltage @@p ] )} 11.875 -34.84375 0 0 0.2 0.2 {vcenter=true layer=15 hide=true}
|
||||
|
|
|
|||
|
|
@ -18,5 +18,5 @@ T {@name} 20 -18.75 0 0 0.2 0.2 {}
|
|||
T {@value} 20 6.25 0 0 0.2 0.2 {}
|
||||
T {@#0:net_name} 10 -28.75 0 0 0.15 0.15 {layer=15}
|
||||
T {@#1:net_name} 10 20 0 0 0.15 0.15 {layer=15}
|
||||
T {tcleval(i=[ngspice::get_current @name\\])} 20 -6.25 0 0 0.2 0.2 {layer=15
|
||||
T {tcleval(i=[ ngspice::get_current @name ])} 20 -6.25 0 0 0.2 0.2 {layer=15
|
||||
hide=true}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ B 2 1200 -500 1880 -310 {flags=graph
|
|||
y1 = -0.0059
|
||||
y2 = 11
|
||||
divy = 6
|
||||
x1=0.024209
|
||||
x2=0.0246776
|
||||
x1=0.00757478
|
||||
x2=0.00916695
|
||||
divx=10
|
||||
node="i(v.x1.vu)
|
||||
i(v.x0.vu)
|
||||
|
|
@ -32,8 +32,8 @@ B 2 1200 -830 1880 -520 {flags=graph
|
|||
y1 = -49
|
||||
y2 = 59
|
||||
divy = 12
|
||||
x1=0.024209
|
||||
x2=0.0246776
|
||||
x1=0.00757478
|
||||
x2=0.00916695
|
||||
divx=10
|
||||
node="outp
|
||||
outm
|
||||
|
|
@ -47,8 +47,8 @@ B 2 1200 -1020 1880 -830 {flags=graph
|
|||
y1 = 2.4e-11
|
||||
y2 = 840
|
||||
divy = 6
|
||||
x1=0.024209
|
||||
x2=0.0246776
|
||||
x1=0.00757478
|
||||
x2=0.00916695
|
||||
divx=10
|
||||
|
||||
|
||||
|
|
@ -60,8 +60,8 @@ B 2 1200 -310 1880 -120 {flags=graph
|
|||
y1 = 0.0077
|
||||
y2 = 850
|
||||
divy = 6
|
||||
x1=0.024209
|
||||
x2=0.0246776
|
||||
x1=0.00757478
|
||||
x2=0.00916695
|
||||
divx=10
|
||||
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ node="[ngspice::get_current \{r19[i]\}]"
|
|||
descr = current
|
||||
}
|
||||
C {ngspice_get_expr.sym} 820 -510 2 0 {name=r29
|
||||
node="[format %.4g [expr ([ngspice::get_voltage outm] - [ngspice::get_voltage outp]) * [ngspice::get_current \{r1[i]\}]]] W"
|
||||
node="[format %.4g [expr ([ngspice::get_voltage outm] - [ngspice::get_voltage outp]) * [ngspice::get_current \{r1[i]\}]]] "
|
||||
descr = power
|
||||
}
|
||||
C {launcher.sym} 780 -190 0 0 {name=h3
|
||||
|
|
|
|||
Loading…
Reference in New Issue