Add variables deg_tfuture deg_limits to allow users setting

lower limits of deg parameters and the extrapolation time
in .spiceinit.
This commit is contained in:
Holger Vogt 2026-02-19 11:42:07 +01:00
parent d85b0a07cd
commit 35bb2960b0
3 changed files with 20 additions and 12 deletions

View File

@ -153,7 +153,13 @@ int readdegparams (struct card *deck) {
Return number of degradation monitors, or 0 in case of error. */
int adddegmonitors(struct card* deck) {
static int degmonno;
double tfuture = 315336e3; /* 10 years */
double tfuture, dlimits;
if (!cp_getvar("deg_tfuture", CP_REAL, &tfuture, 0))
tfuture = 315360e3; /* 10 years */
fprintf(stdout, "Note: deg data extrapolated to %e seconds (%.1f years)\n", tfuture, tfuture / 31536e3);
if (!cp_getvar("deg_limits", CP_REAL, &dlimits, 0))
dlimits = 1e-3;
fprintf(stdout, "Note: deg data lower limit is %e\n", dlimits);
int nodes = 4;
if (agemods[0].paramhash == NULL)
return 1;
@ -214,8 +220,8 @@ int adddegmonitors(struct card* deck) {
*/
char* aline = tprintf("adegmon%d_%s %%v([%s]) mon%d degmon%d\n",
degmonno, instname, fournodes, degmonno, degmonno);
char* mline = tprintf(".model degmon%d degmon (tfuture=%e %s devmod=\"%s\" instname=\"%s\"\n",
degmonno, tfuture, clength, modname, instname);
char* mline = tprintf(".model degmon%d degmon (tfuture=%e dlimits=%e %s devmod=\"%s\" instname=\"%s\"\n",
degmonno, tfuture, dlimits, clength, modname, instname);
tfree(clength);
insert_new_line(deck, aline, 0, deck->linenum_orig, deck->linesource);
insert_new_line(deck, mline, 0, deck->linenum_orig, deck->linesource);

View File

@ -288,6 +288,7 @@ void cm_degmon(ARGS) /* structure holding parms,
double constfac; /* static storage of const factor in model equation */
double tfut;
double tsim;
double dlimits;
double deg; /* monitor output */
double sintegrand = 0;
double sintegral;
@ -322,6 +323,7 @@ void cm_degmon(ARGS) /* structure holding parms,
devmod = PARAM(devmod);
tfut = PARAM(tfuture);
devtype = PARAM(type);
dlimits = PARAM(dlimits);
L = PARAM(L);
tsim = TSTOP;
@ -469,7 +471,7 @@ void cm_degmon(ARGS) /* structure holding parms,
/***************************/
sintegral = 1e99; // flag final time step
/* only significant degradation */
if (fabs(deg) < 1e-6)
if (fabs(deg) < dlimits)
deg = 0.;
loc->result[ii] = deg;
}

View File

@ -65,14 +65,14 @@ Null_Allowed: yes no
PARAMETER_TABLE:
Parameter_Name: type
Description: "model type PMOS, NMOS"
Data_Type: int
Default_Value: 1
Limits: -
Vector: no
Vector_Bounds: -
Null_Allowed: yes
Parameter_Name: type dlimits
Description: "model type PMOS, NMOS" "degradation limits"
Data_Type: int real
Default_Value: 1 1e-3
Limits: - -
Vector: no no
Vector_Bounds: - -
Null_Allowed: yes yes
STATIC_VAR_TABLE: