add ngspice Temperature clipping in HICUM
This commit is contained in:
parent
d735f445e5
commit
724887f32c
|
|
@ -1762,20 +1762,20 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
Vbiei = DEVpnjlim(Vbiei,*(ckt->CKTstate0 + here->HICUMvbiei),here->HICUMvt.rpart,
|
Vbiei = DEVpnjlim(Vbiei,*(ckt->CKTstate0 + here->HICUMvbiei),here->HICUMvt.rpart,
|
||||||
here->HICUMtVcrit,&icheck);
|
here->HICUMtVcrit,&icheck);
|
||||||
Vaval = 3 * here->HICUMvdci_t.rpart;//limit step around 3*vdci_t -> somehow this brings convergence
|
Vaval = 3 * here->HICUMvdci_t.rpart;//limit step around 3*vdci_t -> somehow this brings convergence
|
||||||
// if ((model->HICUMkavlGiven) && (Vbici < MIN(0, -Vaval))) {
|
if ((model->HICUMkavlGiven) && (Vbici < MIN(0, -Vaval))) {
|
||||||
// Vbici_temp = -(Vbici + Vaval);
|
Vbici_temp = -(Vbici + Vaval);
|
||||||
// Vbici_temp = DEVpnjlim(
|
Vbici_temp = DEVpnjlim(
|
||||||
// Vbici_temp,
|
Vbici_temp,
|
||||||
// -(*(ckt->CKTstate0 + here->HICUMvbici) + Vaval),
|
-(*(ckt->CKTstate0 + here->HICUMvbici) + Vaval),
|
||||||
// here->HICUMvt.rpart,
|
here->HICUMvt.rpart,
|
||||||
// here->HICUMtVcrit,
|
here->HICUMtVcrit,
|
||||||
// &ichk1
|
&ichk1
|
||||||
// );
|
);
|
||||||
// Vbici = -(Vbici_temp + Vaval);
|
Vbici = -(Vbici_temp + Vaval);
|
||||||
// } else {
|
} else {
|
||||||
Vbici = DEVpnjlim(Vbici,*(ckt->CKTstate0 + here->HICUMvbici),here->HICUMvt.rpart,
|
Vbici = DEVpnjlim(Vbici,*(ckt->CKTstate0 + here->HICUMvbici),here->HICUMvt.rpart,
|
||||||
here->HICUMtVcrit,&ichk1);
|
here->HICUMtVcrit,&ichk1);
|
||||||
//}
|
}
|
||||||
Vbpei = DEVpnjlim(Vbpei,*(ckt->CKTstate0 + here->HICUMvbpei),here->HICUMvt.rpart,
|
Vbpei = DEVpnjlim(Vbpei,*(ckt->CKTstate0 + here->HICUMvbpei),here->HICUMvt.rpart,
|
||||||
here->HICUMtVcrit,&ichk2);
|
here->HICUMtVcrit,&ichk2);
|
||||||
Vbpci = DEVpnjlim(Vbpci,*(ckt->CKTstate0 + here->HICUMvbpci),here->HICUMvt.rpart,
|
Vbpci = DEVpnjlim(Vbpci,*(ckt->CKTstate0 + here->HICUMvbpci),here->HICUMvt.rpart,
|
||||||
|
|
@ -1786,7 +1786,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
here->HICUMtVcrit,&ichk5);
|
here->HICUMtVcrit,&ichk5);
|
||||||
if (selfheat) {
|
if (selfheat) {
|
||||||
Vrth = HICUMlimitlog(Vrth,
|
Vrth = HICUMlimitlog(Vrth,
|
||||||
*(ckt->CKTstate0 + here->HICUMvrth),10,&ichk6);
|
*(ckt->CKTstate0 + here->HICUMvrth),1,&ichk6);
|
||||||
}
|
}
|
||||||
if ((ichk1 == 1) || (ichk2 == 1) || (ichk3 == 1) || (ichk4 == 1) || (ichk5 == 1) || (ichk6 == 1)) icheck=1;
|
if ((ichk1 == 1) || (ichk2 == 1) || (ichk3 == 1) || (ichk4 == 1) || (ichk5 == 1) || (ichk6 == 1)) icheck=1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,19 @@ using namespace duals::literals;
|
||||||
#define TMIN -100.0
|
#define TMIN -100.0
|
||||||
#define LN_EXP_LIMIT 11.0
|
#define LN_EXP_LIMIT 11.0
|
||||||
|
|
||||||
|
duals::duald clip_temperature(duals::duald T){
|
||||||
|
// smooth clipping function for device temperature, if self heating increases temperature beyond
|
||||||
|
// T0+TMAX or below T0-TMIN
|
||||||
|
duals::duald Tdev;
|
||||||
|
Tdev = T;
|
||||||
|
if (T<(TMIN+CONSTCtoK+1.0)){
|
||||||
|
Tdev = TMIN+CONSTCtoK+exp(T-TMIN-CONSTCtoK-1.0);
|
||||||
|
} else if (T>(TMAX+CONSTCtoK-1.0)) {
|
||||||
|
Tdev = TMAX+CONSTCtoK-exp(TMAX+CONSTCtoK-T-1.0);
|
||||||
|
};
|
||||||
|
return Tdev;
|
||||||
|
};
|
||||||
|
|
||||||
void TMPHICJ(double , double , double , double , double ,
|
void TMPHICJ(double , double , double , double , double ,
|
||||||
double , double , double , double , double , double ,
|
double , double , double , double , double , double ,
|
||||||
double *, double *, double *);
|
double *, double *, double *);
|
||||||
|
|
@ -157,20 +170,29 @@ int hicum_thermal_update(HICUMmodel *inModel, HICUMinstance *inInstance, double
|
||||||
zetabcxt= mg+1-model->HICUMzetacx;
|
zetabcxt= mg+1-model->HICUMzetacx;
|
||||||
zetasct = mg-1.5;
|
zetasct = mg-1.5;
|
||||||
|
|
||||||
// Limit temperature to avoid FPEs in equations
|
|
||||||
*(Tdev_Vrth) = 1.0;
|
|
||||||
if(*(HICUMTemp) < TMIN + CONSTCtoK) {
|
// Smooth ngspice T clipping
|
||||||
*(HICUMTemp) = TMIN + CONSTCtoK;
|
temp = clip_temperature( *(HICUMTemp)+1_e );
|
||||||
*(Tdev_Vrth) = 0.0;
|
*(HICUMTemp) = temp.rpart();
|
||||||
} else {
|
*(Tdev_Vrth) = temp.dpart();
|
||||||
if (*(HICUMTemp) > TMAX + CONSTCtoK) {
|
|
||||||
*(HICUMTemp) = TMAX + CONSTCtoK;
|
// original HICUM clipping for Tdev => left here for reference
|
||||||
*(Tdev_Vrth) = 0.0;
|
// *(Tdev_Vrth) = 1.0;
|
||||||
}
|
// if(*(HICUMTemp) < TMIN + CONSTCtoK) {
|
||||||
}
|
// *(HICUMTemp) = TMIN + CONSTCtoK;
|
||||||
|
// *(Tdev_Vrth) = 0.0;
|
||||||
|
// } else {
|
||||||
|
// if (*(HICUMTemp) > TMAX + CONSTCtoK) {
|
||||||
|
// *(HICUMTemp) = TMAX + CONSTCtoK;
|
||||||
|
// *(Tdev_Vrth) = 0.0;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
//This routine calculate the derivative with respect to Vrth. Since at some point
|
//This routine calculate the derivative with respect to Vrth. Since at some point
|
||||||
// Tdev becomes constant (see above), we need to account for this like below.
|
// Tdev becomes constant (see above), we need to account for this like below.
|
||||||
temp = *(HICUMTemp)+1_e* *(Tdev_Vrth); // dual number device temperature
|
//temp = *(HICUMTemp)+1_e* *(Tdev_Vrth); // dual number device temperature
|
||||||
|
|
||||||
vt = temp*CONSTKoverQ; // dual valued temperature voltage
|
vt = temp*CONSTKoverQ; // dual valued temperature voltage
|
||||||
|
|
||||||
here->HICUMvt0 = Tnom * CONSTKoverQ;
|
here->HICUMvt0 = Tnom * CONSTKoverQ;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue