devices/asrc, introduce `ASRCvars' with the indices of the controlling nodes/branches
This commit is contained in:
parent
b4f1c1dda3
commit
b6b76ad035
|
|
@ -36,13 +36,7 @@ ASRCconvTest(GENmodel *inModel, CKTcircuit *ckt)
|
|||
}
|
||||
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++)
|
||||
if (here->ASRCtree->varTypes[i] == IF_INSTANCE) {
|
||||
int branch = CKTfndBranch(ckt, here->ASRCtree->vars[i].uValue);
|
||||
asrc_vals[i] = ckt->CKTrhsOld[branch];
|
||||
} else {
|
||||
int node_num = here->ASRCtree->vars[i].nValue->number;
|
||||
asrc_vals[i] = ckt->CKTrhsOld[node_num];
|
||||
}
|
||||
asrc_vals[i] = ckt->CKTrhsOld[here->ASRCvars[i]];
|
||||
|
||||
if (here->ASRCtree->IFeval(here->ASRCtree, ckt->CKTgmin, &rhs,
|
||||
asrc_vals, asrc_derivs) != OK)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ typedef struct sASRCinstance {
|
|||
int ASRCtype; /* Whether source is voltage or current */
|
||||
int ASRCbranch; /* number of branch equation added for v source */
|
||||
IFparseTree *ASRCtree; /* The parse tree */
|
||||
int *ASRCvars; /* indices of the controlling nodes/branches */
|
||||
|
||||
double ASRCtemp; /* temperature at which this resistor operates */
|
||||
double ASRCdtemp; /* delta-temperature of a particular instance */
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ ASRCdestroy(GENmodel **model)
|
|||
INPfreeTree(here->ASRCtree);
|
||||
if (here->ASRCposptr)
|
||||
free(here->ASRCposptr);
|
||||
if (here->ASRCvars)
|
||||
free(here->ASRCvars);
|
||||
FREE(here);
|
||||
}
|
||||
nextmod = mod->ASRCnextModel;
|
||||
|
|
|
|||
|
|
@ -59,13 +59,7 @@ ASRCload(GENmodel *inModel, CKTcircuit *ckt)
|
|||
* Fill the vector of values from the previous solution
|
||||
*/
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++)
|
||||
if (here->ASRCtree->varTypes[i] == IF_INSTANCE) {
|
||||
int branch = CKTfndBranch(ckt, here->ASRCtree->vars[i].uValue);
|
||||
asrc_vals[i] = ckt->CKTrhsOld[branch];
|
||||
} else {
|
||||
int node_num = (here->ASRCtree->vars[i].nValue) -> number;
|
||||
asrc_vals[i] = ckt->CKTrhsOld[node_num];
|
||||
}
|
||||
asrc_vals[i] = ckt->CKTrhsOld[here->ASRCvars[i]];
|
||||
|
||||
if (here->ASRCtree->IFeval(here->ASRCtree, ckt->CKTgmin, &rhs, asrc_vals, asrc_derivs) != OK)
|
||||
return(E_BADPARM);
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
|||
}
|
||||
|
||||
here->ASRCposptr = TMALLOC(double *, j);
|
||||
here->ASRCvars = TMALLOC(int *, here->ASRCtree->numVars);
|
||||
here->ASRCacValues = TMALLOC(double *, here->ASRCtree->numVars + 1);
|
||||
|
||||
/* For each controlling variable set the entries
|
||||
|
|
@ -103,6 +104,8 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
|||
return (E_BADPARM);
|
||||
}
|
||||
|
||||
here->ASRCvars[i] = column;
|
||||
|
||||
if (here->ASRCtype == ASRC_VOLTAGE) {
|
||||
TSTALLOC(ASRCposptr[j++], here->ASRCbranch, column);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue