diff --git a/src/spicelib/analysis/dctran.c b/src/spicelib/analysis/dctran.c index ff9dee3e7..9716e9fa3 100644 --- a/src/spicelib/analysis/dctran.c +++ b/src/spicelib/analysis/dctran.c @@ -80,9 +80,6 @@ DCtran(CKTcircuit *ckt, #ifdef WANT_SENSE2 int save, save2, size; long save1; -#ifdef SENSDEBUG - FILE *outsen; -#endif /* SENSDEBUG */ #endif int save_order; long save_mode; @@ -484,9 +481,6 @@ DCtran(CKTcircuit *ckt, #ifdef WANT_SENSE2 if(ckt->CKTsenInfo && (ckt->CKTsenInfo->SENmode & TRANSEN)){ ckt->CKTsenInfo->SENmode = save; -#ifdef SENSDEBUG - fclose(outsen); -#endif /* SENSDEBUG */ } #endif return(OK); diff --git a/src/spicelib/devices/bjt/bjtsupd.c b/src/spicelib/devices/bjt/bjtsupd.c index f2551e6c9..f76ef8f71 100644 --- a/src/spicelib/devices/bjt/bjtsupd.c +++ b/src/spicelib/devices/bjt/bjtsupd.c @@ -55,9 +55,8 @@ BJTsUpdate(GENmodel *inModel, CKTcircuit *ckt) sxpbx = 0; #ifdef SENSDEBUG printf("senupdate Instance name: %s\n",here->BJTname); - printf("iparmno = %d,CKTag[0] = %.2e,CKTag[1] = %.2e\n", - iparmno,ckt->CKTag[0],ckt->CKTag[1]); - + printf("CKTag[0] = %.2e,CKTag[1] = %.2e\n", + ckt->CKTag[0],ckt->CKTag[1]); printf("capbe = %.7e\n",here->BJTcapbe); printf("capbc = %.7e\n",here->BJTcapbc); printf("capsub = %.7e\n",here->BJTcapsub); diff --git a/src/unsupported/cktsenup.c b/src/unsupported/cktsenup.c index cbfd42e8a..0ce1acfbd 100644 --- a/src/unsupported/cktsenup.c +++ b/src/unsupported/cktsenup.c @@ -26,7 +26,7 @@ CKTsenUpdate(CKTcircuit *ckt) int error; for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i]->DEVsenUpdate && ckt->CKThead[i]) { + if (DEVices[i] && DEVices[i]->DEVsenUpdate && ckt->CKThead[i]) { error = DEVices[i]->DEVsenUpdate (ckt->CKThead[i], ckt); if (error) return error; diff --git a/src/unsupported/cktsncom.c b/src/unsupported/cktsncom.c index 747bc3452..5fc0b905e 100644 --- a/src/unsupported/cktsncom.c +++ b/src/unsupported/cktsncom.c @@ -17,6 +17,22 @@ Author: 1985 Thomas L. Quarles #include "ngspice/trandefs.h" #include "ngspice/suffix.h" +// #include "../maths/sparse/spdefs.h" +// +// this include file from `sparse' is incompatible +// with the rest of ngspice +// so we can unfortunatly not include here +// instead we cheat a bit and +// introduce the opaque struct MatrixElement here +// (only the first struct members which are of importance to us) + +struct MatrixElement +{ + double Real; + double Imag; + // ... +}; + int CKTsenComp(CKTcircuit *ckt) @@ -66,14 +82,14 @@ CKTsenComp(CKTcircuit *ckt) for (row = 1; row <= size; row++) { rowe = CKTnodName(ckt, row); - if (strcmp("4", rowe) == 0) { +// if (strcmp("4", rowe) == 0) { for (col = 1; col <= info->SENparms; col++) { printf("\t"); printf("Sap(%s,%d) = %.5e\t", rowe, col, info->SEN_Sap[row][col]); } printf("\n\n"); - } +// } } printf(" RHS matrix :\n"); @@ -88,11 +104,13 @@ CKTsenComp(CKTcircuit *ckt) printf(" Jacobian matrix :\n"); for (row = 1; row <= size; row++) { - for (col = 1; col <= size; col++) - if (elt = SMPfindElt(ckt->CKTmatrix, row , col , 0)) - printf("%.7e ", elt->SMPvalue); + for (col = 1; col <= size; col++) { + elt = SMPfindElt(ckt->CKTmatrix, row , col , 0); + if (elt) + printf("%.7e ", elt->Real); else printf("0.0000000e+00 "); + } printf("\n"); } #endif @@ -154,9 +172,10 @@ CKTsenComp(CKTcircuit *ckt) printf(" Jacobian matrix for AC :\n"); for (row = 1; row <= size; row++) { for (col = 1; col <= size; col++) { - if (elt = SMPfindElt(ckt->CKTmatrix, row , col , 0)) { - printf("%.7e ", elt->SMPvalue); - printf("+j%.7e\t", elt->SMPiValue); + elt = SMPfindElt(ckt->CKTmatrix, row , col , 0); + if (elt) { + printf("%.7e ", elt->Real); + printf("+j%.7e\t", elt->Imag); } else{ printf("0.0000000e+00 "); printf("+j0.0000000e+00\t"); diff --git a/src/unsupported/cktsnld.c b/src/unsupported/cktsnld.c index a96ede9aa..7afeaf3a5 100644 --- a/src/unsupported/cktsnld.c +++ b/src/unsupported/cktsnld.c @@ -41,7 +41,7 @@ CKTsenLoad(CKTcircuit *ckt) ckt->CKTsenInfo->SEN_RHS[row][col] = 0; for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i]->DEVsenLoad && ckt->CKThead[i]) { + if (DEVices[i] && DEVices[i]->DEVsenLoad && ckt->CKThead[i]) { error = DEVices[i]->DEVsenLoad (ckt->CKThead[i], ckt); if (error) return error; @@ -56,7 +56,7 @@ CKTsenLoad(CKTcircuit *ckt) } for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i]->DEVsenAcLoad && ckt->CKThead[i]) { + if (DEVices[i] && DEVices[i]->DEVsenAcLoad && ckt->CKThead[i]) { error = DEVices[i]->DEVsenAcLoad (ckt->CKThead[i], ckt); if (error) return error; diff --git a/src/unsupported/cktsnprt.c b/src/unsupported/cktsnprt.c index 1a2bc224e..c0a6801c8 100644 --- a/src/unsupported/cktsnprt.c +++ b/src/unsupported/cktsnprt.c @@ -25,6 +25,6 @@ CKTsenPrint(CKTcircuit *ckt) int i; for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i]->DEVsenPrint && ckt->CKThead[i]) + if (DEVices[i] && DEVices[i]->DEVsenPrint && ckt->CKThead[i]) DEVices[i]->DEVsenPrint (ckt->CKThead[i], ckt); } diff --git a/src/unsupported/cktsnset.c b/src/unsupported/cktsnset.c index 551697da0..d2984acce 100644 --- a/src/unsupported/cktsnset.c +++ b/src/unsupported/cktsnset.c @@ -36,7 +36,7 @@ CKTsenSetup(CKTcircuit *ckt) info->SENparms = 0; for (i = 0; i < DEVmaxnum; i++) - if (DEVices[i]->DEVsenSetup && ckt->CKThead[i]) { + if (DEVices[i] && DEVices[i]->DEVsenSetup && ckt->CKThead[i]) { error = DEVices[i]->DEVsenSetup (info, ckt->CKThead[i]); if (error) return error; diff --git a/src/unsupported/snstart.c b/src/unsupported/snstart.c index b251f807d..26fc9d115 100644 --- a/src/unsupported/snstart.c +++ b/src/unsupported/snstart.c @@ -25,8 +25,7 @@ SENstartup(CKTcircuit *ckt, int restart) GENinstance *fast; if (restart) { - fprintf(stderr, "unsupported code, (SENstartup), doesn't support restart\n"); - exit(1); + fprintf(stdout, "Sensitivity-2 analysis: unsupported code\n"); } #ifdef SENSDEBUG @@ -37,7 +36,7 @@ SENstartup(CKTcircuit *ckt, int restart) ckt->CKTsenInfo->SENpertfac = 1e-4; ckt->CKTsenInfo->SENinitflag = ON; /* allocate memory in NIsenReinit */ - parmtemp.iValue = 1; + parmtemp.rValue = 1.0; for (i = 0; i < ckt->CKTsenInfo->SENnumVal; i++) { type = -1; @@ -49,6 +48,10 @@ SENstartup(CKTcircuit *ckt, int restart) if (err != OK) return err; +#ifdef SENSDEBUG + printf("SENstartup Instance: %s Design parameter: %s\n", ckt->CKTsenInfo->SENdevices[i], + ckt->CKTsenInfo->SENparmNames[i]); +#endif err = CKTpName( ckt->CKTsenInfo->SENparmNames[i], &parmtemp, ckt, type,