From 08a0e6a019957ba9c29ee96653254880b26c8c98 Mon Sep 17 00:00:00 2001 From: mariok Date: Wed, 15 Apr 2020 18:15:26 +0200 Subject: [PATCH 1/8] gummel works with flsh = 1 and flnqs = 0 --- src/spicelib/devices/hicum2/hicum2defs.h | 18 +- src/spicelib/devices/hicum2/hicum2load.c | 83 +++++++-- tests/hicum2/FG.cir | 6 +- tests/hicum2/FG.out | 207 ++++++++++++----------- 4 files changed, 196 insertions(+), 118 deletions(-) diff --git a/src/spicelib/devices/hicum2/hicum2defs.h b/src/spicelib/devices/hicum2/hicum2defs.h index 724f29fe2..9cbc8079a 100644 --- a/src/spicelib/devices/hicum2/hicum2defs.h +++ b/src/spicelib/devices/hicum2/hicum2defs.h @@ -379,8 +379,22 @@ typedef struct sHICUMinstance { #define HICUMixf_Vbici HICUMstate+74 #define HICUMvxf1 HICUMstate+75 -#define HICUMvxf2 HICUMstate+76 -#define HICUMnumStates 77 +#define HICUMqxf1 HICUMstate+76 +#define HICUMcqxf1 HICUMstate+77 +#define HICUMgqxf1 HICUMstate+78 +#define HICUMixf1_Vbiei HICUMstate+79 +#define HICUMixf1_Vbici HICUMstate+80 +#define HICUMixf1_Vfx2 HICUMstate+81 + +#define HICUMvxf2 HICUMstate+82 +#define HICUMqxf2 HICUMstate+83 +#define HICUMcqxf2 HICUMstate+84 +#define HICUMgqxf2 HICUMstate+85 +#define HICUMixf2_Vbiei HICUMstate+86 +#define HICUMixf2_Vbici HICUMstate+87 +#define HICUMixf2_Vfx1 HICUMstate+88 + +#define HICUMnumStates 89 /* per model data */ typedef struct sHICUMmodel { /* model structure for a hicum */ diff --git a/src/spicelib/devices/hicum2/hicum2load.c b/src/spicelib/devices/hicum2/hicum2load.c index cbc818949..e017c5685 100644 --- a/src/spicelib/devices/hicum2/hicum2load.c +++ b/src/spicelib/devices/hicum2/hicum2load.c @@ -508,6 +508,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) double Ixf1,Ixf2,Qxf1,Qxf2; double Itxf, Qdeix; double Vxf, Ixf, Qxf; + double Vxf1, Vxf2; double hjei_vbe; @@ -590,8 +591,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) //NQS double Vbxf, Vbxf1, Vbxf2; - double Qxf_Vxf; - double Iqxf, Iqxf_Vxf, Iqxf1, Iqxf2; + double Qxf_Vxf, Qxf1_Vxf1, Qxf2_Vxf2; + double Iqxf, Iqxf_Vxf, Iqxf1, Iqxf1_Vxf1, Iqxf2, Iqxf2_Vxf2; double Ith, Vrth, Icth, Icth_Vrth, delvrth; @@ -1339,8 +1340,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Qr = Tr*itr; } //if - itf_Vbiei = itf/VT_f; - itr_Vbici = itr/here->HICUMvt; + itf_Vbiei = itf/VT_f; // TODO: missing the derivatives of Qf + itr_Vbici = itr/here->HICUMvt; // TODO: missing the derivatives of Qpt //NQS effect implemented with LCR networks //Once the delay in ITF is considered, IT_NQS is calculated afterwards @@ -1576,20 +1577,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)) { - double Vxf1, Vxf2, fact; Vxf1 = Vbxf1; Vxf2 = Vbxf2; Ixf1 = (Vxf2-itf)/Tf*model->HICUMt0; Ixf2 = (Vxf2-Vxf1)/Tf*model->HICUMt0; - Qxf1 = model->HICUMalit*Vxf1*model->HICUMt0; - Qxf2 = model->HICUMalit*Vxf2/3*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; + // TODO derivatives of Ixf1 and Ixf2 + Vxf = Vbxf; //for RC nw - fact = model->HICUMt0/Tf; //for RC nw - Ixf = (Vxf - Qdei)*fact; //for RC nw - Qxf = model->HICUMalqf*Vxf*model->HICUMt0; //for RC nw + Ixf = (Vxf - Qdei)*model->HICUMt0/Tf; //for RC nw + Qxf = model->HICUMalqf*model->HICUMt0*Vxf; //for RC nw Qxf_Vxf = model->HICUMalqf*model->HICUMt0; //for RC nw Qdeix = Vxf; //for RC nw } else { @@ -1597,6 +1600,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Ixf2 = Vbxf2; Qxf1 = 0; Qxf2 = 0; + Qxf1_Vxf1 = 0; + Qxf2_Vxf2 = 0; Ixf = Vbxf; Qxf = 0; @@ -1795,6 +1800,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) *(ckt->CKTstate0 + here->HICUMqbcpar2) = Qbcpar2; *(ckt->CKTstate0 + here->HICUMqsu) = Qsu; //NQS + *(ckt->CKTstate0 + here->HICUMqxf1) = Qxf1; + *(ckt->CKTstate0 + here->HICUMqxf2) = Qxf2; *(ckt->CKTstate0 + here->HICUMqxf) = Qxf; if (model->HICUMflsh) *(ckt->CKTstate0 + here->HICUMqcth) = Qcth; @@ -1837,6 +1844,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) *(ckt->CKTstate0 + here->HICUMcqbcpar2) = Qbcpar2_Vbpci; *(ckt->CKTstate0 + here->HICUMcqsu) = Qsu_Vsis; //NQS + *(ckt->CKTstate0 + here->HICUMcqxf1) = Qxf1_Vxf1; + *(ckt->CKTstate0 + here->HICUMcqxf2) = Qxf2_Vxf2; *(ckt->CKTstate0 + here->HICUMcqxf) = Qxf_Vxf; if (model->HICUMflsh) *(ckt->CKTstate0 + here->HICUMcqcth) = model->HICUMcth; @@ -1949,7 +1958,17 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Isc_Vsc = geq; Isc = *(ckt->CKTstate0 + here->HICUMcqscp); //NQS -// Icxf += ddt(Qxf); //for RC nw +// Iqxf1 <+ ddt(Qxf1); + error = NIintegrate(ckt,&geq,&ceq,Qxf1_Vxf1,here->HICUMqxf); + if(error) return(error); + Iqxf1_Vxf1 = geq; + Iqxf1 = *(ckt->CKTstate0 + here->HICUMcqxf1); +// Iqxf2 <+ ddt(Qxf2); + error = NIintegrate(ckt,&geq,&ceq,Qxf2_Vxf2,here->HICUMqxf); + if(error) return(error); + Iqxf2_Vxf2 = geq; + Iqxf2 = *(ckt->CKTstate0 + here->HICUMcqxf2); +// Iqxf += ddt(Qxf); //for RC nw error = NIintegrate(ckt,&geq,&ceq,Qxf_Vxf,here->HICUMqxf); if(error) return(error); Iqxf_Vxf = geq; @@ -2292,6 +2311,48 @@ c Branch: sis, Stamp element: Rsu *(here->HICUMsubsSubsSIPtr) += -Isis_Vsis; //NQS /* +c Branch: xf1-ground, Stamp element: Ixf1 +*/ +// rhs_current = (Ixf1 - Ixf1_Vrth*Vrth - Ixf1_Vbiei*Vbiei - Ixf1_Vbici*Vbici - Ixf2_Vxf2*Vxf2); + rhs_current = Ixf1; + *(ckt->CKTrhs + here->HICUMxf1Node) += rhs_current; // into xf1 node +// *(here->HICUMxf1TempPtr) += -Ixf1_Vrth; +// *(here->HICUMxf1BaseBIPtr) += -Ixf1_Vbiei; +// *(here->HICUMxf1EmitEIPtr) += +Ixf1_Vbiei; +// *(here->HICUMxf1BaseBIPtr) += -Ixf1_Vbici; +// *(here->HICUMxf1CollCIPtr) += +Ixf1_Vbici; +// *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; // TODO +/* +c Branch: xf1-ground, Stamp element: Qxf1 +*/ + rhs_current = Iqxf1 - Iqxf1_Vxf1*Vxf1; + *(ckt->CKTrhs + here->HICUMxf1Node) += rhs_current; // into ground + *(here->HICUMxf1Xf1Ptr) += Iqxf1_Vxf1; +/* +c Branch: xf1-ground, Stamp element: Rxf1 +*/ + *(here->HICUMxf1Xf1Ptr) += Tf; // current Ixf1 is normalized to Tf +/* +c Branch: xf2-ground, Stamp element: Ixf2 +*/ + rhs_current = Ixf2; + *(ckt->CKTrhs + here->HICUMxf2Node) += rhs_current; // into xf node +// *(here->HICUMxf2TempPtr) += -Ixf2_Vrth; +// *(here->HICUMxf2BaseBIPtr) += -Ixf2_Vbiei; +// *(here->HICUMxf2EmitEIPtr) += +Ixf2_Vbiei; +// *(here->HICUMxf2BaseBIPtr) += -Ixf2_Vbici; +// *(here->HICUMxf2CollCIPtr) += +Ixf2_Vbici; +/* +c Branch: xf2-ground, Stamp element: Qxf2 +*/ + rhs_current = Iqxf2 - Iqxf2_Vxf2*Vxf2; + *(ckt->CKTrhs + here->HICUMxf2Node) += rhs_current; // into ground + *(here->HICUMxf2Xf2Ptr) += Iqxf2_Vxf2; +/* +c Branch: xf2-ground, Stamp element: Rxf2 +*/ + *(here->HICUMxf2Xf2Ptr) += Tf; // current Ixf2 is normalized to Tf +/* c Branch: xf-ground, Stamp element: Ixf */ // rhs_current = model->HICUMtype * (Ixf - Ixf_Vrth*Vrth - Ixf_Vbiei*Vbiei - Ixf_Vbici*Vbici); diff --git a/tests/hicum2/FG.cir b/tests/hicum2/FG.cir index 3328ae9c9..5f71028d0 100644 --- a/tests/hicum2/FG.cir +++ b/tests/hicum2/FG.cir @@ -23,12 +23,12 @@ 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=1 kf=0 ++ cbepar=2.609e-014 cbcpar=1.64512e-014 alqf=0.166667 alit=0.333333 flnqs=0 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 -+ zetact=5 zetabet=4.892 flsh=1 rth=1113.4 cth=6.841e-012 zetarth=0 -+ alrth=0.002 flcomp=0.0 tnom=26.85 acbar=1.5 flcono=0 icbar=0.01 ++ zetact=5 zetabet=4.892 flsh=0 rth=1113.4 cth=6.841e-012 zetarth=0 ++ alrth=0.002 flcomp=2.4 tnom=26.85 acbar=1.5 flcono=0 icbar=0.01 + vcbar=0.04 zetavgbe=0.7 hf0=40 ahjei=3 rhjei=2 delck=2 zetahjei=-0.5 diff --git a/tests/hicum2/FG.out b/tests/hicum2/FG.out index bffed4566..9382b81bf 100644 --- a/tests/hicum2/FG.out +++ b/tests/hicum2/FG.out @@ -1,5 +1,4 @@ - No. of Data Rows : 101 Circuit: HICUML2 v2.4.0 Gummel Test @@ -9,105 +8,109 @@ Doing analysis at TEMP = 300.150000 and TNOM = 300.150000 -------------------------------------------------------------------------------- Index v-sweep abs(i(vc)) abs(i(vb)) -------------------------------------------------------------------------------- -0 2.000000e-01 4.049351e-13 2.225580e-12 -1 2.100000e-01 5.113450e-13 2.709949e-12 -2 2.200000e-01 6.630802e-13 3.303959e-12 -3 2.300000e-01 8.814445e-13 4.033035e-12 -4 2.400000e-01 1.197752e-12 4.928519e-12 -5 2.500000e-01 1.658029e-12 6.029049e-12 -6 2.600000e-01 2.329925e-12 7.382271e-12 -7 2.700000e-01 3.312868e-12 9.046943e-12 -8 2.800000e-01 4.752984e-12 1.109555e-11 -9 2.900000e-01 6.865025e-12 1.361750e-11 -10 3.000000e-01 9.964585e-12 1.672315e-11 -11 3.100000e-01 1.451543e-11 2.054869e-11 -12 3.200000e-01 2.119904e-11 2.526227e-11 -13 3.300000e-01 3.101675e-11 3.107153e-11 -14 3.400000e-01 4.543985e-11 3.823301e-11 -15 3.500000e-01 6.662994e-11 4.706370e-11 -16 3.600000e-01 9.776277e-11 5.795551e-11 -17 3.700000e-01 1.435036e-10 7.139318e-11 -18 3.800000e-01 2.107056e-10 8.797657e-11 -19 3.900000e-01 3.094351e-10 1.084485e-10 -20 4.000000e-01 4.544769e-10 1.337292e-10 -21 4.100000e-01 6.675448e-10 1.649602e-10 -22 4.200000e-01 9.805260e-10 2.035581e-10 -23 4.300000e-01 1.440243e-09 2.512831e-10 -24 4.400000e-01 2.115444e-09 3.103247e-10 -25 4.500000e-01 3.107058e-09 3.834107e-10 -26 4.600000e-01 4.563242e-09 4.739441e-10 -27 4.700000e-01 6.701457e-09 5.861787e-10 -28 4.800000e-01 9.840846e-09 7.254419e-10 -29 4.900000e-01 1.444971e-08 8.984222e-10 -30 5.000000e-01 2.121510e-08 1.113538e-09 -31 5.100000e-01 3.114486e-08 1.381420e-09 -32 5.200000e-01 4.571712e-08 1.715539e-09 -33 5.300000e-01 6.709928e-08 2.133002e-09 -34 5.400000e-01 9.846869e-08 2.655677e-09 -35 5.500000e-01 1.444821e-07 3.311602e-09 -36 5.600000e-01 2.119626e-07 4.136919e-09 -37 5.700000e-01 3.109041e-07 5.178468e-09 -38 5.800000e-01 4.559399e-07 6.497298e-09 -39 5.900000e-01 6.684879e-07 8.173459e-09 -40 6.000000e-01 9.798838e-07 1.031258e-08 -41 6.100000e-01 1.435954e-06 1.305493e-08 -42 6.200000e-01 2.103689e-06 1.658806e-08 -43 6.300000e-01 3.080976e-06 2.116430e-08 -44 6.400000e-01 4.510769e-06 2.712546e-08 -45 6.500000e-01 6.598624e-06 3.493740e-08 -46 6.600000e-01 9.651558e-06 4.523897e-08 -47 6.700000e-01 1.410969e-05 5.891122e-08 -48 6.800000e-01 2.061503e-05 7.717565e-08 -49 6.900000e-01 3.009990e-05 1.017337e-07 -50 7.000000e-01 4.391594e-05 1.349652e-07 -51 7.100000e-01 6.401850e-05 1.802097e-07 -52 7.200000e-01 9.322680e-05 2.421649e-07 -53 7.300000e-01 1.355843e-04 3.274474e-07 -54 7.400000e-01 1.968435e-04 4.453752e-07 -55 7.500000e-01 2.850922e-04 6.090441e-07 -56 7.600000e-01 4.115088e-04 8.367799e-07 -57 7.700000e-01 5.911811e-04 1.154039e-06 -58 7.800000e-01 8.438251e-04 1.595796e-06 -59 7.900000e-01 1.194123e-03 2.209384e-06 -60 8.000000e-01 1.671327e-03 3.057614e-06 -61 8.100000e-01 2.307843e-03 4.221915e-06 -62 8.200000e-01 3.136856e-03 5.805096e-06 -63 8.300000e-01 4.189465e-03 7.933416e-06 -64 8.400000e-01 5.492130e-03 1.075774e-05 -65 8.500000e-01 7.065050e-03 1.445376e-05 -66 8.600000e-01 8.921662e-03 1.922145e-05 -67 8.700000e-01 1.106902e-02 2.528408e-05 -68 8.800000e-01 1.350859e-02 3.288743e-05 -69 8.900000e-01 1.623721e-02 4.229989e-05 -70 9.000000e-01 1.924788e-02 5.381443e-05 -71 9.100000e-01 2.253041e-02 6.775416e-05 -72 9.200000e-01 2.607182e-02 8.448562e-05 -73 9.300000e-01 2.985650e-02 1.044530e-04 -74 9.400000e-01 3.386575e-02 1.282787e-04 -75 9.500000e-01 3.807605e-02 1.570841e-04 -76 9.600000e-01 4.245317e-02 1.935144e-04 -77 9.700000e-01 4.693613e-02 2.446155e-04 -78 9.800000e-01 5.140989e-02 3.270976e-04 -79 9.900000e-01 5.571579e-02 4.668657e-04 -80 1.000000e+00 5.977060e-02 6.784053e-04 -81 1.010000e+00 6.363845e-02 9.483720e-04 -82 1.020000e+00 6.743270e-02 1.251993e-03 -83 1.030000e+00 7.123467e-02 1.571674e-03 -84 1.040000e+00 7.508885e-02 1.899848e-03 -85 1.050000e+00 7.901772e-02 2.235275e-03 -86 1.060000e+00 8.303174e-02 2.579678e-03 -87 1.070000e+00 8.713429e-02 2.935896e-03 -88 1.080000e+00 9.132395e-02 3.307053e-03 -89 1.090000e+00 9.559576e-02 3.696236e-03 -90 1.100000e+00 9.994202e-02 4.106396e-03 -91 1.110000e+00 1.043530e-01 4.540339e-03 -92 1.120000e+00 1.088174e-01 5.000748e-03 -93 1.130000e+00 1.133230e-01 5.490201e-03 -94 1.140000e+00 1.178571e-01 6.011191e-03 -95 1.150000e+00 1.224071e-01 6.566120e-03 -96 1.160000e+00 1.269605e-01 7.157300e-03 -97 1.170000e+00 1.315057e-01 7.786926e-03 -98 1.180000e+00 1.360319e-01 8.457060e-03 -99 1.190000e+00 1.405293e-01 9.169599e-03 -100 1.200000e+00 1.449897e-01 9.926253e-03 +0 2.000000e-01 4.049275e-13 2.228959e-12 +1 2.100000e-01 5.113338e-13 2.714122e-12 +2 2.200000e-01 6.630638e-13 3.309110e-12 +3 2.300000e-01 8.814204e-13 4.039392e-12 +4 2.400000e-01 1.197716e-12 4.936361e-12 +5 2.500000e-01 1.657977e-12 6.038721e-12 +6 2.600000e-01 2.329849e-12 7.394200e-12 +7 2.700000e-01 3.312756e-12 9.061656e-12 +8 2.800000e-01 4.752819e-12 1.111369e-11 +9 2.900000e-01 6.864784e-12 1.363988e-11 +10 3.000000e-01 9.964231e-12 1.675076e-11 +11 3.100000e-01 1.451491e-11 2.058275e-11 +12 3.200000e-01 2.119828e-11 2.530429e-11 +13 3.300000e-01 3.101563e-11 3.112340e-11 +14 3.400000e-01 4.543821e-11 3.829703e-11 +15 3.500000e-01 6.662754e-11 4.714276e-11 +16 3.600000e-01 9.775923e-11 5.805316e-11 +17 3.700000e-01 1.434984e-10 7.151385e-11 +18 3.800000e-01 2.106980e-10 8.812576e-11 +19 3.900000e-01 3.094239e-10 1.086330e-10 +20 4.000000e-01 4.544606e-10 1.339576e-10 +21 4.100000e-01 6.675208e-10 1.652431e-10 +22 4.200000e-01 9.804908e-10 2.039088e-10 +23 4.300000e-01 1.440192e-09 2.517182e-10 +24 4.400000e-01 2.115368e-09 3.108651e-10 +25 4.500000e-01 3.106947e-09 3.840828e-10 +26 4.600000e-01 4.563079e-09 4.747812e-10 +27 4.700000e-01 6.701220e-09 5.872228e-10 +28 4.800000e-01 9.840498e-09 7.267469e-10 +29 4.900000e-01 1.444920e-08 9.000565e-10 +30 5.000000e-01 2.121435e-08 1.115590e-09 +31 5.100000e-01 3.114377e-08 1.384003e-09 +32 5.200000e-01 4.571552e-08 1.718801e-09 +33 5.300000e-01 6.709694e-08 2.137136e-09 +34 5.400000e-01 9.846526e-08 2.660936e-09 +35 5.500000e-01 1.444771e-07 3.318322e-09 +36 5.600000e-01 2.119553e-07 4.145547e-09 +37 5.700000e-01 3.108934e-07 5.189603e-09 +38 5.800000e-01 4.559242e-07 6.511750e-09 +39 5.900000e-01 6.684650e-07 8.192332e-09 +40 6.000000e-01 9.798502e-07 1.033739e-08 +41 6.100000e-01 1.435905e-06 1.308778e-08 +42 6.200000e-01 2.103617e-06 1.663188e-08 +43 6.300000e-01 3.080871e-06 2.122323e-08 +44 6.400000e-01 4.510615e-06 2.720542e-08 +45 6.500000e-01 6.598398e-06 3.504698e-08 +46 6.600000e-01 9.651225e-06 4.539080e-08 +47 6.700000e-01 1.410919e-05 5.912434e-08 +48 6.800000e-01 2.061429e-05 7.747943e-08 +49 6.900000e-01 3.009878e-05 1.021749e-07 +50 7.000000e-01 4.391421e-05 1.356208e-07 +51 7.100000e-01 6.401579e-05 1.812111e-07 +52 7.200000e-01 9.322242e-05 2.437450e-07 +53 7.300000e-01 1.355770e-04 3.300338e-07 +54 7.400000e-01 1.968310e-04 4.497756e-07 + + +Index v-sweep abs(i(vc)) abs(i(vb)) +-------------------------------------------------------------------------------- +55 7.500000e-01 2.850699e-04 6.168209e-07 +56 7.600000e-01 4.114682e-04 8.510009e-07 +57 7.700000e-01 5.911057e-04 1.180776e-06 +58 7.800000e-01 8.436838e-04 1.647063e-06 +59 7.900000e-01 1.193858e-03 2.308771e-06 +60 8.000000e-01 1.670833e-03 3.250770e-06 +61 8.100000e-01 2.306936e-03 4.595327e-06 +62 8.200000e-01 3.135216e-03 6.518404e-06 +63 8.300000e-01 4.186547e-03 9.272757e-06 +64 8.400000e-01 5.486996e-03 1.322038e-05 +65 8.500000e-01 7.056092e-03 1.887770e-05 +66 8.600000e-01 8.906138e-03 2.697768e-05 +67 8.700000e-01 1.104232e-02 3.855417e-05 +68 8.800000e-01 1.346315e-02 5.505385e-05 +69 8.900000e-01 1.616097e-02 7.848113e-05 +70 9.000000e-01 1.912221e-02 1.115788e-04 +71 9.100000e-01 2.232745e-02 1.580423e-04 +72 9.200000e-01 2.575127e-02 2.227555e-04 +73 9.300000e-01 2.936192e-02 3.120267e-04 +74 9.400000e-01 3.312105e-02 4.337950e-04 +75 9.500000e-01 3.698335e-02 5.977980e-04 +76 9.600000e-01 4.089592e-02 8.157592e-04 +77 9.700000e-01 4.479692e-02 1.101748e-03 +78 9.800000e-01 4.861470e-02 1.472727e-03 +79 9.900000e-01 5.227379e-02 1.948274e-03 +80 1.000000e+00 5.571609e-02 2.547054e-03 +81 1.010000e+00 5.892578e-02 3.280006e-03 +82 1.020000e+00 6.192652e-02 4.146849e-03 +83 1.030000e+00 6.475256e-02 5.140281e-03 +84 1.040000e+00 6.742704e-02 6.252158e-03 +85 1.050000e+00 6.995901e-02 7.476142e-03 +86 1.060000e+00 7.234907e-02 8.807408e-03 +87 1.070000e+00 7.459498e-02 1.024167e-02 +88 1.080000e+00 7.669484e-02 1.177455e-02 +89 1.090000e+00 7.864841e-02 1.340130e-02 +90 1.100000e+00 8.045738e-02 1.511689e-02 +91 1.110000e+00 8.212510e-02 1.691606e-02 +92 1.120000e+00 8.365625e-02 1.879352e-02 +93 1.130000e+00 8.505642e-02 2.074401e-02 +94 1.140000e+00 8.633178e-02 2.276245e-02 +95 1.150000e+00 8.748886e-02 2.484396e-02 +96 1.160000e+00 8.853430e-02 2.698392e-02 +97 1.170000e+00 8.947473e-02 2.917797e-02 +98 1.180000e+00 9.031666e-02 3.142205e-02 +99 1.190000e+00 9.106643e-02 3.371235e-02 +100 1.200000e+00 9.173014e-02 3.604534e-02 From c7e5df27dbd5b74586d64c9404166e67a1c7af62 Mon Sep 17 00:00:00 2001 From: mariok Date: Thu, 16 Apr 2020 14:44:41 +0200 Subject: [PATCH 2/8] 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 From 9da946bf2d5beaa1a1e74c0465d78bfd079bc320 Mon Sep 17 00:00:00 2001 From: mariok Date: Mon, 20 Apr 2020 09:59:49 +0200 Subject: [PATCH 3/8] started derivatives of hicum2 minority charge --- .gitignore | 2 + src/spicelib/devices/hicum2/hicum2load.c | 91 +++++++++++++++--------- 2 files changed, 58 insertions(+), 35 deletions(-) diff --git a/.gitignore b/.gitignore index fdcecdeb4..00f4e45b4 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,5 @@ Makefile.in # Visual Studio user options files **/*.vcxproj.user +# Visual Studio Code user options files +.vscode/ diff --git a/src/spicelib/devices/hicum2/hicum2load.c b/src/spicelib/devices/hicum2/hicum2load.c index 0546b7934..2145920cc 100644 --- a/src/spicelib/devices/hicum2/hicum2load.c +++ b/src/spicelib/devices/hicum2/hicum2load.c @@ -502,6 +502,9 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) double a_h,Q_pT,d_Q; double Qf,Cdei,Qr,Cdci; double ick,vc,cjcx01,cjcx02; + double ick_Vciei; + double Qf_Vbiei, Qf_Vbici, Q_bf_Vbiei, Q_bf_Vbici, Qr_Vbiei, Qr_Vbici, Q_pT_Vbiei, Q_pT_Vbici; + int l_it; //NQS @@ -1226,6 +1229,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) //Critical current for onset of high-current effects { // HICICK double Ovpt,a,d1,vceff,a1,a11,Odelck,ick1,ick2,ICKa; + double d1_Vciei, vceff_Vciei, a1_Vciei, ick1_Vciei, ick2_Vciei, ICKa_Vciei; Ovpt = 1.0/model->HICUMvpt; a = vc/here->HICUMvt; d1 = a-1; @@ -1239,6 +1243,18 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) ICKa = (vceff-here->HICUMvlim_t)*Ovpt; ick = ick2*(1.0+0.5*(ICKa+sqrt(ICKa*ICKa+model->HICUMaick))); + // derivative: maxima + d1_Vciei = 1/here->HICUMvt; + // vceff_Vciei = (((d_1*d1_Vciei/sqrt(d_1^2+1.921812)+d1_Vciei)*v_t)/2 + vceff_Vciei = (d1*d1_Vciei/sqrt(d1*d1+1.921812)+d1_Vciei)*here->HICUMvt/2; + a1_Vciei = vceff_Vciei/here->HICUMvlim_t; + // ick1_Vciei = (exp(log(exp(d_elck*log(a1))+1)/d_elck+d_elck*log(a1))*a1_Vciei)/(a1*(exp(d_elck*log(a1))+1)) + ick1_Vciei = (exp(Odelck*log(1+exp(model->HICUMdelck*log(a1))) + model->HICUMdelck*log(a1))*a1_Vciei)/(a1*(exp(model->HICUMdelck*log(a1))+1)); + ick2_Vciei = -1.0*a11*ick1_Vciei/ick1/ick1; + ICKa_Vciei = vceff_Vciei*Ovpt; + + // ick_Vciei = (0.5*(sqrt(I_CKa(x)^2+a_ick)+I_CKa(x))+1.0)*('diff(i_ck2(x),x,1))+0.5*i_ck2(x)*((I_CKa(x)*('diff(I_CKa(x),x,1)))/sqrt(I_CKa(x)^2+a_ick)+'diff(I_CKa(x),x,1)) + ick_Vciei = (0.5*(sqrt(ICKa*ICKa+model->HICUMaick)+ICKa)+1.0)*ick2_Vciei+0.5*ick2*((ICKa*(ICKa_Vciei))/sqrt(ICKa*ICKa+model->HICUMaick)+ICKa_Vciei); } //Initialization @@ -1283,7 +1299,6 @@ 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 //Initial formulation of reverse diffusion charge Qr = Tr*itr; @@ -1293,7 +1308,6 @@ 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 d_Q = Q_pT; while (fabs(d_Q) >= RTOLC*fabs(Q_pT) && l_it <= l_itmax) { double a; @@ -1337,6 +1351,21 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) } //if // TODO calculate here the derivatives once! They are not needed inside the newton... + // Qf = Tf*itf; + Qf_Vbiei = 0; + Qf_Vbici = 0; + // Qr = Tr*itr; + Qr_Vbiei = 0; + Qr_Vbici = 0; + // Q_pT = Q_0+Qf+Qr; + Q_pT_Vbiei = Q_0_Vbiei + Qf_Vbiei + Qr_Vbiei; + Q_pT_Vbici = Q_0_Vbici + Qf_Vbici + Qr_Vbici; + // Q_bf = Q_0+Qf+Qr; + Q_bf_Vbiei = 0; + Q_bf_Vbici = 0; + + // itf, itr +//TODO: itf=f(Vbiei,Vbici) -> Qf, Q_bf Ableitungen nach Vbiei, Vbici itf_Vbiei = itf/VT_f; // TODO: missing the derivatives of Qf itr_Vbici = itr/here->HICUMvt; // TODO: missing the derivatives of Qpt @@ -1395,10 +1424,10 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) sq_smooth = sqrt(denom*denom+0.01); hl = 0.5*(denom+sq_smooth); iavl = itf*avl/hl; - iavl_Vbici = itf*avl_Vbici/hl; + iavl_Vbici = itf*avl_Vbici/hl; // TODO itf_Vbici } else { iavl = itf*avl; - iavl_Vbici = itf*avl_Vbici; + iavl_Vbici = itf*avl_Vbici; // TODO itf_Vbici } } } else { @@ -1447,6 +1476,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) // Consideration of peripheral charge if(Qf > 0.0) { rbi = rbi*(Qjei+Qf*model->HICUMfqi)/(Qjei+Qf); + // Qf_Viei and Qf_Vbici rbi_Vbiei = (Qjei+Qf*model->HICUMfqi)*rbi_Vbiei/(Qjei+Qf) + rbi*Cjei/(Qjei+Qf) - (Qjei+Qf*model->HICUMfqi)*rbi*Cjei/(Qjei+Qf)/(Qjei+Qf); rbi_Vbici = rbi_Vbici*(Qjei+Qf*model->HICUMfqi)/(Qjei+Qf); } @@ -1574,22 +1604,16 @@ 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 = Vbxf1; - Ixf2 = Vbxf2; - Qxf1 = 0; - Qxf2 = 0; - Qxf1_Vxf1 = 0; - Qxf2_Vxf2 = 0; + 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; // TODO derivatives of Ixf1 and Ixf2 @@ -2316,7 +2340,7 @@ c Branch: sis, Stamp element: Rsu /* c Branch: xf1-ground, Stamp element: Ixf1 */ -// rhs_current = (Ixf1 - Ixf1_Vrth*Vrth - Ixf1_Vbiei*Vbiei - Ixf1_Vbici*Vbici - Ixf2_Vxf2*Vxf2); +// rhs_current = (Ixf1 - Ixf1_Vxf1*Vxf1 - Ixf1_Vrth*Vrth - Ixf1_Vbiei*Vbiei - Ixf1_Vbici*Vbici - Ixf1_Vxf2*Vxf2); // TODO rhs_current = Ixf1; *(ckt->CKTrhs + here->HICUMxf1Node) += rhs_current; // into xf1 node // *(here->HICUMxf1TempPtr) += -Ixf1_Vrth; @@ -2324,33 +2348,30 @@ c Branch: xf1-ground, Stamp element: Ixf1 // *(here->HICUMxf1EmitEIPtr) += +Ixf1_Vbiei; // *(here->HICUMxf1BaseBIPtr) += -Ixf1_Vbici; // *(here->HICUMxf1CollCIPtr) += +Ixf1_Vbici; -// *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; // TODO +// *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; /* -c Branch: xf1-ground, Stamp element: Qxf1 +c Branch: xf1-ground, Stamp element: Qxf1 // TODO Test in AC simulation! */ - rhs_current = Iqxf1 - Iqxf1_Vxf1*Vxf1; - *(ckt->CKTrhs + here->HICUMxf1Node) += rhs_current; // into ground - *(here->HICUMxf1Xf1Ptr) += Iqxf1_Vxf1; -/* -c Branch: xf1-ground, Stamp element: Rxf1 -*/ - *(here->HICUMxf1Xf1Ptr) += 1; // current Ixf1 is normalized to Tf + // rhs_current = Iqxf1 - Iqxf1_Vxf1*Vxf1; + // *(ckt->CKTrhs + here->HICUMxf1Node) += rhs_current; // into ground + // *(here->HICUMxf1Xf1Ptr) += Iqxf1_Vxf1; /* c Branch: xf2-ground, Stamp element: Ixf2 */ +// rhs_current = (Ixf2 - Ixf2_Vxf1*Vxf1 - Ixf2_Vrth*Vrth - Ixf2_Vbiei*Vbiei - Ixf2_Vbici*Vbici - Ixf2_Vxf2*Vxf2); // TODO rhs_current = Ixf2; - *(ckt->CKTrhs + here->HICUMxf2Node) += rhs_current; // into xf node + *(ckt->CKTrhs + here->HICUMxf2Node) += rhs_current; // into xf2 node // *(here->HICUMxf2TempPtr) += -Ixf2_Vrth; // *(here->HICUMxf2BaseBIPtr) += -Ixf2_Vbiei; // *(here->HICUMxf2EmitEIPtr) += +Ixf2_Vbiei; // *(here->HICUMxf2BaseBIPtr) += -Ixf2_Vbici; // *(here->HICUMxf2CollCIPtr) += +Ixf2_Vbici; /* -c Branch: xf2-ground, Stamp element: Qxf2 +c Branch: xf2-ground, Stamp element: Qxf2 // TODO Test in AC simulation! */ - rhs_current = Iqxf2 - Iqxf2_Vxf2*Vxf2; - *(ckt->CKTrhs + here->HICUMxf2Node) += rhs_current; // into ground - *(here->HICUMxf2Xf2Ptr) += Iqxf2_Vxf2; + // rhs_current = Iqxf2 - Iqxf2_Vxf2*Vxf2; + // *(ckt->CKTrhs + here->HICUMxf2Node) += rhs_current; // into ground + // *(here->HICUMxf2Xf2Ptr) += Iqxf2_Vxf2; /* c Branch: xf2-ground, Stamp element: Rxf2 */ @@ -2367,7 +2388,7 @@ c Branch: xf-ground, Stamp element: Ixf // *(here->HICUMxfBaseBIPtr) += -Ixf_Vbici; // *(here->HICUMxfCollCIPtr) += +Ixf_Vbici; /* -c Branch: xf-ground, Stamp element: Qxf +c Branch: xf-ground, Stamp element: Qxf // TODO Test in AC simulation! */ // rhs_current = model->HICUMtype * (Iqxf - Iqxf_Vxf*Vxf); // *(ckt->CKTrhs + here->HICUMxfNode) += rhs_current; // into ground From 0d94c5d56d86c52ab0638e095d7c6b816723929f Mon Sep 17 00:00:00 2001 From: mariok Date: Mon, 20 Apr 2020 10:56:58 +0200 Subject: [PATCH 4/8] moved cppduals to system lib include --- src/spicelib/devices/hicum2/Makefile.am | 4 ++-- src/spicelib/devices/hicum2/hicumL2.cpp | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/spicelib/devices/hicum2/Makefile.am b/src/spicelib/devices/hicum2/Makefile.am index 649276366..11cfed773 100644 --- a/src/spicelib/devices/hicum2/Makefile.am +++ b/src/spicelib/devices/hicum2/Makefile.am @@ -27,7 +27,7 @@ libhicum2_la_SOURCES = \ AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include -lstdc++ -AM_CFLAGS = -I/home/markus/Documents/Gitprojects/cppduals -lstdc++ -I$(top_srcdir)/src/include -AM_CXXFLAGS = -I/home/markus/Documents/Gitprojects/cppduals -I$(top_srcdir)/src/include -lstdc++ +AM_CFLAGS = -lstdc++ -I$(top_srcdir)/src/include +AM_CXXFLAGS = -I$(top_srcdir)/src/include -lstdc++ MAINTAINERCLEANFILES = Makefile.in diff --git a/src/spicelib/devices/hicum2/hicumL2.cpp b/src/spicelib/devices/hicum2/hicumL2.cpp index 0b5020e18..7a4eb12d5 100644 --- a/src/spicelib/devices/hicum2/hicumL2.cpp +++ b/src/spicelib/devices/hicum2/hicumL2.cpp @@ -1,5 +1,5 @@ #include "cmath" -#include "duals/dual" +#include #include "hicumL2.hpp" //ngspice header files written in C @@ -41,8 +41,8 @@ extern "C" //HICUM DEFINITIONS -#define CHARGE 1.6021766208e-19 -#define CONSTboltz 1.38064852e-23 +#define CHARGE 1.6021766208e-19 +#define CONSTboltz 1.38064852e-23 #define VPT_thresh 1.0e2 #define Dexp_lim 80.0 #define Cexp_lim 80.0 @@ -146,7 +146,7 @@ void QJMODF(duals::duald T, double c_0, double u_d, double z, double a_j, duals: // C : depletion capacitance void QJMOD(duals::duald T, duals::duald c_0, double u_d, double z, double a_j, double v_pt, duals::duald U_cap, duals::duald * C, duals::duald * Qz) { - duals::duald dummy, DQ_j1, DQ_j2, DQ_j3, DC_j1, DC_j2, DC_j3, De_1, De_2, Dzr1, DCln1, DCln2, Dz1, Dv_j1, Dv_j2, Dv_j3, De, Da, Dv_r, Dv_j4, Dv_e, DC_c, DC_max, DV_f, Dv_p, Dz_r, vt; + duals::duald dummy, DQ_j1, DQ_j2, DQ_j3, DC_j1, DC_j2, DC_j3, De_1, De_2, Dzr1, DCln1, DCln2, Dz1, Dv_j1, Dv_j2, Dv_j3, De, Da, Dv_r, Dv_j4, Dv_e, DC_c, DC_max, DV_f, Dv_p, Dz_r, vt; vt = CONSTboltz * T / CHARGE; if (c_0 > 0.0){ Dz_r = z/4.0; @@ -199,7 +199,7 @@ void QJMOD(duals::duald T, duals::duald c_0, double u_d, double z, double a_j, d // OUTPUT: // hicfcio : function of equation (2.1.17-10) void HICFCI(double zb, double zl, double w, double hicfcio, double dhicfcio_dw) -{ +{ double a, a2, a3, r, lnzb, x, z; z = zb*w; lnzb = log(1+zb*w); @@ -1920,7 +1920,6 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) } // Ibpbi += ddt(Qrbi); - dummdumm(int(0)); error = NIintegrate(ckt,&geq,&ceq,Qrbi_Vbpbi,here->HICUMqrbi); if(error) return(error); Ibpbi_Vbpbi += geq; From f5a1c35d803a2406e114133bb469705acd2fb7e5 Mon Sep 17 00:00:00 2001 From: mariok Date: Thu, 23 Apr 2020 14:14:40 +0200 Subject: [PATCH 5/8] removed dummdumm --- src/include/ngspice/cktdefs.h | 1 - src/maths/ni/niinteg.c | 12 +++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/include/ngspice/cktdefs.h b/src/include/ngspice/cktdefs.h index 7afcc54dd..fa1d1031a 100644 --- a/src/include/ngspice/cktdefs.h +++ b/src/include/ngspice/cktdefs.h @@ -440,7 +440,6 @@ extern int NIconvTest(CKTcircuit *); extern void NIdestroy(CKTcircuit *); extern int NIinit(CKTcircuit *); extern int NIintegrate(CKTcircuit *, double *, double *, double , int); -extern void dummdumm(int dumm); extern int NIiter(CKTcircuit * , int); extern int NIpzMuller(PZtrial **, PZtrial *); extern int NIpzComplex(PZtrial **, PZtrial *); diff --git a/src/maths/ni/niinteg.c b/src/maths/ni/niinteg.c index 30136621d..37fb32170 100644 --- a/src/maths/ni/niinteg.c +++ b/src/maths/ni/niinteg.c @@ -14,12 +14,6 @@ Author: 1985 Thomas L. Quarles #define ccap qcap+1 -void dummdumm(int dumm) -{ - double dummy; - dummy=1; -} - int NIintegrate(CKTcircuit *ckt, double *geq, double *ceq, double cap, int qcap) { @@ -31,12 +25,12 @@ NIintegrate(CKTcircuit *ckt, double *geq, double *ceq, double cap, int qcap) case TRAPEZOIDAL: switch(ckt->CKTorder) { case 1: - ckt->CKTstate0[ccap] = ckt->CKTag[0] * ckt->CKTstate0[qcap] + ckt->CKTstate0[ccap] = ckt->CKTag[0] * ckt->CKTstate0[qcap] + ckt->CKTag[1] * ckt->CKTstate1[qcap]; break; case 2: - ckt->CKTstate0[ccap] = - ckt->CKTstate1[ccap] * ckt->CKTag[1] + - ckt->CKTag[0] * + ckt->CKTstate0[ccap] = - ckt->CKTstate1[ccap] * ckt->CKTag[1] + + ckt->CKTag[0] * ( ckt->CKTstate0[qcap] - ckt->CKTstate1[qcap] ); break; default: From 0d0c6a0800681868ad8aa3f14367d1f81936e593 Mon Sep 17 00:00:00 2001 From: mariok Date: Thu, 23 Apr 2020 16:26:37 +0200 Subject: [PATCH 6/8] assigned the temperature derivates to me --- src/spicelib/devices/hicum2/hicumL2.cpp | 9 ++++----- src/spicelib/devices/hicum2/overview_files.md | 4 ++++ tests/hicum2/FG.cir | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/spicelib/devices/hicum2/hicumL2.cpp b/src/spicelib/devices/hicum2/hicumL2.cpp index 9f14fed39..b7d21b174 100644 --- a/src/spicelib/devices/hicum2/hicumL2.cpp +++ b/src/spicelib/devices/hicum2/hicumL2.cpp @@ -6,7 +6,7 @@ Spice3 Implementation: 2019 Dietmar Warning, Markus Müller, Mario Krattenmacher **********/ /* - * This file defines the HICUM L2.4.3 model load function + * This file defines the HICUM L2.4.0 model load function * Comments on the Code: * - We use dual numbers to calculate derivatives, this is readble and error proof. * - The code is targeted to be readbale and maintainable, speed is sacrificied for this purpose. @@ -31,7 +31,7 @@ Spice3 Implementation: 2019 Dietmar Warning, Markus Müller, Mario Krattenmacher * - Qf * - Qr * - iavl - * - iBEti (?) + * - iBEti * - itf, itr */ @@ -110,7 +110,7 @@ duals::duald HICDIO(duals::duald T, double IST, double UM1, duals::duald U) { duals::duald DIOY, le, vt; - printf("2"); + // printf("2"); vt = UM1 * CONSTboltz * T / CHARGE; DIOY = U/vt; if (IST > 0.0) { @@ -536,7 +536,7 @@ void hicum_diode(double T, double IS, double UM1, double U, double *Iz, double * //wrapper for hicum diode equation that also generates derivatives duals::duald result = 0; - printf("executed diode"); + // printf("executed diode"); result = HICDIO(T, IS, UM1, U+1_e); *Iz = result.rpart(); @@ -1654,7 +1654,6 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) //Tunneling current //TODO: missing temperature derivatives abet_t vdei_t ibets_t cjei0_t vdep_t ibets_t cjep0_t - //@Mario: is there really no direct T dependence here? result = calc_ibet(Vbiei, Vbpei+1_e); ibet = result.rpart(); ibet_Vbpei = result.dpart(); diff --git a/src/spicelib/devices/hicum2/overview_files.md b/src/spicelib/devices/hicum2/overview_files.md index abb94ecd6..e5bc1f64e 100644 --- a/src/spicelib/devices/hicum2/overview_files.md +++ b/src/spicelib/devices/hicum2/overview_files.md @@ -23,4 +23,8 @@ This file gives an overview of the files needed for the ngspice HiCUM version, e # hicum2setup.c # hicum2soachk.c # hicum2temp.c + * Temperature scaling of all parameters + * Models are implemented, missing are the derivatives + * As most models are easy and just temperature dependent -> no dual numbers + * Assignee: Mario # hicum2trunc.c diff --git a/tests/hicum2/FG.cir b/tests/hicum2/FG.cir index 3328ae9c9..ee259d6d9 100644 --- a/tests/hicum2/FG.cir +++ b/tests/hicum2/FG.cir @@ -23,11 +23,11 @@ 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=1 kf=0 ++ cbepar=2.609e-014 cbcpar=1.64512e-014 alqf=0.166667 alit=0.333333 flnqs=0 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 -+ zetact=5 zetabet=4.892 flsh=1 rth=1113.4 cth=6.841e-012 zetarth=0 ++ zetact=5 zetabet=4.892 flsh=0 rth=1113.4 cth=6.841e-012 zetarth=0 + alrth=0.002 flcomp=0.0 tnom=26.85 acbar=1.5 flcono=0 icbar=0.01 + vcbar=0.04 zetavgbe=0.7 hf0=40 ahjei=3 rhjei=2 delck=2 zetahjei=-0.5 From 1b0cf0d08c7ca282dba8f1fbecf05b391324ef95 Mon Sep 17 00:00:00 2001 From: mariok Date: Thu, 23 Apr 2020 16:59:55 +0200 Subject: [PATCH 7/8] testing with and without self heating --- src/spicelib/devices/hicum2/hicumL2.cpp | 106 ++++++++++++---- tests/hicum2/FG.out | 160 ++++++++++++------------ tests/hicum2/FG_sh.cir | 35 ++++++ tests/hicum2/Makefile.am | 3 +- 4 files changed, 199 insertions(+), 105 deletions(-) mode change 100644 => 100755 tests/hicum2/FG.out create mode 100644 tests/hicum2/FG_sh.cir diff --git a/src/spicelib/devices/hicum2/hicumL2.cpp b/src/spicelib/devices/hicum2/hicumL2.cpp index b7d21b174..f4b3e2e90 100644 --- a/src/spicelib/devices/hicum2/hicumL2.cpp +++ b/src/spicelib/devices/hicum2/hicumL2.cpp @@ -621,6 +621,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) double Ixf1,Ixf2,Qxf1,Qxf2; double Itxf, Qdeix; double Vxf, Ixf, Qxf; + double Vxf1, Vxf2; double hjei_vbe; @@ -711,8 +712,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) //NQS double Vbxf, Vbxf1, Vbxf2; - double Qxf_Vxf; - double Iqxf, Iqxf_Vxf, Iqxf1, Iqxf2; + double Qxf_Vxf, Qxf1_Vxf1, Qxf2_Vxf2; + double Iqxf, Iqxf_Vxf, Iqxf1, Iqxf1_Vxf1, Iqxf2, Iqxf2_Vxf2; double Ith, Vrth, Icth, Icth_Vrth, delvrth; @@ -1004,9 +1005,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) { @@ -1042,9 +1043,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) && @@ -1750,20 +1751,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)) { - double Vxf1, Vxf2, fact; Vxf1 = Vbxf1; Vxf2 = Vbxf2; Ixf1 = (Vxf2-itf)/Tf*model->HICUMt0; Ixf2 = (Vxf2-Vxf1)/Tf*model->HICUMt0; - Qxf1 = model->HICUMalit*Vxf1*model->HICUMt0; - Qxf2 = model->HICUMalit*Vxf2/3*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; + // TODO derivatives of Ixf1 and Ixf2 + Vxf = Vbxf; //for RC nw - fact = model->HICUMt0/Tf; //for RC nw - Ixf = (Vxf - Qdei)*fact; //for RC nw - Qxf = model->HICUMalqf*Vxf*model->HICUMt0; //for RC nw + Ixf = (Vxf - Qdei)*model->HICUMt0/Tf; //for RC nw + Qxf = model->HICUMalqf*model->HICUMt0*Vxf; //for RC nw Qxf_Vxf = model->HICUMalqf*model->HICUMt0; //for RC nw Qdeix = Vxf; //for RC nw } else { @@ -1771,6 +1774,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Ixf2 = Vbxf2; Qxf1 = 0; Qxf2 = 0; + Qxf1_Vxf1 = 0; + Qxf2_Vxf2 = 0; Ixf = Vbxf; Qxf = 0; @@ -1873,9 +1878,9 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) // ******************************************** // NQS effect -// Ibxf1 = Ixf1; + // Ibxf1 = Ixf1; // Icxf1 += ddt(Qxf1); -// Ibxf2 = Ixf2; + // Ibxf2 = Ixf2; // Icxf2 += ddt(Qxf2); // end of Load_sources @@ -1969,6 +1974,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) *(ckt->CKTstate0 + here->HICUMqbcpar2) = Qbcpar2; *(ckt->CKTstate0 + here->HICUMqsu) = Qsu; //NQS + *(ckt->CKTstate0 + here->HICUMqxf1) = Qxf1; + *(ckt->CKTstate0 + here->HICUMqxf2) = Qxf2; *(ckt->CKTstate0 + here->HICUMqxf) = Qxf; if (model->HICUMflsh) *(ckt->CKTstate0 + here->HICUMqcth) = Qcth; @@ -2011,6 +2018,8 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) *(ckt->CKTstate0 + here->HICUMcqbcpar2) = Qbcpar2_Vbpci; *(ckt->CKTstate0 + here->HICUMcqsu) = Qsu_Vsis; //NQS + *(ckt->CKTstate0 + here->HICUMcqxf1) = Qxf1_Vxf1; + *(ckt->CKTstate0 + here->HICUMcqxf2) = Qxf2_Vxf2; *(ckt->CKTstate0 + here->HICUMcqxf) = Qxf_Vxf; if (model->HICUMflsh) *(ckt->CKTstate0 + here->HICUMcqcth) = model->HICUMcth; @@ -2123,7 +2132,17 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Isc_Vsc = geq; Isc = *(ckt->CKTstate0 + here->HICUMcqscp); //NQS -// Icxf += ddt(Qxf); //for RC nw +// Iqxf1 <+ ddt(Qxf1); + error = NIintegrate(ckt,&geq,&ceq,Qxf1_Vxf1,here->HICUMqxf); + if(error) return(error); + Iqxf1_Vxf1 = geq; + Iqxf1 = *(ckt->CKTstate0 + here->HICUMcqxf1); +// Iqxf2 <+ ddt(Qxf2); + error = NIintegrate(ckt,&geq,&ceq,Qxf2_Vxf2,here->HICUMqxf); + if(error) return(error); + Iqxf2_Vxf2 = geq; + Iqxf2 = *(ckt->CKTstate0 + here->HICUMcqxf2); +// Iqxf += ddt(Qxf); //for RC nw error = NIintegrate(ckt,&geq,&ceq,Qxf_Vxf,here->HICUMqxf); if(error) return(error); Iqxf_Vxf = geq; @@ -2466,6 +2485,49 @@ c Branch: sis, Stamp element: Rsu *(here->HICUMsubsSubsSIPtr) += -Isis_Vsis; //NQS /* +c Branch: xf1-ground, Stamp element: Ixf1 +*/ +// rhs_current = (Ixf1 - Ixf1_Vxf1*Vxf1 - Ixf1_Vrth*Vrth - Ixf1_Vbiei*Vbiei - Ixf1_Vbici*Vbici - Ixf1_Vxf2*Vxf2); // TODO + rhs_current = Ixf1; + *(ckt->CKTrhs + here->HICUMxf1Node) += 0; // rhs_current; // into xf1 node +// *(here->HICUMxf1TempPtr) += -Ixf1_Vrth; +// *(here->HICUMxf1BaseBIPtr) += -Ixf1_Vbiei; +// *(here->HICUMxf1EmitEIPtr) += +Ixf1_Vbiei; +// *(here->HICUMxf1BaseBIPtr) += -Ixf1_Vbici; +// *(here->HICUMxf1CollCIPtr) += +Ixf1_Vbici; +// *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; +/* +c Branch: xf1-ground, Stamp element: Qxf1 // TODO Test in AC simulation! +*/ + // rhs_current = Iqxf1 - Iqxf1_Vxf1*Vxf1; + // *(ckt->CKTrhs + here->HICUMxf1Node) += rhs_current; // into ground + // *(here->HICUMxf1Xf1Ptr) += Iqxf1_Vxf1; +/* +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: Ixf2 +*/ +// rhs_current = (Ixf2 - Ixf2_Vxf1*Vxf1 - Ixf2_Vrth*Vrth - Ixf2_Vbiei*Vbiei - Ixf2_Vbici*Vbici - Ixf2_Vxf2*Vxf2); // TODO + rhs_current = Ixf2; + *(ckt->CKTrhs + here->HICUMxf2Node) += rhs_current; // into xf2 node +// *(here->HICUMxf2TempPtr) += -Ixf2_Vrth; +// *(here->HICUMxf2BaseBIPtr) += -Ixf2_Vbiei; +// *(here->HICUMxf2EmitEIPtr) += +Ixf2_Vbiei; +// *(here->HICUMxf2BaseBIPtr) += -Ixf2_Vbici; +// *(here->HICUMxf2CollCIPtr) += +Ixf2_Vbici; +/* +c Branch: xf2-ground, Stamp element: Qxf2 // TODO Test in AC simulation! +*/ + // rhs_current = Iqxf2 - Iqxf2_Vxf2*Vxf2; + // *(ckt->CKTrhs + here->HICUMxf2Node) += rhs_current; // into ground + // *(here->HICUMxf2Xf2Ptr) += Iqxf2_Vxf2; +/* +c Branch: xf2-ground, Stamp element: Rxf2 +*/ + *(here->HICUMxf2Xf2Ptr) += 1; // current Ixf2 is normalized to Tf +/* c Branch: xf-ground, Stamp element: Ixf */ // rhs_current = model->HICUMtype * (Ixf - Ixf_Vrth*Vrth - Ixf_Vbiei*Vbiei - Ixf_Vbici*Vbici); @@ -2477,15 +2539,15 @@ c Branch: xf-ground, Stamp element: Ixf // *(here->HICUMxfBaseBIPtr) += -Ixf_Vbici; // *(here->HICUMxfCollCIPtr) += +Ixf_Vbici; /* -c Branch: xf-ground, Stamp element: Qxf +c Branch: xf-ground, Stamp element: Qxf // TODO Test in AC simulation! */ - 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.out b/tests/hicum2/FG.out old mode 100644 new mode 100755 index 9382b81bf..2e7b7b4c4 --- a/tests/hicum2/FG.out +++ b/tests/hicum2/FG.out @@ -28,89 +28,85 @@ Index v-sweep abs(i(vc)) abs(i(vb)) 17 3.700000e-01 1.434984e-10 7.151385e-11 18 3.800000e-01 2.106980e-10 8.812576e-11 19 3.900000e-01 3.094239e-10 1.086330e-10 -20 4.000000e-01 4.544606e-10 1.339576e-10 +20 4.000000e-01 4.544605e-10 1.339576e-10 21 4.100000e-01 6.675208e-10 1.652431e-10 22 4.200000e-01 9.804908e-10 2.039088e-10 -23 4.300000e-01 1.440192e-09 2.517182e-10 +23 4.300000e-01 1.440191e-09 2.517182e-10 24 4.400000e-01 2.115368e-09 3.108651e-10 -25 4.500000e-01 3.106947e-09 3.840828e-10 -26 4.600000e-01 4.563079e-09 4.747812e-10 -27 4.700000e-01 6.701220e-09 5.872228e-10 -28 4.800000e-01 9.840498e-09 7.267469e-10 -29 4.900000e-01 1.444920e-08 9.000565e-10 -30 5.000000e-01 2.121435e-08 1.115590e-09 -31 5.100000e-01 3.114377e-08 1.384003e-09 -32 5.200000e-01 4.571552e-08 1.718801e-09 -33 5.300000e-01 6.709694e-08 2.137136e-09 -34 5.400000e-01 9.846526e-08 2.660936e-09 -35 5.500000e-01 1.444771e-07 3.318322e-09 -36 5.600000e-01 2.119553e-07 4.145547e-09 -37 5.700000e-01 3.108934e-07 5.189603e-09 -38 5.800000e-01 4.559242e-07 6.511750e-09 -39 5.900000e-01 6.684650e-07 8.192332e-09 -40 6.000000e-01 9.798502e-07 1.033739e-08 -41 6.100000e-01 1.435905e-06 1.308778e-08 -42 6.200000e-01 2.103617e-06 1.663188e-08 -43 6.300000e-01 3.080871e-06 2.122323e-08 -44 6.400000e-01 4.510615e-06 2.720542e-08 -45 6.500000e-01 6.598398e-06 3.504698e-08 -46 6.600000e-01 9.651225e-06 4.539080e-08 -47 6.700000e-01 1.410919e-05 5.912434e-08 -48 6.800000e-01 2.061429e-05 7.747943e-08 -49 6.900000e-01 3.009878e-05 1.021749e-07 -50 7.000000e-01 4.391421e-05 1.356208e-07 -51 7.100000e-01 6.401579e-05 1.812111e-07 -52 7.200000e-01 9.322242e-05 2.437450e-07 -53 7.300000e-01 1.355770e-04 3.300338e-07 -54 7.400000e-01 1.968310e-04 4.497756e-07 - - -Index v-sweep abs(i(vc)) abs(i(vb)) --------------------------------------------------------------------------------- -55 7.500000e-01 2.850699e-04 6.168209e-07 -56 7.600000e-01 4.114682e-04 8.510009e-07 -57 7.700000e-01 5.911057e-04 1.180776e-06 -58 7.800000e-01 8.436838e-04 1.647063e-06 -59 7.900000e-01 1.193858e-03 2.308771e-06 -60 8.000000e-01 1.670833e-03 3.250770e-06 -61 8.100000e-01 2.306936e-03 4.595327e-06 -62 8.200000e-01 3.135216e-03 6.518404e-06 -63 8.300000e-01 4.186547e-03 9.272757e-06 -64 8.400000e-01 5.486996e-03 1.322038e-05 -65 8.500000e-01 7.056092e-03 1.887770e-05 -66 8.600000e-01 8.906138e-03 2.697768e-05 -67 8.700000e-01 1.104232e-02 3.855417e-05 -68 8.800000e-01 1.346315e-02 5.505385e-05 -69 8.900000e-01 1.616097e-02 7.848113e-05 -70 9.000000e-01 1.912221e-02 1.115788e-04 -71 9.100000e-01 2.232745e-02 1.580423e-04 -72 9.200000e-01 2.575127e-02 2.227555e-04 -73 9.300000e-01 2.936192e-02 3.120267e-04 -74 9.400000e-01 3.312105e-02 4.337950e-04 -75 9.500000e-01 3.698335e-02 5.977980e-04 -76 9.600000e-01 4.089592e-02 8.157592e-04 -77 9.700000e-01 4.479692e-02 1.101748e-03 -78 9.800000e-01 4.861470e-02 1.472727e-03 -79 9.900000e-01 5.227379e-02 1.948274e-03 -80 1.000000e+00 5.571609e-02 2.547054e-03 -81 1.010000e+00 5.892578e-02 3.280006e-03 -82 1.020000e+00 6.192652e-02 4.146849e-03 -83 1.030000e+00 6.475256e-02 5.140281e-03 -84 1.040000e+00 6.742704e-02 6.252158e-03 -85 1.050000e+00 6.995901e-02 7.476142e-03 -86 1.060000e+00 7.234907e-02 8.807408e-03 -87 1.070000e+00 7.459498e-02 1.024167e-02 -88 1.080000e+00 7.669484e-02 1.177455e-02 -89 1.090000e+00 7.864841e-02 1.340130e-02 -90 1.100000e+00 8.045738e-02 1.511689e-02 -91 1.110000e+00 8.212510e-02 1.691606e-02 -92 1.120000e+00 8.365625e-02 1.879352e-02 -93 1.130000e+00 8.505642e-02 2.074401e-02 -94 1.140000e+00 8.633178e-02 2.276245e-02 -95 1.150000e+00 8.748886e-02 2.484396e-02 -96 1.160000e+00 8.853430e-02 2.698392e-02 -97 1.170000e+00 8.947473e-02 2.917797e-02 -98 1.180000e+00 9.031666e-02 3.142205e-02 -99 1.190000e+00 9.106643e-02 3.371235e-02 -100 1.200000e+00 9.173014e-02 3.604534e-02 +25 4.500000e-01 3.106946e-09 3.840828e-10 +26 4.600000e-01 4.563079e-09 4.747811e-10 +27 4.700000e-01 6.701218e-09 5.872227e-10 +28 4.800000e-01 9.840494e-09 7.267467e-10 +29 4.900000e-01 1.444919e-08 9.000562e-10 +30 5.000000e-01 2.121433e-08 1.115590e-09 +31 5.100000e-01 3.114373e-08 1.384002e-09 +32 5.200000e-01 4.571544e-08 1.718799e-09 +33 5.300000e-01 6.709676e-08 2.137132e-09 +34 5.400000e-01 9.846489e-08 2.660929e-09 +35 5.500000e-01 1.444763e-07 3.318308e-09 +36 5.600000e-01 2.119536e-07 4.145522e-09 +37 5.700000e-01 3.108897e-07 5.189556e-09 +38 5.800000e-01 4.559164e-07 6.511663e-09 +39 5.900000e-01 6.684482e-07 8.192167e-09 +40 6.000000e-01 9.798144e-07 1.033707e-08 +41 6.100000e-01 1.435828e-06 1.308719e-08 +42 6.200000e-01 2.103455e-06 1.663074e-08 +43 6.300000e-01 3.080525e-06 2.122105e-08 +44 6.400000e-01 4.509880e-06 2.720120e-08 +45 6.500000e-01 6.596844e-06 3.503877e-08 +46 6.600000e-01 9.647940e-06 4.537475e-08 +47 6.700000e-01 1.410226e-05 5.909275e-08 +48 6.800000e-01 2.059972e-05 7.741690e-08 +49 6.900000e-01 3.006819e-05 1.020505e-07 +50 7.000000e-01 4.385020e-05 1.353718e-07 +51 7.100000e-01 6.388229e-05 1.807107e-07 +52 7.200000e-01 9.294511e-05 2.427359e-07 +53 7.300000e-01 1.350039e-04 3.279924e-07 +54 7.400000e-01 1.956548e-04 4.456394e-07 +55 7.500000e-01 2.826782e-04 6.084386e-07 +56 7.600000e-01 4.066653e-04 8.340431e-07 +57 7.700000e-01 5.816221e-04 1.146610e-06 +58 7.800000e-01 8.253658e-04 1.578709e-06 +59 7.900000e-01 1.159449e-03 2.173417e-06 +60 8.000000e-01 1.608349e-03 2.986417e-06 +61 8.100000e-01 2.197834e-03 4.087850e-06 +62 8.200000e-01 2.952755e-03 5.563725e-06 +63 8.300000e-01 3.894822e-03 7.516722e-06 +64 8.400000e-01 5.040995e-03 1.006634e-05 +65 8.500000e-01 6.402781e-03 1.334838e-05 +66 8.600000e-01 7.986391e-03 1.751363e-05 +67 8.700000e-01 9.793400e-03 2.272603e-05 +68 8.800000e-01 1.182159e-02 2.916016e-05 +69 8.900000e-01 1.406575e-02 3.699861e-05 +70 9.000000e-01 1.651838e-02 4.642947e-05 +71 9.100000e-01 1.917019e-02 5.764474e-05 +72 9.200000e-01 2.201052e-02 7.084062e-05 +73 9.300000e-01 2.502762e-02 8.622214e-05 +74 9.400000e-01 2.820878e-02 1.040182e-04 +75 9.500000e-01 3.154025e-02 1.245245e-04 +76 9.600000e-01 3.500674e-02 1.482245e-04 +77 9.700000e-01 3.858976e-02 1.761297e-04 +78 9.800000e-01 4.226323e-02 2.106934e-04 +79 9.900000e-01 4.598348e-02 2.579408e-04 +80 1.000000e+00 4.967483e-02 3.308659e-04 +81 1.010000e+00 5.323301e-02 4.499557e-04 +82 1.020000e+00 5.657993e-02 6.330012e-04 +83 1.030000e+00 5.972028e-02 8.813991e-04 +84 1.040000e+00 6.271680e-02 1.181850e-03 +85 1.050000e+00 6.563508e-02 1.518125e-03 +86 1.060000e+00 6.852092e-02 1.878222e-03 +87 1.070000e+00 7.140176e-02 2.255370e-03 +88 1.080000e+00 7.429288e-02 2.646645e-03 +89 1.090000e+00 7.720226e-02 3.051443e-03 +90 1.100000e+00 8.013339e-02 3.470405e-03 +91 1.110000e+00 8.308694e-02 3.904762e-03 +92 1.120000e+00 8.606171e-02 4.355986e-03 +93 1.130000e+00 8.905522e-02 4.825594e-03 +94 1.140000e+00 9.206412e-02 5.315066e-03 +95 1.150000e+00 9.508446e-02 5.825795e-03 +96 1.160000e+00 9.811193e-02 6.359080e-03 +97 1.170000e+00 1.011420e-01 6.916117e-03 +98 1.180000e+00 1.041701e-01 7.498008e-03 +99 1.190000e+00 1.071917e-01 8.105763e-03 +100 1.200000e+00 1.102022e-01 8.740302e-03 diff --git a/tests/hicum2/FG_sh.cir b/tests/hicum2/FG_sh.cir new file mode 100644 index 000000000..bb9742106 --- /dev/null +++ b/tests/hicum2/FG_sh.cir @@ -0,0 +1,35 @@ +HICUML2 v2.4.0 Gummel Test +VE Q1_E 0 1.0 +VS Q1_S 0 0.0 +VC Q1_C 0 0.0 +VB Q1_B 0 0.0 +RT Q1_T 0 1M +Q1 Q1_C Q1_B Q1_E Q1_S Q1_T P1 +.DC VE -0.2 -1.2 -10m +.OPTIONS GMIN=1e-13 NOACCT + +.print dc abs(i(vc)) abs(i(vb)) + +.MODEL P1 NPN LEVEL=8 ++ c10=9.074e-030 qp0=1.008e-013 hfe=10.01 hfc=20.04 hjei=3.382 hjci=0.2 ++ ibeis=1.328e-019 mbei=1.027 ireis=1.5e-014 mrei=2 ibeps=1.26e-019 mbep=1.042 ++ ireps=1.8e-014 mrep=1.8 mcf=1 tbhrec=1e-010 ibcis=4.603e-017 mbci=1.15 ++ ibcxs=0 mbcx=1 ibets=0.02035 abet=24 tunode=1 favl=18.96 qavl=5.092e-014 ++ alfav=-0.0024 alqav=-0.0006284 rbi0=4.444 rbx=2.568 fgeo=0.7409 fdqr0=0 ++ fcrbi=0 fqi=1 re=1.511 rcx=2.483 itss=0 msf=1 iscs=0 msc=1 ++ tsf=0 rsu=0 csu=0 cjei0=8.869e-015 vdei=0.714 zei=0.2489 ajei=1.65 ++ cjep0=2.178e-015 vdep=0.8501 zep=0.2632 ajep=1.6 cjci0=3.58e-015 vdci=0.8201 ++ zci=0.2857 vptci=1.79 cjcx0=6.299e-015 vdcx=0.8201 zcx=0.2863 vptcx=1.977 ++ 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=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 ++ zetact=5 zetabet=4.892 flsh=1 rth=1113.4 cth=6.841e-012 zetarth=0 ++ alrth=0.002 flcomp=2.4 tnom=26.85 acbar=1.5 flcono=0 icbar=0.01 ++ vcbar=0.04 zetavgbe=0.7 hf0=40 ahjei=3 rhjei=2 delck=2 zetahjei=-0.5 + + +.END diff --git a/tests/hicum2/Makefile.am b/tests/hicum2/Makefile.am index a3b42bbc8..79fbe2846 100644 --- a/tests/hicum2/Makefile.am +++ b/tests/hicum2/Makefile.am @@ -2,7 +2,8 @@ -TESTS = FG.cir +TESTS = FG.cir \ + FG_sh.cir TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/bin/check.sh $(top_builddir)/src/ngspice From d86caadb07482926593ce3cfc1dce53ebc009341 Mon Sep 17 00:00:00 2001 From: mariok Date: Thu, 23 Apr 2020 18:23:40 +0200 Subject: [PATCH 8/8] added nodes for NQS --- src/spicelib/devices/hicum2/hicumL2.cpp | 1 + tests/hicum2/FG.cir | 3 +-- tests/hicum2/FG_sh.cir | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/spicelib/devices/hicum2/hicumL2.cpp b/src/spicelib/devices/hicum2/hicumL2.cpp index f4b3e2e90..b3499952e 100644 --- a/src/spicelib/devices/hicum2/hicumL2.cpp +++ b/src/spicelib/devices/hicum2/hicumL2.cpp @@ -33,6 +33,7 @@ Spice3 Implementation: 2019 Dietmar Warning, Markus Müller, Mario Krattenmacher * - iavl * - iBEti * - itf, itr + * - NQS derivatives, sources and elements */ #include "cmath" diff --git a/tests/hicum2/FG.cir b/tests/hicum2/FG.cir index 5f71028d0..8b08800e4 100644 --- a/tests/hicum2/FG.cir +++ b/tests/hicum2/FG.cir @@ -1,10 +1,9 @@ HICUML2 v2.4.0 Gummel Test VE Q1_E 0 1.0 -VS Q1_S 0 0.0 VC Q1_C 0 0.0 VB Q1_B 0 0.0 RT Q1_T 0 1M -Q1 Q1_C Q1_B Q1_E Q1_S Q1_T P1 +Q1 Q1_C Q1_B Q1_E Q1_E Q1_T P1 .DC VE -0.2 -1.2 -10m .OPTIONS GMIN=1e-13 NOACCT diff --git a/tests/hicum2/FG_sh.cir b/tests/hicum2/FG_sh.cir index bb9742106..45d051119 100644 --- a/tests/hicum2/FG_sh.cir +++ b/tests/hicum2/FG_sh.cir @@ -1,10 +1,9 @@ HICUML2 v2.4.0 Gummel Test VE Q1_E 0 1.0 -VS Q1_S 0 0.0 VC Q1_C 0 0.0 VB Q1_B 0 0.0 RT Q1_T 0 1M -Q1 Q1_C Q1_B Q1_E Q1_S Q1_T P1 +Q1 Q1_C Q1_B Q1_E Q1_E Q1_T P1 .DC VE -0.2 -1.2 -10m .OPTIONS GMIN=1e-13 NOACCT