If compatmode ps or lt: add a series resistance (100µOhms) to

diodes, when RS is not given or 0:
Improves convergence in behavioural models for op evaluation.
This commit is contained in:
Holger Vogt 2023-11-14 16:56:31 +01:00
parent 29bfe94318
commit 4da3dc51fd
1 changed files with 8 additions and 1 deletions

View File

@ -16,6 +16,7 @@ Modified by Paolo Nenzi 2003 and Dietmar Warning 2012
#include "ngspice/sperror.h"
#include "ngspice/suffix.h"
#include "ngspice/fteext.h"
#include "ngspice/compatmode.h"
int
DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
@ -195,7 +196,13 @@ DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
}
if((!model->DIOresistGiven) || (model->DIOresist==0)) {
model->DIOconductance = 0.0;
if (newcompat.ps || newcompat.lt) {
model->DIOconductance = 1e4; /* improved convergence */
if (ft_ngdebug)
fprintf(stderr, "Diode series resistance in model %s set to 100 µOhm\n", model->gen.GENmodName);
}
else
model->DIOconductance = 0.0;
} else {
model->DIOconductance = 1/model->DIOresist;
}