Added the CKTrhs additional vectors for LinearStatic and LinearDynamic so that VSRC can be converted to be a Linear Dynamic model
This commit is contained in:
parent
1c66b4a957
commit
048c337d85
|
|
@ -111,6 +111,12 @@ struct CKTcircuit {
|
||||||
SMPmatrix *CKTmatrix; /* pointer to sparse matrix */
|
SMPmatrix *CKTmatrix; /* pointer to sparse matrix */
|
||||||
int CKTniState; /* internal state */
|
int CKTniState; /* internal state */
|
||||||
double *CKTrhs; /* current rhs value - being loaded */
|
double *CKTrhs; /* current rhs value - being loaded */
|
||||||
|
|
||||||
|
#ifdef KLU
|
||||||
|
double *CKTrhs_LinearStatic; /* current rhs value (Linear Static) - being loaded */
|
||||||
|
double *CKTrhs_LinearDynamic; /* current rhs value (Linear Dynamic) - being loaded */
|
||||||
|
#endif
|
||||||
|
|
||||||
double *CKTrhsOld; /* previous rhs value for convergence
|
double *CKTrhsOld; /* previous rhs value for convergence
|
||||||
testing */
|
testing */
|
||||||
double *CKTrhsSpare; /* spare rhs value for reordering */
|
double *CKTrhsSpare; /* spare rhs value for reordering */
|
||||||
|
|
@ -308,10 +314,12 @@ struct CKTcircuit {
|
||||||
|
|
||||||
/* Now function prototypes */
|
/* Now function prototypes */
|
||||||
|
|
||||||
|
#ifdef KLU
|
||||||
/* Francesco Lannutti */
|
/* Francesco Lannutti */
|
||||||
extern int CKTloadLinearStatic (CKTcircuit *) ;
|
extern int CKTloadLinearStatic (CKTcircuit *) ;
|
||||||
extern int CKTloadLinearDynamic (CKTcircuit *) ;
|
extern int CKTloadLinearDynamic (CKTcircuit *) ;
|
||||||
extern int CKTloadAssemble (CKTcircuit *) ;
|
extern int CKTloadAssemble (CKTcircuit *) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int ACan(CKTcircuit *, int);
|
extern int ACan(CKTcircuit *, int);
|
||||||
extern int ACaskQuest(CKTcircuit *, JOB *, int , IFvalue *);
|
extern int ACaskQuest(CKTcircuit *, JOB *, int , IFvalue *);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,12 @@ NIreinit( CKTcircuit *ckt)
|
||||||
|
|
||||||
size = SMPmatSize(ckt->CKTmatrix);
|
size = SMPmatSize(ckt->CKTmatrix);
|
||||||
CKALLOC(CKTrhs,size+1,double);
|
CKALLOC(CKTrhs,size+1,double);
|
||||||
|
|
||||||
|
#ifdef KLU
|
||||||
|
CKALLOC(CKTrhs_LinearStatic,size+1,double);
|
||||||
|
CKALLOC(CKTrhs_LinearDynamic,size+1,double);
|
||||||
|
#endif
|
||||||
|
|
||||||
CKALLOC(CKTrhsOld,size+1,double);
|
CKALLOC(CKTrhsOld,size+1,double);
|
||||||
CKALLOC(CKTrhsSpare,size+1,double);
|
CKALLOC(CKTrhsSpare,size+1,double);
|
||||||
CKALLOC(CKTirhs,size+1,double);
|
CKALLOC(CKTirhs,size+1,double);
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,9 @@ CKTloadLinearStatic (CKTcircuit *ckt)
|
||||||
for (i = 0 ; i < ckt->CKTmatrix->CKTklunz ; i++)
|
for (i = 0 ; i < ckt->CKTmatrix->CKTklunz ; i++)
|
||||||
ckt->CKTmatrix->CKTkluAx_LinearStatic [i] = 0 ;
|
ckt->CKTmatrix->CKTkluAx_LinearStatic [i] = 0 ;
|
||||||
|
|
||||||
|
for (i = 0 ; i <= ckt->CKTmatrix->CKTkluN ; i++)
|
||||||
|
ckt->CKTrhs_LinearStatic [i] = 0 ;
|
||||||
|
|
||||||
for (i = 0; i < DEVmaxnum; i++)
|
for (i = 0; i < DEVmaxnum; i++)
|
||||||
{
|
{
|
||||||
if (DEVices[i] && DEVices[i]->DEVload && ckt->CKThead [i] &&
|
if (DEVices[i] && DEVices[i]->DEVload && ckt->CKThead [i] &&
|
||||||
|
|
@ -61,6 +64,9 @@ CKTloadLinearDynamic (CKTcircuit *ckt)
|
||||||
for (i = 0 ; i < ckt->CKTmatrix->CKTklunz ; i++)
|
for (i = 0 ; i < ckt->CKTmatrix->CKTklunz ; i++)
|
||||||
ckt->CKTmatrix->CKTkluAx_LinearDynamic [i] = 0 ;
|
ckt->CKTmatrix->CKTkluAx_LinearDynamic [i] = 0 ;
|
||||||
|
|
||||||
|
for (i = 0 ; i <= ckt->CKTmatrix->CKTkluN ; i++)
|
||||||
|
ckt->CKTrhs_LinearDynamic [i] = 0 ;
|
||||||
|
|
||||||
for (i = 0; i < DEVmaxnum; i++)
|
for (i = 0; i < DEVmaxnum; i++)
|
||||||
{
|
{
|
||||||
if (DEVices[i] && DEVices[i]->DEVload && ckt->CKThead [i] &&
|
if (DEVices[i] && DEVices[i]->DEVload && ckt->CKThead [i] &&
|
||||||
|
|
@ -85,6 +91,9 @@ CKTloadAssemble (CKTcircuit *ckt)
|
||||||
for (i = 0 ; i < ckt->CKTmatrix->CKTklunz ; i++)
|
for (i = 0 ; i < ckt->CKTmatrix->CKTklunz ; i++)
|
||||||
ckt->CKTmatrix->CKTkluAx [i] += (ckt->CKTmatrix->CKTkluAx_LinearStatic [i] + ckt->CKTmatrix->CKTkluAx_LinearDynamic [i]) ;
|
ckt->CKTmatrix->CKTkluAx [i] += (ckt->CKTmatrix->CKTkluAx_LinearStatic [i] + ckt->CKTmatrix->CKTkluAx_LinearDynamic [i]) ;
|
||||||
|
|
||||||
|
for (i = 0 ; i <= ckt->CKTmatrix->CKTkluN ; i++)
|
||||||
|
ckt->CKTrhs [i] += (ckt->CKTrhs_LinearStatic [i] + ckt->CKTrhs_LinearDynamic [i]) ;
|
||||||
|
|
||||||
return 0 ;
|
return 0 ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,6 @@ int VSRCiSize = sizeof(VSRCinstance);
|
||||||
int VSRCmSize = sizeof(VSRCmodel);
|
int VSRCmSize = sizeof(VSRCmodel);
|
||||||
|
|
||||||
#ifdef KLU
|
#ifdef KLU
|
||||||
int VSRCisLinear = 0 ;
|
int VSRCisLinear = 1 ;
|
||||||
int VSRCisLinearStatic = 0 ;
|
int VSRCisLinearStatic = 0 ;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ VSRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
/* loop through all the instances of the model */
|
/* loop through all the instances of the model */
|
||||||
for (here = VSRCinstances(model); here != NULL ; here = VSRCnextInstance(here))
|
for (here = VSRCinstances(model); here != NULL ; here = VSRCnextInstance(here))
|
||||||
{
|
{
|
||||||
CREATE_KLU_BINDING_TABLE(VSRCposIbrPtr, VSRCposIbrBinding, VSRCposNode, VSRCbranch);
|
CREATE_KLU_BINDING_TABLE_DYNAMIC(VSRCposIbrPtr, VSRCposIbrBinding, VSRCposNode, VSRCbranch);
|
||||||
CREATE_KLU_BINDING_TABLE(VSRCnegIbrPtr, VSRCnegIbrBinding, VSRCnegNode, VSRCbranch);
|
CREATE_KLU_BINDING_TABLE_DYNAMIC(VSRCnegIbrPtr, VSRCnegIbrBinding, VSRCnegNode, VSRCbranch);
|
||||||
CREATE_KLU_BINDING_TABLE(VSRCibrNegPtr, VSRCibrNegBinding, VSRCbranch, VSRCnegNode);
|
CREATE_KLU_BINDING_TABLE_DYNAMIC(VSRCibrNegPtr, VSRCibrNegBinding, VSRCbranch, VSRCnegNode);
|
||||||
CREATE_KLU_BINDING_TABLE(VSRCibrPosPtr, VSRCibrPosBinding, VSRCbranch, VSRCposNode);
|
CREATE_KLU_BINDING_TABLE_DYNAMIC(VSRCibrPosPtr, VSRCibrPosBinding, VSRCbranch, VSRCposNode);
|
||||||
|
|
||||||
/* Pole-Zero Analysis */
|
/* Pole-Zero Analysis */
|
||||||
if (here->VSRCibrIbrPtr)
|
if (here->VSRCibrIbrPtr)
|
||||||
|
|
@ -52,7 +52,7 @@ VSRCbindCSC (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
here->VSRCibrIbrBinding = matched ;
|
here->VSRCibrIbrBinding = matched ;
|
||||||
if (matched != NULL)
|
if (matched != NULL)
|
||||||
{
|
{
|
||||||
here->VSRCibrIbrPtr = matched->CSC ;
|
here->VSRCibrIbrPtr = matched->CSC_LinearDynamic ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -75,16 +75,16 @@ VSRCbindCSCComplex (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
/* loop through all the instances of the model */
|
/* loop through all the instances of the model */
|
||||||
for (here = VSRCinstances(model); here != NULL ; here = VSRCnextInstance(here))
|
for (here = VSRCinstances(model); here != NULL ; here = VSRCnextInstance(here))
|
||||||
{
|
{
|
||||||
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(VSRCposIbrPtr, VSRCposIbrBinding, VSRCposNode, VSRCbranch);
|
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(VSRCposIbrPtr, VSRCposIbrBinding, VSRCposNode, VSRCbranch);
|
||||||
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(VSRCnegIbrPtr, VSRCnegIbrBinding, VSRCnegNode, VSRCbranch);
|
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(VSRCnegIbrPtr, VSRCnegIbrBinding, VSRCnegNode, VSRCbranch);
|
||||||
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(VSRCibrNegPtr, VSRCibrNegBinding, VSRCbranch, VSRCnegNode);
|
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(VSRCibrNegPtr, VSRCibrNegBinding, VSRCbranch, VSRCnegNode);
|
||||||
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX(VSRCibrPosPtr, VSRCibrPosBinding, VSRCbranch, VSRCposNode);
|
CONVERT_KLU_BINDING_TABLE_TO_COMPLEX_DYNAMIC(VSRCibrPosPtr, VSRCibrPosBinding, VSRCbranch, VSRCposNode);
|
||||||
/* Pole-Zero Analysis */
|
/* Pole-Zero Analysis */
|
||||||
if ((here-> VSRCbranch != 0) && (here-> VSRCbranch != 0))
|
if ((here-> VSRCbranch != 0) && (here-> VSRCbranch != 0))
|
||||||
{
|
{
|
||||||
if (here->VSRCibrIbrBinding)
|
if (here->VSRCibrIbrBinding)
|
||||||
{
|
{
|
||||||
here->VSRCibrIbrPtr = here->VSRCibrIbrBinding->CSC_Complex ;
|
here->VSRCibrIbrPtr = here->VSRCibrIbrBinding->CSC_Complex_LinearDynamic ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -107,16 +107,16 @@ VSRCbindCSCComplexToReal (GENmodel *inModel, CKTcircuit *ckt)
|
||||||
/* loop through all the instances of the model */
|
/* loop through all the instances of the model */
|
||||||
for (here = VSRCinstances(model); here != NULL ; here = VSRCnextInstance(here))
|
for (here = VSRCinstances(model); here != NULL ; here = VSRCnextInstance(here))
|
||||||
{
|
{
|
||||||
CONVERT_KLU_BINDING_TABLE_TO_REAL(VSRCposIbrPtr, VSRCposIbrBinding, VSRCposNode, VSRCbranch);
|
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(VSRCposIbrPtr, VSRCposIbrBinding, VSRCposNode, VSRCbranch);
|
||||||
CONVERT_KLU_BINDING_TABLE_TO_REAL(VSRCnegIbrPtr, VSRCnegIbrBinding, VSRCnegNode, VSRCbranch);
|
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(VSRCnegIbrPtr, VSRCnegIbrBinding, VSRCnegNode, VSRCbranch);
|
||||||
CONVERT_KLU_BINDING_TABLE_TO_REAL(VSRCibrNegPtr, VSRCibrNegBinding, VSRCbranch, VSRCnegNode);
|
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(VSRCibrNegPtr, VSRCibrNegBinding, VSRCbranch, VSRCnegNode);
|
||||||
CONVERT_KLU_BINDING_TABLE_TO_REAL(VSRCibrPosPtr, VSRCibrPosBinding, VSRCbranch, VSRCposNode);
|
CONVERT_KLU_BINDING_TABLE_TO_REAL_DYNAMIC(VSRCibrPosPtr, VSRCibrPosBinding, VSRCbranch, VSRCposNode);
|
||||||
/* Pole-Zero Analysis */
|
/* Pole-Zero Analysis */
|
||||||
if ((here-> VSRCbranch != 0) && (here-> VSRCbranch != 0))
|
if ((here-> VSRCbranch != 0) && (here-> VSRCbranch != 0))
|
||||||
{
|
{
|
||||||
if (here->VSRCibrIbrBinding)
|
if (here->VSRCibrIbrBinding)
|
||||||
{
|
{
|
||||||
here->VSRCibrIbrPtr = here->VSRCibrIbrBinding->CSC ;
|
here->VSRCibrIbrPtr = here->VSRCibrIbrBinding->CSC_LinearDynamic ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -413,7 +413,11 @@ loadDone:
|
||||||
/* gtri - end - wbk - modify to process srcFact, etc. for all sources */
|
/* gtri - end - wbk - modify to process srcFact, etc. for all sources */
|
||||||
|
|
||||||
/* load the new voltage value into the matrix */
|
/* load the new voltage value into the matrix */
|
||||||
|
#ifdef KLU
|
||||||
|
*(ckt->CKTrhs_LinearDynamic + (here->VSRCbranch)) += value;
|
||||||
|
#else
|
||||||
*(ckt->CKTrhs + (here->VSRCbranch)) += value;
|
*(ckt->CKTrhs + (here->VSRCbranch)) += value;
|
||||||
|
#endif
|
||||||
|
|
||||||
} // for loop instances
|
} // for loop instances
|
||||||
} // for loop models
|
} // for loop models
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue