devices/asrc, rewrite #10/10, emphasise matrix for the two cases VSRC vs ISRC
This commit is contained in:
parent
66a0da8ab9
commit
ad869c6d2d
|
|
@ -50,19 +50,22 @@ ASRCacLoad(GENmodel *inModel, CKTcircuit *ckt)
|
|||
derivs = here->ASRCacValues;
|
||||
|
||||
if (here->ASRCtype == ASRC_VOLTAGE) {
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++) {
|
||||
if (here->ASRCtype == ASRC_VOLTAGE) {
|
||||
*(here->ASRCposptr[j++]) -= derivs[i] / factor;
|
||||
} else {
|
||||
*(here->ASRCposptr[j++]) += derivs[i] / factor;
|
||||
*(here->ASRCposptr[j++]) -= derivs[i] / factor;
|
||||
}
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++)
|
||||
*(here->ASRCposptr[j++]) -= derivs[i] / factor;
|
||||
|
||||
} else {
|
||||
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++) {
|
||||
*(here->ASRCposptr[j++]) += derivs[i] / factor;
|
||||
*(here->ASRCposptr[j++]) -= derivs[i] / factor;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,27 +82,29 @@ ASRCload(GENmodel *inModel, CKTcircuit *ckt)
|
|||
}
|
||||
|
||||
if (here->ASRCtype == ASRC_VOLTAGE) {
|
||||
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++) {
|
||||
rhs -= (asrc_vals[i] * asrc_derivs[i]);
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++) {
|
||||
rhs -= (asrc_vals[i] * asrc_derivs[i]);
|
||||
|
||||
if (here->ASRCtype == ASRC_VOLTAGE) {
|
||||
*(here->ASRCposptr[j++]) -= asrc_derivs[i] * factor;
|
||||
} else {
|
||||
*(here->ASRCposptr[j++]) += asrc_derivs[i] * factor;
|
||||
*(here->ASRCposptr[j++]) -= asrc_derivs[i] * factor;
|
||||
}
|
||||
}
|
||||
*(here->ASRCposptr[j++]) -= asrc_derivs[i] * factor;
|
||||
}
|
||||
|
||||
/* Insert the RHS */
|
||||
if (here->ASRCtype == ASRC_VOLTAGE) {
|
||||
ckt->CKTrhs[here->ASRCbranch] += factor * rhs;
|
||||
|
||||
} else {
|
||||
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++) {
|
||||
rhs -= (asrc_vals[i] * asrc_derivs[i]);
|
||||
|
||||
*(here->ASRCposptr[j++]) += asrc_derivs[i] * factor;
|
||||
*(here->ASRCposptr[j++]) -= asrc_derivs[i] * factor;
|
||||
}
|
||||
|
||||
ckt->CKTrhs[here->ASRCposNode] -= factor * rhs;
|
||||
ckt->CKTrhs[here->ASRCnegNode] += factor * rhs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,19 +66,22 @@ ASRCpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
|
|||
return(E_BADPARM);
|
||||
|
||||
if (here->ASRCtype == ASRC_VOLTAGE) {
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
}
|
||||
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++) {
|
||||
if (here->ASRCtype == ASRC_VOLTAGE) {
|
||||
*(here->ASRCposptr[j++]) -= asrc_derivs[i] / factor;
|
||||
} else {
|
||||
*(here->ASRCposptr[j++]) += asrc_derivs[i] / factor;
|
||||
*(here->ASRCposptr[j++]) -= asrc_derivs[i] / factor;
|
||||
}
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) -= 1.0;
|
||||
*(here->ASRCposptr[j++]) += 1.0;
|
||||
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++)
|
||||
*(here->ASRCposptr[j++]) -= asrc_derivs[i] / factor;
|
||||
|
||||
} else {
|
||||
|
||||
for (i = 0; i < here->ASRCtree->numVars; i++) {
|
||||
*(here->ASRCposptr[j++]) += asrc_derivs[i] / factor;
|
||||
*(here->ASRCposptr[j++]) -= asrc_derivs[i] / factor;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue