Browse Source

devices/asrc, rewrite #4/10, drop `ASRCcont_br'

pre-master-46
rlar 11 years ago
parent
commit
6ea1e1932d
  1. 1
      src/spicelib/devices/asrc/asrcdefs.h
  2. 19
      src/spicelib/devices/asrc/asrcset.c

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

@ -39,7 +39,6 @@ typedef struct sASRCinstance {
* in the sparce matrix */ * in the sparce matrix */
double ASRCprev_value; /* Previous value for the convergence test */ double ASRCprev_value; /* Previous value for the convergence test */
double *ASRCacValues; /* Store rhs and derivatives for ac anal */ double *ASRCacValues; /* Store rhs and derivatives for ac anal */
int ASRCcont_br; /* Temporary store for controlling current branch */
unsigned ASRCtempGiven : 1; /* indicates temperature specified */ unsigned ASRCtempGiven : 1; /* indicates temperature specified */
unsigned ASRCdtempGiven : 1; /* indicates delta-temp specified */ unsigned ASRCdtempGiven : 1; /* indicates delta-temp specified */

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

@ -77,10 +77,12 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
} }
for (i = 0; i < here->ASRCtree->numVars; i++) { for (i = 0; i < here->ASRCtree->numVars; i++) {
int column;
switch (here->ASRCtree->varTypes[i]) { switch (here->ASRCtree->varTypes[i]) {
case IF_INSTANCE: case IF_INSTANCE:
here->ASRCcont_br = CKTfndBranch(ckt, here->ASRCtree->vars[i].uValue);
if (here->ASRCcont_br == 0) {
column = CKTfndBranch(ckt, here->ASRCtree->vars[i].uValue);
if (column == 0) {
SPfrontEnd->IFerrorf(ERR_FATAL, "%s: unknown controlling source %s", SPfrontEnd->IFerrorf(ERR_FATAL, "%s: unknown controlling source %s",
here->ASRCname, here->ASRCtree->vars[i].uValue); here->ASRCname, here->ASRCtree->vars[i].uValue);
return(E_BADPARM); return(E_BADPARM);
@ -88,26 +90,27 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
if (here->ASRCtype == ASRC_VOLTAGE) { if (here->ASRCtype == ASRC_VOLTAGE) {
/* CCVS */ /* CCVS */
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 1); here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 1);
TSTALLOC(ASRCposptr[j++], here->ASRCbranch, here->ASRCcont_br);
TSTALLOC(ASRCposptr[j++], here->ASRCbranch, column);
} else if (here->ASRCtype == ASRC_CURRENT) { } else if (here->ASRCtype == ASRC_CURRENT) {
/* CCCS */ /* CCCS */
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 2); here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 2);
TSTALLOC(ASRCposptr[j++], here->ASRCposNode, here->ASRCcont_br);
TSTALLOC(ASRCposptr[j++], here->ASRCnegNode, here->ASRCcont_br);
TSTALLOC(ASRCposptr[j++], here->ASRCposNode, column);
TSTALLOC(ASRCposptr[j++], here->ASRCnegNode, column);
} else { } else {
return (E_BADPARM); return (E_BADPARM);
} }
break; break;
case IF_NODE: case IF_NODE:
column = here->ASRCtree->vars[i].nValue->number;
if (here->ASRCtype == ASRC_VOLTAGE) { if (here->ASRCtype == ASRC_VOLTAGE) {
/* VCVS */ /* VCVS */
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 1); here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 1);
TSTALLOC(ASRCposptr[j++], here->ASRCbranch, here->ASRCtree->vars[i].nValue->number);
TSTALLOC(ASRCposptr[j++], here->ASRCbranch, column);
} else if (here->ASRCtype == ASRC_CURRENT) { } else if (here->ASRCtype == ASRC_CURRENT) {
/* VCCS */ /* VCCS */
here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 2); here->ASRCposptr = TREALLOC(double *, here->ASRCposptr, j + 2);
TSTALLOC(ASRCposptr[j++], here->ASRCposNode, here->ASRCtree->vars[i].nValue->number);
TSTALLOC(ASRCposptr[j++], here->ASRCnegNode, here->ASRCtree->vars[i].nValue->number);
TSTALLOC(ASRCposptr[j++], here->ASRCposNode, column);
TSTALLOC(ASRCposptr[j++], here->ASRCnegNode, column);
} else { } else {
return (E_BADPARM); return (E_BADPARM);
} }

Loading…
Cancel
Save