From 890ccc415fdba241e9964baa6c066e69ea8e7c7c Mon Sep 17 00:00:00 2001 From: mariok Date: Tue, 12 May 2020 19:55:23 +0200 Subject: [PATCH] implemented hicum_diode as example --- src/spicelib/devices/hicum2/Makefile.am | 4 +- src/spicelib/devices/hicum2/hicum2ask.c | 9 +- src/spicelib/devices/hicum2/hicum2init.c | 2 +- src/spicelib/devices/hicum2/hicum2temp.c | 361 ------------------ src/spicelib/devices/hicum2/hicumL2.cpp | 26 +- .../{hicum2temp.cpp => hicumL2temp.cpp} | 2 +- .../{hicum2temp.hpp => hicumL2temp.hpp} | 0 tests/hicum2/FG.cir | 4 +- 8 files changed, 24 insertions(+), 384 deletions(-) delete mode 100644 src/spicelib/devices/hicum2/hicum2temp.c rename src/spicelib/devices/hicum2/{hicum2temp.cpp => hicumL2temp.cpp} (99%) rename src/spicelib/devices/hicum2/{hicum2temp.hpp => hicumL2temp.hpp} (100%) diff --git a/src/spicelib/devices/hicum2/Makefile.am b/src/spicelib/devices/hicum2/Makefile.am index 3a168ca26..a31fa8528 100644 --- a/src/spicelib/devices/hicum2/Makefile.am +++ b/src/spicelib/devices/hicum2/Makefile.am @@ -15,6 +15,8 @@ libhicum2_la_SOURCES = \ hicum2itf.h \ hicumL2.hpp \ hicumL2.cpp \ + hicumL2temp.hpp \ + hicumL2temp.cpp \ hicum2mask.c \ hicum2mpar.c \ hicum2noise.c \ @@ -22,8 +24,6 @@ libhicum2_la_SOURCES = \ hicum2pzld.c \ hicum2setup.c \ hicum2soachk.c \ - hicum2temp.hpp \ - hicum2temp.cpp \ hicum2trunc.c diff --git a/src/spicelib/devices/hicum2/hicum2ask.c b/src/spicelib/devices/hicum2/hicum2ask.c index 317d157e4..d90e321fd 100644 --- a/src/spicelib/devices/hicum2/hicum2ask.c +++ b/src/spicelib/devices/hicum2/hicum2ask.c @@ -153,19 +153,19 @@ HICUMask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFval return(OK); /* resistances */ case HICUM_QUEST_RCX_T: - value->rValue = here->HICUMrcx_t; + value->rValue = here->HICUMrcx_t.rpart; return(OK); case HICUM_QUEST_RE_T: - value->rValue = here->HICUMre_t; + value->rValue = here->HICUMre_t.rpart; return(OK); case HICUM_QUEST_IT: value->rValue = *(ckt->CKTstate0 + here->HICUMiciei); return(OK); case HICUM_QUEST_RBI: - value->rValue = here->HICUMrbi; + value->rValue = here->HICUMrbi.rpart; return(OK); case HICUM_QUEST_RB: - value->rValue = here->HICUMrbi + here->HICUMrbx_t; + value->rValue = here->HICUMrbi.rpart + here->HICUMrbx_t.rpart; return(OK); /* transconductances and capacitances */ case HICUM_QUEST_BETADC: @@ -281,4 +281,3 @@ HICUMask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFval } /* NOTREACHED */ } - diff --git a/src/spicelib/devices/hicum2/hicum2init.c b/src/spicelib/devices/hicum2/hicum2init.c index c97d7883a..70f7a870f 100644 --- a/src/spicelib/devices/hicum2/hicum2init.c +++ b/src/spicelib/devices/hicum2/hicum2init.c @@ -11,7 +11,7 @@ #include "hicum2ext.h" #include "hicum2init.h" #include "hicumL2.hpp" -#include "hicum2temp.hpp" +#include "hicumL2temp.hpp" SPICEdev HICUMinfo = { diff --git a/src/spicelib/devices/hicum2/hicum2temp.c b/src/spicelib/devices/hicum2/hicum2temp.c deleted file mode 100644 index 201d53085..000000000 --- a/src/spicelib/devices/hicum2/hicum2temp.c +++ /dev/null @@ -1,361 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1985 Thomas L. Quarles -Model Author: 1990 Michael Schröter TU Dresden -Spice3 Implementation: 2019 Dietmar Warning -**********/ - -#include "ngspice/ngspice.h" -#include "ngspice/cktdefs.h" -#include "ngspice/smpdefs.h" -#include "hicum2defs.h" -#include "ngspice/const.h" -#include "ngspice/sperror.h" -#include "ngspice/ifsim.h" -#include "ngspice/suffix.h" - -#define TMAX 326.85 -#define TMIN -100.0 -#define LN_EXP_LIMIT 11.0 - -void TMPHICJ(double , double , double , double , double , - double , double , double , double , double , double , - double *, double *, double *); - -// TEMPERATURE UPDATE OF JUNCTION CAPACITANCE RELATED PARAMETERS -// INPUT: -// mostly model parameters -// x : zero bias junction capacitance -// y : junction built-in potential -// z : grading co-efficient -// w : ratio of maximum to zero-bias value of capacitance or punch-through voltage -// is_al : condition factor to check what "w" stands for -// vgeff : band-gap voltage -// IMPLICIT INPUT: -// vt : thermal voltage -// vt0,qtt0,ln_qtt0,mg : other model variables -// OUTPUT: -// c_j_t : temperature update of "c_j" -// vd_t : temperature update of "vd0" -// w_t : temperature update of "w" -void TMPHICJ(double vt, double vt0, double qtt0, double ln_qtt0, double mg, - double c_j, double vd0, double z, double w, double is_al, double vgeff, - double *c_j_t, double *vd_t, double *w_t) -{ -double vdj0,vdjt,vdt; - -if (c_j > 0.0) { - vdj0 = 2*vt0*log(exp(vd0*0.5/vt0)-exp(-0.5*vd0/vt0)); - vdjt = vdj0*qtt0+vgeff*(1-qtt0)-mg*vt*ln_qtt0; - vdt = vdjt+2*vt*log(0.5*(1+sqrt(1+4*exp(-vdjt/vt)))); - *vd_t = vdt; - *c_j_t = c_j*exp(z*log(vd0/(*vd_t))); - if (is_al == 1) { - *w_t = w*(*vd_t)/vd0; - } else { - *w_t = w; - } - } else { - *c_j_t = c_j; - *vd_t = vd0; - *w_t = w; - } -} - -int iret, hicum_thermal_update(HICUMmodel *, HICUMinstance *); - -int -HICUMtemp(GENmodel *inModel, CKTcircuit *ckt) - /* Pre-compute many useful parameters - */ -{ - HICUMmodel *model = (HICUMmodel *)inModel; - HICUMinstance *here; - - /* loop through all the bipolar models */ - for( ; model != NULL; model = HICUMnextModel(model)) { - - /* loop through all the instances of the model */ - for (here = HICUMinstances(model); here != NULL ; - here=HICUMnextInstance(here)) { - - if(!here->HICUMtempGiven) here->HICUMtemp = ckt->CKTtemp; - - if(here->HICUMdtempGiven) here->HICUMtemp = here->HICUMtemp + here->HICUMdtemp; - - iret = hicum_thermal_update(model, here); - - } - } - return(OK); -} - -int hicum_thermal_update(HICUMmodel *inModel, HICUMinstance *inInstance) -{ - HICUMmodel *model = (HICUMmodel *)inModel; - HICUMinstance *here = (HICUMinstance *)inInstance; - - double k10,k20,avs,vgb_t0,vge_t0,vgbe_t0,vgbe0,vgbc0,vgsc0; - double zetabci,zetabcxt,zetasct; - double k1,k2,dvg0,vge_t,vgb_t,vgbe_t,cratio_t,a; - double k1_dT,k2_dT,dvg0_dT,vge_t_dT,vgb_t_dT,vgbe_t_dT,cratio_t_dT,a_dT; - double Tnom, dT, zetatef, cjcx01, cjcx02, C_1; - double cjci0_t, vdci_t, vptci_t, cjep0_t, vdep_t, ajep_t, vdcx_t, vptcx_t, cscp0_t, vdsp_t, vptsp_t, cjs0_t, vds_t, vpts_t; - - Tnom = model->HICUMtnom; - k10 = model->HICUMf1vg*Tnom*log(Tnom); - k20 = model->HICUMf2vg*Tnom; - avs = model->HICUMalvs*Tnom; - vgb_t0 = model->HICUMvgb+k10+k20; - vge_t0 = model->HICUMvge+k10+k20; - vgbe_t0 = (vgb_t0+vge_t0)/2; - - vgbe0 = (model->HICUMvgb+model->HICUMvge)/2; - vgbc0 = (model->HICUMvgb+model->HICUMvgc)/2; - vgsc0 = (model->HICUMvgs+model->HICUMvgc)/2; - - here->HICUMmg = 3-model->HICUMf1vg/CONSTKoverQ; - zetabci = here->HICUMmg+1-model->HICUMzetaci; - zetabcxt= here->HICUMmg+1-model->HICUMzetacx; - zetasct = here->HICUMmg-1.5; - - // Limit temperature to avoid FPEs in equations - if(here->HICUMtemp < TMIN + CONSTCtoK) { - here->HICUMtemp = TMIN + CONSTCtoK; - } else { - if (here->HICUMtemp > TMAX + CONSTCtoK) { - here->HICUMtemp = TMAX + CONSTCtoK; - } - } - here->HICUMvt0 = Tnom * CONSTKoverQ; - here->HICUMvt = here->HICUMtemp * CONSTKoverQ; - here->HICUMvt_dT = CONSTKoverQ; - dT = here->HICUMtemp-Tnom; - here->HICUMqtt0 = here->HICUMtemp/Tnom; - here->HICUMqtt0_dT = 1/Tnom; - here->HICUMln_qtt0 = log(here->HICUMqtt0); - here->HICUMln_qtt0_dT = 1/here->HICUMtemp; // d(log(x/a))/dx = 1/x - k1 = model->HICUMf1vg*here->HICUMtemp*log(here->HICUMtemp); - k1_dT = model->HICUMf1vg*(log(here->HICUMtemp) + 1); - k2 = model->HICUMf2vg*here->HICUMtemp; - k2_dT = model->HICUMf2vg; - vgb_t = model->HICUMvgb+k1+k2; - vgb_t_dT = k1_dT+k2_dT; - vge_t = model->HICUMvge+k1+k2; - vge_t_dT = k1_dT+k2_dT; - vgbe_t = (vgb_t+vge_t)/2; - vgbe_t_dT = (vgb_t_dT+vge_t_dT)/2; - - here->HICUMtVcrit = here->HICUMvt * - log(here->HICUMvt / (CONSTroot2*model->HICUMibeis*here->HICUMarea*here->HICUMm)); - - //Internal b-e junction capacitance - TMPHICJ(here->HICUMvt0,here->HICUMvt,here->HICUMqtt0,here->HICUMln_qtt0,here->HICUMmg,model->HICUMcjei0,model->HICUMvdei,model->HICUMzei,model->HICUMajei,1,vgbe0,&here->HICUMcjei0_t,&here->HICUMvdei_t,&here->HICUMajei_t); - - if (model->HICUMflcomp == 0.0 || model->HICUMflcomp == 2.1) { - double V_gT, r_VgVT, k; - V_gT = 3.0*here->HICUMvt*here->HICUMln_qtt0 + model->HICUMvgb*(here->HICUMqtt0-1.0); - r_VgVT = V_gT/here->HICUMvt; - //Internal b-e diode saturation currents - a = model->HICUMmcf*r_VgVT/model->HICUMmbei - model->HICUMalb*dT; - here->HICUMibeis_t = model->HICUMibeis*exp(a); - a = model->HICUMmcf*r_VgVT/model->HICUMmrei - model->HICUMalb*dT; - here->HICUMireis_t = model->HICUMireis*exp(a); - a = model->HICUMmcf*r_VgVT/model->HICUMmbep - model->HICUMalb*dT; - //Peripheral b-e diode saturation currents - here->HICUMibeps_t = model->HICUMibeps*exp(a); - a = model->HICUMmcf*r_VgVT/model->HICUMmrep - model->HICUMalb*dT; - here->HICUMireps_t = model->HICUMireps*exp(a); - //Internal b-c diode saturation current - a = r_VgVT/model->HICUMmbci; - here->HICUMibcis_t = model->HICUMibcis*exp(a); - //External b-c diode saturation currents - a = r_VgVT/model->HICUMmbcx; - here->HICUMibcxs_t = model->HICUMibcxs*exp(a); - //Saturation transfer current for substrate transistor - a = r_VgVT/model->HICUMmsf; - here->HICUMitss_t = model->HICUMitss*exp(a); - //Saturation current for c-s diode - a = r_VgVT/model->HICUMmsc; - here->HICUMiscs_t = model->HICUMiscs*exp(a); - //Zero bias hole charge - a = here->HICUMvdei_t/model->HICUMvdei; - here->HICUMqp0_t = model->HICUMqp0*(1.0+0.5*model->HICUMzei*(1.0-a)); - //Voltage separating ohmic and saturation velocity regime - a = model->HICUMvlim*(1.0-model->HICUMalvs*dT)*exp(model->HICUMzetaci*here->HICUMln_qtt0); - k = (a-here->HICUMvt)/here->HICUMvt; - if (k < LN_EXP_LIMIT) { - here->HICUMvlim_t = here->HICUMvt + here->HICUMvt*log(1.0+exp(k)); - } else { - here->HICUMvlim_t = a; - } - //Neutral emitter storage time - a = 1.0+model->HICUMalb*dT; - k = 0.5*(a+sqrt(a*a+0.01)); - here->HICUMtef0_t = model->HICUMtef0*here->HICUMqtt0/k; - } else { - //Internal b-e diode saturation currents - here->HICUMibeis_t = model->HICUMibeis*exp(model->HICUMzetabet*here->HICUMln_qtt0+model->HICUMvge/here->HICUMvt*(here->HICUMqtt0-1)); - if (model->HICUMflcomp>=2.3) { - here->HICUMireis_t = model->HICUMireis*exp(here->HICUMmg/model->HICUMmrei*here->HICUMln_qtt0+vgbe0/(model->HICUMmrei*here->HICUMvt)*(here->HICUMqtt0-1)); - } else { - here->HICUMireis_t = model->HICUMireis*exp(0.5*here->HICUMmg*here->HICUMln_qtt0+0.5*vgbe0/here->HICUMvt*(here->HICUMqtt0-1)); - } - //Peripheral b-e diode saturation currents - here->HICUMibeps_t = model->HICUMibeps*exp(model->HICUMzetabet*here->HICUMln_qtt0+model->HICUMvge/here->HICUMvt*(here->HICUMqtt0-1)); - if (model->HICUMflcomp>=2.3) { - here->HICUMireps_t = model->HICUMireps*exp(here->HICUMmg/model->HICUMmrep*here->HICUMln_qtt0+vgbe0/(model->HICUMmrep*here->HICUMvt)*(here->HICUMqtt0-1)); - } else { - here->HICUMireps_t = model->HICUMireps*exp(0.5*here->HICUMmg*here->HICUMln_qtt0+0.5*vgbe0/here->HICUMvt*(here->HICUMqtt0-1)); - } - //Internal b-c diode saturation currents - here->HICUMibcis_t = model->HICUMibcis*exp(zetabci*here->HICUMln_qtt0+model->HICUMvgc/here->HICUMvt*(here->HICUMqtt0-1)); - //External b-c diode saturation currents - here->HICUMibcxs_t = model->HICUMibcxs*exp(zetabcxt*here->HICUMln_qtt0+model->HICUMvgc/here->HICUMvt*(here->HICUMqtt0-1)); - //Saturation transfer current for substrate transistor - here->HICUMitss_t = model->HICUMitss*exp(zetasct*here->HICUMln_qtt0+model->HICUMvgc/here->HICUMvt*(here->HICUMqtt0-1)); - //Saturation current for c-s diode - here->HICUMiscs_t = model->HICUMiscs*exp(zetasct*here->HICUMln_qtt0+model->HICUMvgs/here->HICUMvt*(here->HICUMqtt0-1)); - //Zero bias hole charge - a = exp(model->HICUMzei*log(here->HICUMvdei_t/model->HICUMvdei)); - here->HICUMqp0_t = model->HICUMqp0*(2.0-a); - //Voltage separating ohmic and saturation velocity regime - here->HICUMvlim_t = model->HICUMvlim*exp((model->HICUMzetaci-avs)*here->HICUMln_qtt0); - //Neutral emitter storage time - if (model->HICUMflcomp >= 2.3) { - here->HICUMtef0_t = model->HICUMtef0; - } else { - zetatef = model->HICUMzetabet-model->HICUMzetact-0.5; - dvg0 = model->HICUMvgb-model->HICUMvge; - here->HICUMtef0_t = model->HICUMtef0*exp(zetatef*here->HICUMln_qtt0-dvg0/here->HICUMvt*(here->HICUMqtt0-1)); - } - } - - //GICCR prefactor - here->HICUMc10_t = model->HICUMc10*exp(model->HICUMzetact*here->HICUMln_qtt0+model->HICUMvgb/here->HICUMvt*(here->HICUMqtt0-1)); - - // Low-field internal collector resistance - here->HICUMrci0_t = model->HICUMrci0*exp(model->HICUMzetaci*here->HICUMln_qtt0); - - //Voltage separating ohmic and saturation velocity regime - //vlim_t = model->HICUMvlim*exp((model->HICUMzetaci-avs)*here->HICUMln_qtt0); - - //Internal c-e saturation voltage - here->HICUMvces_t = model->HICUMvces*(1+model->HICUMalces*dT); - - - //Internal b-c diode saturation current - //ibcis_t = model->HICUMibcis*exp(zetabci*here->HICUMln_qtt0+model->HICUMvgc/here->HICUMvt*(here->HICUMqtt0-1)); - - //Internal b-c junction capacitance - TMPHICJ(here->HICUMvt0,here->HICUMvt,here->HICUMqtt0,here->HICUMln_qtt0,here->HICUMmg,model->HICUMcjci0,model->HICUMvdci,model->HICUMzci,model->HICUMvptci,0,vgbc0,&cjci0_t,&vdci_t,&vptci_t); - here->HICUMcjci0_t = cjci0_t; - here->HICUMvdci_t = vdci_t; - here->HICUMvptci_t = vptci_t; - - //Low-current forward transit time - here->HICUMt0_t = model->HICUMt0*(1+model->HICUMalt0*dT+model->HICUMkt0*dT*dT); - - //Saturation time constant at high current densities - here->HICUMthcs_t = model->HICUMthcs*exp((model->HICUMzetaci-1)*here->HICUMln_qtt0); - - //Avalanche current factors - here->HICUMfavl_t = model->HICUMfavl*exp(model->HICUMalfav*dT); - here->HICUMqavl_t = model->HICUMqavl*exp(model->HICUMalqav*dT); - here->HICUMkavl_t = model->HICUMkavl*exp(model->HICUMalkav*dT); - - //Zero bias internal base resistance - here->HICUMrbi0_t = model->HICUMrbi0*exp(model->HICUMzetarbi*here->HICUMln_qtt0); - - //Peripheral b-e junction capacitance - TMPHICJ(here->HICUMvt0,here->HICUMvt,here->HICUMqtt0,here->HICUMln_qtt0,here->HICUMmg,model->HICUMcjep0,model->HICUMvdep,model->HICUMzep,model->HICUMajep,1,vgbe0,&cjep0_t,&vdep_t,&ajep_t); - here->HICUMcjep0_t = cjep0_t; - here->HICUMvdep_t = vdep_t; - here->HICUMajep_t = ajep_t; - - //Tunneling current factors - if (model->HICUMibets > 0) { // HICTUN_T - double a_eg,ab,aa; - ab = 1.0; - aa = 1.0; - a_eg=vgbe_t0/vgbe_t; - if(model->HICUMtunode==1 && model->HICUMcjep0 > 0.0 && model->HICUMvdep >0.0) { - ab = (here->HICUMcjep0_t/model->HICUMcjep0)*sqrt(a_eg)*vdep_t*vdep_t/(model->HICUMvdep*model->HICUMvdep); - aa = (model->HICUMvdep/vdep_t)*(model->HICUMcjep0/here->HICUMcjep0_t)*pow(a_eg,-1.5); - } else if (model->HICUMtunode==0 && model->HICUMcjei0 > 0.0 && model->HICUMvdei >0.0) { - ab = (here->HICUMcjei0_t/model->HICUMcjei0)*sqrt(a_eg)*here->HICUMvdei_t*here->HICUMvdei_t/(model->HICUMvdei*model->HICUMvdei); - aa = (model->HICUMvdei/here->HICUMvdei_t)*(model->HICUMcjei0/here->HICUMcjei0_t)*pow(a_eg,-1.5); - } - here->HICUMibets_t = model->HICUMibets*ab; - here->HICUMabet_t = model->HICUMabet*aa; - } else { - here->HICUMibets_t = 0; - here->HICUMabet_t = 1; - } - - //Depletion capacitance splitting at b-c junction - //Capacitances at peripheral and external base node - C_1 = (1.0-model->HICUMfbcpar)*(model->HICUMcjcx0+model->HICUMcbcpar); - if (C_1 >= model->HICUMcbcpar) { - cjcx01 = C_1-model->HICUMcbcpar; - cjcx02 = model->HICUMcjcx0-cjcx01; - } else { - cjcx01 = 0.0; - cjcx02 = model->HICUMcjcx0; - } - - //Temperature mapping for tunneling current is done inside HICTUN - - TMPHICJ(here->HICUMvt0,here->HICUMvt,here->HICUMqtt0,here->HICUMln_qtt0,here->HICUMmg,1.0,model->HICUMvdcx,model->HICUMzcx,model->HICUMvptcx,0,vgbc0,&cratio_t,&vdcx_t,&vptcx_t); - here->HICUMcjcx01_t=cratio_t*cjcx01; - here->HICUMcjcx02_t=cratio_t*cjcx02; - here->HICUMvdcx_t = vdcx_t; - here->HICUMvptcx_t = vptcx_t; - - //External b-c diode saturation currents - //ibcxs_t = model->HICUMibcxs*exp(zetabcxt*here->HICUMln_qtt0+model->HICUMvgc/here->HICUMvt*(qtt0-1)); - - //Constant external series resistances - here->HICUMrcx_t = model->HICUMrcx*exp(model->HICUMzetarcx*here->HICUMln_qtt0); - here->HICUMrbx_t = model->HICUMrbx*exp(model->HICUMzetarbx*here->HICUMln_qtt0); - here->HICUMre_t = model->HICUMre*exp(model->HICUMzetare*here->HICUMln_qtt0); - - //Forward transit time in substrate transistor - here->HICUMtsf_t = model->HICUMtsf*exp((model->HICUMzetacx-1.0)*here->HICUMln_qtt0); - - //Capacitance for c-s junction - TMPHICJ(here->HICUMvt0,here->HICUMvt,here->HICUMqtt0,here->HICUMln_qtt0,here->HICUMmg,model->HICUMcjs0,model->HICUMvds,model->HICUMzs,model->HICUMvpts,0,vgsc0,&cjs0_t,&vds_t,&vpts_t); - here->HICUMcjs0_t = cjs0_t; - here->HICUMvds_t = vds_t; - here->HICUMvpts_t = vpts_t; - /*Peripheral s-c capacitance - * Note, thermal update only required for model->HICUMvds > 0 - * Save computional effort otherwise - */ - if (model->HICUMvdsp > 0) { - TMPHICJ(here->HICUMvt0,here->HICUMvt,here->HICUMqtt0,here->HICUMln_qtt0,here->HICUMmg,model->HICUMcscp0,model->HICUMvdsp,model->HICUMzsp,model->HICUMvptsp,0,vgsc0,&cscp0_t,&vdsp_t,&vptsp_t); - here->HICUMcscp0_t = cscp0_t; - here->HICUMvdsp_t = vdsp_t; - here->HICUMvptsp_t = vptsp_t; - } else { - // Avoid uninitialized variables - here->HICUMcscp0_t = model->HICUMcscp0; - here->HICUMvdsp_t = model->HICUMvdsp; - here->HICUMvptsp_t = model->HICUMvptsp; - } - - here->HICUMahjei_t = model->HICUMahjei*exp(model->HICUMzetahjei*here->HICUMln_qtt0); - here->HICUMhjei0_t = model->HICUMhjei*exp(model->HICUMdvgbe/here->HICUMvt*(exp(model->HICUMzetavgbe*log(here->HICUMqtt0))-1)); - here->HICUMhf0_t = model->HICUMhf0*exp(model->HICUMdvgbe/here->HICUMvt*(here->HICUMqtt0-1)); - if (model->HICUMflcomp >= 2.3) { - here->HICUMhfe_t = model->HICUMhfe*exp((model->HICUMvgb-model->HICUMvge)/here->HICUMvt*(here->HICUMqtt0-1)); - here->HICUMhfc_t = model->HICUMhfc*exp((model->HICUMvgb-model->HICUMvgc)/here->HICUMvt*(here->HICUMqtt0-1)); - } else { - here->HICUMhfe_t = model->HICUMhfe; - here->HICUMhfc_t = model->HICUMhfc; - } - - here->HICUMrth_t = model->HICUMrth*exp(model->HICUMzetarth*here->HICUMln_qtt0)*(1+model->HICUMalrth*dT); - - return(0); -} diff --git a/src/spicelib/devices/hicum2/hicumL2.cpp b/src/spicelib/devices/hicum2/hicumL2.cpp index 3f780144a..02bd09fb6 100644 --- a/src/spicelib/devices/hicum2/hicumL2.cpp +++ b/src/spicelib/devices/hicum2/hicumL2.cpp @@ -109,7 +109,7 @@ using namespace duals::literals; // T : Temperature // OUTPUT: // Iz : diode current -duals::duald HICDIO(duals::duald T, double IST, double UM1, duals::duald U) +duals::duald HICDIO(duals::duald T, duals::duald IST, double UM1, duals::duald U) { duals::duald DIOY, le, vt; @@ -314,17 +314,19 @@ duals::duald calc_hjei_vbe(duals::duald Vbiei, duals::duald T, HICUMinstance * h } -void hicum_diode(double T, double IS, double UM1, double U, double *Iz, double *Gz, double *Tz) +void hicum_diode(double T, dual_double IS, double UM1, double U, double *Iz, double *Gz, double *Tz) { //wrapper for hicum diode equation that also generates derivatives duals::duald result = 0; // printf("executed diode"); - result = HICDIO(T, IS, UM1, U+1_e); + duals::duald is_t = IS.rpart; + result = HICDIO(T, is_t, UM1, U+1_e); *Iz = result.rpart(); *Gz = result.dpart(); //derivative for U - result = HICDIO(T+1_e, IS, UM1, U); + is_t.dpart(IS.dpart); + result = HICDIO(T+1_e, is_t, UM1, U); *Tz = result.dpart(); //derivative for T } @@ -648,14 +650,14 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) // INPUT: // itf : forward transport current // I_CK : critical current - // T_f : transit time + // T_f : transit time // Q_f : minority charge / for low current // IMPLICIT INPUT: // tef0, gtfe, fthc, thcs, ahc, latl, latb : model parameters // OUTPUT: - // T_f : transit time + // T_f : transit time // Q_f : minority charge transient analysis - // T_fT : transit time + // T_fT : transit time // Q_fT : minority charge ICCR (transfer current) // Q_bf : excess base charge std::function HICQFF = [&](duals::duald T, duals::duald itf, duals::duald I_CK, duals::duald * T_f, duals::duald * Q_f, duals::duald * T_fT, duals::duald * Q_fT, duals::duald * Q_bf) @@ -1890,7 +1892,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) it_dT = it_ditf*itf_dT + it_ditr*itr_dT; //recast the derivative after Vciei to a derivative to Vbiei and Vciei - // Vciei = Vbiei - Vbici + // Vciei = Vbiei - Vbici // dVciei/dVbiei = 1 // dVciei/dVbici = -1 it_Vbiei += (itf_Vciei - itr_Vciei); @@ -1946,7 +1948,7 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) ibh_rec_Vbici = Otbhrec*Q_bf_Vbici ; ibh_rec_dT = Otbhrec*Q_bf_dT ; //recast the derivative after Vciei to a derivative to Vbiei and Vciei - // Vciei = Vbiei - Vbici + // Vciei = Vbiei - Vbici // dVciei/dVbiei = 1 // dVciei/dVbici = -1 ibh_rec_Vbiei += Q_bf_Vciei; @@ -2027,15 +2029,15 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt) Qdsu = result_Qdsu.rpart(); HSI_Tsu_dT = result_HSI_TSU.dpart(); Qdsu_dT = result_Qdsu.dpart(); - + calc_itss(here->HICUMtemp , Vbpci+1_e, Vsici , &result_HSI_TSU, &result_Qdsu); HSI_Tsu_Vbpci = result_HSI_TSU.dpart(); Qdsu_Vbpci = result_Qdsu.dpart(); calc_itss(here->HICUMtemp , Vbpci , Vsici+1_e, &result_HSI_TSU, &result_Qdsu); HSI_Tsu_Vsici = result_HSI_TSU.dpart(); Qdsu_Vsici = result_Qdsu.dpart(); //@Dietmar. Where is this one written to the matrix? - - + + // if(model->HICUMitss > 0.0) { // Sub_Transfer // double HSa,HSb; // HSUM = model->HICUMmsf*here->HICUMvt; diff --git a/src/spicelib/devices/hicum2/hicum2temp.cpp b/src/spicelib/devices/hicum2/hicumL2temp.cpp similarity index 99% rename from src/spicelib/devices/hicum2/hicum2temp.cpp rename to src/spicelib/devices/hicum2/hicumL2temp.cpp index 468017aba..6c3199248 100644 --- a/src/spicelib/devices/hicum2/hicum2temp.cpp +++ b/src/spicelib/devices/hicum2/hicumL2temp.cpp @@ -11,7 +11,7 @@ Spice3 Implementation: 2019 Dietmar Warning #define M_PI 3.1415926535897932384626433832795 #endif #include -#include "hicum2temp.hpp" +#include "hicumL2temp.hpp" #include #include //trap NAN diff --git a/src/spicelib/devices/hicum2/hicum2temp.hpp b/src/spicelib/devices/hicum2/hicumL2temp.hpp similarity index 100% rename from src/spicelib/devices/hicum2/hicum2temp.hpp rename to src/spicelib/devices/hicum2/hicumL2temp.hpp diff --git a/tests/hicum2/FG.cir b/tests/hicum2/FG.cir index a9e4e7576..3c242c758 100644 --- a/tests/hicum2/FG.cir +++ b/tests/hicum2/FG.cir @@ -3,10 +3,10 @@ VE Q1_E 0 1.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_E Q1_T P1 icVBE=0.2 icVCE=0.2 dt=0.0 +Q1 Q1_C Q1_B Q1_E Q1_E Q1_T P1 icVB=0.2 icVC=0.2 dt=0.0 * .DC VE -0.2 -1.2 -10m .DC VE -0.2 -0.21 -10m -.OPTIONS GMIN=1e-13 NOACCT +.OPTIONS GMIN=1e-13 NOACCT TEMP=20 TNOM=30 .print dc abs(i(vc)) abs(i(vb))