analysis/acsetp.c, ac analysis, allow frequency=0

This commit is contained in:
rlar 2018-01-15 19:01:15 +01:00
parent 57a0a5dec0
commit c5d8ad792e
4 changed files with 33 additions and 5 deletions

View File

@ -22,8 +22,8 @@ ACsetParm(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value)
switch(which) {
case AC_START:
if (value->rValue <= 0.0) {
errMsg = copy("Frequency of 0 is invalid for AC start");
if (value->rValue < 0.0) {
errMsg = copy("Frequency of < 0 is invalid for AC start");
job->ACstartFreq = 1.0;
return(E_PARMVAL);
}
@ -32,8 +32,8 @@ ACsetParm(CKTcircuit *ckt, JOB *anal, int which, IFvalue *value)
break;
case AC_STOP:
if (value->rValue <= 0.0) {
errMsg = copy("Frequency of 0 is invalid for AC stop");
if (value->rValue < 0.0) {
errMsg = copy("Frequency of < 0 is invalid for AC stop");
job->ACstartFreq = 1.0;
return(E_PARMVAL);
}

View File

@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
TESTS = bugs-1.cir bugs-2.cir dollar-1.cir empty-1.cir resume-1.cir log-functions-1.cir alter-vec.cir test-noise-2.cir test-noise-3.cir
TESTS = bugs-1.cir bugs-2.cir dollar-1.cir empty-1.cir resume-1.cir log-functions-1.cir alter-vec.cir test-noise-2.cir test-noise-3.cir ac-zero.cir
TESTS_ENVIRONMENT = ngspice_vpath=$(srcdir) $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice

View File

@ -0,0 +1,27 @@
* whether .ac works for freq=0
*
* (exec-spice "ngspice -b %s" t)
v1 1 0 dc=0 ac=1
r1 1 2 1k
l1 2 3 1uH
r3 3 0 1k
c3 3 0 1uF
.control
ac lin 1 0Hz 0Hz
let v3_gold = 0.5
let err = abs(v(3)/v3_gold - 1)
if err > 1e-15
echo "ERROR: test failed, excessive error, err = $&err"
quit 1
else
echo "INFO: success"
quit 0
end
.endc

View File

@ -0,0 +1 @@
INFO: success