remcirc solved the issue, thanks.
sharedspice - gradual slowdown of ngSpice_Command() despite using destroy all
Documentation says JFET2 supports AFAC parameter but it is not in source code
pdf VDMOS params table is cut off
I see the vector in "Initial transient solution" but linearize don't see such vector
Let's measure RMS value of 10V sinewave: * this prints 7.07 rms value VU1 1 0 DC 0 AC 1 0 SIN (0 10 200 0 0 0) .control tran 10u 20m 0 meas tran rms v(1) from=0 to=20m .endc .end Meas shows 7.07, when I print tran values and calculate RMS myself I get 7.05, ok, close enough. But when I use larger tran step, e.g. 50u, the accurracy goes down and I calculate RMS value 7.00, but the meas command still prints 7.07: * this also prints 7.07 rms value even tho step is larger VU1 1 0 DC 0 AC 1 0 SIN (0 10...
It is caused by having "VDMOS" in the model name, if I change it to QMY_VDMO it works.
If I add VDMOS model "source file.cir" freezes.
doAnalyses: impossible error - can't occur
It has to be something with the way it was compilled, since recompiled version works you can close it.
I've added exit I've added NULL still freezes // gcc -o test test.c -lngspice -lpthread -Wall -ggdb #include <stdio.h> #include <stdbool.h> #include <ngspice/sharedspice.h> int myControlledExit(int exitstatus, bool immediate, bool quitexit, int ident, void *userdata) { printf("simple_ngspice_init_exit: es=%d im=%d qe=%d\n", exitstatus, immediate, quitexit); return exitstatus; } int main() { ngSpice_Init(NULL, NULL, myControlledExit, NULL, NULL, NULL, NULL); char *netlist[] = { "* first line is ignored",...
I downloaded ngspice src (via apt-src install ngspice), I did not applied any patches and compiled it as is with: (./autogen.sh; ./configure --with-ngshared --enable-debug; make), I also haven't made your change yet, and it passes as is (prints both AAA and BBB). Then I studied ruleset in made a quick guess of what parameters debian uses by default and arrived at these parameters: ./configure --enable-cider --enable-maintainer-mode --enable-openmp --enable-pss --enable-xspice --disable-adms --with-editline=yes...
It has to be something else, when I add controlled exit callback the myControlledExit is not called. BBB is also not printed so I can't send more commands. // gcc -o test test.c -lngspice -lpthread -Wall -ggdb #include <stdio.h> #include <stdbool.h> #include <ngspice/sharedspice.h> int myControlledExit(int exitstatus, bool immediate, bool quitexit, int ident, void *userdata) { printf("simple_ngspice_init_exit: es=%d im=%d qe=%d\n", exitstatus, immediate, quitexit); return exitstatus; } int main()...
ngSpice_Circ() never ends if subcircuit does not have all parameters specified
It is IRLZ44N in this file http://bordodynov.ltwiki.org/standard.mos.XVII.txt
I've downloaded thousands of spice models from various websites. You know you search for model for BC547 and on the website is zip with 50 other models so I took it. Few years and 100MB later, I have collected 4000 random VDMOS models. The one I was actually using (IRLZ44N) had negative Rd which cought my attention. So I analyzed them all and found that 4000 have positive Rd, between 0-1ohm, but 63 of those 4000+ have negative. Now I want to know if it is error or if it is possible to be negative....
I've analyzed 4291 VDMOS models used in the wild (found on the internet over the years) and I found that 63 of them have negative Rd, 25 have Rd=0 and 4185 have positive Rd, the actual distribution is in the attachment. Is the negative Rd error or is it possible for it to be negative?
I've analyzed 4291 VDMOS models used in the wild (found on the internet over the years) and I found that 63 of them have negative Rd, 25 have Rd=0 and 4185 have positive Rd, the actual distribution is in the attachment. Is the negative Rd error or is it possible for it to be negative?
I'm using subcircuit, in AC analysis I need to specify the amplitude e.g. 0.5 in this case it works (I see amplitude approaching 0.5 as that's the fixed value I used for ACMAG): * first line is ignored .subckt MYSOURCE pos neg PARAMS: v=0.2 f=200 V1 pos neg DC 0 AC 0.5 SIN (0 {v} {f} 0 0 0) .ends X1 1 0 MYSOURCE PARAMS: v=0.7 f=400 C1 1 2 10n R1 2 0 50k .print ac vm(2) .ac oct 40 16 2000 .end But if I try to put {v} in place of ACMAG, it does not work: * this does not work .subckt MYSOURCE pos neg...
I'm using subcircuit, in AC analysis I need to specify the amplitude e.g. 0.3 in this case it works (I see amplitude approaching 0.5 as that's the fixed value I used for ACMAG): * first line is ignored .subckt MYSOURCE pos neg PARAMS: v=0.2 f=200 V1 pos neg DC 0 AC 0.5 SIN (0 {v} {f} 0 0 0) .ends X1 1 0 MYSOURCE PARAMS: v=0.7 f=400 C1 1 2 10n R1 2 0 50k .print ac vm(2) .ac oct 40 16 2000 .end But if I try to put {v} in place of ACMAG, it does not work: * this does not work .subckt MYSOURCE pos neg...
resistor with r = pwl ignores last point
pwl if r=last time, simulation never ends
Thanks
I'm trying to use PULSE voltage supply with just two pulses. I can either have 1 pulse or infinetely many pulses: * two 5V pulses, 0.1s wide, 0.2s period .control unset ngbehavior .endc * V1 V2 D Raise Fall PW Per N V1 1 0 DC 0 PULSE(1 5 0 0.0001 0.0001 0.1 0.2 2) R1 1 0 1000 .tran 0.01 1.0 0 .print tran v(1) .end I'm using ngspice-36 from ubuntu 22.04
Ok, this helped. So before calling ngSpice_AllVecs("ac1") I need to call: ngSpice_Command("setplot ac1"); Thanks.
Ok, this helped. So before calling ngSpice_AllVecs("ac1") I need to call: ngSpice_Command("setplot ac1");
It doesn't help.
That's exactly what I'm doing in demo and it doesn't work.
I have following circuit: char *netlist[] = { "* voltage divider", "V1 1 0 9", "R1 1 2 1k", "R2 2 0 1k", ".control", "ac dec 10 16 20k", "tran 300u 20m 0", ".endc", ".end" } I'm using ngSpice_AllPlots(), then ngSpice_AllVecs("ac1") then ngGet_Vec_Info(..) then finally reading v_realdata or v_compdata. If I only use "ac" only or "tran" only, it works. But when I want both, the older one gets somehow rewriten and data is no longer available. Attached is minimal demo. When you only use one characteristic...
Subcircuit parameter not working in sine voltage source AC amplitude
ok it works
ok it works
It doesn't work like that, even if I destroy fourier11 the fourier21 will be used: * first line V1 1 0 DC 0 AC 100m 0 SIN(0 100m 196 0 0 0) R1 1 0 50k .options NOACCT NOPAGE .control tran 40u 580m 0 fourier 196 v(1) print fourier11[1][0] print fourier11[1][1] print fourier11[1][2] destroy fourier11 tran 40u 580m 0 fourier 222 v(1) print fourier21[1][0] print fourier21[1][1] print fourier21[1][2] .endc .end
I'm running fourier 123 v(out) in a loop and calculating THD from fourier11 vector. But because I do it in the loop, the second call will store the output in fourier21, third call in fourier31 and so on. I don't know how to change the code to read from different variable each time the loop runs. The variable that is increasing in the name of the vector is "static int callstof = 1;" in fourier.c: int fourier(wordlist *wl, struct plot *current_plot) { ... static int callstof = 1; ... /* create and...
"destroy all" worked
I do a lot of transient and ac analysis and only use measure command, I don't need to print these so I am not printing them, I do about 10 transients and 10 ac. After I'm done, at the end of the file I do one last ac and tran with altered values and I do want to print this ac and tran, but when I use print command, it prints everything and I have 11 transients and 11 ac in the output. Can I somehow clear data before final print so that it is printed only once? ac meas tran meas ac. meas tran mess...
Thanks.
I tried this but amplitude is still 0.1 and I got error: Error: Only a single param - value pair supported. changing amplitude and freq of sine voltage source V1 1 0 DC 0 AC 1 0 SIN(0 0.1 192 0 0 0) R1 1 0 1k2 .control set nobreak set nopage let newamp = 5 let newfreq = 440 alter @v1[sin] [0 $&newamp $&newfreq] set newamp = 6 set newfreq = 1234 .endc .tran 10u 10m 0 .print tran v(1) .end
I have this netlist: first line is ignored V1 1 0 DC 0 AC 0 0 SIN(0 1 440 0 0 0) R1 1 0 1k2 I can change "AC 0" using alter command like this: .control alter V1 AC = 5 .endc But is it possible to change VA and FREQ of SIN (...)? Something like: .control alter V1 VA = 5 alter V1 FREQ = 1234 .endc ngspice-36
I wanted to change all values in voltage source using parameters: .param aaa=0.9 bbb=0.8 this works V1 1 0 DC 0 AC (0.9 0) SIN(0 {bbb} 192 0 0 0) this does not work V1 1 0 DC 0 AC ({aaa} 0) SIN(0 {bbb} 192 0 0 0) Error on line 12 : v1 1 0 dc 0 ac ( 1 0 ) ( 9.000000000000000e-01 0) sin(0 8.000000000000000e-01 192 0 0 0) no such parameter on this device In ngspice manual is this example: Param-example .param amplitude= 1V * .subckt myfilter in out rval=100k cval=100nF Ra in p1 {2rval} Rb p1 out {2rval}...
It works, thanks.
When I use transient or FFT with single node, e.g. v(5) it works. When I print transient between 2 nodes it also work: * first line is ignored * 1V sine 100Hz VU1 1 0 DC 0 AC 0 0 SIN(0 1 100 0 0 0) * three series resistors 1k RR1 2 1 1000 RR2 3 2 1000 RR3 0 3 1000 .options NOACCT NOPAGE .print tran v(2,1) v(3,0) .tran 0.0001 0.02 0 .end But when I try to do FFT between two nodes: * first line is ignored * 1V sine 100Hz VU1 1 0 DC 0 AC 0 0 SIN(0 1 100 0 0 0) * three series resistors 1k RR1 2 1 1000...
It works, thanks
Here is simple FFT demo: * first line is ignored VU1 1 0 DC 0 AC 0.9 0 SIN(0 0.1 50 0 0 0) RR1 1 0 1000 .control tran 100u 100m 0 linearize v(1) set specwindow=blackman fft v(1) print vdb(1) .endc .end I run it from command line: "ngspice -b demo.src" and the output is: ... first 20 or so lines omitted Index vdb(1) 0<->-2.93591e+02<--> 1<->-9.77563e+01<--> 2<->-1.06951e+02<--> 3<->-4.24296e+01<--> 4<->-2.56337e+01<--> .... some lines omitted 124>-1.85311e+02<--> 125>-1.88034e+02<--> 126>-1.91794e+02<-->...
Ok, thanks for explanation.
Diode current is M times larger than it should be
How can I have column names in print longer than 15 characters? When I print: .print tran v(net0) 1000*i(V_AMMETER_A1) It shows: Index time v(net0) 1000*i(v_ammete 0<->0.000000e+00<-->0.000000e+00<-->3.389475e-23<--> 1<->1.000000e-06<-->5.654866e-03<-->-2.34322e-05<--> It is truncated to "1000*i(v_ammete". Is it possible to get whole name?