diff --git a/src/spicelib/devices/bjt/bjt.c b/src/spicelib/devices/bjt/bjt.c index 69e5bd36a..655e88361 100644 --- a/src/spicelib/devices/bjt/bjt.c +++ b/src/spicelib/devices/bjt/bjt.c @@ -204,7 +204,8 @@ IFparm BJTmPTable[] = { /* model parameters */ IOP("tmjs1",BJT_MOD_TMJS1, IF_REAL, "MJS 1. temperature coefficient"), IOP("tmjs2",BJT_MOD_TMJS2, IF_REAL, "MJS 2. temperature coefficient"), IOP("tns1", BJT_MOD_TNS1, IF_REAL, "NS 1. temperature coefficient"), - IOP("tns2", BJT_MOD_TNS2, IF_REAL, "NS 2. temperature coefficient") + IOP("tns2", BJT_MOD_TNS2, IF_REAL, "NS 2. temperature coefficient"), + IOP("nkf", BJT_MOD_NKF, IF_REAL, "NKF High current beta rolloff exponent") }; char *BJTnames[] = { diff --git a/src/spicelib/devices/bjt/bjtdefs.h b/src/spicelib/devices/bjt/bjtdefs.h index fade6dc6f..6c51ec0b8 100644 --- a/src/spicelib/devices/bjt/bjtdefs.h +++ b/src/spicelib/devices/bjt/bjtdefs.h @@ -430,6 +430,7 @@ typedef struct sBJTmodel { /* model structure for a bjt */ double BJTtmjs2; double BJTtns1; double BJTtns2; + double BJTnkf; double BJTinvEarlyVoltF; /* inverse of BJTearlyVoltF */ double BJTinvEarlyVoltR; /* inverse of BJTearlyVoltR */ double BJTinvRollOffF; /* inverse of BJTrollOffF */ @@ -541,6 +542,7 @@ typedef struct sBJTmodel { /* model structure for a bjt */ unsigned BJTtmjs2Given : 1; unsigned BJTtns1Given : 1; unsigned BJTtns2Given : 1; + unsigned BJTnkfGiven : 1; } BJTmodel; #ifndef NPN @@ -671,6 +673,7 @@ typedef struct sBJTmodel { /* model structure for a bjt */ #define BJT_MOD_TNS1 198 #define BJT_MOD_TNS2 199 #define BJT_MOD_SUBS 200 +#define BJT_MOD_NKF 100 /* device questions */ #define BJT_QUEST_FT 201 diff --git a/src/spicelib/devices/bjt/bjtload.c b/src/spicelib/devices/bjt/bjtload.c index f1ef9439b..92bf6f88b 100644 --- a/src/spicelib/devices/bjt/bjtload.c +++ b/src/spicelib/devices/bjt/bjtload.c @@ -478,10 +478,19 @@ next1: vtn=vt*here->BJTtemissionCoeffF; q2=oik*cbe+oikr*cbc; arg=MAX(0,1+4*q2); sqarg=1; - if(arg != 0) sqarg=sqrt(arg); + if(!model->BJTnkfGiven) { + if(arg != 0) sqarg=sqrt(arg); + } else { + if(arg != 0) sqarg=pow(arg,model->BJTnkf); + } qb=q1*(1+sqarg)/2; - dqbdve=q1*(qb*here->BJTtinvEarlyVoltR+oik*gbe/sqarg); - dqbdvc=q1*(qb*here->BJTtinvEarlyVoltF+oikr*gbc/sqarg); + if(!model->BJTnkfGiven) { + dqbdve=q1*(qb*here->BJTtinvEarlyVoltR+oik*gbe/sqarg); + dqbdvc=q1*(qb*here->BJTtinvEarlyVoltF+oikr*gbc/sqarg); + } else { + dqbdve=q1*(qb*here->BJTtinvEarlyVoltR+oik*gbe*2*sqarg*model->BJTnkf/arg); + dqbdvc=q1*(qb*here->BJTtinvEarlyVoltF+oikr*gbc*2*sqarg*model->BJTnkf/arg); + } } /* * weil's approx. for excess phase applied with backward- diff --git a/src/spicelib/devices/bjt/bjtmask.c b/src/spicelib/devices/bjt/bjtmask.c index 440e0edfd..85ae27e99 100644 --- a/src/spicelib/devices/bjt/bjtmask.c +++ b/src/spicelib/devices/bjt/bjtmask.c @@ -357,6 +357,9 @@ BJTmAsk(CKTcircuit *ckt, GENmodel *instPtr, int which, IFvalue *value) case BJT_MOD_TNS2: value->rValue = here->BJTtns2; return(OK); + case BJT_MOD_NKF: + value->rValue = here->BJTnkf; + return(OK); default: return(E_BADPARM); } diff --git a/src/spicelib/devices/bjt/bjtmpar.c b/src/spicelib/devices/bjt/bjtmpar.c index bed92d9ee..f2e1799a8 100644 --- a/src/spicelib/devices/bjt/bjtmpar.c +++ b/src/spicelib/devices/bjt/bjtmpar.c @@ -426,6 +426,10 @@ BJTmParam(int param, IFvalue *value, GENmodel *inModel) mods->BJTtns2 = value->rValue; mods->BJTtns2Given = TRUE; break; + case BJT_MOD_NKF: + mods->BJTnkf = value->rValue; + mods->BJTnkfGiven = TRUE; + break; default: return(E_BADPARM); } diff --git a/src/spicelib/devices/bjt/bjtsetup.c b/src/spicelib/devices/bjt/bjtsetup.c index 35b3d42fd..3aee05f31 100644 --- a/src/spicelib/devices/bjt/bjtsetup.c +++ b/src/spicelib/devices/bjt/bjtsetup.c @@ -296,6 +296,14 @@ BJTsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) if(!model->BJTtns2Given) { model->BJTtns2 = 0.0; } + if(!model->BJTnkfGiven) { + model->BJTnkf = 0.5; + } else { + if (model->BJTnkf > 1.0) { + printf("Warning: NKF has been set to its maximum value: 1.0\n"); + model->BJTnkf = 1.0; + } + } /* * COMPATABILITY WARNING!