Add global has pointer for degradation data storage per instance,

inizialse it.
This commit is contained in:
Holger Vogt 2026-01-26 16:16:15 +01:00
parent 4048610872
commit 40587ead4e
1 changed files with 10 additions and 3 deletions

View File

@ -20,6 +20,9 @@ License: Modified BSD
/* maximum number of models */ /* maximum number of models */
#define DEGMODMAX 64 #define DEGMODMAX 64
/* global pointer: results from first tran run */
NGHASHPTR degdatahash;
struct agemod { struct agemod {
char* devmodel; char* devmodel;
char* simmodel; char* simmodel;
@ -124,7 +127,8 @@ int readdegparams (struct card *deck) {
Check if the model in the x line is found in the model list agemodds. Check if the model in the x line is found in the model list agemodds.
Create a degradation monitor for each x line if model found. Create a degradation monitor for each x line if model found.
Add the x instance name to the degmod name. Add the x instance name to the degmod name.
Add degmon line and its model line to the netlist.*/ Add degmon line and its model line to the netlist.
Return number of degradation monitors, or 0 in case of error. */
int adddegmonitors(struct card* deck) { int adddegmonitors(struct card* deck) {
static int degmonno; static int degmonno;
double tfuture = 315336e3; /* 10 years */ double tfuture = 315336e3; /* 10 years */
@ -178,7 +182,7 @@ int adddegmonitors(struct card* deck) {
char* lpos = strstr(line, "l="); char* lpos = strstr(line, "l=");
if (!lpos) { if (!lpos) {
fprintf(stderr, "Error, channel length l not found in device %s \n\n", deck->line); fprintf(stderr, "Error, channel length l not found in device %s \n\n", deck->line);
return 1; return 0;
} }
/* get l=val [m] */ /* get l=val [m] */
char* clength = gettok(&lpos); char* clength = gettok(&lpos);
@ -207,7 +211,10 @@ int adddegmonitors(struct card* deck) {
tfree(instname); tfree(instname);
} }
} }
return 0; /* initialze the result data storage */
degdatahash = nghash_init(degmonno);
return degmonno;
} }
int quote_degmons(struct card* deck) { int quote_degmons(struct card* deck) {