variable xtrtol may override the XSPICE reduction of trtol

This commit is contained in:
h_vogt 2012-07-29 12:53:31 +02:00
parent 26468839d4
commit d793dd6a61
1 changed files with 13 additions and 4 deletions

View File

@ -8,6 +8,7 @@ Modified: 2000 AlansFixes
#include "ngspice/cktdefs.h"
#include "ngspice/sperror.h"
#include "ngspice/trandefs.h"
#include "ngspice/cpextern.h"
#include "analysis.h"
@ -71,11 +72,19 @@ CKTdoJob(CKTcircuit *ckt, int reset, TSKtask *task)
ckt->CKTdelmin = task->TSKdelmin;
ckt->CKTtrtol = task->TSKtrtol;
#ifdef XSPICE
/* Lower value of trtol to give smaller stepsize and more accuracy */
/* but only if there are 'A' devices in the circuit */
/* Lower value of trtol to give smaller stepsize and more accuracy,
but only if there are 'A' devices in the circuit,
may be overridden by 'set xtrtol=newval' */
if (ckt->CKTadevFlag && (ckt->CKTtrtol > 1)) {
printf("Reducing trtol to 1 for xspice 'A' devices\n");
ckt->CKTtrtol = 1;
int newtol;
if (cp_getvar("xtrtol", CP_NUM, &newtol)) {
printf("Override trtol to %d for xspice 'A' devices\n", newtol);
ckt->CKTtrtol = newtol;
}
else {
printf("Reducing trtol to 1 for xspice 'A' devices\n");
ckt->CKTtrtol = 1;
}
}
#endif
ckt->CKTdefaultMosM = task->TSKdefaultMosM;