From 7407302d5016424403cc135f77e97d8b53002e8c Mon Sep 17 00:00:00 2001 From: Markus Mueller Date: Sat, 27 Jun 2020 17:48:23 +0200 Subject: [PATCH] fix bug in HICUMacload --- src/spicelib/devices/hicum2/hicum2acld.c | 17 ++++++++--------- src/spicelib/devices/hicum2/hicumL2.cpp | 19 +++++-------------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/spicelib/devices/hicum2/hicum2acld.c b/src/spicelib/devices/hicum2/hicum2acld.c index a14830cfa..20be3999a 100644 --- a/src/spicelib/devices/hicum2/hicum2acld.c +++ b/src/spicelib/devices/hicum2/hicum2acld.c @@ -441,11 +441,10 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vbpci; *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vbpci; *(here->HICUMcollCIBaseBPPtr +1) += -XQdsu_Vbpci; - //not implemented - // *(here->HICUMbaseBPBaseBPPtr +1) += XQdsu_Vsici; - // *(here->HICUMsubsSISubsSIPtr +1) += XQdsu_Vsici; - // *(here->HICUMbaseBPSubsSIPtr +1) += -XQdsu_Vsici; - // *(here->HICUMsubsSIBaseBPPtr +1) += -XQdsu_Vsici; + *(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; @@ -472,10 +471,10 @@ HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) *(here->HICUMbaseCollCIPtr + 1) += -XQbcpar1_Vbci; *(here->HICUMcollCIBasePtr + 1) += -XQbcpar1_Vbci; //Qbcpar2 - *(here->HICUMbaseBPBaseBPPtr +1) += XQbepar2_Vbpe; - *(here->HICUMcollCICollCIPtr +1) += XQbepar2_Vbpe; - *(here->HICUMbaseBPCollCIPtr +1) += -XQbepar2_Vbpe; - *(here->HICUMcollCIBaseBPPtr +1) += -XQbepar2_Vbpe; + *(here->HICUMbaseBPBaseBPPtr +1) += XQbcpar2_Vbpci; + *(here->HICUMcollCICollCIPtr +1) += XQbcpar2_Vbpci; + *(here->HICUMbaseBPCollCIPtr +1) += -XQbcpar2_Vbpci; + *(here->HICUMcollCIBaseBPPtr +1) += -XQbcpar2_Vbpci; //Qsu *(here->HICUMsubsSubsPtr + 1) += XQsu_Vsis; *(here->HICUMsubsSISubsSIPtr + 1) += XQsu_Vsis; diff --git a/src/spicelib/devices/hicum2/hicumL2.cpp b/src/spicelib/devices/hicum2/hicumL2.cpp index fb0d5fdba..3009fd4ed 100644 --- a/src/spicelib/devices/hicum2/hicumL2.cpp +++ b/src/spicelib/devices/hicum2/hicumL2.cpp @@ -1197,7 +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)); + 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 @@ -2550,7 +2550,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) // Excess Phase calculation - if ( (model->HICUMflnqs != 0 || model->HICUMflcomp == 0.0 || model->HICUMflcomp == 2.1) && Tf != 0 && (model->HICUMalit > 0 || model->HICUMalqf > 0)) { + if ( nqs && (ckt->CKTmode & (MODETRAN | MODEAC) ) ) { //evaluate nqs network only in TRANSIENT and AC modes. Ixf1 = (Vxf2-itf)/Tf*model->HICUMt0; Ixf1_Vxf2 = 1.0/Tf*model->HICUMt0; Ixf1_ditf = -Ixf1_Vxf2; @@ -2961,8 +2961,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) *(ckt->CKTstate0 + here->HICUMqjcx0_i) = Qjcx_i; *(ckt->CKTstate0 + here->HICUMcqcx0_t_i) = Qjcx_i_Vbci; //Qjcx_ii - *(ckt->CKTstate0 + here->HICUMqjcx0_ii) = Qjcx_ii; - *(ckt->CKTstate0 + here->HICUMcqcx0_t_ii) = Qjcx_ii_Vbpci; + *(ckt->CKTstate0 + here->HICUMqjcx0_ii) = Qjcx_ii; + *(ckt->CKTstate0 + here->HICUMcqcx0_t_ii) = Qjcx_ii_Vbpci; //Qdsu *(ckt->CKTstate0 + here->HICUMqdsu) = Qdsu; *(ckt->CKTstate0 + here->HICUMcqdsu) = Qdsu_Vbpci; @@ -2983,7 +2983,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) *(ckt->CKTstate0 + here->HICUMcqbcpar1) = Qbcpar1_Vbci; //Qbcpar2 *(ckt->CKTstate0 + here->HICUMqbcpar2) = Qbcpar2; - *(ckt->CKTstate0 + here->HICUMcqbcpar2) = Qbcpar1_Vbci; + *(ckt->CKTstate0 + here->HICUMcqbcpar2) = Qbcpar2_Vbpci; //Qsu *(ckt->CKTstate0 + here->HICUMqsu) = Qsu; *(ckt->CKTstate0 + here->HICUMcqsu) = Qsu_Vsis; @@ -3623,15 +3623,6 @@ load: *(here->HICUMsubsSubsSIPtr) += -Isis_Vsis; // finish - // NQS effect - // I(br_bxf1) <+ Ixf1; - // I(br_cxf1) <+ ddt(Qxf1); - // I(br_bxf2) <+ Ixf2; - // I(br_cxf2) <+ ddt(Qxf2); - - // I(br_bxf) <+ Ixf; //for RC nw - // I(br_cxf) <+ ddt(Qxf); //for RC nw - 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;