Add variable 'plainplot' to allow plotting without

function support, but with node names incl chatacters like + - /.
Flag to command 'plot' is renamed to plainplot.
Error message added if vector not found.
Example file added.
This commit is contained in:
Holger Vogt 2020-10-29 15:35:30 +01:00
parent b76ac6be1c
commit 36e2a9af4d
2 changed files with 53 additions and 3 deletions

View File

@ -0,0 +1,46 @@
***** NMOS Transistor BSIM3 (Id-Vds) with Rd ***
** Node name with offensive character '+'
M1 2 1 3 4 n1 W=1u L=0.35u Pd=1.5u Ps=1.5u ad=1.5p as=1.5p
vgs 1 0 3.5
vds 2 0 0.1
vss 3 0 0
vbs 4 0 0
* drain series resistor
R2 2 22 1k
M2 22 1 +32 4 n1 W=1u L=0.35u Pd=1.5u Ps=1.5u ad=1.5p as=1.5p
vss2 +32 0 0
.options Temp=27.0
* BSIM3v3.3.0 model with modified default parameters 0.18µm
.model n1 nmos level=49 version=3.3.0 tox=3.5n nch=2.4e17 nsub=5e16 vth0=0.15
.model p1 pmos level=49 version=3.3.0 tox=3.5n nch=2.5e17 nsub=5e16 vth0=-0.15
.control
set xgridwidth=2
set xbrushwidth=3
dc vds 0 2 0.05 vgs 0 2 0.4
let v(/22) = V(22) ; only availavle in plot dc1
dc vds 0 2 0.05 vgs 0 2 0.5
let v(+22) = V(22) ; only availavle in plot dc2
set nolegend
*set plainplot
plot v(+22) plainplot
set plainwrite
write test.out v(+22) vss#branch dc1.v(/22) dc1.vss#branch
unset nolegend
set color0=white
*unset plainplot ; required if 'set plainplot'
plot vss2#branch vs v(22) title 'Series resistor: Drain current versus drain voltage' xlabel 'Drain voltage' ylabel 'Drain current'
.endc
.end

View File

@ -704,12 +704,14 @@ bool plotit(wordlist *wl, const char *hcopy, const char *devname)
}
if (!sameflag) {
plain = getflag(wl, "plain");
plain = getflag(wl, "plainplot");
}
else if (getflag(wl, "plain")) {
else if (getflag(wl, "plainplot")) {
plain = TRUE;
}
plain = plain | cp_getvar("plainplot", CP_BOOL, NULL, 0);
if (!wl->wl_next) {
fprintf(cp_err, "Error: no vectors given\n");
goto quit1;
@ -724,8 +726,10 @@ bool plotit(wordlist *wl, const char *hcopy, const char *devname)
wordlist* wli;
for (wli = wl->wl_next; wli; wli = wli->wl_next) {
d = vec_get(wli->wl_word);
if (!d)
if (!d) {
fprintf(stderr, "Error during 'plot': vector %s not found\n", wli->wl_word);
goto quit;
}
if (vecs)
lv->v_link2 = d;
else