From 75e3a4da642b1df955547dce97630f8908ed0f52 Mon Sep 17 00:00:00 2001 From: Markus Mueller Date: Tue, 23 Jun 2020 16:24:59 +0200 Subject: [PATCH] protect nqs network --- src/spicelib/devices/hicum2/hicum2acld.c | 100 +++++----- src/spicelib/devices/hicum2/hicum2setup.c | 110 ++++++----- src/spicelib/devices/hicum2/hicumL2.cpp | 217 +++++++++++----------- tests/hicum2/npn/qaSpec_debug | 8 +- 4 files changed, 232 insertions(+), 203 deletions(-) diff --git a/src/spicelib/devices/hicum2/hicum2acld.c b/src/spicelib/devices/hicum2/hicum2acld.c index 15aab5dc8..a14830cfa 100644 --- a/src/spicelib/devices/hicum2/hicum2acld.c +++ b/src/spicelib/devices/hicum2/hicum2acld.c @@ -120,7 +120,8 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) /* loop through all the models */ for( ; model != NULL; model = HICUMnextModel(model)) { - int selfheat = ((model->HICUMflsh > 0) && (model->HICUMrthGiven) && (model->HICUMrth > 0.0)); + int selfheat = ( (model->HICUMflsh > 0) && (model->HICUMrthGiven) && (model->HICUMrth > 0.0)); + int nqs = ( (model->HICUMflnqs != 0 || model->HICUMflcomp == 0.0 || model->HICUMflcomp == 2.1) && (model->HICUMalit > 0 || model->HICUMalqf > 0)); /* loop through all the instances of the model */ for( here = HICUMinstances(model); here!= NULL; @@ -226,8 +227,10 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) *(here->HICUMemitEICollCIPtr) += Iciei_Vbici; *(here->HICUMcollCICollCIPtr) += -Iciei_Vbici; *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbici; - *(here->HICUMcollCIXf2Ptr) += Iciei_Vxf2; - *(here->HICUMemitEIXf2Ptr) += -Iciei_Vxf2; + if (nqs) { + *(here->HICUMcollCIXf2Ptr) += Iciei_Vxf2; + *(here->HICUMemitEIXf2Ptr) += -Iciei_Vxf2; + } // Stamp element: Ibici *(here->HICUMbaseBIBaseBIPtr) += Ibici_Vbici; @@ -299,28 +302,28 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) *(here->HICUMsubsSISubsPtr) += -Isis_Vsis; *(here->HICUMsubsSubsSIPtr) += -Isis_Vsis; - //Ixf1 - *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbiei; - *(here->HICUMxf1EmitEIPtr) += -Ixf1_Vbiei; - *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbici; - *(here->HICUMxf1CollCIPtr) += -Ixf1_Vbici; - *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; - *(here->HICUMxf1Xf1Ptr) += +Ixf1_Vxf1; - - //Ixf2 - *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbiei; - *(here->HICUMxf2EmitEIPtr) += -Ixf2_Vbiei; - *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbici; - *(here->HICUMxf2CollCIPtr) += -Ixf2_Vbici; - *(here->HICUMxf2Xf2Ptr) += +Ixf2_Vxf2; - *(here->HICUMxf2Xf1Ptr) += +Ixf2_Vxf1; - - //Ixf - *(here->HICUMxfBaseBIPtr) += +Ixf_Vbiei; - *(here->HICUMxfEmitEIPtr) += -Ixf_Vbiei; - *(here->HICUMxfBaseBIPtr) += +Ixf_Vbici; - *(here->HICUMxfCollCIPtr) += -Ixf_Vbici; - *(here->HICUMxfXfPtr) += +Ixf_Vxf; + if (nqs) { + //Ixf1 + *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbiei; + *(here->HICUMxf1EmitEIPtr) += -Ixf1_Vbiei; + *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbici; + *(here->HICUMxf1CollCIPtr) += -Ixf1_Vbici; + *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; + *(here->HICUMxf1Xf1Ptr) += +Ixf1_Vxf1; + //Ixf2 + *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbiei; + *(here->HICUMxf2EmitEIPtr) += -Ixf2_Vbiei; + *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbici; + *(here->HICUMxf2CollCIPtr) += -Ixf2_Vbici; + *(here->HICUMxf2Xf2Ptr) += +Ixf2_Vxf2; + *(here->HICUMxf2Xf1Ptr) += +Ixf2_Vxf1; + //Ixf + *(here->HICUMxfBaseBIPtr) += +Ixf_Vbiei; + *(here->HICUMxfEmitEIPtr) += -Ixf_Vbiei; + *(here->HICUMxfBaseBIPtr) += +Ixf_Vbici; + *(here->HICUMxfCollCIPtr) += -Ixf_Vbici; + *(here->HICUMxfXfPtr) += +Ixf_Vxf; + } //////////////////////////////////// ////////// The complex part ////// @@ -409,8 +412,10 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) *(here->HICUMemitEICollCIPtr +1) += XQf_Vbici; *(here->HICUMbaseBICollCIPtr +1) += -XQf_Vbici; *(here->HICUMemitEIBaseBIPtr +1) += -XQf_Vbici; - *(here->HICUMbaseBIXfPtr +1) += XQf_Vxf; - *(here->HICUMemitEIXfPtr +1) += -XQf_Vxf; + if (nqs) { + *(here->HICUMbaseBIXfPtr +1) += XQf_Vxf; + *(here->HICUMemitEIXfPtr +1) += -XQf_Vxf; + } //Qjci *(here->HICUMbaseBIBaseBIPtr +1) += XQjci_Vbici; *(here->HICUMcollCICollCIPtr +1) += XQjci_Vbici; @@ -436,10 +441,11 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vbpci; *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vbpci; *(here->HICUMcollCIBaseBPPtr +1) += -XQdsu_Vbpci; - *(here->HICUMbaseBPBaseBPPtr +1) += XQdsu_Vsici; - *(here->HICUMsubsSISubsSIPtr +1) += XQdsu_Vsici; - *(here->HICUMbaseBPSubsSIPtr +1) += -XQdsu_Vsici; - *(here->HICUMsubsSIBaseBPPtr +1) += -XQdsu_Vsici; + //not implemented + // *(here->HICUMbaseBPBaseBPPtr +1) += XQdsu_Vsici; + // *(here->HICUMsubsSISubsSIPtr +1) += XQdsu_Vsici; + // *(here->HICUMbaseBPSubsSIPtr +1) += -XQdsu_Vsici; + // *(here->HICUMsubsSIBaseBPPtr +1) += -XQdsu_Vsici; //Qjs *(here->HICUMsubsSISubsSIPtr +1) += XQjs_Vsici; *(here->HICUMcollCICollCIPtr +1) += XQjs_Vsici; @@ -475,12 +481,14 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) *(here->HICUMsubsSISubsSIPtr + 1) += XQsu_Vsis; *(here->HICUMsubsSISubsPtr + 1) += -XQsu_Vsis; *(here->HICUMsubsSubsSIPtr + 1) += -XQsu_Vsis; - //Qxf1 - *(here->HICUMxf1Xf1Ptr + 1) += +XQxf1_Vxf1; - //Qxf2 - *(here->HICUMxf2Xf2Ptr + 1) += +XQxf2_Vxf2; - //Qxf - *(here->HICUMxfXfPtr + 1) += +XQxf_Vxf; + if (nqs) { + //Qxf1 + *(here->HICUMxf1Xf1Ptr + 1) += +XQxf1_Vxf1; + //Qxf2 + *(here->HICUMxf2Xf2Ptr + 1) += +XQxf2_Vxf2; + //Qxf + *(here->HICUMxfXfPtr + 1) += +XQxf_Vxf; + } // Stamps with SH if (selfheat) { @@ -518,12 +526,14 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) // Branch: bpsi, Stamp element: Its *(here->HICUMbaseBPtempPtr) += Ibpsi_Vrth; *(here->HICUMsubsSItempPtr) += -Ibpsi_Vrth; -// Stamp element: Ixf f_xf = + - *(here->HICUMxfTempPtr) += Ixf_Vrth; -// Stamp element: Ixf1 f_xf1 = + - *(here->HICUMxf1TempPtr) += Ixf1_Vrth; -// Stamp element: Ixf2 f_xf2 = + - *(here->HICUMxf2TempPtr) += Ixf2_Vrth; + if (nqs) { + // Stamp element: Ixf f_xf = + + *(here->HICUMxfTempPtr) += Ixf_Vrth; + // Stamp element: Ixf1 f_xf1 = + + *(here->HICUMxf1TempPtr) += Ixf1_Vrth; + // Stamp element: Ixf2 f_xf2 = + + *(here->HICUMxf2TempPtr) += Ixf2_Vrth; + } // Stamp element: Ith f_T = - Ith // with respect to Potential Vrth @@ -592,8 +602,8 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) *(here->HICUMsubsSItempPtr + 1) += -XQjs_Vrth; *(here->HICUMcollCItempPtr + 1) += +XQjs_Vrth; //Qscp from S to C f_S =- f_C =+ - *(here->HICUMsubsTempPtr + 1) += -XQscp_Vrth; - *(here->HICUMcollTempPtr + 1) += +XQscp_Vrth; + // *(here->HICUMsubsTempPtr + 1) += -XQscp_Vrth; + // *(here->HICUMcollTempPtr + 1) += +XQscp_Vrth; //Qcth from 0 to T f_0=- f_T=+ *(here->HICUMtempTempPtr + 1) += -XQcth_Vrth; diff --git a/src/spicelib/devices/hicum2/hicum2setup.c b/src/spicelib/devices/hicum2/hicum2setup.c index dfe43dcea..b522f79e5 100644 --- a/src/spicelib/devices/hicum2/hicum2setup.c +++ b/src/spicelib/devices/hicum2/hicum2setup.c @@ -38,6 +38,7 @@ HICUMsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) for( ; model != NULL; model = HICUMnextModel(model)) { int selfheat = (((model->HICUMflsh == 1) || (model->HICUMflsh == 2)) && (model->HICUMrthGiven) && (model->HICUMrth > 0.0)); + int nqs = ( (model->HICUMflnqs != 0 || model->HICUMflcomp == 0.0 || model->HICUMflcomp == 2.1) && (model->HICUMalit > 0 || model->HICUMalqf > 0)); //Circuit simulator specific parameters if(model->HICUMtype != NPN && model->HICUMtype != PNP) @@ -579,22 +580,26 @@ HICUMsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) } } - if(here->HICUMxfNode == 0) { - error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf"); - if(error) return(error); - here->HICUMxfNode = tmp->number; - } - - if(here->HICUMxf1Node == 0) { - error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf1"); - if(error) return(error); - here->HICUMxf1Node = tmp->number; - } - - if(here->HICUMxf2Node == 0) { - error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf2"); - if(error) return(error); - here->HICUMxf2Node = tmp->number; + if (nqs) { + if(here->HICUMxfNode == 0) { + error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf"); + if(error) return(error); + here->HICUMxfNode = tmp->number; + } + if(here->HICUMxf1Node == 0) { + error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf1"); + if(error) return(error); + here->HICUMxf1Node = tmp->number; + } + if(here->HICUMxf2Node == 0) { + error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf2"); + if(error) return(error); + here->HICUMxf2Node = tmp->number; + } + } else { + here->HICUMxfNode = 0; + here->HICUMxf1Node = 0; + here->HICUMxf2Node = 0; } /* macro to make elements with built in test for out of memory */ @@ -644,8 +649,10 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ TSTALLOC(HICUMbaseBIEmitEIPtr,HICUMbaseBINode,HICUMemitEINode); //ei-bi TSTALLOC(HICUMemitEIBaseBIPtr,HICUMemitEINode,HICUMbaseBINode); //bi-ei - TSTALLOC(HICUMbaseBIXfPtr ,HICUMbaseBINode,HICUMxfNode); //ei-bi - TSTALLOC(HICUMemitEIXfPtr ,HICUMemitEINode,HICUMxfNode); //ei-bi + if (nqs) { + TSTALLOC(HICUMbaseBIXfPtr ,HICUMbaseBINode,HICUMxfNode); //ei-bi + TSTALLOC(HICUMemitEIXfPtr ,HICUMemitEINode,HICUMxfNode); //ei-bi + } TSTALLOC(HICUMbaseBICollCIPtr,HICUMbaseBINode,HICUMcollCINode); //ci-bi TSTALLOC(HICUMcollCIBaseBIPtr,HICUMcollCINode,HICUMbaseBINode); //bi-ci @@ -662,27 +669,28 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ TSTALLOC(HICUMsubsCollPtr,HICUMsubsNode,HICUMcollNode); //s-c TSTALLOC(HICUMcollSubsPtr,HICUMcollNode,HICUMsubsNode); //c-s - TSTALLOC(HICUMxf1Xf1Ptr ,HICUMxf1Node ,HICUMxf1Node); - TSTALLOC(HICUMxf1TempPtr ,HICUMxf1Node ,HICUMtempNode); - TSTALLOC(HICUMxf1BaseBIPtr,HICUMxf1Node ,HICUMbaseBINode); - TSTALLOC(HICUMxf1EmitEIPtr,HICUMxf1Node ,HICUMemitEINode); - TSTALLOC(HICUMxf1CollCIPtr,HICUMxf1Node ,HICUMcollCINode); - TSTALLOC(HICUMxf1Xf2Ptr ,HICUMxf1Node ,HICUMxf2Node); + if (nqs) { + TSTALLOC(HICUMxf1Xf1Ptr ,HICUMxf1Node ,HICUMxf1Node); + TSTALLOC(HICUMxf1BaseBIPtr,HICUMxf1Node ,HICUMbaseBINode); + TSTALLOC(HICUMxf1EmitEIPtr,HICUMxf1Node ,HICUMemitEINode); + TSTALLOC(HICUMxf1CollCIPtr,HICUMxf1Node ,HICUMcollCINode); + TSTALLOC(HICUMxf1Xf2Ptr ,HICUMxf1Node ,HICUMxf2Node); - TSTALLOC(HICUMxf2Xf1Ptr ,HICUMxf2Node ,HICUMxf1Node); - TSTALLOC(HICUMxf2TempPtr ,HICUMxf2Node ,HICUMtempNode); - TSTALLOC(HICUMxf2BaseBIPtr,HICUMxf2Node ,HICUMbaseBINode); - TSTALLOC(HICUMxf2EmitEIPtr,HICUMxf2Node ,HICUMemitEINode); - TSTALLOC(HICUMxf2CollCIPtr,HICUMxf2Node ,HICUMcollCINode); - TSTALLOC(HICUMxf2Xf2Ptr ,HICUMxf2Node ,HICUMxf2Node); - TSTALLOC(HICUMemitEIXf2Ptr,HICUMemitEINode,HICUMxf2Node); - TSTALLOC(HICUMcollCIXf2Ptr,HICUMcollCINode,HICUMxf2Node); + TSTALLOC(HICUMxf2Xf1Ptr ,HICUMxf2Node ,HICUMxf1Node); + TSTALLOC(HICUMxf2BaseBIPtr,HICUMxf2Node ,HICUMbaseBINode); + TSTALLOC(HICUMxf2EmitEIPtr,HICUMxf2Node ,HICUMemitEINode); + TSTALLOC(HICUMxf2CollCIPtr,HICUMxf2Node ,HICUMcollCINode); + TSTALLOC(HICUMxf2Xf2Ptr ,HICUMxf2Node ,HICUMxf2Node); + TSTALLOC(HICUMemitEIXf2Ptr,HICUMemitEINode,HICUMxf2Node); + TSTALLOC(HICUMcollCIXf2Ptr,HICUMcollCINode,HICUMxf2Node); - TSTALLOC(HICUMxfXfPtr ,HICUMxfNode,HICUMxfNode); - TSTALLOC(HICUMxfTempPtr ,HICUMxfNode,HICUMtempNode); - TSTALLOC(HICUMxfEmitEIPtr ,HICUMxfNode,HICUMemitEINode); - TSTALLOC(HICUMxfCollCIPtr ,HICUMxfNode,HICUMcollCINode); - TSTALLOC(HICUMxfBaseBIPtr ,HICUMxfNode,HICUMbaseBINode); + TSTALLOC(HICUMxfXfPtr ,HICUMxfNode,HICUMxfNode); + TSTALLOC(HICUMxfEmitEIPtr ,HICUMxfNode,HICUMemitEINode); + TSTALLOC(HICUMxfCollCIPtr ,HICUMxfNode,HICUMcollCINode); + TSTALLOC(HICUMxfBaseBIPtr ,HICUMxfNode,HICUMbaseBINode); + + + } TSTALLOC(HICUMbaseBPSubsSIPtr ,HICUMbaseBPNode,HICUMsubsSINode); TSTALLOC(HICUMsubsSIBaseBPPtr ,HICUMsubsSINode,HICUMbaseBPNode); @@ -711,7 +719,13 @@ do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ TSTALLOC(HICUMtempSubsSIPtr,HICUMtempNode,HICUMsubsSINode); TSTALLOC(HICUMtempTempPtr,HICUMtempNode,HICUMtempNode); - } + + if (nqs) { + TSTALLOC(HICUMxfTempPtr ,HICUMxfNode,HICUMtempNode); + TSTALLOC(HICUMxf2TempPtr ,HICUMxf2Node ,HICUMtempNode); + TSTALLOC(HICUMxf1TempPtr ,HICUMxf1Node ,HICUMtempNode); + } + } } } return(OK); @@ -729,6 +743,7 @@ HICUMunsetup( model = HICUMnextModel(model)) { int selfheat = (((model->HICUMflsh == 1) || (model->HICUMflsh == 2)) && (model->HICUMrthGiven) && (model->HICUMrth > 0.0)); + int nqs = ( (model->HICUMflnqs != 0 || model->HICUMflcomp == 0.0 || model->HICUMflcomp == 2.1) && (model->HICUMalit > 0 || model->HICUMalqf > 0)); for (here = HICUMinstances(model); here != NULL; here=HICUMnextInstance(here)) @@ -764,17 +779,20 @@ HICUMunsetup( } } + if (nqs) { + if(here->HICUMxfNode > 0) - CKTdltNNum(ckt, here->HICUMxfNode); - here->HICUMxfNode = 0; + CKTdltNNum(ckt, here->HICUMxfNode); + here->HICUMxfNode = 0; - if(here->HICUMxf1Node > 0) - CKTdltNNum(ckt, here->HICUMxf1Node); - here->HICUMxf1Node = 0; + if(here->HICUMxf1Node > 0) + CKTdltNNum(ckt, here->HICUMxf1Node); + here->HICUMxf1Node = 0; - if(here->HICUMxf2Node > 0) - CKTdltNNum(ckt, here->HICUMxf2Node); - here->HICUMxf2Node = 0; + if(here->HICUMxf2Node > 0) + CKTdltNNum(ckt, here->HICUMxf2Node); + here->HICUMxf2Node = 0; + } } } diff --git a/src/spicelib/devices/hicum2/hicumL2.cpp b/src/spicelib/devices/hicum2/hicumL2.cpp index 0c4cb09d9..e7ce65075 100644 --- a/src/spicelib/devices/hicum2/hicumL2.cpp +++ b/src/spicelib/devices/hicum2/hicumL2.cpp @@ -1197,6 +1197,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) // Model_initialization int selfheat = ((model->HICUMflsh > 0) && (model->HICUMrthGiven) && (model->HICUMrth > 0.0)); + int nqs = ( (model->HICUMflnqs != 0 || model->HICUMflcomp == 0.0 || model->HICUMflcomp == 2.1) && (model->HICUMalit > 0 || model->HICUMalqf > 0)); // Depletion capacitance splitting at b-c junction // Capacitances at peripheral and external base node @@ -1873,12 +1874,14 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) here->HICUMtVcrit,&ichk3); Vsici = DEVpnjlim(Vsici,*(ckt->CKTstate0 + here->HICUMvsici),here->HICUMvt.rpart, here->HICUMtVcrit,&ichk4); - Vxf = DEVpnjlim(Vxf,*(ckt->CKTstate0 + here->HICUMvxf),here->HICUMvt.rpart, - here->HICUMtVcrit,&ichk5); - Vxf1 = DEVpnjlim(Vxf1,*(ckt->CKTstate0 + here->HICUMvxf1),here->HICUMvt.rpart, - here->HICUMtVcrit,&ichk6); - Vxf2 = DEVpnjlim(Vxf2,*(ckt->CKTstate0 + here->HICUMvxf2),here->HICUMvt.rpart, - here->HICUMtVcrit,&ichk7); + if (nqs) { + Vxf = DEVpnjlim(Vxf,*(ckt->CKTstate0 + here->HICUMvxf),here->HICUMvt.rpart, + here->HICUMtVcrit,&ichk5); + Vxf1 = DEVpnjlim(Vxf1,*(ckt->CKTstate0 + here->HICUMvxf1),here->HICUMvt.rpart, + here->HICUMtVcrit,&ichk6); + Vxf2 = DEVpnjlim(Vxf2,*(ckt->CKTstate0 + here->HICUMvxf2),here->HICUMvt.rpart, + here->HICUMtVcrit,&ichk7); + } if (selfheat) { ichk8 = 1; Vrth = HICUMlimitlog(Vrth, @@ -2546,7 +2549,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Qdeix_Vxf = 0.0; // Excess Phase calculation - if ((model->HICUMflnqs != 0 || model->HICUMflcomp == 0.0 || model->HICUMflcomp == 2.1) && Tf != 0 && (model->HICUMalit > 0 || model->HICUMalqf > 0)) { + + if ( (model->HICUMflnqs != 0 || model->HICUMflcomp == 0.0 || model->HICUMflcomp == 2.1) && Tf != 0 && (model->HICUMalit > 0 || model->HICUMalqf > 0)) { Ixf1 = (Vxf2-itf)/Tf*model->HICUMt0; Ixf1_Vxf2 = 1.0/Tf*model->HICUMt0; Ixf1_ditf = -Ixf1_Vxf2; @@ -2848,20 +2852,22 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Ibpsi_Vbpci += ckt->CKTgmin; Ibpsi_Vsici += ckt->CKTgmin; - //Ixf - Ixf_Vbiei += ckt->CKTgmin; - Ixf_Vbici += ckt->CKTgmin; - Ixf_Vxf += ckt->CKTgmin; - //Ixf1 - Ixf1_Vbiei += ckt->CKTgmin; - Ixf1_Vbici += ckt->CKTgmin; - Ixf1_Vxf2 += ckt->CKTgmin; - Ixf1_Vxf1 += ckt->CKTgmin; - //Ixf2 - Ixf2_Vbiei += ckt->CKTgmin; - Ixf2_Vbici += ckt->CKTgmin; - Ixf2_Vxf2 += ckt->CKTgmin; - Ixf2_Vxf1 += ckt->CKTgmin; + if (nqs) { + //Ixf + Ixf_Vbiei += ckt->CKTgmin; + Ixf_Vbici += ckt->CKTgmin; + Ixf_Vxf += ckt->CKTgmin; + //Ixf1 + Ixf1_Vbiei += ckt->CKTgmin; + Ixf1_Vbici += ckt->CKTgmin; + Ixf1_Vxf2 += ckt->CKTgmin; + Ixf1_Vxf1 += ckt->CKTgmin; + //Ixf2 + Ixf2_Vbiei += ckt->CKTgmin; + Ixf2_Vbici += ckt->CKTgmin; + Ixf2_Vxf2 += ckt->CKTgmin; + Ixf2_Vxf1 += ckt->CKTgmin; + } //SHE derivatives if (selfheat) { @@ -2899,10 +2905,12 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Ith_Veie += ckt->CKTgmin; Ith_Vrth += ckt->CKTgmin; - // //NQS - Ixf_dT += ckt->CKTgmin; - Ixf1_dT += ckt->CKTgmin; - Ixf2_dT += ckt->CKTgmin; + if (nqs) { + // //NQS + Ixf_dT += ckt->CKTgmin; + Ixf1_dT += ckt->CKTgmin; + Ixf2_dT += ckt->CKTgmin; + } } // end of Load_sources @@ -3164,21 +3172,23 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) if(error) return(error); Isc_Vsc = geq; Isc = *(ckt->CKTstate0 + here->HICUMcqscp); - //Qxf - error = NIintegrate(ckt,&geq,&ceq,Qxf1_Vxf1,here->HICUMqxf); - if(error) return(error); - Ixf1_Vxf1 += geq; - Ixf1 += *(ckt->CKTstate0 + here->HICUMcqxf); - //Qxf2 - error = NIintegrate(ckt,&geq,&ceq,Qxf2_Vxf2,here->HICUMqxf2); - if(error) return(error); - Ixf2_Vxf2 += geq; - Ixf2 += *(ckt->CKTstate0 + here->HICUMcqxf2); - //Qxf - error = NIintegrate(ckt,&geq,&ceq,Qxf_Vxf,here->HICUMqxf1); - if(error) return(error); - Ixf_Vxf += geq; - Ixf += *(ckt->CKTstate0 + here->HICUMcqxf1); + if (nqs) { + //Qxf + error = NIintegrate(ckt,&geq,&ceq,Qxf1_Vxf1,here->HICUMqxf); + if(error) return(error); + Ixf1_Vxf1 += geq; + Ixf1 += *(ckt->CKTstate0 + here->HICUMcqxf); + //Qxf2 + error = NIintegrate(ckt,&geq,&ceq,Qxf2_Vxf2,here->HICUMqxf2); + if(error) return(error); + Ixf2_Vxf2 += geq; + Ixf2 += *(ckt->CKTstate0 + here->HICUMcqxf2); + //Qxf + error = NIintegrate(ckt,&geq,&ceq,Qxf_Vxf,here->HICUMqxf1); + if(error) return(error); + Ixf_Vxf += geq; + Ixf += *(ckt->CKTstate0 + here->HICUMcqxf1); + } if (selfheat) { @@ -3231,12 +3241,12 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) /* * check convergence */ - if ( (!(ckt->CKTmode & MODEINITFIX))||(!(here->HICUMoff))) { - if (icheck == 1) { - ckt->CKTnoncon++; - ckt->CKTtroubleElt = (GENinstance *) here; - } - } + // if ( (!(ckt->CKTmode & MODEINITFIX))||(!(here->HICUMoff))) { + // if (icheck == 1) { + // ckt->CKTnoncon++; + // ckt->CKTtroubleElt = (GENinstance *) here; + // } + // } /* * charge storage for electrostatic caps @@ -3491,9 +3501,11 @@ load: *(here->HICUMemitEICollCIPtr) += Iciei_Vbici; *(here->HICUMcollCICollCIPtr) += -Iciei_Vbici; *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbici; - // with respect to Vxf2 - *(here->HICUMcollCIXf2Ptr) += Iciei_Vxf2; - *(here->HICUMemitEIXf2Ptr) += -Iciei_Vxf2; + if (nqs) { + // with respect to Vxf2 + *(here->HICUMcollCIXf2Ptr) += Iciei_Vxf2; + *(here->HICUMemitEIXf2Ptr) += -Iciei_Vxf2; + } // finish // Branch: bci, Stamp element: Qbcx @@ -3620,50 +3632,37 @@ load: // I(br_bxf) <+ Ixf; //for RC nw // I(br_cxf) <+ ddt(Qxf); //for RC nw -// Branch: xf1-ground, Stamp element: Ixf1 f_xf1=+ //Markus has opposite sign than Dietmar. This current flows from xf1 to ground? - rhs_current = Ixf1 - Ixf1_Vbici*Vbici - Ixf1_Vbiei*Vbiei -Ixf1_Vxf1*Vxf1 - Ixf1_Vxf2*Vxf2; - *(ckt->CKTrhs + here->HICUMxf1Node) += -rhs_current; // rhs_current; // into xf1 node - *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbiei; - *(here->HICUMxf1EmitEIPtr) += -Ixf1_Vbiei; - *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbici; - *(here->HICUMxf1CollCIPtr) += -Ixf1_Vbici; - *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; - *(here->HICUMxf1Xf1Ptr) += +Ixf1_Vxf1; + if (nqs) { + // Branch: xf1-ground, Stamp element: Ixf1 f_xf1=+ //Markus has opposite sign than Dietmar. This current flows from xf1 to ground? + rhs_current = Ixf1 - Ixf1_Vbici*Vbici - Ixf1_Vbiei*Vbiei -Ixf1_Vxf1*Vxf1 - Ixf1_Vxf2*Vxf2; + *(ckt->CKTrhs + here->HICUMxf1Node) += -rhs_current; // rhs_current; // into xf1 node + *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbiei; + *(here->HICUMxf1EmitEIPtr) += -Ixf1_Vbiei; + *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbici; + *(here->HICUMxf1CollCIPtr) += -Ixf1_Vbici; + *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; + *(here->HICUMxf1Xf1Ptr) += +Ixf1_Vxf1; -// Branch: xf2-ground, Stamp element: Ixf2 f_xf2=+ //Markus has opposite sign than Dietmar. This current flows from xf1 to ground? - rhs_current = Ixf2 - Ixf2_Vbici*Vbici - Ixf2_Vbiei*Vbiei - Ixf2_Vxf1*Vxf1 - Ixf2_Vxf2*Vxf2; - *(ckt->CKTrhs + here->HICUMxf2Node) += -rhs_current; // rhs_current; // into xf2 node - *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbiei; - *(here->HICUMxf2EmitEIPtr) += -Ixf2_Vbiei; - *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbici; - *(here->HICUMxf2CollCIPtr) += -Ixf2_Vbici; - *(here->HICUMxf2Xf2Ptr) += +Ixf2_Vxf2; - *(here->HICUMxf2Xf1Ptr) += +Ixf2_Vxf1; + // Branch: xf2-ground, Stamp element: Ixf2 f_xf2=+ //Markus has opposite sign than Dietmar. This current flows from xf1 to ground? + rhs_current = Ixf2 - Ixf2_Vbici*Vbici - Ixf2_Vbiei*Vbiei - Ixf2_Vxf1*Vxf1 - Ixf2_Vxf2*Vxf2; + *(ckt->CKTrhs + here->HICUMxf2Node) += -rhs_current; // rhs_current; // into xf2 node + *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbiei; + *(here->HICUMxf2EmitEIPtr) += -Ixf2_Vbiei; + *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbici; + *(here->HICUMxf2CollCIPtr) += -Ixf2_Vbici; + *(here->HICUMxf2Xf2Ptr) += +Ixf2_Vxf2; + *(here->HICUMxf2Xf1Ptr) += +Ixf2_Vxf1; -// Branch: xf-ground, Stamp element: Ixf f_xf=+ //Markus has opposite sign than Dietmar. This current flows from xf1 to ground? - rhs_current = Ixf - Ixf_Vbici*Vbici - Ixf_Vbiei*Vbiei - Ixf_Vxf*Vxf; - *(ckt->CKTrhs + here->HICUMxfNode) += -rhs_current; // rhs_current; // into xf2 node - *(here->HICUMxfBaseBIPtr) += +Ixf_Vbiei; - *(here->HICUMxfEmitEIPtr) += -Ixf_Vbiei; - *(here->HICUMxfBaseBIPtr) += +Ixf_Vbici; - *(here->HICUMxfCollCIPtr) += -Ixf_Vbici; - *(here->HICUMxfXfPtr) += +Ixf_Vxf; + // Branch: xf-ground, Stamp element: Ixf f_xf=+ //Markus has opposite sign than Dietmar. This current flows from xf1 to ground? + rhs_current = Ixf - Ixf_Vbici*Vbici - Ixf_Vbiei*Vbiei - Ixf_Vxf*Vxf; + *(ckt->CKTrhs + here->HICUMxfNode) += -rhs_current; // rhs_current; // into xf2 node + *(here->HICUMxfBaseBIPtr) += +Ixf_Vbiei; + *(here->HICUMxfEmitEIPtr) += -Ixf_Vbiei; + *(here->HICUMxfBaseBIPtr) += +Ixf_Vbici; + *(here->HICUMxfCollCIPtr) += -Ixf_Vbici; + *(here->HICUMxfXfPtr) += +Ixf_Vxf; + } -/* -c Branch: xf1-ground, Stamp element: Rxf1 TODO: This is wrong, but needed at the moment for convergence -*/ - // *(here->HICUMxf1Xf1Ptr) += 1; // current Ixf1 is normalized to Tf -/* -c Branch: xf2-ground, Stamp element: Rxf2 -*/ - // *(here->HICUMxf2Xf2Ptr) += 1; // current Ixf2 is normalized to Tf -/* -c Branch: xf-ground, Stamp element: Ixf -*/ -/* -c Branch: xf-ground, Stamp element: Rxf -*/ - // *(here->HICUMxfXfPtr) += 1; // current Ixf is normalized to Tf // ############################################################# // ############### FINISH STAMPS NO SH ######################### @@ -3779,26 +3778,28 @@ c Branch: xf-ground, Stamp element: Rxf *(here->HICUMsubsSItempPtr) += -Ibpsi_Vrth; // finish -// Stamp element: Ixf f_xf = + - rhs_current = -Ixf_dT*Vrth; - *(ckt->CKTrhs + here->HICUMxfNode) += -rhs_current; - // with respect to Potential Vxf - *(here->HICUMxfTempPtr) += Ixf_dT; -// finish + if (nqs) { + // Stamp element: Ixf f_xf = + + rhs_current = -Ixf_dT*Vrth; + *(ckt->CKTrhs + here->HICUMxfNode) += -rhs_current; + // with respect to Potential Vxf + *(here->HICUMxfTempPtr) += Ixf_dT; + // finish -// Stamp element: Ixf1 f_xf1 = + - rhs_current = -Ixf1_dT*Vrth; - *(ckt->CKTrhs + here->HICUMxf1Node) += -rhs_current; - // with respect to Potential Vxf1 - *(here->HICUMxf1TempPtr) += Ixf1_dT; -// finish + // Stamp element: Ixf1 f_xf1 = + + rhs_current = -Ixf1_dT*Vrth; + *(ckt->CKTrhs + here->HICUMxf1Node) += -rhs_current; + // with respect to Potential Vxf1 + *(here->HICUMxf1TempPtr) += Ixf1_dT; + // finish -// Stamp element: Ixf2 f_xf2 = + - rhs_current = -Ixf2_dT*Vrth; - *(ckt->CKTrhs + here->HICUMxf2Node) += -rhs_current; - // with respect to Potential Vxf2 - *(here->HICUMxf2TempPtr) += Ixf2_dT; -// finish + // Stamp element: Ixf2 f_xf2 = + + rhs_current = -Ixf2_dT*Vrth; + *(ckt->CKTrhs + here->HICUMxf2Node) += -rhs_current; + // with respect to Potential Vxf2 + *(here->HICUMxf2TempPtr) += Ixf2_dT; + // finish + } // Stamp element: Ith f_T = - Ith rhs_current = Ith + Icth - Icth_Vrth*Vrth diff --git a/tests/hicum2/npn/qaSpec_debug b/tests/hicum2/npn/qaSpec_debug index d1d3d6512..066ad82cb 100644 --- a/tests/hicum2/npn/qaSpec_debug +++ b/tests/hicum2/npn/qaSpec_debug @@ -35,15 +35,15 @@ pins coll base emit subs therm float therm checkPolarity n -test fgum_ac_npn_vert_nqs_dc +test fgum_ac_npn_full_ac temperature 27 biases V(emit)=0 V(subs)=0 biasSweep V(base)=0.750000,1.050000,0.010000 biasList V(coll)=0.500000,1.000000,1.500000 -outputs I(coll) I(base) -modelParameters parameters/npn_vert_nqs +freq dec 10 1e+010 2e+010 +outputs G(base,base) G(base,coll) G(coll,base) G(coll,coll) C(base,base) C(base,coll) C(coll,base) C(coll,coll) +modelParameters parameters/npn_full -// // Specific tests //