From c7e5df27dbd5b74586d64c9404166e67a1c7af62 Mon Sep 17 00:00:00 2001 From: mariok Date: Thu, 16 Apr 2020 14:44:41 +0200 Subject: [PATCH] DC runs with Ixf --- src/spicelib/devices/hicum2/hicum2load.c | 57 +++++++++++++----------- tests/hicum2/FG.cir | 2 +- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/spicelib/devices/hicum2/hicum2load.c b/src/spicelib/devices/hicum2/hicum2load.c index e017c5685..0546b7934 100644 --- a/src/spicelib/devices/hicum2/hicum2load.c +++ b/src/spicelib/devices/hicum2/hicum2load.c @@ -722,9 +722,9 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Vsis = model->HICUMtype*( *(ckt->CKTrhsOld+here->HICUMsubsSINode)- *(ckt->CKTrhsOld+here->HICUMsubsNode)); - Vbxf = *(ckt->CKTstate0 + here->HICUMvxf); - Vbxf1 = *(ckt->CKTstate0 + here->HICUMvxf1); - Vbxf2 = *(ckt->CKTstate0 + here->HICUMvxf2); + Vbxf = *(ckt->CKTrhsOld + here->HICUMxfNode); + Vbxf1 = *(ckt->CKTrhsOld + here->HICUMxf1Node); + Vbxf2 = *(ckt->CKTrhsOld + here->HICUMxf2Node); if (model->HICUMflsh) Vrth = *(ckt->CKTstate0 + here->HICUMvrth); } else if(ckt->CKTmode & MODEINITTRAN) { @@ -760,9 +760,9 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Vsis = model->HICUMtype*( *(ckt->CKTrhsOld+here->HICUMsubsSINode)- *(ckt->CKTrhsOld+here->HICUMsubsNode)); - Vbxf = *(ckt->CKTstate1 + here->HICUMvxf); - Vbxf1 = *(ckt->CKTstate1 + here->HICUMvxf1); - Vbxf2 = *(ckt->CKTstate1 + here->HICUMvxf2); + Vbxf = *(ckt->CKTrhsOld + here->HICUMxfNode); + Vbxf1 = *(ckt->CKTrhsOld + here->HICUMxf1Node); + Vbxf2 = *(ckt->CKTrhsOld + here->HICUMxf2Node); if (model->HICUMflsh) Vrth = *(ckt->CKTstate1 + here->HICUMvrth); } else if((ckt->CKTmode & MODEINITJCT) && @@ -1230,10 +1230,6 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) a = vc/here->HICUMvt; d1 = a-1; vceff = (1.0+((d1+sqrt(d1*d1+1.921812))/2))*here->HICUMvt; - // a = vceff/vlim_t; - // ick = vceff*Orci0_t/sqrt(1.0+a*a); - // ICKa = (vceff-vlim_t)*Ovpt; - // ick = ick*(1.0+0.5*(ICKa+sqrt(ICKa*ICKa+1.0e-3))); a1 = vceff/here->HICUMvlim_t; a11 = vceff*Orci0_t; @@ -1287,7 +1283,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Tf = T_f0; Qf = T_f0*itf; HICQFF(here, model, itf,ick,&Tf,&Qf,&T_fT,&Q_fT,&Q_bf); -//todo: itf=f(Vbiei,Vbici) -> Qf, Q_bf Ableitungen nach Vbiei, Vbici +//TODO: itf=f(Vbiei,Vbici) -> Qf, Q_bf Ableitungen nach Vbiei, Vbici //Initial formulation of reverse diffusion charge Qr = Tr*itr; @@ -1297,7 +1293,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) //Iteration for Q_pT is required for improved initial solution Qf = sqrt(T_f0*itf*Q_fT); Q_pT = Q_0+Qf+Qr; -//todo: Q_pT_Vbiei, Vbici +//TODO: Q_pT_Vbiei, Vbici d_Q = Q_pT; while (fabs(d_Q) >= RTOLC*fabs(Q_pT) && l_it <= l_itmax) { double a; @@ -1340,6 +1336,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Qr = Tr*itr; } //if + // TODO calculate here the derivatives once! They are not needed inside the newton... itf_Vbiei = itf/VT_f; // TODO: missing the derivatives of Qf itr_Vbici = itr/here->HICUMvt; // TODO: missing the derivatives of Qpt @@ -1577,16 +1574,22 @@ 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)) { - Vxf1 = Vbxf1; - Vxf2 = Vbxf2; + // Vxf1 = Vbxf1; + // Vxf2 = Vbxf2; - Ixf1 = (Vxf2-itf)/Tf*model->HICUMt0; - Ixf2 = (Vxf2-Vxf1)/Tf*model->HICUMt0; - Qxf1 = model->HICUMalit*model->HICUMt0*Vxf1; - Qxf1_Vxf1 = model->HICUMalit*model->HICUMt0; - Qxf2 = model->HICUMalit*model->HICUMt0*Vxf2/3; - Qxf2_Vxf2 = model->HICUMalit*model->HICUMt0/3; - Itxf = Vxf2; + // Ixf1 = (Vxf2-itf)/Tf*model->HICUMt0; + // Ixf2 = (Vxf2-Vxf1)/Tf*model->HICUMt0; + // Qxf1 = model->HICUMalit*model->HICUMt0*Vxf1; + // Qxf1_Vxf1 = model->HICUMalit*model->HICUMt0; + // Qxf2 = model->HICUMalit*model->HICUMt0*Vxf2/3; + // Qxf2_Vxf2 = model->HICUMalit*model->HICUMt0/3; + // Itxf = Vxf2; + Ixf1 = Vbxf1; + Ixf2 = Vbxf2; + Qxf1 = 0; + Qxf2 = 0; + Qxf1_Vxf1 = 0; + Qxf2_Vxf2 = 0; // TODO derivatives of Ixf1 and Ixf2 @@ -2331,7 +2334,7 @@ c Branch: xf1-ground, Stamp element: Qxf1 /* c Branch: xf1-ground, Stamp element: Rxf1 */ - *(here->HICUMxf1Xf1Ptr) += Tf; // current Ixf1 is normalized to Tf + *(here->HICUMxf1Xf1Ptr) += 1; // current Ixf1 is normalized to Tf /* c Branch: xf2-ground, Stamp element: Ixf2 */ @@ -2351,7 +2354,7 @@ c Branch: xf2-ground, Stamp element: Qxf2 /* c Branch: xf2-ground, Stamp element: Rxf2 */ - *(here->HICUMxf2Xf2Ptr) += Tf; // current Ixf2 is normalized to Tf + *(here->HICUMxf2Xf2Ptr) += 1; // current Ixf2 is normalized to Tf /* c Branch: xf-ground, Stamp element: Ixf */ @@ -2366,13 +2369,13 @@ c Branch: xf-ground, Stamp element: Ixf /* c Branch: xf-ground, Stamp element: Qxf */ - rhs_current = model->HICUMtype * (Iqxf - Iqxf_Vxf*Vxf); - *(ckt->CKTrhs + here->HICUMxfNode) += rhs_current; // into ground - *(here->HICUMxfXfPtr) += Iqxf_Vxf; + // rhs_current = model->HICUMtype * (Iqxf - Iqxf_Vxf*Vxf); + // *(ckt->CKTrhs + here->HICUMxfNode) += rhs_current; // into ground + // *(here->HICUMxfXfPtr) += Iqxf_Vxf; /* c Branch: xf-ground, Stamp element: Rxf */ - *(here->HICUMxfXfPtr) += Tf; // current Ixf is normalized to Tf + *(here->HICUMxfXfPtr) += 1; // current Ixf is normalized to Tf if (model->HICUMflsh) { /* diff --git a/tests/hicum2/FG.cir b/tests/hicum2/FG.cir index 5f71028d0..04634b063 100644 --- a/tests/hicum2/FG.cir +++ b/tests/hicum2/FG.cir @@ -23,7 +23,7 @@ Q1 Q1_C Q1_B Q1_E Q1_S Q1_T P1 + fbcpar=0.3 fbepar=1 cjs0=2.6e-014 vds=0.9997 zs=0.4295 vpts=100 + t0=2.089e-013 dt0h=8e-014 tbvl=8.25e-014 tef0=3.271e-013 gtfe=3.548 thcs=5.001e-012 + ahc=0.05 fthc=0.7 rci0=9.523 vlim=0.6999 vces=0.01 vpt=2 tr=0 -+ cbepar=2.609e-014 cbcpar=1.64512e-014 alqf=0.166667 alit=0.333333 flnqs=0 kf=0 ++ cbepar=2.609e-014 cbcpar=1.64512e-014 alqf=0.166667 alit=0.333333 flnqs=1 kf=0 + af=2 cfbe=-1 latb=0 latl=0 vgb=0.91 alt0=0.004 kt0=6.588e-005 + zetaci=0.58 alvs=0.001 alces=-0.2286 zetarbi=0.3002 zetarbx=0.06011 zetarcx=-0.02768 + zetare=-0.9605 zetacx=0 vge=1.17 vgc=1.17 vgs=1.17 f1vg=-0.000102377 f2vg=0.00043215