Add device type (nmos, pmos), derived from model name.

Invert PMOS voltages (pmos still in error though).
Output monitor now watches id_lin integral.
This commit is contained in:
Holger Vogt 2025-12-08 15:16:55 +01:00
parent 573b9ae25f
commit 76b85ff556
1 changed files with 23 additions and 1 deletions

View File

@ -83,6 +83,7 @@ typedef struct {
double constfac[3]; /* intermediate factor */
double sintegral[3]; /* intermediate intgral */
double prevtime[3]; /* previous time */
int devtype; /* device type 1: nms, -1: pmos */
double VGS0; /* degradation model parameter */
double A[3]; /* degradation model parameter */
double Ea[3]; /* degradation model parameter */
@ -282,6 +283,7 @@ void cm_degmon(ARGS) /* structure holding parms,
double sintegral;
double prevtime;
double k = 1.38062259e-5; /* Boltzmann */
int devtype;
char *devmod; /* PSP device model */
char *simmod; /* degradation model */
@ -349,6 +351,16 @@ void cm_degmon(ARGS) /* structure holding parms,
loc->sintegral[ii] = 0.;
loc->prevtime[ii] = 0.;
}
if (strstr(devmod, "_nmos"))
loc->devtype = 1;
else if (strstr(devmod, "_pmos"))
loc->devtype = -1;
else {
loc->devtype = 0;
cm_message_send("Error: could not extract device type from model name\n");
cm_cexit(1);
}
/*
cm_message_send(INSTNAME);
cm_message_send(INSTMODNAME);
@ -373,6 +385,15 @@ void cm_degmon(ARGS) /* structure holding parms,
vs = INPUT(nodes[2]);
vb = INPUT(nodes[3]);
devtype = loc->devtype;
if (devtype == -1){
vd *= -1.;
vg *= -1.;
vs *= -1.;
vb *= -1.;
}
for (ii = 0; ii < 3; ii++) {
double x1, x2;
@ -399,7 +420,8 @@ void cm_degmon(ARGS) /* structure holding parms,
}
/* test output */
OUTPUT(mon) = sintegral;
if(ii == 0)
OUTPUT(mon) = sintegral;
if (T(0) > 0.99999 * tsim) {
/**** model equations 2 ****/