reverse recovery: safe guard against VP=0

This commit is contained in:
dwarning 2025-09-21 16:31:44 +02:00
parent 5dbb153188
commit b5232a50cb
1 changed files with 12 additions and 11 deletions

View File

@ -211,13 +211,15 @@ DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
if(!model->DIOrecSatCurGiven) {
model->DIOrecSatCur = 1e-14;
}
if (!model->DIOsoftRevRecParamGiven) {
if (model->DIOtransitTime < ckt->CKTepsmin) {
if (model->DIOsoftRevRecParamGiven && (model->DIOsoftRevRecParam < ckt->CKTepsmin)) {
fprintf(stderr, "Warning: %s: VP too small - reverse recovery effect disabled!\n",
model->DIOmodName);
model->DIOsoftRevRecParamGiven = FALSE;
}
if (model->DIOsoftRevRecParamGiven && (model->DIOtransitTime < ckt->CKTepsmin)) {
fprintf(stderr, "Warning: %s: TT too small - reverse recovery effect disabled!\n",
model->DIOmodName);
}
model->DIOsoftRevRecParam = 0.0;
model->DIOsoftRevRecParamGiven = FALSE;
}
/* set lower limit of saturation current */
@ -369,7 +371,7 @@ DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
}
/* rev-rec */
if (model->DIOsoftRevRecParamGiven && model->DIOsoftRevRecParam!=0 && model->DIOtransitTime!=0) {
if (model->DIOsoftRevRecParamGiven) {
if(here->DIOqpNode == 0) {
error = CKTmkVolt(ckt, &tmp, here->DIOname, "qp");
if(error) return(error);
@ -379,7 +381,6 @@ DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
here->DIOqpNode = 0;
}
int selfheat = ((here->DIOtempNode > 0) && (here->DIOthermal) && (model->DIOrth0Given));
/* macro to make elements with built in test for out of memory */
@ -407,7 +408,7 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\
}
/* rev-rec */
if (model->DIOsoftRevRecParamGiven && model->DIOsoftRevRecParam!=0 && model->DIOtransitTime!=0) {
if (model->DIOsoftRevRecParamGiven) {
TSTALLOC(DIOqpQpPtr , DIOqpNode, DIOqpNode);
TSTALLOC(DIOqpPosPrimePtr, DIOqpNode, DIOposPrimeNode);
TSTALLOC(DIOqpNegPtr , DIOqpNode, DIOnegNode);