Browse Source

Added the KLU support to Noise Analysis

pre-master-46
Francesco Lannutti 6 years ago
committed by Holger Vogt
parent
commit
7048a24b74
  1. 39
      src/spicelib/analysis/noisean.c

39
src/spicelib/analysis/noisean.c

@ -31,8 +31,13 @@ Modified: 2001 AlansFixes
/* gtri - end - wbk */ /* gtri - end - wbk */
#endif #endif
// fixme
// ugly hack to work around missing api to specify the "type" of signals
#ifdef KLU
#include "ngspice/devdefs.h"
#endif
// fixme
// ugly hack to work around missing api to specify the "type" of signals
extern int fixme_onoise_type; extern int fixme_onoise_type;
extern int fixme_inoise_type; extern int fixme_inoise_type;
@ -162,6 +167,7 @@ NOISEan(CKTcircuit* ckt, int restart)
return(E_BADPARM); return(E_BADPARM);
} }
#ifdef XSPICE #ifdef XSPICE
/* gtri - begin - wbk - Call EVTop if event-driven instances exist */ /* gtri - begin - wbk - Call EVTop if event-driven instances exist */
@ -176,6 +182,19 @@ NOISEan(CKTcircuit* ckt, int restart)
} }
else else
#endif #endif
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
{
/* Conversion from Complex Matrix to Real Matrix */
for (i = 0 ; i < DEVmaxnum ; i++)
if (DEVices [i] && DEVices [i]->DEVbindCSCComplexToReal && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplexToReal (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUmatrixReal ;
}
#endif
/* If no event-driven instances, do what SPICE normally does */ /* If no event-driven instances, do what SPICE normally does */
if (!ckt->CKTnoopac) { /* skip OP if option NOOPAC is set and circuit is linear */ if (!ckt->CKTnoopac) { /* skip OP if option NOOPAC is set and circuit is linear */
error = CKTop(ckt, error = CKTop(ckt,
@ -226,7 +245,6 @@ NOISEan(CKTcircuit* ckt, int restart)
/* gtri - end - wbk */ /* gtri - end - wbk */
#endif #endif
/* Patch to noisean.c by Richard D. McRoberts. */ /* Patch to noisean.c by Richard D. McRoberts. */
ckt->CKTmode = (ckt->CKTmode & MODEUIC) | MODEDCOP | MODEINITSMSIG; ckt->CKTmode = (ckt->CKTmode & MODEUIC) | MODEDCOP | MODEINITSMSIG;
error = CKTload(ckt); error = CKTload(ckt);
@ -357,6 +375,21 @@ NOISEan(CKTcircuit* ckt, int restart)
/* gtri - end - wbk */ /* gtri - end - wbk */
#endif #endif
#ifdef KLU
if (ckt->CKTmatrix->CKTkluMODE)
{
/* Conversion from Real Matrix to Complex Matrix */
if (!ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex)
{
for (i = 0 ; i < DEVmaxnum ; i++)
if (DEVices [i] && DEVices [i]->DEVbindCSCComplex && ckt->CKThead [i])
DEVices [i]->DEVbindCSCComplex (ckt->CKThead [i], ckt) ;
ckt->CKTmatrix->SMPkluMatrix->KLUmatrixIsComplex = KLUMatrixComplex ;
}
}
#endif
/* do the noise analysis over all frequencies */ /* do the noise analysis over all frequencies */
while (data->freq <= job->NstopFreq + freqTol) { while (data->freq <= job->NstopFreq + freqTol) {

Loading…
Cancel
Save