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

This commit is contained in:
rlar 2015-04-12 18:11:41 +02:00
parent ce49a4977d
commit 6ea1e1932d
2 changed files with 11 additions and 9 deletions

View File

@ -39,7 +39,6 @@ typedef struct sASRCinstance {
* in the sparce matrix */
double ASRCprev_value; /* Previous value for the convergence test */
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 ASRCdtempGiven : 1; /* indicates delta-temp specified */

View File

@ -77,10 +77,12 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
}
for (i = 0; i < here->ASRCtree->numVars; i++) {
int column;
switch (here->ASRCtree->varTypes[i]) {
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",
here->ASRCname, here->ASRCtree->vars[i].uValue);
return(E_BADPARM);
@ -88,26 +90,27 @@ ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
if (here->ASRCtype == ASRC_VOLTAGE) {
/* CCVS */
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) {
/* CCCS */
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 {
return (E_BADPARM);
}
break;
case IF_NODE:
column = here->ASRCtree->vars[i].nValue->number;
if (here->ASRCtype == ASRC_VOLTAGE) {
/* VCVS */
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) {
/* VCCS */
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 {
return (E_BADPARM);
}