Browse Source

devices/asrc, introduce `ASRCvars' with the indices of the controlling nodes/branches

pre-master-46
rlar 11 years ago
parent
commit
b6b76ad035
  1. 8
      src/spicelib/devices/asrc/asrcconv.c
  2. 1
      src/spicelib/devices/asrc/asrcdefs.h
  3. 2
      src/spicelib/devices/asrc/asrcdest.c
  4. 8
      src/spicelib/devices/asrc/asrcload.c
  5. 3
      src/spicelib/devices/asrc/asrcset.c

8
src/spicelib/devices/asrc/asrcconv.c

@ -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)

1
src/spicelib/devices/asrc/asrcdefs.h

@ -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 */

2
src/spicelib/devices/asrc/asrcdest.c

@ -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;

8
src/spicelib/devices/asrc/asrcload.c

@ -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);

3
src/spicelib/devices/asrc/asrcset.c

@ -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…
Cancel
Save