Inserted a new Topological DiagGmin algorithm, which moves also Gmin of every device

This commit is contained in:
Francesco Lannutti 2013-09-19 22:05:53 +03:00
parent 8fdb1320bf
commit 9e83607186
5 changed files with 32 additions and 1 deletions

View File

@ -121,6 +121,7 @@ struct CKTcircuit {
double *CKTfvk ; /* KCL Verification array */
int *CKTnodeIsLinear ; /* Flag to indicate if a node is linear or non-linear */
CKTmkCurKCLnode **CKTmkCurKCLarray ; /* Array of KCL Currents */
double **CKTdiag ;
#endif
double *CKTrhsSpare; /* spare rhs value for reordering */

View File

@ -76,13 +76,17 @@ NIconvTest (CKTcircuit *ckt)
ptr = ptr->next ;
}
if (maximum < fabs (ckt->CKTgmin * ckt->CKTrhsOld [i]))
maximum = fabs (ckt->CKTgmin * ckt->CKTrhsOld [i]) ;
#ifdef STEPDEBUG
fprintf (stderr, "Index: %d\tValue: %-.9g\tThreshold: %-.9g\tMaximum: %-.9g\n", i, fabs (ckt->CKTfvk [i]),
ckt->CKTreltol * maximum + ckt->CKTabstol, maximum) ;
#endif
/* Check Convergence */
if (fabs (ckt->CKTfvk [i]) > (ckt->CKTreltol * maximum + ckt->CKTabstol))
if (fabs (ckt->CKTfvk [i] + ckt->CKTgmin * ckt->CKTrhsOld [i]) > (ckt->CKTreltol * maximum + ckt->CKTabstol))
{
ckt->CKTtroubleNode = i ;
ckt->CKTtroubleElt = NULL ;

View File

@ -43,6 +43,9 @@ NIreinit( CKTcircuit *ckt)
CKALLOC(CKTmkCurKCLarray,size+1,CKTmkCurKCLnode*);
for (i = 0 ; i <= size ; i++)
ckt->CKTmkCurKCLarray [i] = NULL ;
CKALLOC(CKTdiag,size+1,double*);
for (i = 0 ; i <= size ; i++)
ckt->CKTdiag [i] = NULL ;
#endif
#ifdef PREDICTOR

View File

@ -79,6 +79,16 @@ CKTload(CKTcircuit *ckt)
}
}
#ifdef KIRCHHOFF
/* GMIN Stepping */
for (i = 1 ; i <= size ; i++)
{
if (ckt->CKTdiag [i] != NULL)
{
*(ckt->CKTdiag [i]) += ckt->CKTgmin ;
}
}
#endif
#ifdef XSPICE
/* gtri - add - wbk - 11/26/90 - reset the MIF init flags */

View File

@ -129,6 +129,19 @@ CKTsetup(CKTcircuit *ckt)
#endif
#ifdef KIRCHHOFF
CKTnode *node ;
node = ckt->CKTnodes ;
for (i = 1 ; i <= SMPmatSize (ckt->CKTmatrix) ; i++)
{
node = node->next ;
if (node->type == SP_VOLTAGE)
{
ckt->CKTdiag [i] = SMPmakeElt (ckt->CKTmatrix, i, i) ;
}
}
/** Marking node as Non-Linear when needed
* By default every node is Linear
*/