Enhanced diode model (should work).

This commit is contained in:
pnenzi 2003-10-23 22:05:59 +00:00
parent df9511efcf
commit 39d9a6e677
15 changed files with 44 additions and 16 deletions

View File

@ -1,7 +1,7 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
@ -43,7 +43,9 @@ IFparm DIOmPTable[] = { /* model parameters */
IOPU( "tnom",DIO_MOD_TNOM,IF_REAL, "Parameter measurement temperature"), IOPU( "tnom",DIO_MOD_TNOM,IF_REAL, "Parameter measurement temperature"),
IOP( "rs", DIO_MOD_RS, IF_REAL, "Ohmic resistance"), IOP( "rs", DIO_MOD_RS, IF_REAL, "Ohmic resistance"),
IOP( "trs", DIO_MOD_TRS, IF_REAL, "Ohmic resistance temp. coeff."), IOP( "trs", DIO_MOD_TRS, IF_REAL, "Ohmic resistance 1st order temp. coeff."),
IOPR( "trs1", DIO_MOD_TRS, IF_REAL, "Ohmic resistance 1st order temp. coeff."),
IOP( "trs2", DIO_MOD_TRS2, IF_REAL, "Ohmic resistance 2nd order temp. coeff."),
IOP( "n", DIO_MOD_N, IF_REAL, "Emission Coefficient"), IOP( "n", DIO_MOD_N, IF_REAL, "Emission Coefficient"),
IOPA( "tt", DIO_MOD_TT, IF_REAL, "Transit Time"), IOPA( "tt", DIO_MOD_TT, IF_REAL, "Transit Time"),
IOPA( "ttt1", DIO_MOD_TTT1, IF_REAL, "Transit Time 1st order temp. coeff."), IOPA( "ttt1", DIO_MOD_TTT1, IF_REAL, "Transit Time 1st order temp. coeff."),
@ -51,10 +53,11 @@ IFparm DIOmPTable[] = { /* model parameters */
IOPA( "cjo", DIO_MOD_CJO, IF_REAL, "Junction capacitance"), IOPA( "cjo", DIO_MOD_CJO, IF_REAL, "Junction capacitance"),
IOPR( "cj0", DIO_MOD_CJO, IF_REAL, "Junction capacitance"), IOPR( "cj0", DIO_MOD_CJO, IF_REAL, "Junction capacitance"),
IOP( "vj", DIO_MOD_VJ, IF_REAL, "Junction potential"), IOP( "vj", DIO_MOD_VJ, IF_REAL, "Junction potential"),
IOPR( "pb", DIO_MOD_VJ, IF_REAL, "Junction potential"),
IOP( "m", DIO_MOD_M, IF_REAL, "Grading coefficient"), IOP( "m", DIO_MOD_M, IF_REAL, "Grading coefficient"),
IOPR("mj", DIO_MOD_M, IF_REAL, "Grading coefficient"), IOPR("mj", DIO_MOD_M, IF_REAL, "Grading coefficient"),
IOP("tm1", DIO_MOD_TM1, IF_REAL, " Grading coefficient 1st temp. coeff."), IOP("tm1", DIO_MOD_TM1, IF_REAL, " Grading coefficient 1st temp. coeff."),
IOP("tm1", DIO_MOD_TM2, IF_REAL, " Grading coefficient 2nd temp. coeff."), IOP("tm2", DIO_MOD_TM2, IF_REAL, " Grading coefficient 2nd temp. coeff."),
IOP( "cjp", DIO_MOD_CJSW, IF_REAL, "Sidewall junction capacitance"), IOP( "cjp", DIO_MOD_CJSW, IF_REAL, "Sidewall junction capacitance"),
IOPR( "cjsw", DIO_MOD_CJSW, IF_REAL, "Sidewall junction capacitance"), IOPR( "cjsw", DIO_MOD_CJSW, IF_REAL, "Sidewall junction capacitance"),
IOP( "php", DIO_MOD_VJSW, IF_REAL, "Sidewall junction potential"), IOP( "php", DIO_MOD_VJSW, IF_REAL, "Sidewall junction potential"),
@ -68,6 +71,7 @@ IFparm DIOmPTable[] = { /* model parameters */
IOP( "kf", DIO_MOD_KF, IF_REAL, "flicker noise coefficient"), IOP( "kf", DIO_MOD_KF, IF_REAL, "flicker noise coefficient"),
IOP( "af", DIO_MOD_AF, IF_REAL, "flicker noise exponent"), IOP( "af", DIO_MOD_AF, IF_REAL, "flicker noise exponent"),
IOP( "fc", DIO_MOD_FC, IF_REAL, "Forward bias junction fit parameter"), IOP( "fc", DIO_MOD_FC, IF_REAL, "Forward bias junction fit parameter"),
IOP( "fcs", DIO_MOD_FCS, IF_REAL, "Forward bias sidewall junction fit parameter"),
IOP( "bv", DIO_MOD_BV, IF_REAL, "Reverse breakdown voltage"), IOP( "bv", DIO_MOD_BV, IF_REAL, "Reverse breakdown voltage"),
IOP( "ibv", DIO_MOD_IBV, IF_REAL, "Current at reverse breakdown voltage"), IOP( "ibv", DIO_MOD_IBV, IF_REAL, "Current at reverse breakdown voltage"),
OPU( "cond", DIO_MOD_COND,IF_REAL, "Ohmic conductance"), OPU( "cond", DIO_MOD_COND,IF_REAL, "Ohmic conductance"),

View File

@ -1,7 +1,7 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
#include "ngspice.h" #include "ngspice.h"

View File

@ -1,7 +1,7 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
#ifndef DIO #ifndef DIO
#define DIO #define DIO
@ -164,6 +164,7 @@ typedef struct sDIOmodel { /* model structure for a diode */
unsigned DIOresistGiven : 1; unsigned DIOresistGiven : 1;
unsigned DIOresistTemp1Given : 1; unsigned DIOresistTemp1Given : 1;
unsigned DIOresistTemp2Given : 1;
unsigned DIOemissionCoeffGiven : 1; unsigned DIOemissionCoeffGiven : 1;
unsigned DIOtransitTimeGiven : 1; unsigned DIOtransitTimeGiven : 1;
unsigned DIOtranTimeTemp1Given : 1; unsigned DIOtranTimeTemp1Given : 1;
@ -194,6 +195,7 @@ typedef struct sDIOmodel { /* model structure for a diode */
double DIOresist; /* ohmic series resistance */ double DIOresist; /* ohmic series resistance */
double DIOresistTemp1; /* series resistance 1st order temp. coeff. */ double DIOresistTemp1; /* series resistance 1st order temp. coeff. */
double DIOresistTemp2; /* series resistance 2nd order temp. coeff. */
double DIOconductance; /* conductance corresponding to ohmic R */ double DIOconductance; /* conductance corresponding to ohmic R */
double DIOemissionCoeff; /* emission coefficient (N) */ double DIOemissionCoeff; /* emission coefficient (N) */
double DIOtransitTime; /* transit time (TT) */ double DIOtransitTime; /* transit time (TT) */
@ -277,6 +279,7 @@ typedef struct sDIOmodel { /* model structure for a diode */
#define DIO_MOD_TM1 127 #define DIO_MOD_TM1 127
#define DIO_MOD_TM2 128 #define DIO_MOD_TM2 128
#define DIO_MOD_TRS 129 #define DIO_MOD_TRS 129
#define DIO_MOD_TRS2 130
#include "dioext.h" #include "dioext.h"
#endif /*DIO*/ #endif /*DIO*/

View File

@ -1,7 +1,7 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1988 Jaijeet S Roychowdhury Author: 1988 Jaijeet S Roychowdhury
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
#include "ngspice.h" #include "ngspice.h"

View File

@ -2,7 +2,7 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: 2000 AlansFixes Modified: 2000 AlansFixes
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
@ -143,6 +143,7 @@ DIOload(GENmodel *inModel, CKTcircuit *ckt)
/* /*
* bypass if solution has not changed * bypass if solution has not changed
*/ */
#ifndef NOBYPASS
if ((!(ckt->CKTmode & MODEINITPRED)) && (ckt->CKTbypass)) { if ((!(ckt->CKTmode & MODEINITPRED)) && (ckt->CKTbypass)) {
tol=ckt->CKTvoltTol + ckt->CKTreltol* tol=ckt->CKTvoltTol + ckt->CKTreltol*
MAX(fabs(vd),fabs(*(ckt->CKTstate0 +here->DIOvoltage))); MAX(fabs(vd),fabs(*(ckt->CKTstate0 +here->DIOvoltage)));
@ -159,7 +160,7 @@ DIOload(GENmodel *inModel, CKTcircuit *ckt)
} }
} }
} }
#endif /* NOBYPASS */
/* /*
* limit new junction voltage * limit new junction voltage
*/ */

View File

@ -1,7 +1,7 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
/* /*
*/ */
@ -37,6 +37,9 @@ DIOmAsk (CKTcircuit *ckt, GENmodel *inModel, int which, IFvalue *value)
case DIO_MOD_TRS: case DIO_MOD_TRS:
value->rValue = model->DIOresistTemp1; value->rValue = model->DIOresistTemp1;
return(OK); return(OK);
case DIO_MOD_TRS2:
value->rValue = model->DIOresistTemp2;
return(OK);
case DIO_MOD_N: case DIO_MOD_N:
value->rValue = model->DIOemissionCoeff; value->rValue = model->DIOemissionCoeff;
return(OK); return(OK);

View File

@ -1,7 +1,7 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
/* /*
*/ */
@ -40,6 +40,10 @@ DIOmParam(int param, IFvalue *value, GENmodel *inModel)
model->DIOresistTemp1 = value->rValue; model->DIOresistTemp1 = value->rValue;
model->DIOresistTemp1Given = TRUE; model->DIOresistTemp1Given = TRUE;
break; break;
case DIO_MOD_TRS2:
model->DIOresistTemp2 = value->rValue;
model->DIOresistTemp2Given = TRUE;
break;
case DIO_MOD_N: case DIO_MOD_N:
model->DIOemissionCoeff = value->rValue; model->DIOemissionCoeff = value->rValue;
model->DIOemissionCoeffGiven = TRUE; model->DIOemissionCoeffGiven = TRUE;

View File

@ -1,7 +1,7 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
/* /*
*/ */

View File

@ -1,6 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
/* /*
*/ */

View File

@ -2,7 +2,7 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: 2000 AlansFixes Modified: 2000 AlansFixes
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
/* load the diode structure with those pointers needed later /* load the diode structure with those pointers needed later
@ -100,7 +100,9 @@ DIOsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
if(!model->DIOresistTemp1Given) { if(!model->DIOresistTemp1Given) {
model->DIOresistTemp1 = 0.0; model->DIOresistTemp1 = 0.0;
} }
if(!model->DIOresistTemp2Given) {
model->DIOresistTemp2 = 0.0;
}
/* loop through all the instances of the model */ /* loop through all the instances of the model */
for (here = model->DIOinstances; here != NULL ; for (here = model->DIOinstances; here != NULL ;
here=here->DIOnextInstance) { here=here->DIOnextInstance) {

View File

@ -1,6 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
/* /*
*/ */

View File

@ -1,6 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
/* /*
*/ */

View File

@ -1,6 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
/* /*
*/ */

View File

@ -1,6 +1,8 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
This function is obsolete (was used by an old sensitivity analysis)
**********/ **********/
/* /*
*/ */

View File

@ -2,7 +2,7 @@
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Thomas L. Quarles Author: 1985 Thomas L. Quarles
Modified: 2000 AlansFixes Modified: 2000 AlansFixes
Modified by Dietmar Warning 2003 Modified by Dietmar Warning 2003 and Paolo Nenzi 2003
**********/ **********/
/* perform the temperature update to the diode */ /* perform the temperature update to the diode */
@ -215,7 +215,8 @@ DIOtemp(GENmodel *inModel, CKTcircuit *ckt)
here->DIOtConductance = model->DIOconductance; here->DIOtConductance = model->DIOconductance;
if(model->DIOresistGiven && model->DIOresist!=0.0) { if(model->DIOresistGiven && model->DIOresist!=0.0) {
difference = here->DIOtemp - model->DIOnomTemp; difference = here->DIOtemp - model->DIOnomTemp;
factor = 1.0 + (model->DIOresistTemp1)*difference; factor = 1.0 + (model->DIOresistTemp1) * difference
+ (model->DIOresistTemp2 * difference * difference);
here->DIOtConductance = model->DIOconductance / factor; here->DIOtConductance = model->DIOconductance / factor;
} }