From 53d94d81b56409bac3de4d944501fdb914c4e368 Mon Sep 17 00:00:00 2001 From: Markus Mueller Date: Mon, 24 Jun 2024 15:29:05 +0200 Subject: [PATCH] correctec model author line in HICUML2 buil-in model --- src/spicelib/devices/hicum2/hicum2.c | 608 ++--- src/spicelib/devices/hicum2/hicum2acld.c | 1292 +++++----- src/spicelib/devices/hicum2/hicum2ask.c | 506 ++-- src/spicelib/devices/hicum2/hicum2conv.c | 2 +- src/spicelib/devices/hicum2/hicum2defs.h | 2534 +++++++++---------- src/spicelib/devices/hicum2/hicum2ext.h | 66 +- src/spicelib/devices/hicum2/hicum2getic.c | 2 +- src/spicelib/devices/hicum2/hicum2init.c | 182 +- src/spicelib/devices/hicum2/hicum2init.h | 2 +- src/spicelib/devices/hicum2/hicum2itf.h | 2 +- src/spicelib/devices/hicum2/hicum2mask.c | 2 +- src/spicelib/devices/hicum2/hicum2mpar.c | 2 +- src/spicelib/devices/hicum2/hicum2noise.c | 2 +- src/spicelib/devices/hicum2/hicum2param.c | 2 +- src/spicelib/devices/hicum2/hicum2pzld.c | 1518 +++++------ src/spicelib/devices/hicum2/hicum2setup.c | 1736 ++++++------- src/spicelib/devices/hicum2/hicum2soachk.c | 2 +- src/spicelib/devices/hicum2/hicum2trunc.c | 2 +- src/spicelib/devices/hicum2/hicumL2.cpp | 2 +- src/spicelib/devices/hicum2/hicumL2.hpp | 2 +- src/spicelib/devices/hicum2/hicumL2temp.cpp | 1040 ++++---- src/spicelib/devices/hicum2/hicumL2temp.hpp | 2 +- 22 files changed, 4754 insertions(+), 4754 deletions(-) diff --git a/src/spicelib/devices/hicum2/hicum2.c b/src/spicelib/devices/hicum2/hicum2.c index b9e636f3c..dda2cb6a3 100644 --- a/src/spicelib/devices/hicum2/hicum2.c +++ b/src/spicelib/devices/hicum2/hicum2.c @@ -1,304 +1,304 @@ -/********** -License : 3-clause BSD -Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden -**********/ - -/* - * This file defines the HICUM data structures that are - * available to the next level(s) up the calling hierarchy - */ - -#include "ngspice/ngspice.h" -#include "ngspice/devdefs.h" -#include "hicum2defs.h" -#include "ngspice/suffix.h" - -IFparm HICUMpTable[] = { /* parameters */ - IOPU("area", HICUM_AREA, IF_REAL, "Area factor"), - IOPU("off", HICUM_OFF, IF_FLAG, "Device initially off"), - IP("ic", HICUM_IC, IF_REALVEC, "Initial condition vector"), - -// these are left here for future. Sometimes it is advantageous for debugging if one can set the initial node voltages of all nodes. -// OP("icvb", HICUM_IC_VB, IF_REAL, "Initial B potential"), -// OP("icvc", HICUM_IC_VC, IF_REAL, "Initial C potential"), -// OP("icve", HICUM_IC_VE, IF_REAL, "Initial E potential"), -// OP("icvbi", HICUM_IC_VBi, IF_REAL, "Initial Bi potential"), -// OP("icvbp", HICUM_IC_VBp, IF_REAL, "Initial Bp potential"), -// OP("icvci", HICUM_IC_VCi, IF_REAL, "Initial Ci potential"), -// OP("icvt", HICUM_IC_Vt, IF_REAL, "Initial T potential"), -// OP("icvei", HICUM_IC_VEi, IF_REAL, "Initial Ei potential"), - - IOPU("m", HICUM_M, IF_REAL, "Multiplier"), - IOPU("temp", HICUM_TEMP, IF_REAL, "Instance temperature"), - IP("dt", HICUM_DTEMP, IF_REAL, "Instance delta temperature"), - IOPU("tk", HICUM_QUEST_TK, IF_REAL, "Actual device temperature"), - IOPU("dtsh", HICUM_QUEST_DTSH, IF_REAL, "Temperature increase due to self-heating"), - IOPU("it", HICUM_QUEST_IT, IF_REAL, "transfer current"), - - OPU("collnode", HICUM_QUEST_COLLNODE, IF_INTEGER, "Number of collector node"), - OPU("basenode", HICUM_QUEST_BASENODE, IF_INTEGER, "Number of base node"), - OPU("emitnode", HICUM_QUEST_EMITNODE, IF_INTEGER, "Number of emitter node"), - OPU("subsnode", HICUM_QUEST_SUBSNODE, IF_INTEGER, "Number of substrate node"), - OPU("tempnode", HICUM_QUEST_TEMPNODE, IF_INTEGER, "Number of temperature node"), - OPU("collCInode", HICUM_QUEST_COLLCINODE, IF_INTEGER, "Internal collector node"), - OPU("baseBPnode", HICUM_QUEST_BASEBPNODE, IF_INTEGER, "External base node"), - OPU("baseBInode", HICUM_QUEST_BASEBINODE, IF_INTEGER, "Internal base node"), - OPU("emitEInode", HICUM_QUEST_EMITEINODE, IF_INTEGER, "Internal emitter node"), - OPU("subsSInode", HICUM_QUEST_SUBSSINODE, IF_INTEGER, "Internal substrate node"), - OPU("xfnode", HICUM_QUEST_XFNODE, IF_INTEGER, "Internal phase node xf"), - OPU("xf1node", HICUM_QUEST_XF1NODE, IF_INTEGER, "Internal phase node xf1"), - OPU("xf2node", HICUM_QUEST_XF2NODE, IF_INTEGER, "Internal phase node xf2"), -/* voltages */ - OP("vbe", HICUM_QUEST_VBE, IF_REAL, "External BE voltage"), - OP("vbbp", HICUM_QUEST_VBBP, IF_REAL, "BBP voltage"), - OP("vbc", HICUM_QUEST_VBC, IF_REAL, "External BC voltage"), - OP("vce", HICUM_QUEST_VCE, IF_REAL, "External CE voltage"), - OP("vsc", HICUM_QUEST_VSC, IF_REAL, "External SC voltage"), - OP("vbiei", HICUM_QUEST_VBIEI, IF_REAL, "Internal BE voltage"), - OP("vbpbi", HICUM_QUEST_VBPBI, IF_REAL, "Peripheral Base to internal Base voltage"), - OP("vbici", HICUM_QUEST_VBICI, IF_REAL, "Internal BC voltage"), - OP("vciei", HICUM_QUEST_VCIEI, IF_REAL, "Internal CE voltage"), -/* currents */ - OP("ic", HICUM_QUEST_CC, IF_REAL, "Collector current"), - OP("iavl", HICUM_QUEST_CAVL, IF_REAL, "Avalanche current"), - OP("ib", HICUM_QUEST_CB, IF_REAL, "Base current"), - OP("ibei", HICUM_QUEST_CBEI, IF_REAL, "Intenral Base Emitter current"), - OP("ibci", HICUM_QUEST_CBCI, IF_REAL, "Internal Base Collector current"), - OP("ie", HICUM_QUEST_CE, IF_REAL, "Emitter current"), - OP("is", HICUM_QUEST_CS, IF_REAL, "Substrate current"), -/* resistances */ - OP("rcx_t", HICUM_QUEST_RCX_T, IF_REAL, "External (saturated) collector series resistance"), - OP("re_t", HICUM_QUEST_RE_T, IF_REAL, "Emitter series resistance"), - OP("rbi", HICUM_QUEST_RBI, IF_REAL, "Internal base resistance as calculated in the model"), - OP("rb", HICUM_QUEST_RB, IF_REAL, "Total base resistance as calculated in the model"), - -/* transconductances and capacitances */ - OP("betadc", HICUM_QUEST_BETADC, IF_REAL, "Common emitter forward current gain"), - OP("gmi", HICUM_QUEST_GMI, IF_REAL, "Internal transconductance"), - OP("gms", HICUM_QUEST_GMS, IF_REAL, "Transconductance of the parasitic substrate PNP"), - OP("rpii", HICUM_QUEST_RPII, IF_REAL, "Internal base-emitter (input) resistance"), - OP("rpix", HICUM_QUEST_RPIX, IF_REAL, "External base-emitter (input) resistance"), - OP("rmui", HICUM_QUEST_RMUI, IF_REAL, "Internal feedback resistance"), - OP("rmux", HICUM_QUEST_RMUX, IF_REAL, "External feedback resistance"), - OP("roi", HICUM_QUEST_ROI, IF_REAL, "Output resistance"), - OP("cpii", HICUM_QUEST_CPII, IF_REAL, "Total internal BE capacitance"), - OP("cpix", HICUM_QUEST_CPIX, IF_REAL, "Total external BE capacitance"), - OP("cmui", HICUM_QUEST_CMUI, IF_REAL, "Total internal BC capacitance"), - OP("cmux", HICUM_QUEST_CMUX, IF_REAL, "Total external BC capacitance"), - OP("ccs", HICUM_QUEST_CCS, IF_REAL, "CS junction capacitance"), - OP("betaac", HICUM_QUEST_BETAAC, IF_REAL, "Small signal current gain"), - OP("crbi", HICUM_QUEST_CRBI, IF_REAL, "Shunt capacitance across RBI as calculated in the model"), -/* transit time */ - OP("tf", HICUM_QUEST_TF, IF_REAL, "Forward transit time"), - OP("ft", HICUM_QUEST_FT, IF_REAL, "Transit frequency"), - OP("ick", HICUM_QUEST_ICK, IF_REAL, "Transit frequency"), -/* power */ - OP("p", HICUM_QUEST_POWER, IF_REAL, "Power dissipation") -}; - -IFparm HICUMmPTable[] = { /* model parameters */ -//Circuit simulator specific parameters - IOP("type", HICUM_MOD_TYPE, IF_STRING, "For transistor type NPN(+1) or PNP (-1)"), - IOPU("npn", HICUM_MOD_NPN, IF_FLAG, "NPN type device"), - IOPU("pnp", HICUM_MOD_PNP, IF_FLAG, "PNP type device"), - IOP("tnom", HICUM_MOD_TNOM, IF_REAL, "Temperature at which parameters are specified"), - IOPR("tref", HICUM_MOD_TNOM, IF_REAL, "Temperature at which parameters are specified"), - IOP("version", HICUM_MOD_VERSION, IF_STRING, " parameter for model version"), - -//Transfer current - IOP("c10", HICUM_MOD_C10 , IF_REAL, "GICCR constant"), - IOP("qp0", HICUM_MOD_QP0 , IF_REAL, "Zero-bias hole charge"), - IOP("ich", HICUM_MOD_ICH , IF_REAL, "High-current correction for 2D and 3D effects"), //`0' signifies infinity - IOP("hf0", HICUM_MOD_HF0 , IF_REAL, "Weight factor for the low current minority charge"), - IOP("hfe", HICUM_MOD_HFE , IF_REAL, "Emitter minority charge weighting factor in HBTs"), - IOP("hfc", HICUM_MOD_HFC , IF_REAL, "Collector minority charge weighting factor in HBTs"), - IOP("hjei", HICUM_MOD_HJEI , IF_REAL, "B-E depletion charge weighting factor in HBTs"), - IOP("ahjei", HICUM_MOD_AHJEI, IF_REAL, "Parameter describing the slope of hjEi(VBE)"), - IOP("rhjei", HICUM_MOD_RHJEI, IF_REAL, "Smoothing parameter for hjEi(VBE) at high voltage"), - IOP("hjci", HICUM_MOD_HJCI , IF_REAL, "B-C depletion charge weighting factor in HBTs"), - -//Base-Emitter diode currents - IOP("ibeis", HICUM_MOD_IBEIS, IF_REAL, "Internal B-E saturation current"), - IOP("mbei", HICUM_MOD_MBEI , IF_REAL, "Internal B-E current ideality factor"), - IOP("ireis", HICUM_MOD_IREIS, IF_REAL, "Internal B-E recombination saturation current"), - IOP("mrei", HICUM_MOD_MREI , IF_REAL, "Internal B-E recombination current ideality factor"), - IOP("ibeps", HICUM_MOD_IBEPS, IF_REAL, "Peripheral B-E saturation current"), - IOP("mbep", HICUM_MOD_MBEP , IF_REAL, "Peripheral B-E current ideality factor"), - IOP("ireps", HICUM_MOD_IREPS, IF_REAL, "Peripheral B-E recombination saturation current"), - IOP("mrep", HICUM_MOD_MREP , IF_REAL, "Peripheral B-E recombination current ideality factor"), - IOP("mcf", HICUM_MOD_MCF , IF_REAL, "Non-ideality factor for III-V HBTs"), - -//Transit time for excess recombination current at b-c barrier - IOP("tbhrec", HICUM_MOD_TBHREC, IF_REAL, "Base current recombination time constant at B-C barrier for high forward injection"), - -//Base-Collector diode currents - IOP("ibcis", HICUM_MOD_IBCIS, IF_REAL, "Internal B-C saturation current"), - IOP("mbci", HICUM_MOD_MBCI , IF_REAL, "Internal B-C current ideality factor"), - IOP("ibcxs", HICUM_MOD_IBCXS, IF_REAL, "External B-C saturation current"), - IOP("mbcx", HICUM_MOD_MBCX , IF_REAL, "External B-C current ideality factor"), - -//Base-Emitter tunneling current - IOP("ibets", HICUM_MOD_IBETS, IF_REAL, "B-E tunneling saturation current"), - IOP("abet", HICUM_MOD_ABET, IF_REAL, "Exponent factor for tunneling current"), - IOP("tunode",HICUM_MOD_TUNODE, IF_INTEGER, "Specifies the base node connection for the tunneling current"), // =1 signifies perimeter node - -//Base-Collector avalanche current - IOP("favl", HICUM_MOD_FAVL , IF_REAL, "Avalanche current factor"), - IOP("qavl", HICUM_MOD_QAVL , IF_REAL, "Exponent factor for avalanche current"), - IOP("kavl", HICUM_MOD_KAVL , IF_REAL, "Flag/factor for turning strong avalanche on"), - IOP("alfav", HICUM_MOD_ALFAV, IF_REAL, "Relative TC for FAVL"), - IOP("alqav", HICUM_MOD_ALQAV, IF_REAL, "Relative TC for QAVL"), - IOP("alkav", HICUM_MOD_ALKAV, IF_REAL, "Relative TC for KAVL"), - -//Series resistances - IOP("rbi0", HICUM_MOD_RBI0 , IF_REAL, "Zero bias internal base resistance"), - IOP("rbx", HICUM_MOD_RBX , IF_REAL, "External base series resistance"), - IOP("fgeo", HICUM_MOD_FGEO , IF_REAL, "Factor for geometry dependence of emitter current crowding"), - IOP("fdqr0", HICUM_MOD_FDQR0, IF_REAL, "Correction factor for modulation by B-E and B-C space charge layer"), - IOP("fcrbi", HICUM_MOD_FCRBI, IF_REAL, "Ratio of HF shunt to total internal capacitance (lateral NQS effect)"), - IOP("fqi", HICUM_MOD_FQI , IF_REAL, "Ration of internal to total minority charge"), - IOP("re", HICUM_MOD_RE , IF_REAL, "Emitter series resistance"), - IOP("rcx", HICUM_MOD_RCX , IF_REAL, "External collector series resistance"), - -//Substrate transistor - IOP("itss", HICUM_MOD_ITSS, IF_REAL, "Substrate transistor transfer saturation current"), - IOP("msf", HICUM_MOD_MSF , IF_REAL, "Forward ideality factor of substrate transfer current"), - IOP("iscs", HICUM_MOD_ISCS, IF_REAL, "C-S diode saturation current"), - IOP("msc", HICUM_MOD_MSC , IF_REAL, "Ideality factor of C-S diode current"), - IOP("tsf", HICUM_MOD_TSF , IF_REAL, "Transit time for forward operation of substrate transistor"), - -//Intra-device substrate coupling - IOP("rsu", HICUM_MOD_RSU, IF_REAL, "Substrate series resistance"), - IOP("csu", HICUM_MOD_CSU, IF_REAL, "Substrate shunt capacitance"), - -//Depletion Capacitances - IOP("cjei0", HICUM_MOD_CJEI0 , IF_REAL, "Internal B-E zero-bias depletion capacitance"), - IOP("vdei", HICUM_MOD_VDEI , IF_REAL, "Internal B-E built-in potential"), - IOP("zei", HICUM_MOD_ZEI , IF_REAL, "Internal B-E grading coefficient"), - IOP("ajei", HICUM_MOD_AJEI , IF_REAL, "Ratio of maximum to zero-bias value of internal B-E capacitance"), - IOPR("aljei", HICUM_MOD_AJEI , IF_REAL, "Ratio of maximum to zero-bias value of internal B-E capacitance"), - IOP("cjep0", HICUM_MOD_CJEP0 , IF_REAL, "Peripheral B-E zero-bias depletion capacitance"), - IOP("vdep", HICUM_MOD_VDEP , IF_REAL, "Peripheral B-E built-in potential"), - IOP("zep", HICUM_MOD_ZEP , IF_REAL, "Peripheral B-E grading coefficient"), - IOP("ajep", HICUM_MOD_AJEP , IF_REAL, "Ratio of maximum to zero-bias value of peripheral B-E capacitance"), - IOPR("aljep", HICUM_MOD_AJEP , IF_REAL, "Ratio of maximum to zero-bias value of peripheral B-E capacitance"), - IOP("cjci0", HICUM_MOD_CJCI0 , IF_REAL, "Internal B-C zero-bias depletion capacitance"), - IOP("vdci", HICUM_MOD_VDCI , IF_REAL, "Internal B-C built-in potential"), - IOP("zci", HICUM_MOD_ZCI , IF_REAL, "Internal B-C grading coefficient"), - IOP("vptci", HICUM_MOD_VPTCI , IF_REAL, "Internal B-C punch-through voltage"), - IOP("cjcx0", HICUM_MOD_CJCX0 , IF_REAL, "External B-C zero-bias depletion capacitance"), - IOP("vdcx", HICUM_MOD_VDCX , IF_REAL, "External B-C built-in potential"), - IOP("zcx", HICUM_MOD_ZCX , IF_REAL, "External B-C grading coefficient"), - IOP("vptcx", HICUM_MOD_VPTCX , IF_REAL, "External B-C punch-through voltage"), - IOP("fbcpar", HICUM_MOD_FBCPAR, IF_REAL, "Partitioning factor of parasitic B-C cap"), - IOPR("fbc", HICUM_MOD_FBCPAR, IF_REAL, "Partitioning factor of parasitic B-C cap"), - IOP("fbepar", HICUM_MOD_FBEPAR, IF_REAL, "Partitioning factor of parasitic B-E cap"), - IOPR("fbe", HICUM_MOD_FBEPAR, IF_REAL, "Partitioning factor of parasitic B-E cap"), - IOP("cjs0", HICUM_MOD_CJS0 , IF_REAL, "C-S zero-bias depletion capacitance"), - IOP("vds", HICUM_MOD_VDS , IF_REAL, "C-S built-in potential"), - IOP("zs", HICUM_MOD_ZS , IF_REAL, "C-S grading coefficient"), - IOP("vpts", HICUM_MOD_VPTS , IF_REAL, "C-S punch-through voltage"), - IOP("cscp0", HICUM_MOD_CSCP0 , IF_REAL, "Perimeter S-C zero-bias depletion capacitance"), - IOP("vdsp", HICUM_MOD_VDSP , IF_REAL, "Perimeter S-C built-in potential"), - IOP("zsp", HICUM_MOD_ZSP , IF_REAL, "Perimeter S-C grading coefficient"), - IOP("vptsp", HICUM_MOD_VPTSP , IF_REAL, "Perimeter S-C punch-through voltage"), - -//Diffusion Capacitances - IOP("t0", HICUM_MOD_T0 , IF_REAL, "Low current forward transit time at VBC=0V"), - IOP("dt0h", HICUM_MOD_DT0H , IF_REAL, "Time constant for base and B-C space charge layer width modulation"), - IOP("tbvl", HICUM_MOD_TBVL , IF_REAL, "Time constant for modeling carrier jam at low VCE"), - IOP("tef0", HICUM_MOD_TEF0 , IF_REAL, "Neutral emitter storage time"), - IOP("gtfe", HICUM_MOD_GTFE , IF_REAL, "Exponent factor for current dependence of neutral emitter storage time"), - IOP("thcs", HICUM_MOD_THCS , IF_REAL, "Saturation time constant at high current densities"), - IOP("ahc", HICUM_MOD_AHC , IF_REAL, "Smoothing factor for current dependence of base and collector transit time"), - IOPR("alhc", HICUM_MOD_AHC , IF_REAL, "Smoothing factor for current dependence of base and collector transit time"), - IOP("fthc", HICUM_MOD_FTHC , IF_REAL, "Partitioning factor for base and collector portion"), - IOP("rci0", HICUM_MOD_RCI0 , IF_REAL, "Internal collector resistance at low electric field"), - IOP("vlim", HICUM_MOD_VLIM , IF_REAL, "Voltage separating ohmic and saturation velocity regime"), - IOP("vces", HICUM_MOD_VCES , IF_REAL, "Internal C-E saturation voltage"), - IOP("vpt", HICUM_MOD_VPT , IF_REAL, "Collector punch-through voltage"), // `0' signifies infinity - IOP("aick", HICUM_MOD_AICK , IF_REAL, "Smoothing term for ICK"), - IOP("delck", HICUM_MOD_DELCK, IF_REAL, "Fitting factor for critical current"), - IOP("tr", HICUM_MOD_TR , IF_REAL, "Storage time for inverse operation"), - IOP("vcbar", HICUM_MOD_VCBAR, IF_REAL, "Barrier voltage"), - IOP("icbar", HICUM_MOD_ICBAR, IF_REAL, "Normalization parameter"), - IOP("acbar", HICUM_MOD_ACBAR, IF_REAL, "Smoothing parameter for barrier voltage"), - -//Isolation Capacitances - IOP("cbepar", HICUM_MOD_CBEPAR, IF_REAL, "Total parasitic B-E capacitance"), - IOPR("ceox", HICUM_MOD_CBEPAR, IF_REAL, "Total parasitic B-E capacitance"), - IOP("cbcpar", HICUM_MOD_CBCPAR, IF_REAL, "Total parasitic B-C capacitance"), - IOPR("ccox", HICUM_MOD_CBCPAR, IF_REAL, "Total parasitic B-C capacitance"), - -//Non-quasi-static Effect - IOP("alqf", HICUM_MOD_ALQF, IF_REAL, "Factor for additional delay time of minority charge"), - IOP("alit", HICUM_MOD_ALIT, IF_REAL, "Factor for additional delay time of transfer current"), - IOP("flnqs", HICUM_MOD_FLNQS, IF_INTEGER, "Flag for turning on and off of vertical NQS effect"), - -//Noise - IOP("kf", HICUM_MOD_KF , IF_REAL, "Flicker noise coefficient"), - IOP("af", HICUM_MOD_AF , IF_REAL, "Flicker noise exponent factor"), - IOP("cfbe", HICUM_MOD_CFBE , IF_INTEGER, "Flag for determining where to tag the flicker noise source"), - IOP("flcono", HICUM_MOD_FLCONO, IF_INTEGER, "Flag for turning on and off of correlated noise implementation"), - IOP("kfre", HICUM_MOD_KFRE , IF_REAL, "Emitter resistance flicker noise coefficient"), - IOP("afre", HICUM_MOD_AFRE , IF_REAL, "Emitter resistance flicker noise exponent factor"), - -//Lateral Geometry Scaling (at high current densities) - IOP("latb", HICUM_MOD_LATB, IF_REAL, "Scaling factor for collector minority charge in direction of emitter width"), - IOP("latl", HICUM_MOD_LATL, IF_REAL, "Scaling factor for collector minority charge in direction of emitter length"), - -//Temperature dependence - IOP("vgb", HICUM_MOD_VGB , IF_REAL, "Bandgap voltage extrapolated to 0 K"), - IOP("alt0", HICUM_MOD_ALT0 , IF_REAL, "First order relative TC of parameter T0"), - IOP("kt0", HICUM_MOD_KT0 , IF_REAL, "Second order relative TC of parameter T0"), - IOP("zetaci", HICUM_MOD_ZETACI , IF_REAL, "Temperature exponent for RCI0"), - IOP("alvs", HICUM_MOD_ALVS , IF_REAL, "Relative TC of saturation drift velocity"), - IOP("alces", HICUM_MOD_ALCES , IF_REAL, "Relative TC of VCES"), - IOP("zetarbi", HICUM_MOD_ZETARBI , IF_REAL, "Temperature exponent of internal base resistance"), - IOP("zetarbx", HICUM_MOD_ZETARBX , IF_REAL, "Temperature exponent of external base resistance"), - IOP("zetarcx", HICUM_MOD_ZETARCX , IF_REAL, "Temperature exponent of external collector resistance"), - IOP("zetare", HICUM_MOD_ZETARE , IF_REAL, "Temperature exponent of emitter resistance"), - IOP("zetacx", HICUM_MOD_ZETACX , IF_REAL, "Temperature exponent of mobility in substrate transistor transit time"), - IOP("vge", HICUM_MOD_VGE , IF_REAL, "Effective emitter bandgap voltage"), - IOP("vgc", HICUM_MOD_VGC , IF_REAL, "Effective collector bandgap voltage"), - IOP("vgs", HICUM_MOD_VGS , IF_REAL, "Effective substrate bandgap voltage"), - IOP("f1vg", HICUM_MOD_F1VG , IF_REAL, "Coefficient K1 in T-dependent band-gap equation"), - IOP("f2vg", HICUM_MOD_F2VG , IF_REAL, "Coefficient K2 in T-dependent band-gap equation"), - IOP("zetact", HICUM_MOD_ZETACT , IF_REAL, "Exponent coefficient in transfer current temperature dependence"), - IOP("zetabet", HICUM_MOD_ZETABET , IF_REAL, "Exponent coefficient in B-E junction current temperature dependence"), - IOP("alb", HICUM_MOD_ALB , IF_REAL, "Relative TC of forward current gain for V2.1 model"), - IOP("dvgbe", HICUM_MOD_DVGBE , IF_REAL, "Bandgap difference between B and B-E junction used for hjEi0 and hf0"), - IOP("zetahjei", HICUM_MOD_ZETAHJEI, IF_REAL, "Temperature coefficient for ahjEi"), - IOP("zetavgbe", HICUM_MOD_ZETAVGBE, IF_REAL, "Temperature coefficient for hjEi0"), - -//Self-Heating - IOP("flsh", HICUM_MOD_FLSH , IF_INTEGER, "Flag for turning on and off self-heating effect"), - IOP("rth", HICUM_MOD_RTH , IF_REAL, "Thermal resistance"), - IOP("zetarth", HICUM_MOD_ZETARTH, IF_REAL, "Temperature coefficient for Rth"), - IOP("alrth", HICUM_MOD_ALRTH , IF_REAL, "First order relative TC of parameter Rth"), - IOP("cth", HICUM_MOD_CTH , IF_REAL, "Thermal capacitance"), - -//Compatibility with V2.1 - IOP("flcomp", HICUM_MOD_FLCOMP, IF_REAL, "Flag for compatibility with v2.1 model (0=v2.1)"), - - IOP("vbe_max", HICUM_MOD_VBE_MAX, IF_REAL, "maximum voltage B-E junction"), - IOP("vbc_max", HICUM_MOD_VBC_MAX, IF_REAL, "maximum voltage B-C junction"), - IOP("vce_max", HICUM_MOD_VCE_MAX, IF_REAL, "maximum voltage C-E branch") - -}; - -char *HICUMnames[] = { - "collector", - "base", - "emitter", - "substrate", - "temp" -}; - - -int HICUMnSize = NUMELEMS(HICUMnames); -int HICUMpTSize = NUMELEMS(HICUMpTable); -int HICUMmPTSize = NUMELEMS(HICUMmPTable); -int HICUMiSize = sizeof(HICUMinstance); -int HICUMmSize = sizeof(HICUMmodel); +/********** +License : 3-clause BSD +Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher +Model Author : (Copyright 1993-2024) Michael Schroter +**********/ + +/* + * This file defines the HICUM data structures that are + * available to the next level(s) up the calling hierarchy + */ + +#include "ngspice/ngspice.h" +#include "ngspice/devdefs.h" +#include "hicum2defs.h" +#include "ngspice/suffix.h" + +IFparm HICUMpTable[] = { /* parameters */ + IOPU("area", HICUM_AREA, IF_REAL, "Area factor"), + IOPU("off", HICUM_OFF, IF_FLAG, "Device initially off"), + IP("ic", HICUM_IC, IF_REALVEC, "Initial condition vector"), + +// these are left here for future. Sometimes it is advantageous for debugging if one can set the initial node voltages of all nodes. +// OP("icvb", HICUM_IC_VB, IF_REAL, "Initial B potential"), +// OP("icvc", HICUM_IC_VC, IF_REAL, "Initial C potential"), +// OP("icve", HICUM_IC_VE, IF_REAL, "Initial E potential"), +// OP("icvbi", HICUM_IC_VBi, IF_REAL, "Initial Bi potential"), +// OP("icvbp", HICUM_IC_VBp, IF_REAL, "Initial Bp potential"), +// OP("icvci", HICUM_IC_VCi, IF_REAL, "Initial Ci potential"), +// OP("icvt", HICUM_IC_Vt, IF_REAL, "Initial T potential"), +// OP("icvei", HICUM_IC_VEi, IF_REAL, "Initial Ei potential"), + + IOPU("m", HICUM_M, IF_REAL, "Multiplier"), + IOPU("temp", HICUM_TEMP, IF_REAL, "Instance temperature"), + IP("dt", HICUM_DTEMP, IF_REAL, "Instance delta temperature"), + IOPU("tk", HICUM_QUEST_TK, IF_REAL, "Actual device temperature"), + IOPU("dtsh", HICUM_QUEST_DTSH, IF_REAL, "Temperature increase due to self-heating"), + IOPU("it", HICUM_QUEST_IT, IF_REAL, "transfer current"), + + OPU("collnode", HICUM_QUEST_COLLNODE, IF_INTEGER, "Number of collector node"), + OPU("basenode", HICUM_QUEST_BASENODE, IF_INTEGER, "Number of base node"), + OPU("emitnode", HICUM_QUEST_EMITNODE, IF_INTEGER, "Number of emitter node"), + OPU("subsnode", HICUM_QUEST_SUBSNODE, IF_INTEGER, "Number of substrate node"), + OPU("tempnode", HICUM_QUEST_TEMPNODE, IF_INTEGER, "Number of temperature node"), + OPU("collCInode", HICUM_QUEST_COLLCINODE, IF_INTEGER, "Internal collector node"), + OPU("baseBPnode", HICUM_QUEST_BASEBPNODE, IF_INTEGER, "External base node"), + OPU("baseBInode", HICUM_QUEST_BASEBINODE, IF_INTEGER, "Internal base node"), + OPU("emitEInode", HICUM_QUEST_EMITEINODE, IF_INTEGER, "Internal emitter node"), + OPU("subsSInode", HICUM_QUEST_SUBSSINODE, IF_INTEGER, "Internal substrate node"), + OPU("xfnode", HICUM_QUEST_XFNODE, IF_INTEGER, "Internal phase node xf"), + OPU("xf1node", HICUM_QUEST_XF1NODE, IF_INTEGER, "Internal phase node xf1"), + OPU("xf2node", HICUM_QUEST_XF2NODE, IF_INTEGER, "Internal phase node xf2"), +/* voltages */ + OP("vbe", HICUM_QUEST_VBE, IF_REAL, "External BE voltage"), + OP("vbbp", HICUM_QUEST_VBBP, IF_REAL, "BBP voltage"), + OP("vbc", HICUM_QUEST_VBC, IF_REAL, "External BC voltage"), + OP("vce", HICUM_QUEST_VCE, IF_REAL, "External CE voltage"), + OP("vsc", HICUM_QUEST_VSC, IF_REAL, "External SC voltage"), + OP("vbiei", HICUM_QUEST_VBIEI, IF_REAL, "Internal BE voltage"), + OP("vbpbi", HICUM_QUEST_VBPBI, IF_REAL, "Peripheral Base to internal Base voltage"), + OP("vbici", HICUM_QUEST_VBICI, IF_REAL, "Internal BC voltage"), + OP("vciei", HICUM_QUEST_VCIEI, IF_REAL, "Internal CE voltage"), +/* currents */ + OP("ic", HICUM_QUEST_CC, IF_REAL, "Collector current"), + OP("iavl", HICUM_QUEST_CAVL, IF_REAL, "Avalanche current"), + OP("ib", HICUM_QUEST_CB, IF_REAL, "Base current"), + OP("ibei", HICUM_QUEST_CBEI, IF_REAL, "Intenral Base Emitter current"), + OP("ibci", HICUM_QUEST_CBCI, IF_REAL, "Internal Base Collector current"), + OP("ie", HICUM_QUEST_CE, IF_REAL, "Emitter current"), + OP("is", HICUM_QUEST_CS, IF_REAL, "Substrate current"), +/* resistances */ + OP("rcx_t", HICUM_QUEST_RCX_T, IF_REAL, "External (saturated) collector series resistance"), + OP("re_t", HICUM_QUEST_RE_T, IF_REAL, "Emitter series resistance"), + OP("rbi", HICUM_QUEST_RBI, IF_REAL, "Internal base resistance as calculated in the model"), + OP("rb", HICUM_QUEST_RB, IF_REAL, "Total base resistance as calculated in the model"), + +/* transconductances and capacitances */ + OP("betadc", HICUM_QUEST_BETADC, IF_REAL, "Common emitter forward current gain"), + OP("gmi", HICUM_QUEST_GMI, IF_REAL, "Internal transconductance"), + OP("gms", HICUM_QUEST_GMS, IF_REAL, "Transconductance of the parasitic substrate PNP"), + OP("rpii", HICUM_QUEST_RPII, IF_REAL, "Internal base-emitter (input) resistance"), + OP("rpix", HICUM_QUEST_RPIX, IF_REAL, "External base-emitter (input) resistance"), + OP("rmui", HICUM_QUEST_RMUI, IF_REAL, "Internal feedback resistance"), + OP("rmux", HICUM_QUEST_RMUX, IF_REAL, "External feedback resistance"), + OP("roi", HICUM_QUEST_ROI, IF_REAL, "Output resistance"), + OP("cpii", HICUM_QUEST_CPII, IF_REAL, "Total internal BE capacitance"), + OP("cpix", HICUM_QUEST_CPIX, IF_REAL, "Total external BE capacitance"), + OP("cmui", HICUM_QUEST_CMUI, IF_REAL, "Total internal BC capacitance"), + OP("cmux", HICUM_QUEST_CMUX, IF_REAL, "Total external BC capacitance"), + OP("ccs", HICUM_QUEST_CCS, IF_REAL, "CS junction capacitance"), + OP("betaac", HICUM_QUEST_BETAAC, IF_REAL, "Small signal current gain"), + OP("crbi", HICUM_QUEST_CRBI, IF_REAL, "Shunt capacitance across RBI as calculated in the model"), +/* transit time */ + OP("tf", HICUM_QUEST_TF, IF_REAL, "Forward transit time"), + OP("ft", HICUM_QUEST_FT, IF_REAL, "Transit frequency"), + OP("ick", HICUM_QUEST_ICK, IF_REAL, "Transit frequency"), +/* power */ + OP("p", HICUM_QUEST_POWER, IF_REAL, "Power dissipation") +}; + +IFparm HICUMmPTable[] = { /* model parameters */ +//Circuit simulator specific parameters + IOP("type", HICUM_MOD_TYPE, IF_STRING, "For transistor type NPN(+1) or PNP (-1)"), + IOPU("npn", HICUM_MOD_NPN, IF_FLAG, "NPN type device"), + IOPU("pnp", HICUM_MOD_PNP, IF_FLAG, "PNP type device"), + IOP("tnom", HICUM_MOD_TNOM, IF_REAL, "Temperature at which parameters are specified"), + IOPR("tref", HICUM_MOD_TNOM, IF_REAL, "Temperature at which parameters are specified"), + IOP("version", HICUM_MOD_VERSION, IF_STRING, " parameter for model version"), + +//Transfer current + IOP("c10", HICUM_MOD_C10 , IF_REAL, "GICCR constant"), + IOP("qp0", HICUM_MOD_QP0 , IF_REAL, "Zero-bias hole charge"), + IOP("ich", HICUM_MOD_ICH , IF_REAL, "High-current correction for 2D and 3D effects"), //`0' signifies infinity + IOP("hf0", HICUM_MOD_HF0 , IF_REAL, "Weight factor for the low current minority charge"), + IOP("hfe", HICUM_MOD_HFE , IF_REAL, "Emitter minority charge weighting factor in HBTs"), + IOP("hfc", HICUM_MOD_HFC , IF_REAL, "Collector minority charge weighting factor in HBTs"), + IOP("hjei", HICUM_MOD_HJEI , IF_REAL, "B-E depletion charge weighting factor in HBTs"), + IOP("ahjei", HICUM_MOD_AHJEI, IF_REAL, "Parameter describing the slope of hjEi(VBE)"), + IOP("rhjei", HICUM_MOD_RHJEI, IF_REAL, "Smoothing parameter for hjEi(VBE) at high voltage"), + IOP("hjci", HICUM_MOD_HJCI , IF_REAL, "B-C depletion charge weighting factor in HBTs"), + +//Base-Emitter diode currents + IOP("ibeis", HICUM_MOD_IBEIS, IF_REAL, "Internal B-E saturation current"), + IOP("mbei", HICUM_MOD_MBEI , IF_REAL, "Internal B-E current ideality factor"), + IOP("ireis", HICUM_MOD_IREIS, IF_REAL, "Internal B-E recombination saturation current"), + IOP("mrei", HICUM_MOD_MREI , IF_REAL, "Internal B-E recombination current ideality factor"), + IOP("ibeps", HICUM_MOD_IBEPS, IF_REAL, "Peripheral B-E saturation current"), + IOP("mbep", HICUM_MOD_MBEP , IF_REAL, "Peripheral B-E current ideality factor"), + IOP("ireps", HICUM_MOD_IREPS, IF_REAL, "Peripheral B-E recombination saturation current"), + IOP("mrep", HICUM_MOD_MREP , IF_REAL, "Peripheral B-E recombination current ideality factor"), + IOP("mcf", HICUM_MOD_MCF , IF_REAL, "Non-ideality factor for III-V HBTs"), + +//Transit time for excess recombination current at b-c barrier + IOP("tbhrec", HICUM_MOD_TBHREC, IF_REAL, "Base current recombination time constant at B-C barrier for high forward injection"), + +//Base-Collector diode currents + IOP("ibcis", HICUM_MOD_IBCIS, IF_REAL, "Internal B-C saturation current"), + IOP("mbci", HICUM_MOD_MBCI , IF_REAL, "Internal B-C current ideality factor"), + IOP("ibcxs", HICUM_MOD_IBCXS, IF_REAL, "External B-C saturation current"), + IOP("mbcx", HICUM_MOD_MBCX , IF_REAL, "External B-C current ideality factor"), + +//Base-Emitter tunneling current + IOP("ibets", HICUM_MOD_IBETS, IF_REAL, "B-E tunneling saturation current"), + IOP("abet", HICUM_MOD_ABET, IF_REAL, "Exponent factor for tunneling current"), + IOP("tunode",HICUM_MOD_TUNODE, IF_INTEGER, "Specifies the base node connection for the tunneling current"), // =1 signifies perimeter node + +//Base-Collector avalanche current + IOP("favl", HICUM_MOD_FAVL , IF_REAL, "Avalanche current factor"), + IOP("qavl", HICUM_MOD_QAVL , IF_REAL, "Exponent factor for avalanche current"), + IOP("kavl", HICUM_MOD_KAVL , IF_REAL, "Flag/factor for turning strong avalanche on"), + IOP("alfav", HICUM_MOD_ALFAV, IF_REAL, "Relative TC for FAVL"), + IOP("alqav", HICUM_MOD_ALQAV, IF_REAL, "Relative TC for QAVL"), + IOP("alkav", HICUM_MOD_ALKAV, IF_REAL, "Relative TC for KAVL"), + +//Series resistances + IOP("rbi0", HICUM_MOD_RBI0 , IF_REAL, "Zero bias internal base resistance"), + IOP("rbx", HICUM_MOD_RBX , IF_REAL, "External base series resistance"), + IOP("fgeo", HICUM_MOD_FGEO , IF_REAL, "Factor for geometry dependence of emitter current crowding"), + IOP("fdqr0", HICUM_MOD_FDQR0, IF_REAL, "Correction factor for modulation by B-E and B-C space charge layer"), + IOP("fcrbi", HICUM_MOD_FCRBI, IF_REAL, "Ratio of HF shunt to total internal capacitance (lateral NQS effect)"), + IOP("fqi", HICUM_MOD_FQI , IF_REAL, "Ration of internal to total minority charge"), + IOP("re", HICUM_MOD_RE , IF_REAL, "Emitter series resistance"), + IOP("rcx", HICUM_MOD_RCX , IF_REAL, "External collector series resistance"), + +//Substrate transistor + IOP("itss", HICUM_MOD_ITSS, IF_REAL, "Substrate transistor transfer saturation current"), + IOP("msf", HICUM_MOD_MSF , IF_REAL, "Forward ideality factor of substrate transfer current"), + IOP("iscs", HICUM_MOD_ISCS, IF_REAL, "C-S diode saturation current"), + IOP("msc", HICUM_MOD_MSC , IF_REAL, "Ideality factor of C-S diode current"), + IOP("tsf", HICUM_MOD_TSF , IF_REAL, "Transit time for forward operation of substrate transistor"), + +//Intra-device substrate coupling + IOP("rsu", HICUM_MOD_RSU, IF_REAL, "Substrate series resistance"), + IOP("csu", HICUM_MOD_CSU, IF_REAL, "Substrate shunt capacitance"), + +//Depletion Capacitances + IOP("cjei0", HICUM_MOD_CJEI0 , IF_REAL, "Internal B-E zero-bias depletion capacitance"), + IOP("vdei", HICUM_MOD_VDEI , IF_REAL, "Internal B-E built-in potential"), + IOP("zei", HICUM_MOD_ZEI , IF_REAL, "Internal B-E grading coefficient"), + IOP("ajei", HICUM_MOD_AJEI , IF_REAL, "Ratio of maximum to zero-bias value of internal B-E capacitance"), + IOPR("aljei", HICUM_MOD_AJEI , IF_REAL, "Ratio of maximum to zero-bias value of internal B-E capacitance"), + IOP("cjep0", HICUM_MOD_CJEP0 , IF_REAL, "Peripheral B-E zero-bias depletion capacitance"), + IOP("vdep", HICUM_MOD_VDEP , IF_REAL, "Peripheral B-E built-in potential"), + IOP("zep", HICUM_MOD_ZEP , IF_REAL, "Peripheral B-E grading coefficient"), + IOP("ajep", HICUM_MOD_AJEP , IF_REAL, "Ratio of maximum to zero-bias value of peripheral B-E capacitance"), + IOPR("aljep", HICUM_MOD_AJEP , IF_REAL, "Ratio of maximum to zero-bias value of peripheral B-E capacitance"), + IOP("cjci0", HICUM_MOD_CJCI0 , IF_REAL, "Internal B-C zero-bias depletion capacitance"), + IOP("vdci", HICUM_MOD_VDCI , IF_REAL, "Internal B-C built-in potential"), + IOP("zci", HICUM_MOD_ZCI , IF_REAL, "Internal B-C grading coefficient"), + IOP("vptci", HICUM_MOD_VPTCI , IF_REAL, "Internal B-C punch-through voltage"), + IOP("cjcx0", HICUM_MOD_CJCX0 , IF_REAL, "External B-C zero-bias depletion capacitance"), + IOP("vdcx", HICUM_MOD_VDCX , IF_REAL, "External B-C built-in potential"), + IOP("zcx", HICUM_MOD_ZCX , IF_REAL, "External B-C grading coefficient"), + IOP("vptcx", HICUM_MOD_VPTCX , IF_REAL, "External B-C punch-through voltage"), + IOP("fbcpar", HICUM_MOD_FBCPAR, IF_REAL, "Partitioning factor of parasitic B-C cap"), + IOPR("fbc", HICUM_MOD_FBCPAR, IF_REAL, "Partitioning factor of parasitic B-C cap"), + IOP("fbepar", HICUM_MOD_FBEPAR, IF_REAL, "Partitioning factor of parasitic B-E cap"), + IOPR("fbe", HICUM_MOD_FBEPAR, IF_REAL, "Partitioning factor of parasitic B-E cap"), + IOP("cjs0", HICUM_MOD_CJS0 , IF_REAL, "C-S zero-bias depletion capacitance"), + IOP("vds", HICUM_MOD_VDS , IF_REAL, "C-S built-in potential"), + IOP("zs", HICUM_MOD_ZS , IF_REAL, "C-S grading coefficient"), + IOP("vpts", HICUM_MOD_VPTS , IF_REAL, "C-S punch-through voltage"), + IOP("cscp0", HICUM_MOD_CSCP0 , IF_REAL, "Perimeter S-C zero-bias depletion capacitance"), + IOP("vdsp", HICUM_MOD_VDSP , IF_REAL, "Perimeter S-C built-in potential"), + IOP("zsp", HICUM_MOD_ZSP , IF_REAL, "Perimeter S-C grading coefficient"), + IOP("vptsp", HICUM_MOD_VPTSP , IF_REAL, "Perimeter S-C punch-through voltage"), + +//Diffusion Capacitances + IOP("t0", HICUM_MOD_T0 , IF_REAL, "Low current forward transit time at VBC=0V"), + IOP("dt0h", HICUM_MOD_DT0H , IF_REAL, "Time constant for base and B-C space charge layer width modulation"), + IOP("tbvl", HICUM_MOD_TBVL , IF_REAL, "Time constant for modeling carrier jam at low VCE"), + IOP("tef0", HICUM_MOD_TEF0 , IF_REAL, "Neutral emitter storage time"), + IOP("gtfe", HICUM_MOD_GTFE , IF_REAL, "Exponent factor for current dependence of neutral emitter storage time"), + IOP("thcs", HICUM_MOD_THCS , IF_REAL, "Saturation time constant at high current densities"), + IOP("ahc", HICUM_MOD_AHC , IF_REAL, "Smoothing factor for current dependence of base and collector transit time"), + IOPR("alhc", HICUM_MOD_AHC , IF_REAL, "Smoothing factor for current dependence of base and collector transit time"), + IOP("fthc", HICUM_MOD_FTHC , IF_REAL, "Partitioning factor for base and collector portion"), + IOP("rci0", HICUM_MOD_RCI0 , IF_REAL, "Internal collector resistance at low electric field"), + IOP("vlim", HICUM_MOD_VLIM , IF_REAL, "Voltage separating ohmic and saturation velocity regime"), + IOP("vces", HICUM_MOD_VCES , IF_REAL, "Internal C-E saturation voltage"), + IOP("vpt", HICUM_MOD_VPT , IF_REAL, "Collector punch-through voltage"), // `0' signifies infinity + IOP("aick", HICUM_MOD_AICK , IF_REAL, "Smoothing term for ICK"), + IOP("delck", HICUM_MOD_DELCK, IF_REAL, "Fitting factor for critical current"), + IOP("tr", HICUM_MOD_TR , IF_REAL, "Storage time for inverse operation"), + IOP("vcbar", HICUM_MOD_VCBAR, IF_REAL, "Barrier voltage"), + IOP("icbar", HICUM_MOD_ICBAR, IF_REAL, "Normalization parameter"), + IOP("acbar", HICUM_MOD_ACBAR, IF_REAL, "Smoothing parameter for barrier voltage"), + +//Isolation Capacitances + IOP("cbepar", HICUM_MOD_CBEPAR, IF_REAL, "Total parasitic B-E capacitance"), + IOPR("ceox", HICUM_MOD_CBEPAR, IF_REAL, "Total parasitic B-E capacitance"), + IOP("cbcpar", HICUM_MOD_CBCPAR, IF_REAL, "Total parasitic B-C capacitance"), + IOPR("ccox", HICUM_MOD_CBCPAR, IF_REAL, "Total parasitic B-C capacitance"), + +//Non-quasi-static Effect + IOP("alqf", HICUM_MOD_ALQF, IF_REAL, "Factor for additional delay time of minority charge"), + IOP("alit", HICUM_MOD_ALIT, IF_REAL, "Factor for additional delay time of transfer current"), + IOP("flnqs", HICUM_MOD_FLNQS, IF_INTEGER, "Flag for turning on and off of vertical NQS effect"), + +//Noise + IOP("kf", HICUM_MOD_KF , IF_REAL, "Flicker noise coefficient"), + IOP("af", HICUM_MOD_AF , IF_REAL, "Flicker noise exponent factor"), + IOP("cfbe", HICUM_MOD_CFBE , IF_INTEGER, "Flag for determining where to tag the flicker noise source"), + IOP("flcono", HICUM_MOD_FLCONO, IF_INTEGER, "Flag for turning on and off of correlated noise implementation"), + IOP("kfre", HICUM_MOD_KFRE , IF_REAL, "Emitter resistance flicker noise coefficient"), + IOP("afre", HICUM_MOD_AFRE , IF_REAL, "Emitter resistance flicker noise exponent factor"), + +//Lateral Geometry Scaling (at high current densities) + IOP("latb", HICUM_MOD_LATB, IF_REAL, "Scaling factor for collector minority charge in direction of emitter width"), + IOP("latl", HICUM_MOD_LATL, IF_REAL, "Scaling factor for collector minority charge in direction of emitter length"), + +//Temperature dependence + IOP("vgb", HICUM_MOD_VGB , IF_REAL, "Bandgap voltage extrapolated to 0 K"), + IOP("alt0", HICUM_MOD_ALT0 , IF_REAL, "First order relative TC of parameter T0"), + IOP("kt0", HICUM_MOD_KT0 , IF_REAL, "Second order relative TC of parameter T0"), + IOP("zetaci", HICUM_MOD_ZETACI , IF_REAL, "Temperature exponent for RCI0"), + IOP("alvs", HICUM_MOD_ALVS , IF_REAL, "Relative TC of saturation drift velocity"), + IOP("alces", HICUM_MOD_ALCES , IF_REAL, "Relative TC of VCES"), + IOP("zetarbi", HICUM_MOD_ZETARBI , IF_REAL, "Temperature exponent of internal base resistance"), + IOP("zetarbx", HICUM_MOD_ZETARBX , IF_REAL, "Temperature exponent of external base resistance"), + IOP("zetarcx", HICUM_MOD_ZETARCX , IF_REAL, "Temperature exponent of external collector resistance"), + IOP("zetare", HICUM_MOD_ZETARE , IF_REAL, "Temperature exponent of emitter resistance"), + IOP("zetacx", HICUM_MOD_ZETACX , IF_REAL, "Temperature exponent of mobility in substrate transistor transit time"), + IOP("vge", HICUM_MOD_VGE , IF_REAL, "Effective emitter bandgap voltage"), + IOP("vgc", HICUM_MOD_VGC , IF_REAL, "Effective collector bandgap voltage"), + IOP("vgs", HICUM_MOD_VGS , IF_REAL, "Effective substrate bandgap voltage"), + IOP("f1vg", HICUM_MOD_F1VG , IF_REAL, "Coefficient K1 in T-dependent band-gap equation"), + IOP("f2vg", HICUM_MOD_F2VG , IF_REAL, "Coefficient K2 in T-dependent band-gap equation"), + IOP("zetact", HICUM_MOD_ZETACT , IF_REAL, "Exponent coefficient in transfer current temperature dependence"), + IOP("zetabet", HICUM_MOD_ZETABET , IF_REAL, "Exponent coefficient in B-E junction current temperature dependence"), + IOP("alb", HICUM_MOD_ALB , IF_REAL, "Relative TC of forward current gain for V2.1 model"), + IOP("dvgbe", HICUM_MOD_DVGBE , IF_REAL, "Bandgap difference between B and B-E junction used for hjEi0 and hf0"), + IOP("zetahjei", HICUM_MOD_ZETAHJEI, IF_REAL, "Temperature coefficient for ahjEi"), + IOP("zetavgbe", HICUM_MOD_ZETAVGBE, IF_REAL, "Temperature coefficient for hjEi0"), + +//Self-Heating + IOP("flsh", HICUM_MOD_FLSH , IF_INTEGER, "Flag for turning on and off self-heating effect"), + IOP("rth", HICUM_MOD_RTH , IF_REAL, "Thermal resistance"), + IOP("zetarth", HICUM_MOD_ZETARTH, IF_REAL, "Temperature coefficient for Rth"), + IOP("alrth", HICUM_MOD_ALRTH , IF_REAL, "First order relative TC of parameter Rth"), + IOP("cth", HICUM_MOD_CTH , IF_REAL, "Thermal capacitance"), + +//Compatibility with V2.1 + IOP("flcomp", HICUM_MOD_FLCOMP, IF_REAL, "Flag for compatibility with v2.1 model (0=v2.1)"), + + IOP("vbe_max", HICUM_MOD_VBE_MAX, IF_REAL, "maximum voltage B-E junction"), + IOP("vbc_max", HICUM_MOD_VBC_MAX, IF_REAL, "maximum voltage B-C junction"), + IOP("vce_max", HICUM_MOD_VCE_MAX, IF_REAL, "maximum voltage C-E branch") + +}; + +char *HICUMnames[] = { + "collector", + "base", + "emitter", + "substrate", + "temp" +}; + + +int HICUMnSize = NUMELEMS(HICUMnames); +int HICUMpTSize = NUMELEMS(HICUMpTable); +int HICUMmPTSize = NUMELEMS(HICUMmPTable); +int HICUMiSize = sizeof(HICUMinstance); +int HICUMmSize = sizeof(HICUMmodel); diff --git a/src/spicelib/devices/hicum2/hicum2acld.c b/src/spicelib/devices/hicum2/hicum2acld.c index 66ee40e0a..40b24250c 100644 --- a/src/spicelib/devices/hicum2/hicum2acld.c +++ b/src/spicelib/devices/hicum2/hicum2acld.c @@ -1,646 +1,646 @@ -/********** -License : 3-clause BSD -Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden -**********/ - -/* - * Function to load the COMPLEX circuit matrix using the - * small signal parameters saved during a previous DC operating - * point analysis. - */ - -#include "ngspice/ngspice.h" -#include "ngspice/cktdefs.h" -#include "hicum2defs.h" -#include "ngspice/sperror.h" -#include "ngspice/suffix.h" - -int -HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) -{ - HICUMinstance *here; - HICUMmodel *model = (HICUMmodel*)inModel; - double Ibpei_Vbpei; - double Ibpei_Vrth; - - double Ibiei_Vbiei; - double Ibiei_Vxf; - double Ibiei_Vbici; - double Ibiei_Vrth; - - double Ibici_Vbici; - double Ibici_Vbiei; - double Ibici_Vrth; - - double Ibpci_Vbpci; - double Ibpci_Vrth; - - double Isici_Vsici; - double Isici_Vrth; - - double Iciei_Vbiei; - double Iciei_Vbici; - double Iciei_Vrth; - double Iciei_Vxf2; - - - double Ibpbi_Vbpbi; - double Ibpbi_Vbici; - double Ibpbi_Vbiei; - double Ibpbi_Vrth; - - double Isis_Vsis; - double Irth_Vrth; - double Icic_Vcic, Icic_Vrth; - double Ieie_Veie, Ieie_Vrth; - double Ibbp_Vbbp, Ibbp_Vrth; - - double Ibpsi_Vbpci; - double Ibpsi_Vsici; - double Ibpsi_Vrth; - - double XQrbi_Vbpbi; - double XQrbi_Vbiei; - double XQrbi_Vbici; - double XQrbi_Vrth; - double XQjei_Vbiei; - double XQjei_Vrth; - double XQjci_Vbici; - double XQjci_Vrth; - double XQjep_Vbpei; - double XQjep_Vrth; - double volatile Xqjcx0_t_i_Vbci; - double Xqjcx0_t_i_Vrth; - double volatile Xqjcx0_t_ii_Vbpci; - double Xqjcx0_t_ii_Vrth; - double XQdsu_Vbpci; - double XQdsu_Vsici; - double XQdsu_Vrth; - double XQjs_Vsici; - double XQjs_Vrth; - double XQscp_Vsc; - double XQscp_Vrth; - double XQbepar1_Vbe; - double XQbepar2_Vbpe; - double XQbcpar1_Vbci; - double XQbcpar2_Vbpci; - double XQsu_Vsis; - double XQcth_Vrth; - double XQf_Vbiei; - double XQf_Vbici; - double XQf_Vrth; - double XQf_Vxf; - double XQr_Vrth; - double XQr_Vbiei; - double XQr_Vbici; - - double XQxf_Vxf; - double XQxf1_Vxf1; - double XQxf2_Vxf2; - - double Ixf1_Vbiei; - double Ixf1_Vbici; - double Ixf1_Vxf2 ; - double Ixf1_Vxf1 ; - double Ixf1_Vrth ; - - double Ixf2_Vbiei; - double Ixf2_Vbici; - double Ixf2_Vxf2 ; - double Ixf2_Vxf1 ; - double Ixf2_Vrth ; - - double Ixf_Vbiei ; - double Ixf_Vbici ; - double Ixf_Vxf ; - double Ixf_Vrth ; - - double Ith_Vrth, Ith_Vbiei, Ith_Vbici, Ith_Vbpbi, Ith_Vbpci, Ith_Vbpei, Ith_Vciei, Ith_Vsici, Ith_Vcic, Ith_Vbbp, Ith_Veie; - - /* loop through all the models */ - for( ; model != NULL; model = HICUMnextModel(model)) { - - /* loop through all the instances of the model */ - for( here = HICUMinstances(model); here!= NULL; - here = HICUMnextInstance(here)) { - - - // get all derivatives of branch DC currents - if(model->HICUMrcxGiven && model->HICUMrcx != 0) { - Icic_Vcic = 1/here->HICUMrcx_t.rpart; - Icic_Vrth = -*(ckt->CKTstate0 + here->HICUMvcic)/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart*here->HICUMrcx_t.dpart; - } else { - Icic_Vcic = 0.0; - Icic_Vrth = 0.0; - } - if(model->HICUMrbxGiven && model->HICUMrbx != 0) { - Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; - Ibbp_Vrth = -*(ckt->CKTstate0 + here->HICUMvbbp)/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart*here->HICUMrbx_t.dpart; - } else { - Ibbp_Vbbp = 0.0; - Ibbp_Vrth = 0.0; - } - if(model->HICUMreGiven && model->HICUMre != 0) { - Ieie_Veie = 1/here->HICUMre_t.rpart; - Ieie_Vrth = -*(ckt->CKTstate0 + here->HICUMveie)/here->HICUMre_t.rpart/here->HICUMre_t.rpart*here->HICUMre_t.dpart; - } else { - Ieie_Veie = 0.0; - Ieie_Vrth = 0.0; - } - if(model->HICUMrsuGiven && model->HICUMrsu != 0) { - Isis_Vsis = 1/model->HICUMrsu*here->HICUMm; - } else { - Isis_Vsis = 0.0; - } - if(model->HICUMselfheat) { - Irth_Vrth = (1/here->HICUMrth_t.rpart - *(ckt->CKTstate0 + here->HICUMvrth)/(here->HICUMrth_t.rpart*here->HICUMrth_t.rpart) * here->HICUMrth_t.dpart); - } else { - Irth_Vrth = 0.0; - } - - - - Ibiei_Vbiei = *(ckt->CKTstate0 + here->HICUMibiei_Vbiei); - Ibiei_Vxf = *(ckt->CKTstate0 + here->HICUMibiei_Vxf); - Ibiei_Vbici = *(ckt->CKTstate0 + here->HICUMibiei_Vbici); - Ibiei_Vrth = *(ckt->CKTstate0 + here->HICUMibiei_Vrth); - - Ibpei_Vbpei = *(ckt->CKTstate0 + here->HICUMibpei_Vbpei); - Ibpei_Vrth = *(ckt->CKTstate0 + here->HICUMibpei_Vrth); - - Iciei_Vbiei = *(ckt->CKTstate0 + here->HICUMiciei_Vbiei); - Iciei_Vbici = *(ckt->CKTstate0 + here->HICUMiciei_Vbici); - Iciei_Vrth = *(ckt->CKTstate0 + here->HICUMiciei_Vrth); - Iciei_Vxf2 = *(ckt->CKTstate0 + here->HICUMiciei_Vxf2); - - Ibici_Vbici = *(ckt->CKTstate0 + here->HICUMibici_Vbici); - Ibici_Vbiei = *(ckt->CKTstate0 + here->HICUMibici_Vbiei); - Ibici_Vrth = *(ckt->CKTstate0 + here->HICUMibici_Vrth); - - Ibpbi_Vbpbi = *(ckt->CKTstate0 + here->HICUMibpbi_Vbpbi); - Ibpbi_Vbiei = *(ckt->CKTstate0 + here->HICUMibpbi_Vbiei); - Ibpbi_Vbici = *(ckt->CKTstate0 + here->HICUMibpbi_Vbici); - Ibpbi_Vrth = *(ckt->CKTstate0 + here->HICUMibpbi_Vrth); - - Ibpci_Vbpci = *(ckt->CKTstate0 + here->HICUMibpci_Vbpci); - Ibpci_Vrth = *(ckt->CKTstate0 + here->HICUMibpci_Vrth); - - Isici_Vsici = *(ckt->CKTstate0 + here->HICUMisici_Vsici); - Isici_Vrth = *(ckt->CKTstate0 + here->HICUMisici_Vrth); - - Ibpsi_Vbpci = *(ckt->CKTstate0 + here->HICUMibpsi_Vbpci); - Ibpsi_Vsici = *(ckt->CKTstate0 + here->HICUMibpsi_Vsici); - Ibpsi_Vrth = *(ckt->CKTstate0 + here->HICUMibpsi_Vrth); - - Ith_Vrth = *(ckt->CKTstate0 + here->HICUMith_Vrth); - Ith_Vbiei = *(ckt->CKTstate0 + here->HICUMith_Vbiei); - Ith_Vbici = *(ckt->CKTstate0 + here->HICUMith_Vbici); - Ith_Vbpbi = *(ckt->CKTstate0 + here->HICUMith_Vbpbi); - Ith_Vbpci = *(ckt->CKTstate0 + here->HICUMith_Vbpci); - Ith_Vbpei = *(ckt->CKTstate0 + here->HICUMith_Vbpei); - Ith_Vciei = *(ckt->CKTstate0 + here->HICUMith_Vciei); - Ith_Vsici = *(ckt->CKTstate0 + here->HICUMith_Vsici); - Ith_Vcic = *(ckt->CKTstate0 + here->HICUMith_Vcic); - Ith_Vbbp = *(ckt->CKTstate0 + here->HICUMith_Vbbp); - Ith_Veie = *(ckt->CKTstate0 + here->HICUMith_Veie); - - Ixf1_Vbiei = *(ckt->CKTstate0 + here->HICUMixf1_Vbiei); - Ixf1_Vbici = *(ckt->CKTstate0 + here->HICUMixf1_Vbici); - Ixf1_Vxf2 = *(ckt->CKTstate0 + here->HICUMixf1_Vxf2); - Ixf1_Vxf1 = *(ckt->CKTstate0 + here->HICUMixf1_Vxf1); - Ixf1_Vrth = *(ckt->CKTstate0 + here->HICUMixf1_Vrth); - - Ixf2_Vbiei = *(ckt->CKTstate0 + here->HICUMixf2_Vbiei); - Ixf2_Vbici = *(ckt->CKTstate0 + here->HICUMixf2_Vbici); - Ixf2_Vxf2 = *(ckt->CKTstate0 + here->HICUMixf2_Vxf2); - Ixf2_Vxf1 = *(ckt->CKTstate0 + here->HICUMixf2_Vxf1); - Ixf2_Vrth = *(ckt->CKTstate0 + here->HICUMixf2_Vrth); - - Ixf_Vbiei = *(ckt->CKTstate0 + here->HICUMixf_Vbiei); - Ixf_Vbici = *(ckt->CKTstate0 + here->HICUMixf_Vbici); - Ixf_Vxf = *(ckt->CKTstate0 + here->HICUMixf_Vxf); - Ixf_Vrth = *(ckt->CKTstate0 + here->HICUMixf_Vrth); - -//////////////////////////////////// -////////// The real part ///////// -//////////////////////////////////// - -// Stamp element: Ibiei - *(here->HICUMbaseBIBaseBIPtr) += Ibiei_Vbiei; - *(here->HICUMemitEIEmitEIPtr) += Ibiei_Vbiei; - *(here->HICUMbaseBIEmitEIPtr) += -Ibiei_Vbiei; - *(here->HICUMemitEIBaseBIPtr) += -Ibiei_Vbiei; - *(here->HICUMbaseBIBaseBIPtr) += Ibiei_Vbici; - *(here->HICUMemitEICollCIPtr) += Ibiei_Vbici; - *(here->HICUMbaseBICollCIPtr) += -Ibiei_Vbici; - *(here->HICUMemitEIBaseBIPtr) += -Ibiei_Vbici; - if (model->HICUMnqs) { - *(here->HICUMbaseBIXfPtr) += Ibiei_Vxf; - *(here->HICUMemitEIXfPtr) += -Ibiei_Vxf; - } - -// Stamp element: Ibpei - *(here->HICUMbaseBPBaseBPPtr) += Ibpei_Vbpei; - *(here->HICUMemitEIEmitEIPtr) += Ibpei_Vbpei; - *(here->HICUMbaseBPEmitEIPtr) += -Ibpei_Vbpei; - *(here->HICUMemitEIBaseBPPtr) += -Ibpei_Vbpei;; - -// Stamp element: Ibici - *(here->HICUMbaseBIBaseBIPtr) += Ibici_Vbici; - *(here->HICUMcollCICollCIPtr) += Ibici_Vbici; - *(here->HICUMcollCIBaseBIPtr) += -Ibici_Vbici; - *(here->HICUMbaseBICollCIPtr) += -Ibici_Vbici; - *(here->HICUMbaseBIBaseBIPtr) += Ibici_Vbiei; - *(here->HICUMcollCIEmitEIPtr) += Ibici_Vbiei; - *(here->HICUMcollCIBaseBIPtr) += -Ibici_Vbiei; - *(here->HICUMbaseBIEmitEIPtr) += -Ibici_Vbiei; - -// Stamp element: Iciei - *(here->HICUMcollCIBaseBIPtr) += Iciei_Vbiei; - *(here->HICUMemitEIEmitEIPtr) += Iciei_Vbiei; - *(here->HICUMcollCIEmitEIPtr) += -Iciei_Vbiei; - *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbiei; - *(here->HICUMcollCIBaseBIPtr) += Iciei_Vbici; - *(here->HICUMemitEICollCIPtr) += Iciei_Vbici; - *(here->HICUMcollCICollCIPtr) += -Iciei_Vbici; - *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbici; - if (model->HICUMnqs) { - *(here->HICUMcollCIXf2Ptr) += Iciei_Vxf2; - *(here->HICUMemitEIXf2Ptr) += -Iciei_Vxf2; - } - - -// Stamp element: Ibpci - *(here->HICUMbaseBPBaseBPPtr) += Ibpci_Vbpci; - *(here->HICUMcollCICollCIPtr) += Ibpci_Vbpci; - *(here->HICUMbaseBPCollCIPtr) += -Ibpci_Vbpci; - *(here->HICUMcollCIBaseBPPtr) += -Ibpci_Vbpci; - -// Stamp element: Rcx - *(here->HICUMcollCollPtr) += Icic_Vcic; - *(here->HICUMcollCICollCIPtr) += Icic_Vcic; - *(here->HICUMcollCICollPtr) += -Icic_Vcic; - *(here->HICUMcollCollCIPtr) += -Icic_Vcic; - -// Stamp element: Rbx - *(here->HICUMbaseBasePtr) += Ibbp_Vbbp; - *(here->HICUMbaseBPBaseBPPtr) += Ibbp_Vbbp; - *(here->HICUMbaseBPBasePtr) += -Ibbp_Vbbp; - *(here->HICUMbaseBaseBPPtr) += -Ibbp_Vbbp; - -// Stamp element: Re - *(here->HICUMemitEmitPtr) += Ieie_Veie; - *(here->HICUMemitEIEmitEIPtr) += Ieie_Veie; - *(here->HICUMemitEIEmitPtr) += -Ieie_Veie; - *(here->HICUMemitEmitEIPtr) += -Ieie_Veie; - -// Stamp element: Ibpbi - if (here->HICUMrbi>0.0) { - *(here->HICUMbaseBPBaseBPPtr) += Ibpbi_Vbpbi; - *(here->HICUMbaseBIBaseBIPtr) += Ibpbi_Vbpbi; - *(here->HICUMbaseBPBaseBIPtr) += -Ibpbi_Vbpbi; - *(here->HICUMbaseBIBaseBPPtr) += -Ibpbi_Vbpbi; - *(here->HICUMbaseBPBaseBIPtr) += Ibpbi_Vbiei; - *(here->HICUMbaseBIEmitEIPtr) += Ibpbi_Vbiei; - *(here->HICUMbaseBPEmitEIPtr) += -Ibpbi_Vbiei; - *(here->HICUMbaseBIBaseBIPtr) += -Ibpbi_Vbiei; - *(here->HICUMbaseBPBaseBIPtr) += Ibpbi_Vbici; - *(here->HICUMbaseBICollCIPtr) += Ibpbi_Vbici; - *(here->HICUMbaseBPCollCIPtr) += -Ibpbi_Vbici; - *(here->HICUMbaseBIBaseBIPtr) += -Ibpbi_Vbici; - }; - -// Stamp element: Isici - *(here->HICUMsubsSISubsSIPtr) += Isici_Vsici; - *(here->HICUMcollCICollCIPtr) += Isici_Vsici; - *(here->HICUMsubsSICollCIPtr) += -Isici_Vsici; - *(here->HICUMcollCISubsSIPtr) += -Isici_Vsici;; - -// Stamp element: Ibpsi - *(here->HICUMbaseBPSubsSIPtr) += Ibpsi_Vsici; - *(here->HICUMsubsSICollCIPtr) += Ibpsi_Vsici; - *(here->HICUMbaseBPCollCIPtr) += -Ibpsi_Vsici; - *(here->HICUMsubsSISubsSIPtr) += -Ibpsi_Vsici; - *(here->HICUMbaseBPBaseBPPtr) += Ibpsi_Vbpci; - *(here->HICUMsubsSICollCIPtr) += Ibpsi_Vbpci; - *(here->HICUMbaseBPCollCIPtr) += -Ibpsi_Vbpci; - *(here->HICUMsubsSIBaseBPPtr) += -Ibpsi_Vbpci;; - -// Stamp element: Rsu - *(here->HICUMsubsSubsPtr) += Isis_Vsis; - *(here->HICUMsubsSISubsSIPtr) += Isis_Vsis; - *(here->HICUMsubsSISubsPtr) += -Isis_Vsis; - *(here->HICUMsubsSubsSIPtr) += -Isis_Vsis; - - if (model->HICUMnqs) { - //Ixf1 - *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbiei; - *(here->HICUMxf1EmitEIPtr) += -Ixf1_Vbiei; - *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbici; - *(here->HICUMxf1CollCIPtr) += -Ixf1_Vbici; - *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; - *(here->HICUMxf1Xf1Ptr) += +Ixf1_Vxf1; - //Ixf2 - *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbiei; - *(here->HICUMxf2EmitEIPtr) += -Ixf2_Vbiei; - *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbici; - *(here->HICUMxf2CollCIPtr) += -Ixf2_Vbici; - *(here->HICUMxf2Xf2Ptr) += +Ixf2_Vxf2; - *(here->HICUMxf2Xf1Ptr) += +Ixf2_Vxf1; - //Ixf - *(here->HICUMxfBaseBIPtr) += +Ixf_Vbiei; - *(here->HICUMxfEmitEIPtr) += -Ixf_Vbiei; - *(here->HICUMxfBaseBIPtr) += +Ixf_Vbici; - *(here->HICUMxfCollCIPtr) += -Ixf_Vbici; - *(here->HICUMxfXfPtr) += +Ixf_Vxf; - } - -//////////////////////////////////// -////////// The complex part ////// -//////////////////////////////////// - - //Qrbi - XQrbi_Vbpbi = *(ckt->CKTstate0 + here->HICUMcqrbi) * ckt->CKTomega; - XQrbi_Vbiei = here->HICUMqrbi_Vbiei * ckt->CKTomega; - XQrbi_Vbici = here->HICUMqrbi_Vbici * ckt->CKTomega; - XQrbi_Vrth = here->HICUMqrbi_Vrth * ckt->CKTomega; - //Qjei - XQjei_Vbiei = *(ckt->CKTstate0 + here->HICUMcqjei) * ckt->CKTomega; - XQjei_Vrth = here->HICUMqjei_Vrth * ckt->CKTomega; - //Qf - XQf_Vbiei = *(ckt->CKTstate0 + here->HICUMcqf) * ckt->CKTomega; - XQf_Vbici = here->HICUMqf_Vbici * ckt->CKTomega; - XQf_Vrth = here->HICUMqf_Vrth * ckt->CKTomega; - XQf_Vxf = here->HICUMqf_Vxf * ckt->CKTomega; - //Qr - XQr_Vbici = *(ckt->CKTstate0 + here->HICUMcqr) * ckt->CKTomega; - XQr_Vbiei = here->HICUMqr_Vbiei * ckt->CKTomega; - XQr_Vrth = here->HICUMqr_Vrth * ckt->CKTomega; - //Qjci - XQjci_Vbici = *(ckt->CKTstate0 + here->HICUMcqjci) * ckt->CKTomega; - XQjci_Vrth = here->HICUMqjci_Vrth * ckt->CKTomega; - //Qjep - XQjep_Vbpei = *(ckt->CKTstate0 + here->HICUMcqjep) * ckt->CKTomega; - XQjep_Vrth = here->HICUMqjep_Vrth * ckt->CKTomega; - //Qjcx_i - Xqjcx0_t_i_Vbci = *(ckt->CKTstate0 + here->HICUMcqcx0_t_i) * ckt->CKTomega; - Xqjcx0_t_i_Vrth = here->HICUMqjcx0_i_Vrth * ckt->CKTomega; - //Qjcx_ii - Xqjcx0_t_ii_Vbpci = *(ckt->CKTstate0 + here->HICUMcqcx0_t_ii) * ckt->CKTomega; - Xqjcx0_t_ii_Vrth = here->HICUMqjcx0_ii_Vrth * ckt->CKTomega; - //Qdsu - XQdsu_Vbpci = *(ckt->CKTstate0 + here->HICUMcqdsu) * ckt->CKTomega; - XQdsu_Vsici = here->HICUMqdsu_Vsici * ckt->CKTomega; - XQdsu_Vrth = here->HICUMqdsu_Vrth * ckt->CKTomega; - //Qjs - XQjs_Vsici = *(ckt->CKTstate0 + here->HICUMcqjs) * ckt->CKTomega; - XQjs_Vrth = here->HICUMqjs_Vrth * ckt->CKTomega; - //Qscp - XQscp_Vsc = *(ckt->CKTstate0 + here->HICUMcqscp) * ckt->CKTomega; - XQscp_Vrth = here->HICUMqscp_Vrth * ckt->CKTomega; - //Qbepar1 - XQbepar1_Vbe = *(ckt->CKTstate0 + here->HICUMcqbepar1) * ckt->CKTomega; - //Qbepar2 - XQbepar2_Vbpe = *(ckt->CKTstate0 + here->HICUMcqbepar2) * ckt->CKTomega; - //Qbcpar1 - XQbcpar1_Vbci = *(ckt->CKTstate0 + here->HICUMcqbcpar1) * ckt->CKTomega; - //Qbcpar2 - XQbcpar2_Vbpci = *(ckt->CKTstate0 + here->HICUMcqbcpar2) * ckt->CKTomega; - //Qsu - XQsu_Vsis = *(ckt->CKTstate0 + here->HICUMcqsu) * ckt->CKTomega; - //Qcth - XQcth_Vrth = *(ckt->CKTstate0 + here->HICUMcqcth) * ckt->CKTomega; - //Qxf - XQxf_Vxf = *(ckt->CKTstate0 + here->HICUMcqxf) * ckt->CKTomega; - XQxf1_Vxf1 = *(ckt->CKTstate0 + here->HICUMcqxf1) * ckt->CKTomega; - XQxf2_Vxf2 = *(ckt->CKTstate0 + here->HICUMcqxf2) * ckt->CKTomega; - - //Qrbi f_bp=+ f_bi=- - if (here->HICUMrbi>0.0) { - *(here->HICUMbaseBPBaseBPPtr + 1) += XQrbi_Vbpbi; - *(here->HICUMbaseBIBaseBIPtr + 1) += XQrbi_Vbpbi; - *(here->HICUMbaseBPBaseBIPtr + 1) += -XQrbi_Vbpbi; - *(here->HICUMbaseBIBaseBPPtr + 1) += -XQrbi_Vbpbi; - *(here->HICUMbaseBPBaseBIPtr + 1) += XQrbi_Vbiei; - *(here->HICUMbaseBIEmitEIPtr + 1) += XQrbi_Vbiei; - *(here->HICUMbaseBPEmitEIPtr + 1) += -XQrbi_Vbiei; - *(here->HICUMbaseBIBaseBIPtr + 1) += -XQrbi_Vbiei; - *(here->HICUMbaseBPBaseBIPtr + 1) += XQrbi_Vbici; - *(here->HICUMbaseBICollCIPtr + 1) += XQrbi_Vbici; - *(here->HICUMbaseBPCollCIPtr + 1) += -XQrbi_Vbici; - *(here->HICUMbaseBIBaseBIPtr + 1) += -XQrbi_Vbici; - } - //Qjei - *(here->HICUMbaseBIBaseBIPtr + 1) += XQjei_Vbiei; - *(here->HICUMemitEIEmitEIPtr + 1) += XQjei_Vbiei; - *(here->HICUMbaseBIEmitEIPtr + 1) += -XQjei_Vbiei; - *(here->HICUMemitEIBaseBIPtr + 1) += -XQjei_Vbiei; - //Qf f_Bi=+ f_Ei =- - *(here->HICUMbaseBIBaseBIPtr +1) += XQf_Vbiei; - *(here->HICUMemitEIEmitEIPtr +1) += XQf_Vbiei; - *(here->HICUMbaseBIEmitEIPtr +1) += -XQf_Vbiei; - *(here->HICUMemitEIBaseBIPtr +1) += -XQf_Vbiei; - *(here->HICUMbaseBIBaseBIPtr +1) += XQf_Vbici; - *(here->HICUMemitEICollCIPtr +1) += XQf_Vbici; - *(here->HICUMbaseBICollCIPtr +1) += -XQf_Vbici; - *(here->HICUMemitEIBaseBIPtr +1) += -XQf_Vbici; - if (model->HICUMnqs) { - *(here->HICUMbaseBIXfPtr +1) += XQf_Vxf; - *(here->HICUMemitEIXfPtr +1) += -XQf_Vxf; - } - //Qjci - *(here->HICUMbaseBIBaseBIPtr +1) += XQjci_Vbici; - *(here->HICUMcollCICollCIPtr +1) += XQjci_Vbici; - *(here->HICUMcollCIBaseBIPtr +1) += -XQjci_Vbici; - *(here->HICUMbaseBICollCIPtr +1) += -XQjci_Vbici; - //Qr f_bi = + f_ci=- - *(here->HICUMbaseBIBaseBIPtr +1) += XQr_Vbici; - *(here->HICUMcollCICollCIPtr +1) += XQr_Vbici; - *(here->HICUMcollCIBaseBIPtr +1) += -XQr_Vbici; - *(here->HICUMbaseBICollCIPtr +1) += -XQr_Vbici; - *(here->HICUMbaseBIBaseBIPtr +1) += XQr_Vbiei; - *(here->HICUMcollCIEmitEIPtr +1) += XQr_Vbiei; - *(here->HICUMcollCIBaseBIPtr +1) += -XQr_Vbiei; - *(here->HICUMbaseBIEmitEIPtr +1) += -XQr_Vbiei; - //Qjep - *(here->HICUMbaseBPBaseBPPtr +1) += XQjep_Vbpei; - *(here->HICUMemitEIEmitEIPtr +1) += XQjep_Vbpei; - *(here->HICUMbaseBPEmitEIPtr +1) += -XQjep_Vbpei; - *(here->HICUMemitEIBaseBPPtr +1) += -XQjep_Vbpei; - //Qjcx_i - *(here->HICUMbaseBasePtr +1) += Xqjcx0_t_i_Vbci; - *(here->HICUMcollCICollCIPtr +1) += Xqjcx0_t_i_Vbci; - *(here->HICUMbaseCollCIPtr +1) += -Xqjcx0_t_i_Vbci; - *(here->HICUMcollCIBasePtr +1) += -Xqjcx0_t_i_Vbci; - //Qjcx_ii - *(here->HICUMbaseBPBaseBPPtr +1) += Xqjcx0_t_ii_Vbpci; - *(here->HICUMcollCICollCIPtr +1) += Xqjcx0_t_ii_Vbpci; - *(here->HICUMbaseBPCollCIPtr +1) += -Xqjcx0_t_ii_Vbpci; - *(here->HICUMcollCIBaseBPPtr +1) += -Xqjcx0_t_ii_Vbpci; - //Qdsu f_bp=+ f_ci=- - *(here->HICUMbaseBPBaseBPPtr +1) += XQdsu_Vbpci; - *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vbpci; - *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vbpci; - *(here->HICUMcollCIBaseBPPtr +1) += -XQdsu_Vbpci; - *(here->HICUMbaseBPSubsSIPtr +1) += XQdsu_Vsici; - *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vsici; - *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vsici; - *(here->HICUMcollCISubsSIPtr +1) += -XQdsu_Vsici; - //Qjs - *(here->HICUMsubsSISubsSIPtr +1) += XQjs_Vsici; - *(here->HICUMcollCICollCIPtr +1) += XQjs_Vsici; - *(here->HICUMsubsSICollCIPtr +1) += -XQjs_Vsici; - *(here->HICUMcollCISubsSIPtr +1) += -XQjs_Vsici; - //Qscp - *(here->HICUMsubsSubsPtr + 1) += XQscp_Vsc; - *(here->HICUMcollCollPtr + 1) += XQscp_Vsc; - *(here->HICUMcollSubsPtr + 1) += -XQscp_Vsc; - *(here->HICUMsubsCollPtr + 1) += -XQscp_Vsc; - //Qbepar1 - *(here->HICUMbaseBasePtr + 1) += XQbepar1_Vbe; - *(here->HICUMemitEmitPtr + 1) += XQbepar1_Vbe; - *(here->HICUMbaseEmitPtr + 1) += -XQbepar1_Vbe; - *(here->HICUMemitBasePtr + 1) += -XQbepar1_Vbe; - //Qbepar2 - *(here->HICUMbaseBPBaseBPPtr + 1) += XQbepar2_Vbpe; - *(here->HICUMemitEmitPtr + 1) += XQbepar2_Vbpe; - *(here->HICUMemitBaseBPPtr + 1) += -XQbepar2_Vbpe; - *(here->HICUMbaseBPEmitPtr + 1) += -XQbepar2_Vbpe; - //Qbcpar1 - *(here->HICUMbaseBasePtr + 1) += XQbcpar1_Vbci; - *(here->HICUMcollCICollCIPtr + 1) += XQbcpar1_Vbci; - *(here->HICUMbaseCollCIPtr + 1) += -XQbcpar1_Vbci; - *(here->HICUMcollCIBasePtr + 1) += -XQbcpar1_Vbci; - //Qbcpar2 - *(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; - *(here->HICUMsubsSISubsPtr + 1) += -XQsu_Vsis; - *(here->HICUMsubsSubsSIPtr + 1) += -XQsu_Vsis; - if (model->HICUMnqs) { - //Qxf1 - *(here->HICUMxf1Xf1Ptr + 1) += +XQxf1_Vxf1; - //Qxf2 - *(here->HICUMxf2Xf2Ptr + 1) += +XQxf2_Vxf2; - //Qxf - *(here->HICUMxfXfPtr + 1) += +XQxf_Vxf; - } - - // Stamps with SH - if (model->HICUMselfheat) { -// Stamp element: Ibiei f_Bi = + f_Ei = - - *(here->HICUMbaseBItempPtr) += Ibiei_Vrth; - *(here->HICUMemitEItempPtr) += -Ibiei_Vrth; -// Stamp element: Ibpei f_Bp = + f_Ei = - - // with respect to Potential Vrth - *(here->HICUMbaseBPtempPtr) += Ibpei_Vrth; - *(here->HICUMemitEItempPtr) += -Ibpei_Vrth; -// Stamp element: Ibici f_Bi = + f_Ci = - - *(here->HICUMbaseBItempPtr) += Ibici_Vrth; - *(here->HICUMcollCItempPtr) += -Ibici_Vrth; -// Stamp element: Iciei f_Ci = + f_Ei = - - *(here->HICUMcollCItempPtr) += Iciei_Vrth; - *(here->HICUMemitEItempPtr) += -Iciei_Vrth; -// Stamp element: Ibpci f_Bp = + f_Ci = - - *(here->HICUMbaseBPtempPtr) += Ibpci_Vrth; - *(here->HICUMcollCItempPtr) += -Ibpci_Vrth; -// Stamp element: Rcx f_Ci = + f_C = - - *(here->HICUMcollCItempPtr) += Icic_Vrth; - *(here->HICUMcollTempPtr) += -Icic_Vrth; -// Stamp element: Rbx f_B = + f_Bp = - - *(here->HICUMbaseTempPtr) += Ibbp_Vrth; - *(here->HICUMbaseBPtempPtr) += -Ibbp_Vrth; -// Stamp element: Re f_Ei = + f_E = - - *(here->HICUMemitEItempPtr) += Ieie_Vrth; - *(here->HICUMemitTempPtr) += -Ieie_Vrth; -// Stamp element: Rbi f_Bp = + f_Bi = - - *(here->HICUMbaseBPtempPtr) += Ibpbi_Vrth; - *(here->HICUMbaseBItempPtr) += -Ibpbi_Vrth; -// Stamp element: Isici f_Si = + f_Ci = - - *(here->HICUMsubsSItempPtr) += Isici_Vrth; - *(here->HICUMcollCItempPtr) += -Isici_Vrth; -// Branch: bpsi, Stamp element: Its - *(here->HICUMbaseBPtempPtr) += Ibpsi_Vrth; - *(here->HICUMsubsSItempPtr) += -Ibpsi_Vrth; - if (model->HICUMnqs) { - // Stamp element: Ixf f_xf = + - *(here->HICUMxfTempPtr) += Ixf_Vrth; - // Stamp element: Ixf1 f_xf1 = + - *(here->HICUMxf1TempPtr) += Ixf1_Vrth; - // Stamp element: Ixf2 f_xf2 = + - *(here->HICUMxf2TempPtr) += Ixf2_Vrth; - } - -// Stamp element: Rth f_T = + - *(here->HICUMtempTempPtr) += Irth_Vrth; - -// Stamp element: Ith f_T = - Ith - // with respect to Potential Vrth - *(here->HICUMtempTempPtr) += -Ith_Vrth; - // with respect to Potential Vbiei - *(here->HICUMtempBaseBIPtr) += -Ith_Vbiei; - *(here->HICUMtempEmitEIPtr) += +Ith_Vbiei; - // with respect to Potential Vbici - *(here->HICUMtempBaseBIPtr) += -Ith_Vbici; - *(here->HICUMtempCollCIPtr) += +Ith_Vbici; - // with respect to Potential Vciei - *(here->HICUMtempCollCIPtr) += -Ith_Vciei; - *(here->HICUMtempEmitEIPtr) += +Ith_Vciei; - // with respect to Potential Vbpei - *(here->HICUMtempBaseBPPtr) += -Ith_Vbpei; - *(here->HICUMtempEmitEIPtr) += +Ith_Vbpei; - // with respect to Potential Vbpci - *(here->HICUMtempBaseBPPtr) += -Ith_Vbpci; - *(here->HICUMtempCollCIPtr) += +Ith_Vbpci; - // with respect to Potential Vsici - *(here->HICUMtempSubsSIPtr) += -Ith_Vsici; - *(here->HICUMtempCollCIPtr) += +Ith_Vsici; - // with respect to Potential Vbpbi - *(here->HICUMtempBaseBPPtr) += -Ith_Vbpbi; - *(here->HICUMtempBaseBIPtr) += +Ith_Vbpbi; - // with respect to Potential Vcic - *(here->HICUMtempCollCIPtr) += -Ith_Vcic; - *(here->HICUMtempCollPtr) += +Ith_Vcic; - // with respect to Potential Vbbp - *(here->HICUMtempBasePtr) += -Ith_Vbbp; - *(here->HICUMtempBaseBPPtr) += +Ith_Vbbp; - // with respect to Potential Veie - *(here->HICUMtempEmitEIPtr) += -Ith_Veie; - *(here->HICUMtempEmitPtr) += +Ith_Veie; - - //the charges - *(here->HICUMbaseBItempPtr + 1) += +XQrbi_Vrth; - *(here->HICUMbaseBPtempPtr + 1) += -XQrbi_Vrth; - *(here->HICUMbaseBItempPtr + 1) += +XQjei_Vrth; - *(here->HICUMemitEItempPtr + 1) += -XQjei_Vrth; - *(here->HICUMbaseBItempPtr + 1) += +XQf_Vrth; - *(here->HICUMemitEItempPtr + 1) += -XQf_Vrth; - *(here->HICUMbaseBItempPtr + 1) += +XQr_Vrth; - *(here->HICUMcollCItempPtr + 1) += -XQr_Vrth; - *(here->HICUMbaseBItempPtr + 1) += +XQjci_Vrth; - *(here->HICUMcollCItempPtr + 1) += -XQjci_Vrth; - *(here->HICUMbaseBPtempPtr + 1) += +XQjep_Vrth; - *(here->HICUMemitEItempPtr + 1) += -XQjep_Vrth; - *(here->HICUMbaseTempPtr + 1) += +Xqjcx0_t_i_Vrth; - *(here->HICUMcollCItempPtr + 1) += -Xqjcx0_t_i_Vrth; - *(here->HICUMbaseBPtempPtr + 1) += +Xqjcx0_t_ii_Vrth; - *(here->HICUMcollCItempPtr + 1) += -Xqjcx0_t_ii_Vrth; - *(here->HICUMbaseBPtempPtr + 1) += +XQdsu_Vrth; - *(here->HICUMcollCItempPtr + 1) += -XQdsu_Vrth; - *(here->HICUMsubsSItempPtr + 1) += +XQjs_Vrth; - *(here->HICUMcollCItempPtr + 1) += -XQjs_Vrth; - *(here->HICUMsubsTempPtr + 1) += +XQscp_Vrth; - *(here->HICUMcollTempPtr + 1) += -XQscp_Vrth; - *(here->HICUMtempTempPtr + 1) += +XQcth_Vrth; - - } - - } - } - return(OK); -} +/********** +License : 3-clause BSD +Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher +Model Author : (Copyright 1993-2024) Michael Schroter +**********/ + +/* + * Function to load the COMPLEX circuit matrix using the + * small signal parameters saved during a previous DC operating + * point analysis. + */ + +#include "ngspice/ngspice.h" +#include "ngspice/cktdefs.h" +#include "hicum2defs.h" +#include "ngspice/sperror.h" +#include "ngspice/suffix.h" + +int +HICUMacLoad(GENmodel *inModel, CKTcircuit *ckt) +{ + HICUMinstance *here; + HICUMmodel *model = (HICUMmodel*)inModel; + double Ibpei_Vbpei; + double Ibpei_Vrth; + + double Ibiei_Vbiei; + double Ibiei_Vxf; + double Ibiei_Vbici; + double Ibiei_Vrth; + + double Ibici_Vbici; + double Ibici_Vbiei; + double Ibici_Vrth; + + double Ibpci_Vbpci; + double Ibpci_Vrth; + + double Isici_Vsici; + double Isici_Vrth; + + double Iciei_Vbiei; + double Iciei_Vbici; + double Iciei_Vrth; + double Iciei_Vxf2; + + + double Ibpbi_Vbpbi; + double Ibpbi_Vbici; + double Ibpbi_Vbiei; + double Ibpbi_Vrth; + + double Isis_Vsis; + double Irth_Vrth; + double Icic_Vcic, Icic_Vrth; + double Ieie_Veie, Ieie_Vrth; + double Ibbp_Vbbp, Ibbp_Vrth; + + double Ibpsi_Vbpci; + double Ibpsi_Vsici; + double Ibpsi_Vrth; + + double XQrbi_Vbpbi; + double XQrbi_Vbiei; + double XQrbi_Vbici; + double XQrbi_Vrth; + double XQjei_Vbiei; + double XQjei_Vrth; + double XQjci_Vbici; + double XQjci_Vrth; + double XQjep_Vbpei; + double XQjep_Vrth; + double volatile Xqjcx0_t_i_Vbci; + double Xqjcx0_t_i_Vrth; + double volatile Xqjcx0_t_ii_Vbpci; + double Xqjcx0_t_ii_Vrth; + double XQdsu_Vbpci; + double XQdsu_Vsici; + double XQdsu_Vrth; + double XQjs_Vsici; + double XQjs_Vrth; + double XQscp_Vsc; + double XQscp_Vrth; + double XQbepar1_Vbe; + double XQbepar2_Vbpe; + double XQbcpar1_Vbci; + double XQbcpar2_Vbpci; + double XQsu_Vsis; + double XQcth_Vrth; + double XQf_Vbiei; + double XQf_Vbici; + double XQf_Vrth; + double XQf_Vxf; + double XQr_Vrth; + double XQr_Vbiei; + double XQr_Vbici; + + double XQxf_Vxf; + double XQxf1_Vxf1; + double XQxf2_Vxf2; + + double Ixf1_Vbiei; + double Ixf1_Vbici; + double Ixf1_Vxf2 ; + double Ixf1_Vxf1 ; + double Ixf1_Vrth ; + + double Ixf2_Vbiei; + double Ixf2_Vbici; + double Ixf2_Vxf2 ; + double Ixf2_Vxf1 ; + double Ixf2_Vrth ; + + double Ixf_Vbiei ; + double Ixf_Vbici ; + double Ixf_Vxf ; + double Ixf_Vrth ; + + double Ith_Vrth, Ith_Vbiei, Ith_Vbici, Ith_Vbpbi, Ith_Vbpci, Ith_Vbpei, Ith_Vciei, Ith_Vsici, Ith_Vcic, Ith_Vbbp, Ith_Veie; + + /* loop through all the models */ + for( ; model != NULL; model = HICUMnextModel(model)) { + + /* loop through all the instances of the model */ + for( here = HICUMinstances(model); here!= NULL; + here = HICUMnextInstance(here)) { + + + // get all derivatives of branch DC currents + if(model->HICUMrcxGiven && model->HICUMrcx != 0) { + Icic_Vcic = 1/here->HICUMrcx_t.rpart; + Icic_Vrth = -*(ckt->CKTstate0 + here->HICUMvcic)/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart*here->HICUMrcx_t.dpart; + } else { + Icic_Vcic = 0.0; + Icic_Vrth = 0.0; + } + if(model->HICUMrbxGiven && model->HICUMrbx != 0) { + Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; + Ibbp_Vrth = -*(ckt->CKTstate0 + here->HICUMvbbp)/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart*here->HICUMrbx_t.dpart; + } else { + Ibbp_Vbbp = 0.0; + Ibbp_Vrth = 0.0; + } + if(model->HICUMreGiven && model->HICUMre != 0) { + Ieie_Veie = 1/here->HICUMre_t.rpart; + Ieie_Vrth = -*(ckt->CKTstate0 + here->HICUMveie)/here->HICUMre_t.rpart/here->HICUMre_t.rpart*here->HICUMre_t.dpart; + } else { + Ieie_Veie = 0.0; + Ieie_Vrth = 0.0; + } + if(model->HICUMrsuGiven && model->HICUMrsu != 0) { + Isis_Vsis = 1/model->HICUMrsu*here->HICUMm; + } else { + Isis_Vsis = 0.0; + } + if(model->HICUMselfheat) { + Irth_Vrth = (1/here->HICUMrth_t.rpart - *(ckt->CKTstate0 + here->HICUMvrth)/(here->HICUMrth_t.rpart*here->HICUMrth_t.rpart) * here->HICUMrth_t.dpart); + } else { + Irth_Vrth = 0.0; + } + + + + Ibiei_Vbiei = *(ckt->CKTstate0 + here->HICUMibiei_Vbiei); + Ibiei_Vxf = *(ckt->CKTstate0 + here->HICUMibiei_Vxf); + Ibiei_Vbici = *(ckt->CKTstate0 + here->HICUMibiei_Vbici); + Ibiei_Vrth = *(ckt->CKTstate0 + here->HICUMibiei_Vrth); + + Ibpei_Vbpei = *(ckt->CKTstate0 + here->HICUMibpei_Vbpei); + Ibpei_Vrth = *(ckt->CKTstate0 + here->HICUMibpei_Vrth); + + Iciei_Vbiei = *(ckt->CKTstate0 + here->HICUMiciei_Vbiei); + Iciei_Vbici = *(ckt->CKTstate0 + here->HICUMiciei_Vbici); + Iciei_Vrth = *(ckt->CKTstate0 + here->HICUMiciei_Vrth); + Iciei_Vxf2 = *(ckt->CKTstate0 + here->HICUMiciei_Vxf2); + + Ibici_Vbici = *(ckt->CKTstate0 + here->HICUMibici_Vbici); + Ibici_Vbiei = *(ckt->CKTstate0 + here->HICUMibici_Vbiei); + Ibici_Vrth = *(ckt->CKTstate0 + here->HICUMibici_Vrth); + + Ibpbi_Vbpbi = *(ckt->CKTstate0 + here->HICUMibpbi_Vbpbi); + Ibpbi_Vbiei = *(ckt->CKTstate0 + here->HICUMibpbi_Vbiei); + Ibpbi_Vbici = *(ckt->CKTstate0 + here->HICUMibpbi_Vbici); + Ibpbi_Vrth = *(ckt->CKTstate0 + here->HICUMibpbi_Vrth); + + Ibpci_Vbpci = *(ckt->CKTstate0 + here->HICUMibpci_Vbpci); + Ibpci_Vrth = *(ckt->CKTstate0 + here->HICUMibpci_Vrth); + + Isici_Vsici = *(ckt->CKTstate0 + here->HICUMisici_Vsici); + Isici_Vrth = *(ckt->CKTstate0 + here->HICUMisici_Vrth); + + Ibpsi_Vbpci = *(ckt->CKTstate0 + here->HICUMibpsi_Vbpci); + Ibpsi_Vsici = *(ckt->CKTstate0 + here->HICUMibpsi_Vsici); + Ibpsi_Vrth = *(ckt->CKTstate0 + here->HICUMibpsi_Vrth); + + Ith_Vrth = *(ckt->CKTstate0 + here->HICUMith_Vrth); + Ith_Vbiei = *(ckt->CKTstate0 + here->HICUMith_Vbiei); + Ith_Vbici = *(ckt->CKTstate0 + here->HICUMith_Vbici); + Ith_Vbpbi = *(ckt->CKTstate0 + here->HICUMith_Vbpbi); + Ith_Vbpci = *(ckt->CKTstate0 + here->HICUMith_Vbpci); + Ith_Vbpei = *(ckt->CKTstate0 + here->HICUMith_Vbpei); + Ith_Vciei = *(ckt->CKTstate0 + here->HICUMith_Vciei); + Ith_Vsici = *(ckt->CKTstate0 + here->HICUMith_Vsici); + Ith_Vcic = *(ckt->CKTstate0 + here->HICUMith_Vcic); + Ith_Vbbp = *(ckt->CKTstate0 + here->HICUMith_Vbbp); + Ith_Veie = *(ckt->CKTstate0 + here->HICUMith_Veie); + + Ixf1_Vbiei = *(ckt->CKTstate0 + here->HICUMixf1_Vbiei); + Ixf1_Vbici = *(ckt->CKTstate0 + here->HICUMixf1_Vbici); + Ixf1_Vxf2 = *(ckt->CKTstate0 + here->HICUMixf1_Vxf2); + Ixf1_Vxf1 = *(ckt->CKTstate0 + here->HICUMixf1_Vxf1); + Ixf1_Vrth = *(ckt->CKTstate0 + here->HICUMixf1_Vrth); + + Ixf2_Vbiei = *(ckt->CKTstate0 + here->HICUMixf2_Vbiei); + Ixf2_Vbici = *(ckt->CKTstate0 + here->HICUMixf2_Vbici); + Ixf2_Vxf2 = *(ckt->CKTstate0 + here->HICUMixf2_Vxf2); + Ixf2_Vxf1 = *(ckt->CKTstate0 + here->HICUMixf2_Vxf1); + Ixf2_Vrth = *(ckt->CKTstate0 + here->HICUMixf2_Vrth); + + Ixf_Vbiei = *(ckt->CKTstate0 + here->HICUMixf_Vbiei); + Ixf_Vbici = *(ckt->CKTstate0 + here->HICUMixf_Vbici); + Ixf_Vxf = *(ckt->CKTstate0 + here->HICUMixf_Vxf); + Ixf_Vrth = *(ckt->CKTstate0 + here->HICUMixf_Vrth); + +//////////////////////////////////// +////////// The real part ///////// +//////////////////////////////////// + +// Stamp element: Ibiei + *(here->HICUMbaseBIBaseBIPtr) += Ibiei_Vbiei; + *(here->HICUMemitEIEmitEIPtr) += Ibiei_Vbiei; + *(here->HICUMbaseBIEmitEIPtr) += -Ibiei_Vbiei; + *(here->HICUMemitEIBaseBIPtr) += -Ibiei_Vbiei; + *(here->HICUMbaseBIBaseBIPtr) += Ibiei_Vbici; + *(here->HICUMemitEICollCIPtr) += Ibiei_Vbici; + *(here->HICUMbaseBICollCIPtr) += -Ibiei_Vbici; + *(here->HICUMemitEIBaseBIPtr) += -Ibiei_Vbici; + if (model->HICUMnqs) { + *(here->HICUMbaseBIXfPtr) += Ibiei_Vxf; + *(here->HICUMemitEIXfPtr) += -Ibiei_Vxf; + } + +// Stamp element: Ibpei + *(here->HICUMbaseBPBaseBPPtr) += Ibpei_Vbpei; + *(here->HICUMemitEIEmitEIPtr) += Ibpei_Vbpei; + *(here->HICUMbaseBPEmitEIPtr) += -Ibpei_Vbpei; + *(here->HICUMemitEIBaseBPPtr) += -Ibpei_Vbpei;; + +// Stamp element: Ibici + *(here->HICUMbaseBIBaseBIPtr) += Ibici_Vbici; + *(here->HICUMcollCICollCIPtr) += Ibici_Vbici; + *(here->HICUMcollCIBaseBIPtr) += -Ibici_Vbici; + *(here->HICUMbaseBICollCIPtr) += -Ibici_Vbici; + *(here->HICUMbaseBIBaseBIPtr) += Ibici_Vbiei; + *(here->HICUMcollCIEmitEIPtr) += Ibici_Vbiei; + *(here->HICUMcollCIBaseBIPtr) += -Ibici_Vbiei; + *(here->HICUMbaseBIEmitEIPtr) += -Ibici_Vbiei; + +// Stamp element: Iciei + *(here->HICUMcollCIBaseBIPtr) += Iciei_Vbiei; + *(here->HICUMemitEIEmitEIPtr) += Iciei_Vbiei; + *(here->HICUMcollCIEmitEIPtr) += -Iciei_Vbiei; + *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbiei; + *(here->HICUMcollCIBaseBIPtr) += Iciei_Vbici; + *(here->HICUMemitEICollCIPtr) += Iciei_Vbici; + *(here->HICUMcollCICollCIPtr) += -Iciei_Vbici; + *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbici; + if (model->HICUMnqs) { + *(here->HICUMcollCIXf2Ptr) += Iciei_Vxf2; + *(here->HICUMemitEIXf2Ptr) += -Iciei_Vxf2; + } + + +// Stamp element: Ibpci + *(here->HICUMbaseBPBaseBPPtr) += Ibpci_Vbpci; + *(here->HICUMcollCICollCIPtr) += Ibpci_Vbpci; + *(here->HICUMbaseBPCollCIPtr) += -Ibpci_Vbpci; + *(here->HICUMcollCIBaseBPPtr) += -Ibpci_Vbpci; + +// Stamp element: Rcx + *(here->HICUMcollCollPtr) += Icic_Vcic; + *(here->HICUMcollCICollCIPtr) += Icic_Vcic; + *(here->HICUMcollCICollPtr) += -Icic_Vcic; + *(here->HICUMcollCollCIPtr) += -Icic_Vcic; + +// Stamp element: Rbx + *(here->HICUMbaseBasePtr) += Ibbp_Vbbp; + *(here->HICUMbaseBPBaseBPPtr) += Ibbp_Vbbp; + *(here->HICUMbaseBPBasePtr) += -Ibbp_Vbbp; + *(here->HICUMbaseBaseBPPtr) += -Ibbp_Vbbp; + +// Stamp element: Re + *(here->HICUMemitEmitPtr) += Ieie_Veie; + *(here->HICUMemitEIEmitEIPtr) += Ieie_Veie; + *(here->HICUMemitEIEmitPtr) += -Ieie_Veie; + *(here->HICUMemitEmitEIPtr) += -Ieie_Veie; + +// Stamp element: Ibpbi + if (here->HICUMrbi>0.0) { + *(here->HICUMbaseBPBaseBPPtr) += Ibpbi_Vbpbi; + *(here->HICUMbaseBIBaseBIPtr) += Ibpbi_Vbpbi; + *(here->HICUMbaseBPBaseBIPtr) += -Ibpbi_Vbpbi; + *(here->HICUMbaseBIBaseBPPtr) += -Ibpbi_Vbpbi; + *(here->HICUMbaseBPBaseBIPtr) += Ibpbi_Vbiei; + *(here->HICUMbaseBIEmitEIPtr) += Ibpbi_Vbiei; + *(here->HICUMbaseBPEmitEIPtr) += -Ibpbi_Vbiei; + *(here->HICUMbaseBIBaseBIPtr) += -Ibpbi_Vbiei; + *(here->HICUMbaseBPBaseBIPtr) += Ibpbi_Vbici; + *(here->HICUMbaseBICollCIPtr) += Ibpbi_Vbici; + *(here->HICUMbaseBPCollCIPtr) += -Ibpbi_Vbici; + *(here->HICUMbaseBIBaseBIPtr) += -Ibpbi_Vbici; + }; + +// Stamp element: Isici + *(here->HICUMsubsSISubsSIPtr) += Isici_Vsici; + *(here->HICUMcollCICollCIPtr) += Isici_Vsici; + *(here->HICUMsubsSICollCIPtr) += -Isici_Vsici; + *(here->HICUMcollCISubsSIPtr) += -Isici_Vsici;; + +// Stamp element: Ibpsi + *(here->HICUMbaseBPSubsSIPtr) += Ibpsi_Vsici; + *(here->HICUMsubsSICollCIPtr) += Ibpsi_Vsici; + *(here->HICUMbaseBPCollCIPtr) += -Ibpsi_Vsici; + *(here->HICUMsubsSISubsSIPtr) += -Ibpsi_Vsici; + *(here->HICUMbaseBPBaseBPPtr) += Ibpsi_Vbpci; + *(here->HICUMsubsSICollCIPtr) += Ibpsi_Vbpci; + *(here->HICUMbaseBPCollCIPtr) += -Ibpsi_Vbpci; + *(here->HICUMsubsSIBaseBPPtr) += -Ibpsi_Vbpci;; + +// Stamp element: Rsu + *(here->HICUMsubsSubsPtr) += Isis_Vsis; + *(here->HICUMsubsSISubsSIPtr) += Isis_Vsis; + *(here->HICUMsubsSISubsPtr) += -Isis_Vsis; + *(here->HICUMsubsSubsSIPtr) += -Isis_Vsis; + + if (model->HICUMnqs) { + //Ixf1 + *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbiei; + *(here->HICUMxf1EmitEIPtr) += -Ixf1_Vbiei; + *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbici; + *(here->HICUMxf1CollCIPtr) += -Ixf1_Vbici; + *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; + *(here->HICUMxf1Xf1Ptr) += +Ixf1_Vxf1; + //Ixf2 + *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbiei; + *(here->HICUMxf2EmitEIPtr) += -Ixf2_Vbiei; + *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbici; + *(here->HICUMxf2CollCIPtr) += -Ixf2_Vbici; + *(here->HICUMxf2Xf2Ptr) += +Ixf2_Vxf2; + *(here->HICUMxf2Xf1Ptr) += +Ixf2_Vxf1; + //Ixf + *(here->HICUMxfBaseBIPtr) += +Ixf_Vbiei; + *(here->HICUMxfEmitEIPtr) += -Ixf_Vbiei; + *(here->HICUMxfBaseBIPtr) += +Ixf_Vbici; + *(here->HICUMxfCollCIPtr) += -Ixf_Vbici; + *(here->HICUMxfXfPtr) += +Ixf_Vxf; + } + +//////////////////////////////////// +////////// The complex part ////// +//////////////////////////////////// + + //Qrbi + XQrbi_Vbpbi = *(ckt->CKTstate0 + here->HICUMcqrbi) * ckt->CKTomega; + XQrbi_Vbiei = here->HICUMqrbi_Vbiei * ckt->CKTomega; + XQrbi_Vbici = here->HICUMqrbi_Vbici * ckt->CKTomega; + XQrbi_Vrth = here->HICUMqrbi_Vrth * ckt->CKTomega; + //Qjei + XQjei_Vbiei = *(ckt->CKTstate0 + here->HICUMcqjei) * ckt->CKTomega; + XQjei_Vrth = here->HICUMqjei_Vrth * ckt->CKTomega; + //Qf + XQf_Vbiei = *(ckt->CKTstate0 + here->HICUMcqf) * ckt->CKTomega; + XQf_Vbici = here->HICUMqf_Vbici * ckt->CKTomega; + XQf_Vrth = here->HICUMqf_Vrth * ckt->CKTomega; + XQf_Vxf = here->HICUMqf_Vxf * ckt->CKTomega; + //Qr + XQr_Vbici = *(ckt->CKTstate0 + here->HICUMcqr) * ckt->CKTomega; + XQr_Vbiei = here->HICUMqr_Vbiei * ckt->CKTomega; + XQr_Vrth = here->HICUMqr_Vrth * ckt->CKTomega; + //Qjci + XQjci_Vbici = *(ckt->CKTstate0 + here->HICUMcqjci) * ckt->CKTomega; + XQjci_Vrth = here->HICUMqjci_Vrth * ckt->CKTomega; + //Qjep + XQjep_Vbpei = *(ckt->CKTstate0 + here->HICUMcqjep) * ckt->CKTomega; + XQjep_Vrth = here->HICUMqjep_Vrth * ckt->CKTomega; + //Qjcx_i + Xqjcx0_t_i_Vbci = *(ckt->CKTstate0 + here->HICUMcqcx0_t_i) * ckt->CKTomega; + Xqjcx0_t_i_Vrth = here->HICUMqjcx0_i_Vrth * ckt->CKTomega; + //Qjcx_ii + Xqjcx0_t_ii_Vbpci = *(ckt->CKTstate0 + here->HICUMcqcx0_t_ii) * ckt->CKTomega; + Xqjcx0_t_ii_Vrth = here->HICUMqjcx0_ii_Vrth * ckt->CKTomega; + //Qdsu + XQdsu_Vbpci = *(ckt->CKTstate0 + here->HICUMcqdsu) * ckt->CKTomega; + XQdsu_Vsici = here->HICUMqdsu_Vsici * ckt->CKTomega; + XQdsu_Vrth = here->HICUMqdsu_Vrth * ckt->CKTomega; + //Qjs + XQjs_Vsici = *(ckt->CKTstate0 + here->HICUMcqjs) * ckt->CKTomega; + XQjs_Vrth = here->HICUMqjs_Vrth * ckt->CKTomega; + //Qscp + XQscp_Vsc = *(ckt->CKTstate0 + here->HICUMcqscp) * ckt->CKTomega; + XQscp_Vrth = here->HICUMqscp_Vrth * ckt->CKTomega; + //Qbepar1 + XQbepar1_Vbe = *(ckt->CKTstate0 + here->HICUMcqbepar1) * ckt->CKTomega; + //Qbepar2 + XQbepar2_Vbpe = *(ckt->CKTstate0 + here->HICUMcqbepar2) * ckt->CKTomega; + //Qbcpar1 + XQbcpar1_Vbci = *(ckt->CKTstate0 + here->HICUMcqbcpar1) * ckt->CKTomega; + //Qbcpar2 + XQbcpar2_Vbpci = *(ckt->CKTstate0 + here->HICUMcqbcpar2) * ckt->CKTomega; + //Qsu + XQsu_Vsis = *(ckt->CKTstate0 + here->HICUMcqsu) * ckt->CKTomega; + //Qcth + XQcth_Vrth = *(ckt->CKTstate0 + here->HICUMcqcth) * ckt->CKTomega; + //Qxf + XQxf_Vxf = *(ckt->CKTstate0 + here->HICUMcqxf) * ckt->CKTomega; + XQxf1_Vxf1 = *(ckt->CKTstate0 + here->HICUMcqxf1) * ckt->CKTomega; + XQxf2_Vxf2 = *(ckt->CKTstate0 + here->HICUMcqxf2) * ckt->CKTomega; + + //Qrbi f_bp=+ f_bi=- + if (here->HICUMrbi>0.0) { + *(here->HICUMbaseBPBaseBPPtr + 1) += XQrbi_Vbpbi; + *(here->HICUMbaseBIBaseBIPtr + 1) += XQrbi_Vbpbi; + *(here->HICUMbaseBPBaseBIPtr + 1) += -XQrbi_Vbpbi; + *(here->HICUMbaseBIBaseBPPtr + 1) += -XQrbi_Vbpbi; + *(here->HICUMbaseBPBaseBIPtr + 1) += XQrbi_Vbiei; + *(here->HICUMbaseBIEmitEIPtr + 1) += XQrbi_Vbiei; + *(here->HICUMbaseBPEmitEIPtr + 1) += -XQrbi_Vbiei; + *(here->HICUMbaseBIBaseBIPtr + 1) += -XQrbi_Vbiei; + *(here->HICUMbaseBPBaseBIPtr + 1) += XQrbi_Vbici; + *(here->HICUMbaseBICollCIPtr + 1) += XQrbi_Vbici; + *(here->HICUMbaseBPCollCIPtr + 1) += -XQrbi_Vbici; + *(here->HICUMbaseBIBaseBIPtr + 1) += -XQrbi_Vbici; + } + //Qjei + *(here->HICUMbaseBIBaseBIPtr + 1) += XQjei_Vbiei; + *(here->HICUMemitEIEmitEIPtr + 1) += XQjei_Vbiei; + *(here->HICUMbaseBIEmitEIPtr + 1) += -XQjei_Vbiei; + *(here->HICUMemitEIBaseBIPtr + 1) += -XQjei_Vbiei; + //Qf f_Bi=+ f_Ei =- + *(here->HICUMbaseBIBaseBIPtr +1) += XQf_Vbiei; + *(here->HICUMemitEIEmitEIPtr +1) += XQf_Vbiei; + *(here->HICUMbaseBIEmitEIPtr +1) += -XQf_Vbiei; + *(here->HICUMemitEIBaseBIPtr +1) += -XQf_Vbiei; + *(here->HICUMbaseBIBaseBIPtr +1) += XQf_Vbici; + *(here->HICUMemitEICollCIPtr +1) += XQf_Vbici; + *(here->HICUMbaseBICollCIPtr +1) += -XQf_Vbici; + *(here->HICUMemitEIBaseBIPtr +1) += -XQf_Vbici; + if (model->HICUMnqs) { + *(here->HICUMbaseBIXfPtr +1) += XQf_Vxf; + *(here->HICUMemitEIXfPtr +1) += -XQf_Vxf; + } + //Qjci + *(here->HICUMbaseBIBaseBIPtr +1) += XQjci_Vbici; + *(here->HICUMcollCICollCIPtr +1) += XQjci_Vbici; + *(here->HICUMcollCIBaseBIPtr +1) += -XQjci_Vbici; + *(here->HICUMbaseBICollCIPtr +1) += -XQjci_Vbici; + //Qr f_bi = + f_ci=- + *(here->HICUMbaseBIBaseBIPtr +1) += XQr_Vbici; + *(here->HICUMcollCICollCIPtr +1) += XQr_Vbici; + *(here->HICUMcollCIBaseBIPtr +1) += -XQr_Vbici; + *(here->HICUMbaseBICollCIPtr +1) += -XQr_Vbici; + *(here->HICUMbaseBIBaseBIPtr +1) += XQr_Vbiei; + *(here->HICUMcollCIEmitEIPtr +1) += XQr_Vbiei; + *(here->HICUMcollCIBaseBIPtr +1) += -XQr_Vbiei; + *(here->HICUMbaseBIEmitEIPtr +1) += -XQr_Vbiei; + //Qjep + *(here->HICUMbaseBPBaseBPPtr +1) += XQjep_Vbpei; + *(here->HICUMemitEIEmitEIPtr +1) += XQjep_Vbpei; + *(here->HICUMbaseBPEmitEIPtr +1) += -XQjep_Vbpei; + *(here->HICUMemitEIBaseBPPtr +1) += -XQjep_Vbpei; + //Qjcx_i + *(here->HICUMbaseBasePtr +1) += Xqjcx0_t_i_Vbci; + *(here->HICUMcollCICollCIPtr +1) += Xqjcx0_t_i_Vbci; + *(here->HICUMbaseCollCIPtr +1) += -Xqjcx0_t_i_Vbci; + *(here->HICUMcollCIBasePtr +1) += -Xqjcx0_t_i_Vbci; + //Qjcx_ii + *(here->HICUMbaseBPBaseBPPtr +1) += Xqjcx0_t_ii_Vbpci; + *(here->HICUMcollCICollCIPtr +1) += Xqjcx0_t_ii_Vbpci; + *(here->HICUMbaseBPCollCIPtr +1) += -Xqjcx0_t_ii_Vbpci; + *(here->HICUMcollCIBaseBPPtr +1) += -Xqjcx0_t_ii_Vbpci; + //Qdsu f_bp=+ f_ci=- + *(here->HICUMbaseBPBaseBPPtr +1) += XQdsu_Vbpci; + *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vbpci; + *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vbpci; + *(here->HICUMcollCIBaseBPPtr +1) += -XQdsu_Vbpci; + *(here->HICUMbaseBPSubsSIPtr +1) += XQdsu_Vsici; + *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vsici; + *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vsici; + *(here->HICUMcollCISubsSIPtr +1) += -XQdsu_Vsici; + //Qjs + *(here->HICUMsubsSISubsSIPtr +1) += XQjs_Vsici; + *(here->HICUMcollCICollCIPtr +1) += XQjs_Vsici; + *(here->HICUMsubsSICollCIPtr +1) += -XQjs_Vsici; + *(here->HICUMcollCISubsSIPtr +1) += -XQjs_Vsici; + //Qscp + *(here->HICUMsubsSubsPtr + 1) += XQscp_Vsc; + *(here->HICUMcollCollPtr + 1) += XQscp_Vsc; + *(here->HICUMcollSubsPtr + 1) += -XQscp_Vsc; + *(here->HICUMsubsCollPtr + 1) += -XQscp_Vsc; + //Qbepar1 + *(here->HICUMbaseBasePtr + 1) += XQbepar1_Vbe; + *(here->HICUMemitEmitPtr + 1) += XQbepar1_Vbe; + *(here->HICUMbaseEmitPtr + 1) += -XQbepar1_Vbe; + *(here->HICUMemitBasePtr + 1) += -XQbepar1_Vbe; + //Qbepar2 + *(here->HICUMbaseBPBaseBPPtr + 1) += XQbepar2_Vbpe; + *(here->HICUMemitEmitPtr + 1) += XQbepar2_Vbpe; + *(here->HICUMemitBaseBPPtr + 1) += -XQbepar2_Vbpe; + *(here->HICUMbaseBPEmitPtr + 1) += -XQbepar2_Vbpe; + //Qbcpar1 + *(here->HICUMbaseBasePtr + 1) += XQbcpar1_Vbci; + *(here->HICUMcollCICollCIPtr + 1) += XQbcpar1_Vbci; + *(here->HICUMbaseCollCIPtr + 1) += -XQbcpar1_Vbci; + *(here->HICUMcollCIBasePtr + 1) += -XQbcpar1_Vbci; + //Qbcpar2 + *(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; + *(here->HICUMsubsSISubsPtr + 1) += -XQsu_Vsis; + *(here->HICUMsubsSubsSIPtr + 1) += -XQsu_Vsis; + if (model->HICUMnqs) { + //Qxf1 + *(here->HICUMxf1Xf1Ptr + 1) += +XQxf1_Vxf1; + //Qxf2 + *(here->HICUMxf2Xf2Ptr + 1) += +XQxf2_Vxf2; + //Qxf + *(here->HICUMxfXfPtr + 1) += +XQxf_Vxf; + } + + // Stamps with SH + if (model->HICUMselfheat) { +// Stamp element: Ibiei f_Bi = + f_Ei = - + *(here->HICUMbaseBItempPtr) += Ibiei_Vrth; + *(here->HICUMemitEItempPtr) += -Ibiei_Vrth; +// Stamp element: Ibpei f_Bp = + f_Ei = - + // with respect to Potential Vrth + *(here->HICUMbaseBPtempPtr) += Ibpei_Vrth; + *(here->HICUMemitEItempPtr) += -Ibpei_Vrth; +// Stamp element: Ibici f_Bi = + f_Ci = - + *(here->HICUMbaseBItempPtr) += Ibici_Vrth; + *(here->HICUMcollCItempPtr) += -Ibici_Vrth; +// Stamp element: Iciei f_Ci = + f_Ei = - + *(here->HICUMcollCItempPtr) += Iciei_Vrth; + *(here->HICUMemitEItempPtr) += -Iciei_Vrth; +// Stamp element: Ibpci f_Bp = + f_Ci = - + *(here->HICUMbaseBPtempPtr) += Ibpci_Vrth; + *(here->HICUMcollCItempPtr) += -Ibpci_Vrth; +// Stamp element: Rcx f_Ci = + f_C = - + *(here->HICUMcollCItempPtr) += Icic_Vrth; + *(here->HICUMcollTempPtr) += -Icic_Vrth; +// Stamp element: Rbx f_B = + f_Bp = - + *(here->HICUMbaseTempPtr) += Ibbp_Vrth; + *(here->HICUMbaseBPtempPtr) += -Ibbp_Vrth; +// Stamp element: Re f_Ei = + f_E = - + *(here->HICUMemitEItempPtr) += Ieie_Vrth; + *(here->HICUMemitTempPtr) += -Ieie_Vrth; +// Stamp element: Rbi f_Bp = + f_Bi = - + *(here->HICUMbaseBPtempPtr) += Ibpbi_Vrth; + *(here->HICUMbaseBItempPtr) += -Ibpbi_Vrth; +// Stamp element: Isici f_Si = + f_Ci = - + *(here->HICUMsubsSItempPtr) += Isici_Vrth; + *(here->HICUMcollCItempPtr) += -Isici_Vrth; +// Branch: bpsi, Stamp element: Its + *(here->HICUMbaseBPtempPtr) += Ibpsi_Vrth; + *(here->HICUMsubsSItempPtr) += -Ibpsi_Vrth; + if (model->HICUMnqs) { + // Stamp element: Ixf f_xf = + + *(here->HICUMxfTempPtr) += Ixf_Vrth; + // Stamp element: Ixf1 f_xf1 = + + *(here->HICUMxf1TempPtr) += Ixf1_Vrth; + // Stamp element: Ixf2 f_xf2 = + + *(here->HICUMxf2TempPtr) += Ixf2_Vrth; + } + +// Stamp element: Rth f_T = + + *(here->HICUMtempTempPtr) += Irth_Vrth; + +// Stamp element: Ith f_T = - Ith + // with respect to Potential Vrth + *(here->HICUMtempTempPtr) += -Ith_Vrth; + // with respect to Potential Vbiei + *(here->HICUMtempBaseBIPtr) += -Ith_Vbiei; + *(here->HICUMtempEmitEIPtr) += +Ith_Vbiei; + // with respect to Potential Vbici + *(here->HICUMtempBaseBIPtr) += -Ith_Vbici; + *(here->HICUMtempCollCIPtr) += +Ith_Vbici; + // with respect to Potential Vciei + *(here->HICUMtempCollCIPtr) += -Ith_Vciei; + *(here->HICUMtempEmitEIPtr) += +Ith_Vciei; + // with respect to Potential Vbpei + *(here->HICUMtempBaseBPPtr) += -Ith_Vbpei; + *(here->HICUMtempEmitEIPtr) += +Ith_Vbpei; + // with respect to Potential Vbpci + *(here->HICUMtempBaseBPPtr) += -Ith_Vbpci; + *(here->HICUMtempCollCIPtr) += +Ith_Vbpci; + // with respect to Potential Vsici + *(here->HICUMtempSubsSIPtr) += -Ith_Vsici; + *(here->HICUMtempCollCIPtr) += +Ith_Vsici; + // with respect to Potential Vbpbi + *(here->HICUMtempBaseBPPtr) += -Ith_Vbpbi; + *(here->HICUMtempBaseBIPtr) += +Ith_Vbpbi; + // with respect to Potential Vcic + *(here->HICUMtempCollCIPtr) += -Ith_Vcic; + *(here->HICUMtempCollPtr) += +Ith_Vcic; + // with respect to Potential Vbbp + *(here->HICUMtempBasePtr) += -Ith_Vbbp; + *(here->HICUMtempBaseBPPtr) += +Ith_Vbbp; + // with respect to Potential Veie + *(here->HICUMtempEmitEIPtr) += -Ith_Veie; + *(here->HICUMtempEmitPtr) += +Ith_Veie; + + //the charges + *(here->HICUMbaseBItempPtr + 1) += +XQrbi_Vrth; + *(here->HICUMbaseBPtempPtr + 1) += -XQrbi_Vrth; + *(here->HICUMbaseBItempPtr + 1) += +XQjei_Vrth; + *(here->HICUMemitEItempPtr + 1) += -XQjei_Vrth; + *(here->HICUMbaseBItempPtr + 1) += +XQf_Vrth; + *(here->HICUMemitEItempPtr + 1) += -XQf_Vrth; + *(here->HICUMbaseBItempPtr + 1) += +XQr_Vrth; + *(here->HICUMcollCItempPtr + 1) += -XQr_Vrth; + *(here->HICUMbaseBItempPtr + 1) += +XQjci_Vrth; + *(here->HICUMcollCItempPtr + 1) += -XQjci_Vrth; + *(here->HICUMbaseBPtempPtr + 1) += +XQjep_Vrth; + *(here->HICUMemitEItempPtr + 1) += -XQjep_Vrth; + *(here->HICUMbaseTempPtr + 1) += +Xqjcx0_t_i_Vrth; + *(here->HICUMcollCItempPtr + 1) += -Xqjcx0_t_i_Vrth; + *(here->HICUMbaseBPtempPtr + 1) += +Xqjcx0_t_ii_Vrth; + *(here->HICUMcollCItempPtr + 1) += -Xqjcx0_t_ii_Vrth; + *(here->HICUMbaseBPtempPtr + 1) += +XQdsu_Vrth; + *(here->HICUMcollCItempPtr + 1) += -XQdsu_Vrth; + *(here->HICUMsubsSItempPtr + 1) += +XQjs_Vrth; + *(here->HICUMcollCItempPtr + 1) += -XQjs_Vrth; + *(here->HICUMsubsTempPtr + 1) += +XQscp_Vrth; + *(here->HICUMcollTempPtr + 1) += -XQscp_Vrth; + *(here->HICUMtempTempPtr + 1) += +XQcth_Vrth; + + } + + } + } + return(OK); +} diff --git a/src/spicelib/devices/hicum2/hicum2ask.c b/src/spicelib/devices/hicum2/hicum2ask.c index 4fb6d89d7..b3292f4b4 100644 --- a/src/spicelib/devices/hicum2/hicum2ask.c +++ b/src/spicelib/devices/hicum2/hicum2ask.c @@ -1,253 +1,253 @@ -/********** -License : 3-clause BSD -Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden -**********/ - -/* - * This routine gives access to the internal device - * parameters for HICUMs - */ - -#include "ngspice/ngspice.h" -#include "ngspice/const.h" -#include "ngspice/cktdefs.h" -#include "hicum2defs.h" -#include "ngspice/ifsim.h" -#include "ngspice/sperror.h" -#include "ngspice/suffix.h" - -/*ARGSUSED*/ -int -HICUMask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue *select) -{ - HICUMinstance *here = (HICUMinstance*)instPtr; - - NG_IGNORE(select); - double g_be; - IFvalue IC, IB, RPIi, RPIx, GMi; - IFvalue CPIi, CPIx, CMUi, CMUx; - IFvalue rcx_t, re_t, rb, BETAAC; - - switch(which) { - case HICUM_AREA: - value->rValue = here->HICUMarea; - return(OK); - case HICUM_OFF: - value->iValue = here->HICUMoff; - return(OK); - case HICUM_TEMP: - value->rValue = here->HICUMtemp - CONSTCtoK; - return(OK); - case HICUM_M: - value->rValue = here->HICUMm; - return(OK); - case HICUM_QUEST_COLLNODE: - value->iValue = here->HICUMcollNode; - return(OK); - case HICUM_QUEST_BASENODE: - value->iValue = here->HICUMbaseNode; - return(OK); - case HICUM_QUEST_EMITNODE: - value->iValue = here->HICUMemitNode; - return(OK); - case HICUM_QUEST_SUBSNODE: - value->iValue = here->HICUMsubsNode; - return(OK); - case HICUM_QUEST_COLLCINODE: - value->iValue = here->HICUMcollCINode; - return(OK); - case HICUM_QUEST_BASEBPNODE: - value->iValue = here->HICUMbaseBPNode; - return(OK); - case HICUM_QUEST_BASEBINODE: - value->iValue = here->HICUMbaseBINode; - return(OK); - case HICUM_QUEST_EMITEINODE: - value->iValue = here->HICUMemitEINode; - return(OK); - case HICUM_QUEST_SUBSSINODE: - value->iValue = here->HICUMsubsSINode; - return(OK); -/* voltages */ - case HICUM_QUEST_VBE: - value->rValue = *(ckt->CKTstate0 + here->HICUMbaseNode)-*(ckt->CKTstate0 + here->HICUMemitNode); - return(OK); - case HICUM_QUEST_VBBP: - value->rValue = *(ckt->CKTstate0 + here->HICUMbaseNode)-*(ckt->CKTstate0 + here->HICUMbaseBPNode); - return(OK); - case HICUM_QUEST_VBC: - value->rValue = *(ckt->CKTstate0 + here->HICUMbaseNode)-*(ckt->CKTstate0 + here->HICUMcollNode); - return(OK); - case HICUM_QUEST_VCE: - value->rValue = *(ckt->CKTstate0 + here->HICUMcollNode)-*(ckt->CKTstate0 + here->HICUMemitNode); - return(OK); - case HICUM_QUEST_VSC: - value->rValue = *(ckt->CKTstate0 + here->HICUMcollNode)-*(ckt->CKTstate0 + here->HICUMsubsNode); - return(OK); - case HICUM_QUEST_VBIEI: - value->rValue = *(ckt->CKTstate0 + here->HICUMvbiei); - return(OK); - case HICUM_QUEST_VBPBI: - value->rValue = *(ckt->CKTstate0 + here->HICUMvbpbi); - return(OK); - case HICUM_QUEST_VBICI: - value->rValue = *(ckt->CKTstate0 + here->HICUMvbici); - return(OK); - case HICUM_QUEST_VCIEI: - value->rValue = *(ckt->CKTstate0 + here->HICUMvbiei) - *(ckt->CKTstate0 + here->HICUMvbici); - return(OK); -/* currents */ - case HICUM_QUEST_CC: - value->rValue = *(ckt->CKTstate0 + here->HICUMiciei) - - *(ckt->CKTstate0 + here->HICUMibici) - - *(ckt->CKTstate0 + here->HICUMibpci) - - *(ckt->CKTstate0 + here->HICUMisici); - value->rValue *= HICUMmodPtr(here)->HICUMtype; - return(OK); - case HICUM_QUEST_CB: - value->rValue = *(ckt->CKTstate0 + here->HICUMibiei) + - *(ckt->CKTstate0 + here->HICUMibici) + - *(ckt->CKTstate0 + here->HICUMibpci) + - *(ckt->CKTstate0 + here->HICUMibpsi); - value->rValue *= HICUMmodPtr(here)->HICUMtype; - return(OK); - case HICUM_QUEST_CE: - value->rValue = - *(ckt->CKTstate0 + here->HICUMibiei) - - *(ckt->CKTstate0 + here->HICUMibpei) - - *(ckt->CKTstate0 + here->HICUMiciei); - value->rValue *= HICUMmodPtr(here)->HICUMtype; - return(OK); - case HICUM_QUEST_CS: - value->rValue = *(ckt->CKTstate0 + here->HICUMisici) - - *(ckt->CKTstate0 + here->HICUMibpsi); - value->rValue *= HICUMmodPtr(here)->HICUMtype; - return(OK); - case HICUM_QUEST_CAVL: - value->rValue = here->HICUMiavl; - return(OK); - case HICUM_QUEST_CBEI: - value->rValue = *(ckt->CKTstate0 + here->HICUMibiei); - return(OK); - case HICUM_QUEST_CBCI: - value->rValue = *(ckt->CKTstate0 + here->HICUMibici); - return(OK); -/* resistances */ - case HICUM_QUEST_RCX_T: - value->rValue = here->HICUMrcx_t.rpart; - return(OK); - case HICUM_QUEST_RE_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; - return(OK); - case HICUM_QUEST_RB: - value->rValue = here->HICUMrbi + here->HICUMrbx_t.rpart; - return(OK); -/* transconductances and capacitances */ - case HICUM_QUEST_BETADC: - HICUMask(ckt, instPtr, HICUM_QUEST_CC, &IC, select); - HICUMask(ckt, instPtr, HICUM_QUEST_CB, &IB, select); - if (IB.rValue != 0.0) { - value->rValue = IC.rValue/IB.rValue; - } else { - value->rValue = 0.0; - } - return(OK); - case HICUM_QUEST_GMI: - value->rValue = *(ckt->CKTstate0 + here->HICUMiciei_Vbiei); - return(OK); - case HICUM_QUEST_GMS: - value->rValue = *(ckt->CKTstate0 + here->HICUMibpsi_Vbpci); - return(OK); - case HICUM_QUEST_RPII: - value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMibiei_Vbiei) ); - return(OK); - case HICUM_QUEST_RPIX: - value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMibpei_Vbpei) ); - return(OK); - case HICUM_QUEST_RMUI: - value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMibici_Vbici) + ckt->CKTgmin); - return(OK); - case HICUM_QUEST_RMUX: - value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMibpci_Vbpci) + ckt->CKTgmin); - return(OK); - case HICUM_QUEST_ROI: - value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMiciei_Vbiei) + ckt->CKTgmin); - return(OK); - case HICUM_QUEST_CPII: - value->rValue = here->HICUMcapjei + here->HICUMcapdeix; - return(OK); - case HICUM_QUEST_CPIX: - value->rValue = here->HICUMcapjep + here->HICUMcbepar_scaled; - return(OK); - case HICUM_QUEST_CMUI: - value->rValue = here->HICUMcapjci + here->HICUMcapdci; - return(OK); - case HICUM_QUEST_CMUX: - value->rValue = here->HICUMcapjcx_t_i + here->HICUMcapjcx_t_ii + here->HICUMcbcpar_scaled + here->HICUMcapdsu; - return(OK); - case HICUM_QUEST_CCS: - value->rValue = here->HICUMcapjs + here->HICUMcapscp; - return(OK); - case HICUM_QUEST_CRBI: - value->rValue = here->HICUMcaprbi; - return(OK); - case HICUM_QUEST_BETAAC: - HICUMask(ckt, instPtr, HICUM_QUEST_RPII, &RPIi, select); - HICUMask(ckt, instPtr, HICUM_QUEST_RPIX, &RPIx, select); - HICUMask(ckt, instPtr, HICUM_QUEST_GMI, &GMi, select); - g_be = 1/(RPIi.rValue + RPIx.rValue); - if (g_be > 0.0) { - value->rValue = GMi.rValue/g_be; - } else { - value->rValue = 0.0; - } - return(OK); -/* transit time */ - case HICUM_QUEST_TF: - value->rValue = here->HICUMtf; - return(OK); - case HICUM_QUEST_FT: - // FT = GMi/(2*`M_PI*(CPIi+CPIx+CMUi+CMUx+(rcx_t+re_t+(re_t+rb)/BETAAC)*GMi*(CMUi+CMUx))); - HICUMask(ckt, instPtr, HICUM_QUEST_GMI, &GMi, select); - HICUMask(ckt, instPtr, HICUM_QUEST_CPII, &CPIi, select); - HICUMask(ckt, instPtr, HICUM_QUEST_CPIX, &CPIx, select); - HICUMask(ckt, instPtr, HICUM_QUEST_CMUI, &CMUi, select); - HICUMask(ckt, instPtr, HICUM_QUEST_CMUX, &CMUx, select); - HICUMask(ckt, instPtr, HICUM_QUEST_RCX_T, &rcx_t, select); - HICUMask(ckt, instPtr, HICUM_QUEST_RE_T, &re_t, select); - HICUMask(ckt, instPtr, HICUM_QUEST_RB, &rb, select); - HICUMask(ckt, instPtr, HICUM_QUEST_BETAAC, &BETAAC, select); - - value->rValue = GMi.rValue/( - 2 * M_PI * ( - CPIi.rValue + CPIx.rValue + - CMUi.rValue + CMUx.rValue + - (rcx_t.rValue + re_t.rValue + (re_t.rValue + rb.rValue)/BETAAC.rValue) - ) * GMi.rValue * ( - CMUi.rValue + CMUx.rValue - ) - ); - return(OK); - case HICUM_QUEST_ICK: - value->rValue = here->HICUMick; - return(OK); - case HICUM_QUEST_POWER: - value->rValue = here->HICUMpterm; - return(OK); - case HICUM_QUEST_TK: - value->rValue = here->HICUMtemp; - return(OK); - case HICUM_QUEST_DTSH: - value->rValue = here->HICUMdtemp_sh; - return(OK); - default: - return(E_BADPARM); - } - /* NOTREACHED */ -} +/********** +License : 3-clause BSD +Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher +Model Author : (Copyright 1993-2024) Michael Schroter +**********/ + +/* + * This routine gives access to the internal device + * parameters for HICUMs + */ + +#include "ngspice/ngspice.h" +#include "ngspice/const.h" +#include "ngspice/cktdefs.h" +#include "hicum2defs.h" +#include "ngspice/ifsim.h" +#include "ngspice/sperror.h" +#include "ngspice/suffix.h" + +/*ARGSUSED*/ +int +HICUMask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue *select) +{ + HICUMinstance *here = (HICUMinstance*)instPtr; + + NG_IGNORE(select); + double g_be; + IFvalue IC, IB, RPIi, RPIx, GMi; + IFvalue CPIi, CPIx, CMUi, CMUx; + IFvalue rcx_t, re_t, rb, BETAAC; + + switch(which) { + case HICUM_AREA: + value->rValue = here->HICUMarea; + return(OK); + case HICUM_OFF: + value->iValue = here->HICUMoff; + return(OK); + case HICUM_TEMP: + value->rValue = here->HICUMtemp - CONSTCtoK; + return(OK); + case HICUM_M: + value->rValue = here->HICUMm; + return(OK); + case HICUM_QUEST_COLLNODE: + value->iValue = here->HICUMcollNode; + return(OK); + case HICUM_QUEST_BASENODE: + value->iValue = here->HICUMbaseNode; + return(OK); + case HICUM_QUEST_EMITNODE: + value->iValue = here->HICUMemitNode; + return(OK); + case HICUM_QUEST_SUBSNODE: + value->iValue = here->HICUMsubsNode; + return(OK); + case HICUM_QUEST_COLLCINODE: + value->iValue = here->HICUMcollCINode; + return(OK); + case HICUM_QUEST_BASEBPNODE: + value->iValue = here->HICUMbaseBPNode; + return(OK); + case HICUM_QUEST_BASEBINODE: + value->iValue = here->HICUMbaseBINode; + return(OK); + case HICUM_QUEST_EMITEINODE: + value->iValue = here->HICUMemitEINode; + return(OK); + case HICUM_QUEST_SUBSSINODE: + value->iValue = here->HICUMsubsSINode; + return(OK); +/* voltages */ + case HICUM_QUEST_VBE: + value->rValue = *(ckt->CKTstate0 + here->HICUMbaseNode)-*(ckt->CKTstate0 + here->HICUMemitNode); + return(OK); + case HICUM_QUEST_VBBP: + value->rValue = *(ckt->CKTstate0 + here->HICUMbaseNode)-*(ckt->CKTstate0 + here->HICUMbaseBPNode); + return(OK); + case HICUM_QUEST_VBC: + value->rValue = *(ckt->CKTstate0 + here->HICUMbaseNode)-*(ckt->CKTstate0 + here->HICUMcollNode); + return(OK); + case HICUM_QUEST_VCE: + value->rValue = *(ckt->CKTstate0 + here->HICUMcollNode)-*(ckt->CKTstate0 + here->HICUMemitNode); + return(OK); + case HICUM_QUEST_VSC: + value->rValue = *(ckt->CKTstate0 + here->HICUMcollNode)-*(ckt->CKTstate0 + here->HICUMsubsNode); + return(OK); + case HICUM_QUEST_VBIEI: + value->rValue = *(ckt->CKTstate0 + here->HICUMvbiei); + return(OK); + case HICUM_QUEST_VBPBI: + value->rValue = *(ckt->CKTstate0 + here->HICUMvbpbi); + return(OK); + case HICUM_QUEST_VBICI: + value->rValue = *(ckt->CKTstate0 + here->HICUMvbici); + return(OK); + case HICUM_QUEST_VCIEI: + value->rValue = *(ckt->CKTstate0 + here->HICUMvbiei) - *(ckt->CKTstate0 + here->HICUMvbici); + return(OK); +/* currents */ + case HICUM_QUEST_CC: + value->rValue = *(ckt->CKTstate0 + here->HICUMiciei) - + *(ckt->CKTstate0 + here->HICUMibici) - + *(ckt->CKTstate0 + here->HICUMibpci) - + *(ckt->CKTstate0 + here->HICUMisici); + value->rValue *= HICUMmodPtr(here)->HICUMtype; + return(OK); + case HICUM_QUEST_CB: + value->rValue = *(ckt->CKTstate0 + here->HICUMibiei) + + *(ckt->CKTstate0 + here->HICUMibici) + + *(ckt->CKTstate0 + here->HICUMibpci) + + *(ckt->CKTstate0 + here->HICUMibpsi); + value->rValue *= HICUMmodPtr(here)->HICUMtype; + return(OK); + case HICUM_QUEST_CE: + value->rValue = - *(ckt->CKTstate0 + here->HICUMibiei) - + *(ckt->CKTstate0 + here->HICUMibpei) - + *(ckt->CKTstate0 + here->HICUMiciei); + value->rValue *= HICUMmodPtr(here)->HICUMtype; + return(OK); + case HICUM_QUEST_CS: + value->rValue = *(ckt->CKTstate0 + here->HICUMisici) - + *(ckt->CKTstate0 + here->HICUMibpsi); + value->rValue *= HICUMmodPtr(here)->HICUMtype; + return(OK); + case HICUM_QUEST_CAVL: + value->rValue = here->HICUMiavl; + return(OK); + case HICUM_QUEST_CBEI: + value->rValue = *(ckt->CKTstate0 + here->HICUMibiei); + return(OK); + case HICUM_QUEST_CBCI: + value->rValue = *(ckt->CKTstate0 + here->HICUMibici); + return(OK); +/* resistances */ + case HICUM_QUEST_RCX_T: + value->rValue = here->HICUMrcx_t.rpart; + return(OK); + case HICUM_QUEST_RE_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; + return(OK); + case HICUM_QUEST_RB: + value->rValue = here->HICUMrbi + here->HICUMrbx_t.rpart; + return(OK); +/* transconductances and capacitances */ + case HICUM_QUEST_BETADC: + HICUMask(ckt, instPtr, HICUM_QUEST_CC, &IC, select); + HICUMask(ckt, instPtr, HICUM_QUEST_CB, &IB, select); + if (IB.rValue != 0.0) { + value->rValue = IC.rValue/IB.rValue; + } else { + value->rValue = 0.0; + } + return(OK); + case HICUM_QUEST_GMI: + value->rValue = *(ckt->CKTstate0 + here->HICUMiciei_Vbiei); + return(OK); + case HICUM_QUEST_GMS: + value->rValue = *(ckt->CKTstate0 + here->HICUMibpsi_Vbpci); + return(OK); + case HICUM_QUEST_RPII: + value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMibiei_Vbiei) ); + return(OK); + case HICUM_QUEST_RPIX: + value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMibpei_Vbpei) ); + return(OK); + case HICUM_QUEST_RMUI: + value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMibici_Vbici) + ckt->CKTgmin); + return(OK); + case HICUM_QUEST_RMUX: + value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMibpci_Vbpci) + ckt->CKTgmin); + return(OK); + case HICUM_QUEST_ROI: + value->rValue = 1/( *(ckt->CKTstate0 + here->HICUMiciei_Vbiei) + ckt->CKTgmin); + return(OK); + case HICUM_QUEST_CPII: + value->rValue = here->HICUMcapjei + here->HICUMcapdeix; + return(OK); + case HICUM_QUEST_CPIX: + value->rValue = here->HICUMcapjep + here->HICUMcbepar_scaled; + return(OK); + case HICUM_QUEST_CMUI: + value->rValue = here->HICUMcapjci + here->HICUMcapdci; + return(OK); + case HICUM_QUEST_CMUX: + value->rValue = here->HICUMcapjcx_t_i + here->HICUMcapjcx_t_ii + here->HICUMcbcpar_scaled + here->HICUMcapdsu; + return(OK); + case HICUM_QUEST_CCS: + value->rValue = here->HICUMcapjs + here->HICUMcapscp; + return(OK); + case HICUM_QUEST_CRBI: + value->rValue = here->HICUMcaprbi; + return(OK); + case HICUM_QUEST_BETAAC: + HICUMask(ckt, instPtr, HICUM_QUEST_RPII, &RPIi, select); + HICUMask(ckt, instPtr, HICUM_QUEST_RPIX, &RPIx, select); + HICUMask(ckt, instPtr, HICUM_QUEST_GMI, &GMi, select); + g_be = 1/(RPIi.rValue + RPIx.rValue); + if (g_be > 0.0) { + value->rValue = GMi.rValue/g_be; + } else { + value->rValue = 0.0; + } + return(OK); +/* transit time */ + case HICUM_QUEST_TF: + value->rValue = here->HICUMtf; + return(OK); + case HICUM_QUEST_FT: + // FT = GMi/(2*`M_PI*(CPIi+CPIx+CMUi+CMUx+(rcx_t+re_t+(re_t+rb)/BETAAC)*GMi*(CMUi+CMUx))); + HICUMask(ckt, instPtr, HICUM_QUEST_GMI, &GMi, select); + HICUMask(ckt, instPtr, HICUM_QUEST_CPII, &CPIi, select); + HICUMask(ckt, instPtr, HICUM_QUEST_CPIX, &CPIx, select); + HICUMask(ckt, instPtr, HICUM_QUEST_CMUI, &CMUi, select); + HICUMask(ckt, instPtr, HICUM_QUEST_CMUX, &CMUx, select); + HICUMask(ckt, instPtr, HICUM_QUEST_RCX_T, &rcx_t, select); + HICUMask(ckt, instPtr, HICUM_QUEST_RE_T, &re_t, select); + HICUMask(ckt, instPtr, HICUM_QUEST_RB, &rb, select); + HICUMask(ckt, instPtr, HICUM_QUEST_BETAAC, &BETAAC, select); + + value->rValue = GMi.rValue/( + 2 * M_PI * ( + CPIi.rValue + CPIx.rValue + + CMUi.rValue + CMUx.rValue + + (rcx_t.rValue + re_t.rValue + (re_t.rValue + rb.rValue)/BETAAC.rValue) + ) * GMi.rValue * ( + CMUi.rValue + CMUx.rValue + ) + ); + return(OK); + case HICUM_QUEST_ICK: + value->rValue = here->HICUMick; + return(OK); + case HICUM_QUEST_POWER: + value->rValue = here->HICUMpterm; + return(OK); + case HICUM_QUEST_TK: + value->rValue = here->HICUMtemp; + return(OK); + case HICUM_QUEST_DTSH: + value->rValue = here->HICUMdtemp_sh; + return(OK); + default: + return(E_BADPARM); + } + /* NOTREACHED */ +} diff --git a/src/spicelib/devices/hicum2/hicum2conv.c b/src/spicelib/devices/hicum2/hicum2conv.c index 0be839408..a7c953093 100644 --- a/src/spicelib/devices/hicum2/hicum2conv.c +++ b/src/spicelib/devices/hicum2/hicum2conv.c @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ /* diff --git a/src/spicelib/devices/hicum2/hicum2defs.h b/src/spicelib/devices/hicum2/hicum2defs.h index a839b62c6..7f7ead7c9 100644 --- a/src/spicelib/devices/hicum2/hicum2defs.h +++ b/src/spicelib/devices/hicum2/hicum2defs.h @@ -1,1267 +1,1267 @@ -/********** -License : 3-clause BSD -Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden -**********/ - -#ifndef HICUM -#define HICUM - -#include "ngspice/cktdefs.h" -#include "ngspice/ifsim.h" -#include "ngspice/gendefs.h" -#include "ngspice/complex.h" -#include "ngspice/noisedef.h" - -/* structures to describe Bipolar Junction Transistors */ - -/* indices to array of HICUM noise sources */ - -enum { - HICUMRCNOIZ = 0, - HICUMRBNOIZ, - HICUMRBINOIZ, - HICUMRENOIZ, - HICUMRSNOIZ, - HICUMIAVLNOIZ, - HICUMIBCINOIZ, - HICUMIBEPNOIZ, - HICUMIBCXNOIZ, - HICUMIJSCNOIZ, - HICUMITNOIZ, - HICUMIBEINOIZ, - HICUMFLBENOIZ, - HICUMFLRENOIZ, - HICUMTOTNOIZ, - /* finally, the number of noise sources */ - HICUMNSRCS -}; - -typedef struct sDualDouble { - double rpart; - double dpart; -} dual_double; - -/* data needed to describe a single instance */ - -typedef struct sHICUMinstance { - - struct GENinstance gen; - -#define HICUMmodPtr(inst) ((struct sHICUMmodel *)((inst)->gen.GENmodPtr)) -#define HICUMnextInstance(inst) ((struct sHICUMinstance *)((inst)->gen.GENnextInstance)) -#define HICUMname gen.GENname -#define HICUMstate gen.GENstate - - const int HICUMcollNode; /* number of collector node of hicum */ - const int HICUMbaseNode; /* number of base node of hicum */ - const int HICUMemitNode; /* number of emitter node of hicum */ - const int HICUMsubsNode; /* number of substrate node of hicum */ - int HICUMtempNode; /* number of the temperature node of the hicum */ - int HICUMcollCINode; /* number of internal collector node of hicum */ - int HICUMbaseBINode; /* number of internal base node of hicum */ - int HICUMemitEINode; /* number of internal emitter node of hicum */ - int HICUMbaseBPNode; /* number of internal base node of hicum */ - int HICUMsubsSINode; /* number of internal substrate node */ - int HICUMxfNode; /* number of internal excess phase node qdei */ - int HICUMxf1Node; /* number of internal excess phase 1 node itf */ - int HICUMxf2Node; /* number of internal excess phase 2 node itf */ - - double HICUMarea; /* area factor for the hicum */ - //initial conditions - double HICUMicVBE; /* initial condition inner B-E branch */ - double HICUMicVCE; /* initial condition inner C-E branch */ - double HICUMicVCS; /* initial condition inner C-S branch */ - - double HICUMtemp; /* instance temperature */ - double HICUMtemp_Vrth;/* derivative device temperature to temperature at thermal node */ - double HICUMdtemp; /* instance delta temperature */ - double HICUMdtemp_sh; /* instance delta temperature because of self-heating */ - double HICUMm; /* multiply factor for the hicum */ - - double HICUMvt0; - dual_double HICUMvt; - dual_double HICUMdT; - dual_double HICUMibeis_t; - dual_double HICUMireis_t; - dual_double HICUMibeps_t; - dual_double HICUMireps_t; - dual_double HICUMibcis_t; - dual_double HICUMibcxs_t; - dual_double HICUMitss_t; - dual_double HICUMiscs_t; - dual_double HICUMqp0_t; - dual_double HICUMvlim_t; - dual_double HICUMtef0_t; - dual_double HICUMc10_t; - dual_double HICUMrci0_t; - dual_double HICUMvces_t; - dual_double HICUMt0_t; - dual_double HICUMthcs_t; - dual_double HICUMfavl_t; - dual_double HICUMqavl_t; - dual_double HICUMkavl_t; - dual_double HICUMrbi0_t; - dual_double HICUMibets_t; - dual_double HICUMabet_t; - dual_double HICUMcjcx01_t; - dual_double HICUMcjcx02_t; - dual_double HICUMrcx_t; - dual_double HICUMrbx_t; - dual_double HICUMre_t; - dual_double HICUMtsf_t; - dual_double HICUMcscp0_t; - dual_double HICUMvdsp_t; - dual_double HICUMvptsp_t; - dual_double HICUMahjei_t; - dual_double HICUMhjei0_t; - dual_double HICUMhf0_t; - dual_double HICUMhfc_t; - dual_double HICUMhfe_t; - dual_double HICUMrth_t; - - dual_double HICUMvdei_t; - dual_double HICUMajei_t; - dual_double HICUMcjci0_t; - dual_double HICUMvdci_t; - dual_double HICUMvptci_t; - dual_double HICUMvdep_t; - dual_double HICUMajep_t; - dual_double HICUMcjep0_t; - dual_double HICUMcjei0_t; - dual_double HICUMvdcx_t; - dual_double HICUMvptcx_t; - dual_double HICUMcjs0_t; - dual_double HICUMvds_t; - dual_double HICUMvpts_t; - - //model variables that depend on "area" and "m" and are needed in temp - double HICUMqp0_scaled; - double HICUMc10_scaled; - double HICUMicbar_scaled; - double HICUMrth_scaled; - double HICUMcth_scaled; - double HICUMcjei0_scaled; - double HICUMibeis_scaled; - double HICUMireis_scaled; - double HICUMibeps_scaled; - double HICUMireps_scaled; - double HICUMcjep0_scaled; - double HICUMcbepar_scaled; - double HICUMibets_scaled; - double HICUMibcis_scaled; - double HICUMcjci0_scaled; - double HICUMcjcx0_scaled; - double HICUMcbcpar_scaled; - double HICUMibcxs_scaled; - double HICUMqavl_scaled; - double HICUMre_scaled; - double HICUMrci0_scaled; - double HICUMrbx_scaled; - double HICUMrcx_scaled; - double HICUMrbi0_scaled; - double HICUMkf_scaled; - double HICUMkfre_scaled; - - double HICUMrbi; - double HICUMiavl; - double HICUMpterm; - - double HICUMtf; - double HICUMick; - - double *HICUMcollCollPtr; /* pointer to sparse matrix at - * (collector,collector) */ - double *HICUMbaseBasePtr; /* pointer to sparse matrix at - * (base,base) */ - double *HICUMemitEmitPtr; /* pointer to sparse matrix at - * (emitter,emitter) */ - double *HICUMsubsSubsPtr; /* pointer to sparse matrix at - * (substrate,substrate) */ - double *HICUMcollCICollCIPtr; /* pointer to sparse matrix at - * (collector prime,collector prime) */ - double *HICUMbaseBIBaseBIPtr; /* pointer to sparse matrix at - * (collector prime,collector prime) */ - double *HICUMbaseBPBaseBPPtr; /* pointer to sparse matrix at - * (collector prime,collector prime) */ - double *HICUMemitEIEmitEIPtr; /* pointer to sparse matrix at - * (emitter prime,emitter prime) */ - double *HICUMemitEIXfPtr; /* pointer to sparse matrix at - * (emitter prime,xf) */ - double *HICUMbaseBIXfPtr; /* pointer to sparse matrix at - * (base prime,xf) */ - - - double *HICUMsubsSISubsSIPtr; /* pointer to sparse matrix at - * (substrate prime, substrate prime) */ - - double *HICUMbaseEmitPtr; /* pointer to sparse matrix at - * (base,emit) */ - double *HICUMemitBasePtr; /* pointer to sparse matrix at - * (emit,base) */ - double *HICUMcollCollCIPtr; /* pointer to sparse matrix at - * (collector,collector prime) */ - double *HICUMbaseBaseBPPtr; /* pointer to sparse matrix at - * (base,base prime) */ - double *HICUMemitEmitEIPtr; /* pointer to sparse matrix at - * (emitter,emitter prime) */ - double *HICUMsubsSubsSIPtr; /* pointer to sparse matrix at - * (substrate, Substrate connection) */ - double *HICUMcollCIBaseBIPtr; /* pointer to sparse matrix at - * (collector prime,base) */ - double *HICUMcollCIEmitEIPtr; /* pointer to sparse matrix at - * (collector prime,emitter prime) */ - double *HICUMbaseBPBaseBIPtr; /* pointer to sparse matrix at - * (base prime,emitter prime) */ - double *HICUMbaseBPEmitEIPtr; /* pointer to sparse matrix at - * (base prime,emitter prime) */ - double *HICUMbaseBPSubsSIPtr; /* pointer to sparse matrix at - * (base prime,emitter prime) */ - double *HICUMbaseBIEmitEIPtr; /* pointer to sparse matrix at - * (base prime,emitter prime) */ - - double *HICUMcollCICollPtr; /* pointer to sparse matrix at - * (collector prime,collector) */ - double *HICUMbaseBPBasePtr; /* pointer to sparse matrix at - * (base prime,base ) */ - double *HICUMemitEIEmitPtr; /* pointer to sparse matrix at - * (emitter prime,emitter) */ - double *HICUMsubsSISubsPtr; /* pointer to sparse matrix at - * (Substrate connection, substrate) */ - double *HICUMbaseBPCollCIPtr; /* pointer to sparse matrix at - * (base,collector prime) */ - double *HICUMcollCIBaseBPPtr; /* pointer to sparse matrix at - * (collector prime,base) */ - - double *HICUMbaseBICollCIPtr; /* pointer to sparse matrix at - * (base,collector prime) */ - double *HICUMemitEICollCIPtr; /* pointer to sparse matrix at - * (emitter prime,collector prime) */ - double *HICUMsubsSICollCIPtr; /* pointer to sparse matrix at - * (substrate,collector prime) */ - double *HICUMcollCISubsSIPtr; /* pointer to sparse matrix at - * (collector prime,substrate) */ - double *HICUMbaseBIBaseBPPtr; /* pointer to sparse matrix at - * (base prime,emitter prime) */ - double *HICUMemitEIBaseBPPtr; /* pointer to sparse matrix at - * (emitter prime,base prime) */ - double *HICUMsubsSIBaseBPPtr; /* pointer to sparse matrix at - * (substrate,base) */ - double *HICUMsubsSIBaseBIPtr; /* pointer to sparse matrix at - * (substrate,base) */ - double *HICUMemitEIBaseBIPtr; /* pointer to sparse matrix at - * (emitter prime,base prime) */ - double *HICUMsubsTempPtr; /* pointer to sparse matrix at - * (subs ,T) */ - - - double *HICUMcollCIBasePtr; - double *HICUMbaseCollCIPtr; - - double *HICUMbaseBPEmitPtr; - double *HICUMemitBaseBPPtr; - - double *HICUMsubsCollPtr; - double *HICUMcollSubsPtr; - - /* excess phase */ - double *HICUMxfXfPtr; - double *HICUMxfBaseBIPtr; - double *HICUMxfEmitEIPtr; - double *HICUMxfCollCIPtr; - double *HICUMxfTempPtr; - - double *HICUMxf1Xf1Ptr; - double *HICUMxf1TempPtr; - double *HICUMxf1BaseBIPtr; - double *HICUMxf1EmitEIPtr; - double *HICUMxf1CollCIPtr; - double *HICUMxf1Xf2Ptr; - - double *HICUMxf2Xf1Ptr; - double *HICUMxf2TempPtr; - double *HICUMxf2BaseBIPtr; - double *HICUMxf2EmitEIPtr; - double *HICUMxf2CollCIPtr; - double *HICUMxf2Xf2Ptr; - double *HICUMemitXf2Ptr; - double *HICUMemitEIXf2Ptr; - double *HICUMcollCIXf2Ptr; - - /* self heating */ - double *HICUMcollTempPtr; - double *HICUMbaseTempPtr; - double *HICUMemitTempPtr; - - double *HICUMcollCItempPtr; - double *HICUMbaseBItempPtr; - double *HICUMbaseBPtempPtr; - double *HICUMemitEItempPtr; - double *HICUMsubsSItempPtr; - - double *HICUMtempCollPtr; - double *HICUMtempBasePtr; - double *HICUMtempEmitPtr; - - double *HICUMtempCollCIPtr; - double *HICUMtempBaseBIPtr; - double *HICUMtempBaseBPPtr; - double *HICUMtempEmitEIPtr; - double *HICUMtempSubsSIPtr; - double *HICUMtempTempPtr; - - unsigned HICUMareaGiven :1; /* flag to indicate area was specified */ - unsigned HICUMoff :1; /* 'off' flag for hicum */ - unsigned HICUMicVBEGiven :1; /* flag to indicate VBE init. cond. given */ - unsigned HICUMicVCEGiven :1; /* flag to indicate VCE init. cond. given */ - unsigned HICUMicVCSGiven :1; /* flag to indicate VCS init. cond. given */ - unsigned HICUMtempGiven :1; /* temperature given for hicum instance*/ - unsigned HICUMdtempGiven :1; /* delta temperature given for hicum instance*/ - unsigned HICUMmGiven :1; /* flag to indicate multiplier was specified */ - - double HICUMcaprbi; - double HICUMcapdeix; - double HICUMcapjei; - double HICUMcapdci; - double HICUMcapjci; - double HICUMcapjep; - double HICUMcapjcx_t_i; - double HICUMcapjcx_t_ii; - double HICUMcapdsu; - double HICUMcapjs; - double HICUMcapscp; - double HICUMcapsu; - double HICUMcapcth; - - //Caps due to coupling between branches - double HICUMqrbi_Vbiei; - double HICUMqrbi_Vbici; - double HICUMqrbi_Vrth; - double HICUMqjei_Vrth; - double HICUMqjep_Vrth; - double HICUMqf_Vbici; - double HICUMqf_Vxf; - double HICUMqf_Vrth; - double HICUMqr_Vbiei; - double HICUMqr_Vrth; - double HICUMqjci_Vrth; - double HICUMqjcx0_i_Vrth; - double HICUMqjcx0_ii_Vrth; - double HICUMqdsu_Vrth; - double HICUMqdsu_Vsici; - double HICUMqjs_Vrth; - double HICUMqscp_Vrth; - double HICUMicth_dT; - - double HICUMcapxf; - - double HICUMtVcrit; - double HICUMbetadc; - -#ifndef NONOISE - double HICUMnVar[NSTATVARS][HICUMNSRCS]; -#else /*NONOISE*/ - double **HICUMnVar; -#endif /*NONOISE*/ -/* the above to avoid allocating memory when it is not needed */ - -#ifdef KLU - BindElement *HICUMbaseBaseBinding ; - BindElement *HICUMbaseBaseBPBinding ; - BindElement *HICUMbaseBIBaseBIBinding ; - BindElement *HICUMbaseBIBaseBPBinding ; - BindElement *HICUMbaseBICollCIBinding ; - BindElement *HICUMbaseBIEmitEIBinding ; - BindElement *HICUMbaseBItempBinding ; - BindElement *HICUMbaseBIXfBinding ; - BindElement *HICUMbaseBPBaseBIBinding ; - BindElement *HICUMbaseBPBaseBinding ; - BindElement *HICUMbaseBPBaseBPBinding ; - BindElement *HICUMbaseBPCollCIBinding ; - BindElement *HICUMbaseBPEmitBinding ; - BindElement *HICUMbaseBPEmitEIBinding ; - BindElement *HICUMbaseBPSubsSIBinding ; - BindElement *HICUMbaseBPtempBinding ; - BindElement *HICUMbaseCollCIBinding ; - BindElement *HICUMbaseEmitBinding ; - BindElement *HICUMbaseTempBinding ; - BindElement *HICUMcollCIBaseBIBinding ; - BindElement *HICUMcollCIBaseBinding ; - BindElement *HICUMcollCIBaseBPBinding ; - BindElement *HICUMcollCICollBinding ; - BindElement *HICUMcollCICollCIBinding ; - BindElement *HICUMcollCIEmitEIBinding ; - BindElement *HICUMcollCISubsSIBinding ; - BindElement *HICUMcollCItempBinding ; - BindElement *HICUMcollCIXf2Binding ; - BindElement *HICUMcollCollBinding ; - BindElement *HICUMcollCollCIBinding ; - BindElement *HICUMcollSubsBinding ; - BindElement *HICUMcollTempBinding ; - BindElement *HICUMemitBaseBinding ; - BindElement *HICUMemitBaseBPBinding ; - BindElement *HICUMemitEIBaseBIBinding ; - BindElement *HICUMemitEIBaseBPBinding ; - BindElement *HICUMemitEICollCIBinding ; - BindElement *HICUMemitEIEmitBinding ; - BindElement *HICUMemitEIEmitEIBinding ; - BindElement *HICUMemitEItempBinding ; - BindElement *HICUMemitEIXf2Binding ; - BindElement *HICUMemitEIXfBinding ; - BindElement *HICUMemitEmitBinding ; - BindElement *HICUMemitEmitEIBinding ; - BindElement *HICUMemitTempBinding ; - BindElement *HICUMsubsCollBinding ; - BindElement *HICUMsubsSIBaseBPBinding ; - BindElement *HICUMsubsSICollCIBinding ; - BindElement *HICUMsubsSISubsBinding ; - BindElement *HICUMsubsSISubsSIBinding ; - BindElement *HICUMsubsSItempBinding ; - BindElement *HICUMsubsSubsBinding ; - BindElement *HICUMsubsSubsSIBinding ; - BindElement *HICUMsubsTempBinding ; - BindElement *HICUMtempBaseBIBinding ; - BindElement *HICUMtempBaseBinding ; - BindElement *HICUMtempBaseBPBinding ; - BindElement *HICUMtempCollBinding ; - BindElement *HICUMtempCollCIBinding ; - BindElement *HICUMtempEmitBinding ; - BindElement *HICUMtempEmitEIBinding ; - BindElement *HICUMtempSubsSIBinding ; - BindElement *HICUMtempTempBinding ; - BindElement *HICUMxf1BaseBIBinding ; - BindElement *HICUMxf1CollCIBinding ; - BindElement *HICUMxf1EmitEIBinding ; - BindElement *HICUMxf1TempBinding ; - BindElement *HICUMxf1Xf1Binding ; - BindElement *HICUMxf1Xf2Binding ; - BindElement *HICUMxf2BaseBIBinding ; - BindElement *HICUMxf2CollCIBinding ; - BindElement *HICUMxf2EmitEIBinding ; - BindElement *HICUMxf2TempBinding ; - BindElement *HICUMxf2Xf1Binding ; - BindElement *HICUMxf2Xf2Binding ; - BindElement *HICUMxfBaseBIBinding ; - BindElement *HICUMxfCollCIBinding ; - BindElement *HICUMxfEmitEIBinding ; - BindElement *HICUMxfTempBinding ; - BindElement *HICUMxfXfBinding ; -#endif - -} HICUMinstance; - -/* entries in the state vector for hicum: */ - -#define HICUMvbiei HICUMstate -#define HICUMvbici HICUMstate+1 -#define HICUMvbpei HICUMstate+2 -#define HICUMvbpbi HICUMstate+3 -#define HICUMvbpci HICUMstate+4 -#define HICUMvsici HICUMstate+5 -#define HICUMvcic HICUMstate+6 -#define HICUMvbbp HICUMstate+7 -#define HICUMveie HICUMstate+8 -#define HICUMvrth HICUMstate+9 -#define HICUMvxf HICUMstate+10 -#define HICUMvxf1 HICUMstate+11 -#define HICUMvxf2 HICUMstate+12 - -#define HICUMibiei HICUMstate+13 -#define HICUMibiei_Vbiei HICUMstate+14 -#define HICUMibiei_Vxf HICUMstate+15 -#define HICUMibiei_Vbici HICUMstate+16 -#define HICUMibiei_Vrth HICUMstate+17 - -#define HICUMibpei HICUMstate+18 -#define HICUMibpei_Vbpei HICUMstate+19 -#define HICUMibpei_Vrth HICUMstate+20 - -#define HICUMiciei HICUMstate+21 -#define HICUMiciei_Vbiei HICUMstate+22 -#define HICUMiciei_Vbici HICUMstate+23 -#define HICUMiciei_Vxf2 HICUMstate+24 -#define HICUMiciei_Vrth HICUMstate+25 - -#define HICUMibici HICUMstate+26 -#define HICUMibici_Vbici HICUMstate+27 -#define HICUMibici_Vbiei HICUMstate+28 -#define HICUMibici_Vrth HICUMstate+29 - -#define HICUMibpbi HICUMstate+30 -#define HICUMibpbi_Vbpbi HICUMstate+31 -#define HICUMibpbi_Vbiei HICUMstate+32 -#define HICUMibpbi_Vbici HICUMstate+33 -#define HICUMibpbi_Vrth HICUMstate+34 - -#define HICUMibpci HICUMstate+35 -#define HICUMibpci_Vbpci HICUMstate+36 -#define HICUMibpci_Vrth HICUMstate+37 - -#define HICUMisici HICUMstate+38 -#define HICUMisici_Vsici HICUMstate+39 -#define HICUMisici_Vrth HICUMstate+40 - -#define HICUMibpsi HICUMstate+41 -#define HICUMibpsi_Vbpci HICUMstate+42 -#define HICUMibpsi_Vsici HICUMstate+43 -#define HICUMibpsi_Vrth HICUMstate+44 - -#define HICUMisis_Vsis HICUMstate+45 - -#define HICUMieie HICUMstate+46 // needed for re-flicker noise -#define HICUMieie_Vrth HICUMstate+47 - -#define HICUMqrbi HICUMstate+48 -#define HICUMcqrbi HICUMstate+49 - -#define HICUMqjei HICUMstate+50 -#define HICUMcqjei HICUMstate+51 - -#define HICUMqf HICUMstate+52 -#define HICUMcqf HICUMstate+53 - -#define HICUMqr HICUMstate+54 -#define HICUMcqr HICUMstate+55 - -#define HICUMqjci HICUMstate+56 -#define HICUMcqjci HICUMstate+57 - -#define HICUMqjep HICUMstate+58 -#define HICUMcqjep HICUMstate+59 - -#define HICUMqjcx0_i HICUMstate+60 -#define HICUMcqcx0_t_i HICUMstate+61 - -#define HICUMqjcx0_ii HICUMstate+62 -#define HICUMcqcx0_t_ii HICUMstate+63 - -#define HICUMqdsu HICUMstate+64 -#define HICUMcqdsu HICUMstate+65 - -#define HICUMqjs HICUMstate+66 -#define HICUMcqjs HICUMstate+67 - -#define HICUMqscp HICUMstate+68 -#define HICUMcqscp HICUMstate+69 - -#define HICUMqbepar1 HICUMstate+70 -#define HICUMcqbepar1 HICUMstate+71 -#define HICUMgqbepar1 HICUMstate+72 - -#define HICUMqbepar2 HICUMstate+73 -#define HICUMcqbepar2 HICUMstate+74 -#define HICUMgqbepar2 HICUMstate+75 - -#define HICUMqbcpar1 HICUMstate+76 -#define HICUMcqbcpar1 HICUMstate+77 -#define HICUMgqbcpar1 HICUMstate+78 - -#define HICUMqbcpar2 HICUMstate+79 -#define HICUMcqbcpar2 HICUMstate+80 -#define HICUMgqbcpar2 HICUMstate+81 - -#define HICUMqsu HICUMstate+82 -#define HICUMcqsu HICUMstate+83 -#define HICUMgqsu HICUMstate+84 - -#define HICUMqcth HICUMstate+85 -#define HICUMcqcth HICUMstate+86 - -#define HICUMqxf HICUMstate+87 -#define HICUMcqxf HICUMstate+88 -#define HICUMgqxf HICUMstate+89 -#define HICUMixf HICUMstate+90 -#define HICUMixf_Vbiei HICUMstate+91 -#define HICUMixf_Vbici HICUMstate+92 -#define HICUMixf_Vxf HICUMstate+93 -#define HICUMixf_Vrth HICUMstate+94 - -#define HICUMqxf1 HICUMstate+95 -#define HICUMcqxf1 HICUMstate+96 -#define HICUMgqxf1 HICUMstate+97 -#define HICUMixf1 HICUMstate+98 -#define HICUMixf1_Vbiei HICUMstate+99 -#define HICUMixf1_Vbici HICUMstate+100 -#define HICUMixf1_Vxf2 HICUMstate+101 -#define HICUMixf1_Vxf1 HICUMstate+102 -#define HICUMixf1_Vrth HICUMstate+103 - -#define HICUMqxf2 HICUMstate+104 -#define HICUMcqxf2 HICUMstate+105 -#define HICUMgqxf2 HICUMstate+106 -#define HICUMixf2 HICUMstate+107 -#define HICUMixf2_Vbiei HICUMstate+108 -#define HICUMixf2_Vbici HICUMstate+109 -#define HICUMixf2_Vxf1 HICUMstate+110 -#define HICUMixf2_Vxf2 HICUMstate+111 -#define HICUMixf2_Vrth HICUMstate+112 - -#define HICUMith HICUMstate+113 -#define HICUMith_Vrth HICUMstate+114 -#define HICUMith_Vbiei HICUMstate+115 -#define HICUMith_Vbici HICUMstate+116 -#define HICUMith_Vbpbi HICUMstate+117 -#define HICUMith_Vbpci HICUMstate+118 -#define HICUMith_Vbpei HICUMstate+119 -#define HICUMith_Vciei HICUMstate+120 -#define HICUMith_Vsici HICUMstate+121 -#define HICUMith_Vcic HICUMstate+122 -#define HICUMith_Vbbp HICUMstate+123 -#define HICUMith_Veie HICUMstate+124 - -#define HICUMit HICUMstate+125 //for noise - -#define HICUMnumStates 126 - -/* per model data */ -typedef struct sHICUMmodel { /* model structure for a hicum */ - - struct GENmodel gen; - -#define HICUMmodType gen.GENmodType -#define HICUMnextModel(inst) ((struct sHICUMmodel *)((inst)->gen.GENnextModel)) -#define HICUMinstances(inst) ((HICUMinstance *)((inst)->gen.GENinstances)) -#define HICUMmodName gen.GENmodName - -//Circuit simulator specific parameters - int HICUMtype; - double HICUMtnom; - - char *HICUMversion; - -//Transfer current - double HICUMc10; - double HICUMqp0; - double HICUMich; - double HICUMhf0; - double HICUMhfe; - double HICUMhfc; - double HICUMhjei; - double HICUMahjei; - double HICUMrhjei; - double HICUMhjci; - -//Base-Emitter diode; - double HICUMibeis; - double HICUMmbei; - double HICUMireis; - double HICUMmrei; - double HICUMibeps; - double HICUMmbep; - double HICUMireps; - double HICUMmrep; - double HICUMmcf; - -//Transit time for excess recombination current at b-c barrier - double HICUMtbhrec; - -//Base-Collector diode currents - double HICUMibcis; - double HICUMmbci; - double HICUMibcxs; - double HICUMmbcx; - -//Base-Emitter tunneling current - double HICUMibets; - double HICUMabet; - int HICUMtunode; - -//Base-Collector avalanche current - double HICUMfavl; - double HICUMqavl; - double HICUMkavl; - double HICUMalfav; - double HICUMalqav; - double HICUMalkav; - -//Series resistances - double HICUMrbi0; - double HICUMrbx; - double HICUMfgeo; - double HICUMfdqr0; - double HICUMfcrbi; - double HICUMfqi; - double HICUMre; - double HICUMrcx; - -//Substrate transistor - double HICUMitss; - double HICUMmsf; - double HICUMiscs; - double HICUMmsc; - double HICUMtsf; - -//Intra-device substrate coupling - double HICUMrsu; - double HICUMcsu; - -//Depletion Capacitances - double HICUMcjei0; - double HICUMvdei; - double HICUMzei; - double HICUMajei; - double HICUMcjep0; - double HICUMvdep; - double HICUMzep; - double HICUMajep; - double HICUMcjci0; - double HICUMvdci; - double HICUMzci; - double HICUMvptci; - double HICUMcjcx0; - double HICUMvdcx; - double HICUMzcx; - double HICUMvptcx; - double HICUMfbcpar; - double HICUMfbepar; - double HICUMcjs0; - double HICUMvds; - double HICUMzs; - double HICUMvpts; - double HICUMcscp0; - double HICUMvdsp; - double HICUMzsp; - double HICUMvptsp; - -//Diffusion Capacitances - double HICUMt0; - double HICUMdt0h; - double HICUMtbvl; - double HICUMtef0; - double HICUMgtfe; - double HICUMthcs; - double HICUMahc; - double HICUMfthc; - double HICUMrci0; - double HICUMvlim; - double HICUMvces; - double HICUMvpt; - double HICUMaick; - double HICUMdelck; - double HICUMtr; - double HICUMvcbar; - double HICUMicbar; - double HICUMacbar; - -//Isolation Capacitances - double HICUMcbepar; - double HICUMcbcpar; - -//Non-quasi-static Effect - double HICUMalqf; - double HICUMalit; - int HICUMflnqs; - -//Noise - double HICUMkf; - double HICUMaf; - int HICUMcfbe; - int HICUMflcono; - double HICUMkfre; - double HICUMafre; - -//Lateral Geometry Scaling (at high current densities) - double HICUMlatb; - double HICUMlatl; - -//Temperature dependence - double HICUMvgb; - double HICUMalt0; - double HICUMkt0; - double HICUMzetaci; - double HICUMalvs; - double HICUMalces; - double HICUMzetarbi; - double HICUMzetarbx; - double HICUMzetarcx; - double HICUMzetare; - double HICUMzetacx; - double HICUMvge; - double HICUMvgc; - double HICUMvgs; - double HICUMf1vg; - double HICUMf2vg; - double HICUMzetact; - double HICUMzetabet; - double HICUMalb; - double HICUMdvgbe; - double HICUMzetahjei; - double HICUMzetavgbe; - -//Self-Heating - int HICUMflsh; - double HICUMrth; - double HICUMzetarth; - double HICUMalrth; - double HICUMcth; - -//Compatibility with V2.1 - double HICUMflcomp; - -//SOA check parameters - double HICUMvbeMax; /* maximum voltage over B-E junction */ - double HICUMvbcMax; /* maximum voltage over B-C junction */ - double HICUMvceMax; /* maximum voltage over C-E branch */ - -//Model internal switches - int HICUMselfheat; - int HICUMnqs; - -//Circuit simulator specific parameters - unsigned HICUMtypeGiven : 1; - unsigned HICUMtnomGiven : 1; - - unsigned HICUMversionGiven :1; - -//Transfer current - unsigned HICUMc10Given : 1; - unsigned HICUMqp0Given : 1; - unsigned HICUMichGiven : 1; - unsigned HICUMhf0Given : 1; - unsigned HICUMhfeGiven : 1; - unsigned HICUMhfcGiven : 1; - unsigned HICUMhjeiGiven : 1; - unsigned HICUMahjeiGiven : 1; - unsigned HICUMrhjeiGiven : 1; - unsigned HICUMhjciGiven : 1; - -//Base-Emitter diodeGiven : 1; - unsigned HICUMibeisGiven : 1; - unsigned HICUMmbeiGiven : 1; - unsigned HICUMireisGiven : 1; - unsigned HICUMmreiGiven : 1; - unsigned HICUMibepsGiven : 1; - unsigned HICUMmbepGiven : 1; - unsigned HICUMirepsGiven : 1; - unsigned HICUMmrepGiven : 1; - unsigned HICUMmcfGiven : 1; - -//Transit time for excess recombination current at b-c barrier - unsigned HICUMtbhrecGiven : 1; - -//Base-Collector diode currents - unsigned HICUMibcisGiven : 1; - unsigned HICUMmbciGiven : 1; - unsigned HICUMibcxsGiven : 1; - unsigned HICUMmbcxGiven : 1; - -//Base-Emitter tunneling current - unsigned HICUMibetsGiven : 1; - unsigned HICUMabetGiven : 1; - unsigned HICUMtunodeGiven : 1; - -//Base-Collector avalanche current - unsigned HICUMfavlGiven : 1; - unsigned HICUMqavlGiven : 1; - unsigned HICUMkavlGiven : 1; - unsigned HICUMalfavGiven : 1; - unsigned HICUMalqavGiven : 1; - unsigned HICUMalkavGiven : 1; - -//Series resistances - unsigned HICUMrbi0Given : 1; - unsigned HICUMrbxGiven : 1; - unsigned HICUMfgeoGiven : 1; - unsigned HICUMfdqr0Given : 1; - unsigned HICUMfcrbiGiven : 1; - unsigned HICUMfqiGiven : 1; - unsigned HICUMreGiven : 1; - unsigned HICUMrcxGiven : 1; - -//Substrate transistor - unsigned HICUMitssGiven : 1; - unsigned HICUMmsfGiven : 1; - unsigned HICUMiscsGiven : 1; - unsigned HICUMmscGiven : 1; - unsigned HICUMtsfGiven : 1; - -//Intra-device substrate coupling - unsigned HICUMrsuGiven : 1; - unsigned HICUMcsuGiven : 1; - -//Depletion Capacitances - unsigned HICUMcjei0Given : 1; - unsigned HICUMvdeiGiven : 1; - unsigned HICUMzeiGiven : 1; - unsigned HICUMajeiGiven : 1; - unsigned HICUMcjep0Given : 1; - unsigned HICUMvdepGiven : 1; - unsigned HICUMzepGiven : 1; - unsigned HICUMajepGiven : 1; - unsigned HICUMcjci0Given : 1; - unsigned HICUMvdciGiven : 1; - unsigned HICUMzciGiven : 1; - unsigned HICUMvptciGiven : 1; - unsigned HICUMcjcx0Given : 1; - unsigned HICUMvdcxGiven : 1; - unsigned HICUMzcxGiven : 1; - unsigned HICUMvptcxGiven : 1; - unsigned HICUMfbcparGiven : 1; - unsigned HICUMfbeparGiven : 1; - unsigned HICUMcjs0Given : 1; - unsigned HICUMvdsGiven : 1; - unsigned HICUMzsGiven : 1; - unsigned HICUMvptsGiven : 1; - unsigned HICUMcscp0Given : 1; - unsigned HICUMvdspGiven : 1; - unsigned HICUMzspGiven : 1; - unsigned HICUMvptspGiven : 1; - -//Diffusion Capacitances - unsigned HICUMt0Given : 1; - unsigned HICUMdt0hGiven : 1; - unsigned HICUMtbvlGiven : 1; - unsigned HICUMtef0Given : 1; - unsigned HICUMgtfeGiven : 1; - unsigned HICUMthcsGiven : 1; - unsigned HICUMahcGiven : 1; - unsigned HICUMfthcGiven : 1; - unsigned HICUMrci0Given : 1; - unsigned HICUMvlimGiven : 1; - unsigned HICUMvcesGiven : 1; - unsigned HICUMvptGiven : 1; - unsigned HICUMaickGiven : 1; - unsigned HICUMdelckGiven : 1; - unsigned HICUMtrGiven : 1; - unsigned HICUMvcbarGiven : 1; - unsigned HICUMicbarGiven : 1; - unsigned HICUMacbarGiven : 1; - -//Isolation Capacitances - unsigned HICUMcbeparGiven : 1; - unsigned HICUMcbcparGiven : 1; - -//Non-quasi-static Effect - unsigned HICUMalqfGiven : 1; - unsigned HICUMalitGiven : 1; - unsigned HICUMflnqsGiven : 1; - -//Noise - unsigned HICUMkfGiven : 1; - unsigned HICUMafGiven : 1; - unsigned HICUMcfbeGiven : 1; - unsigned HICUMflconoGiven : 1; - unsigned HICUMkfreGiven : 1; - unsigned HICUMafreGiven : 1; - -//Lateral Geometry Scaling (at high current densities) - unsigned HICUMlatbGiven : 1; - unsigned HICUMlatlGiven : 1; - -//Temperature dependence - unsigned HICUMvgbGiven : 1; - unsigned HICUMalt0Given : 1; - unsigned HICUMkt0Given : 1; - unsigned HICUMzetaciGiven : 1; - unsigned HICUMalvsGiven : 1; - unsigned HICUMalcesGiven : 1; - unsigned HICUMzetarbiGiven : 1; - unsigned HICUMzetarbxGiven : 1; - unsigned HICUMzetarcxGiven : 1; - unsigned HICUMzetareGiven : 1; - unsigned HICUMzetacxGiven : 1; - unsigned HICUMvgeGiven : 1; - unsigned HICUMvgcGiven : 1; - unsigned HICUMvgsGiven : 1; - unsigned HICUMf1vgGiven : 1; - unsigned HICUMf2vgGiven : 1; - unsigned HICUMzetactGiven : 1; - unsigned HICUMzetabetGiven : 1; - unsigned HICUMalbGiven : 1; - unsigned HICUMdvgbeGiven : 1; - unsigned HICUMzetahjeiGiven : 1; - unsigned HICUMzetavgbeGiven : 1; - -//Self-Heating - unsigned HICUMflshGiven : 1; - unsigned HICUMrth_deGiven : 1; - unsigned HICUMrthGiven : 1; - unsigned HICUMzetarthGiven : 1; - unsigned HICUMalrthGiven : 1; - unsigned HICUMcthGiven : 1; - -//Compatibility with V2.1 - unsigned HICUMflcompGiven : 1; - - unsigned HICUMvbeMaxGiven : 1; - unsigned HICUMvbcMaxGiven : 1; - unsigned HICUMvceMaxGiven : 1; -} HICUMmodel; - -#ifndef NPN -#define NPN 1 -#define PNP -1 -#endif /*NPN*/ - -/* device parameters */ -enum { - HICUM_AREA = 1, - HICUM_OFF, - HICUM_IC, - HICUM_TEMP, - HICUM_DTEMP, - HICUM_M, -}; - -/* model parameters */ -enum { -//Circuit simulator specific parameters - HICUM_MOD_NPN = 101, - HICUM_MOD_PNP, - HICUM_MOD_TNOM, - - HICUM_MOD_VERSION, - -//Transfer current - HICUM_MOD_C10, - HICUM_MOD_QP0, - HICUM_MOD_ICH, - HICUM_MOD_HF0, - HICUM_MOD_HFE, - HICUM_MOD_HFC, - HICUM_MOD_HJEI, - HICUM_MOD_AHJEI, - HICUM_MOD_RHJEI, - HICUM_MOD_HJCI, - -//Base-Emitter diode, - HICUM_MOD_IBEIS, - HICUM_MOD_MBEI, - HICUM_MOD_IREIS, - HICUM_MOD_MREI, - HICUM_MOD_IBEPS, - HICUM_MOD_MBEP, - HICUM_MOD_IREPS, - HICUM_MOD_MREP, - HICUM_MOD_MCF, - -//Transit time for excess recombination current at b-c barrier - HICUM_MOD_TBHREC, - -//Base-Collector diode currents - HICUM_MOD_IBCIS, - HICUM_MOD_MBCI, - HICUM_MOD_IBCXS, - HICUM_MOD_MBCX, - -//Base-Emitter tunneling current - HICUM_MOD_IBETS, - HICUM_MOD_ABET, - HICUM_MOD_TUNODE, - -//Base-Collector avalanche current - HICUM_MOD_FAVL, - HICUM_MOD_QAVL, - HICUM_MOD_KAVL, - HICUM_MOD_ALFAV, - HICUM_MOD_ALQAV, - HICUM_MOD_ALKAV, - -//Series resistances - HICUM_MOD_RBI0, - HICUM_MOD_RBX, - HICUM_MOD_FGEO, - HICUM_MOD_FDQR0, - HICUM_MOD_FCRBI, - HICUM_MOD_FQI, - HICUM_MOD_RE, - HICUM_MOD_RCX, - -//Substrate transistor - HICUM_MOD_ITSS, - HICUM_MOD_MSF, - HICUM_MOD_ISCS, - HICUM_MOD_MSC, - HICUM_MOD_TSF, - -//Intra-device substrate coupling - HICUM_MOD_RSU, - HICUM_MOD_CSU, - -//Depletion Capacitances - HICUM_MOD_CJEI0, - HICUM_MOD_VDEI, - HICUM_MOD_ZEI, - HICUM_MOD_AJEI, - HICUM_MOD_CJEP0, - HICUM_MOD_VDEP, - HICUM_MOD_ZEP, - HICUM_MOD_AJEP, - HICUM_MOD_CJCI0, - HICUM_MOD_VDCI, - HICUM_MOD_ZCI, - HICUM_MOD_VPTCI, - HICUM_MOD_CJCX0, - HICUM_MOD_VDCX, - HICUM_MOD_ZCX, - HICUM_MOD_VPTCX, - HICUM_MOD_FBCPAR, - HICUM_MOD_FBEPAR, - HICUM_MOD_CJS0, - HICUM_MOD_VDS, - HICUM_MOD_ZS, - HICUM_MOD_VPTS, - HICUM_MOD_CSCP0, - HICUM_MOD_VDSP, - HICUM_MOD_ZSP, - HICUM_MOD_VPTSP, - -//Diffusion Capacitances - HICUM_MOD_T0, - HICUM_MOD_DT0H, - HICUM_MOD_TBVL, - HICUM_MOD_TEF0, - HICUM_MOD_GTFE, - HICUM_MOD_THCS, - HICUM_MOD_AHC, - HICUM_MOD_FTHC, - HICUM_MOD_RCI0, - HICUM_MOD_VLIM, - HICUM_MOD_VCES, - HICUM_MOD_VPT, - HICUM_MOD_AICK, - HICUM_MOD_DELCK, - HICUM_MOD_TR, - HICUM_MOD_VCBAR, - HICUM_MOD_ICBAR, - HICUM_MOD_ACBAR, - -//Isolation Capacitances - HICUM_MOD_CBEPAR, - HICUM_MOD_CBCPAR, - -//Non-quasi-static Effect - HICUM_MOD_ALQF, - HICUM_MOD_ALIT, - HICUM_MOD_FLNQS, - -//Noise - HICUM_MOD_KF, - HICUM_MOD_AF, - HICUM_MOD_CFBE, - HICUM_MOD_FLCONO, - - HICUM_MOD_KFRE, - HICUM_MOD_AFRE, - -//Lateral Geometry Scaling (at high current densities) - HICUM_MOD_LATB, - HICUM_MOD_LATL, - -//Temperature dependence - HICUM_MOD_VGB, - HICUM_MOD_ALT0, - HICUM_MOD_KT0, - HICUM_MOD_ZETACI, - HICUM_MOD_ALVS, - HICUM_MOD_ALCES, - HICUM_MOD_ZETARBI, - HICUM_MOD_ZETARBX, - HICUM_MOD_ZETARCX, - HICUM_MOD_ZETARE, - HICUM_MOD_ZETACX, - HICUM_MOD_VGE, - HICUM_MOD_VGC, - HICUM_MOD_VGS, - HICUM_MOD_F1VG, - HICUM_MOD_F2VG, - HICUM_MOD_ZETACT, - HICUM_MOD_ZETABET, - HICUM_MOD_ALB, - HICUM_MOD_DVGBE, - HICUM_MOD_ZETAHJEI, - HICUM_MOD_ZETAVGBE, - -//Self-Heating - HICUM_MOD_FLSH, - HICUM_MOD_RTH, - HICUM_MOD_ZETARTH, - HICUM_MOD_ALRTH, - HICUM_MOD_CTH, - -//Compatibility with V2.1 - HICUM_MOD_FLCOMP, - -//SOA check - HICUM_MOD_VBE_MAX, - HICUM_MOD_VBC_MAX, - HICUM_MOD_VCE_MAX, -}; - -/* device questions */ -enum { - HICUM_QUEST_COLLNODE = 251, - HICUM_QUEST_BASENODE, - HICUM_QUEST_EMITNODE, - HICUM_QUEST_SUBSNODE, - HICUM_QUEST_TEMPNODE, - HICUM_QUEST_COLLCINODE, - HICUM_QUEST_BASEBPNODE, - HICUM_QUEST_BASEBINODE, - HICUM_QUEST_EMITEINODE, - HICUM_QUEST_SUBSSINODE, - HICUM_QUEST_XFNODE, - HICUM_QUEST_XF1NODE, - HICUM_QUEST_XF2NODE, -/* temperature */ - HICUM_QUEST_TK, - HICUM_QUEST_DTSH, -/* voltages */ - HICUM_QUEST_VBE, - HICUM_QUEST_VBBP, - HICUM_QUEST_VBC, - HICUM_QUEST_VCE, - HICUM_QUEST_VSC, - HICUM_QUEST_VBIEI, - HICUM_QUEST_VBPBI, - HICUM_QUEST_VBICI, - HICUM_QUEST_VCIEI, -/* currents */ - HICUM_QUEST_CC, - HICUM_QUEST_CAVL, - HICUM_QUEST_CB, - HICUM_QUEST_CE, - HICUM_QUEST_CS, - HICUM_QUEST_CBEI, - HICUM_QUEST_CBCI, -/* resistances */ - HICUM_QUEST_RCX_T, - HICUM_QUEST_RE_T, - HICUM_QUEST_IT, - HICUM_QUEST_RBI, - HICUM_QUEST_RB, -/* transconductances and capacitances */ - HICUM_QUEST_BETADC, - HICUM_QUEST_GMI, - HICUM_QUEST_GMS, - HICUM_QUEST_RPII, - HICUM_QUEST_RPIX, - HICUM_QUEST_RMUI, - HICUM_QUEST_RMUX, - HICUM_QUEST_ROI, - HICUM_QUEST_CPII, - HICUM_QUEST_CPIX, - HICUM_QUEST_CMUI, - HICUM_QUEST_CMUX, - HICUM_QUEST_CCS, - HICUM_QUEST_BETAAC, - HICUM_QUEST_CRBI, -/* transit time */ - HICUM_QUEST_TF, - HICUM_QUEST_FT, - HICUM_QUEST_ICK, -/* power */ - HICUM_QUEST_POWER, -}; - -/* model questions */ -enum { - HICUM_MOD_COLLCONDUCT = 301, - HICUM_MOD_BASECONDUCT, - HICUM_MOD_EMITTERCONDUCT, - HICUM_MOD_SUBSTRATECONDUCT, - HICUM_MOD_TYPE, -}; - -#include "hicum2ext.h" -#endif /*HICUM*/ +/********** +License : 3-clause BSD +Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher +Model Author : (Copyright 1993-2024) Michael Schroter +**********/ + +#ifndef HICUM +#define HICUM + +#include "ngspice/cktdefs.h" +#include "ngspice/ifsim.h" +#include "ngspice/gendefs.h" +#include "ngspice/complex.h" +#include "ngspice/noisedef.h" + +/* structures to describe Bipolar Junction Transistors */ + +/* indices to array of HICUM noise sources */ + +enum { + HICUMRCNOIZ = 0, + HICUMRBNOIZ, + HICUMRBINOIZ, + HICUMRENOIZ, + HICUMRSNOIZ, + HICUMIAVLNOIZ, + HICUMIBCINOIZ, + HICUMIBEPNOIZ, + HICUMIBCXNOIZ, + HICUMIJSCNOIZ, + HICUMITNOIZ, + HICUMIBEINOIZ, + HICUMFLBENOIZ, + HICUMFLRENOIZ, + HICUMTOTNOIZ, + /* finally, the number of noise sources */ + HICUMNSRCS +}; + +typedef struct sDualDouble { + double rpart; + double dpart; +} dual_double; + +/* data needed to describe a single instance */ + +typedef struct sHICUMinstance { + + struct GENinstance gen; + +#define HICUMmodPtr(inst) ((struct sHICUMmodel *)((inst)->gen.GENmodPtr)) +#define HICUMnextInstance(inst) ((struct sHICUMinstance *)((inst)->gen.GENnextInstance)) +#define HICUMname gen.GENname +#define HICUMstate gen.GENstate + + const int HICUMcollNode; /* number of collector node of hicum */ + const int HICUMbaseNode; /* number of base node of hicum */ + const int HICUMemitNode; /* number of emitter node of hicum */ + const int HICUMsubsNode; /* number of substrate node of hicum */ + int HICUMtempNode; /* number of the temperature node of the hicum */ + int HICUMcollCINode; /* number of internal collector node of hicum */ + int HICUMbaseBINode; /* number of internal base node of hicum */ + int HICUMemitEINode; /* number of internal emitter node of hicum */ + int HICUMbaseBPNode; /* number of internal base node of hicum */ + int HICUMsubsSINode; /* number of internal substrate node */ + int HICUMxfNode; /* number of internal excess phase node qdei */ + int HICUMxf1Node; /* number of internal excess phase 1 node itf */ + int HICUMxf2Node; /* number of internal excess phase 2 node itf */ + + double HICUMarea; /* area factor for the hicum */ + //initial conditions + double HICUMicVBE; /* initial condition inner B-E branch */ + double HICUMicVCE; /* initial condition inner C-E branch */ + double HICUMicVCS; /* initial condition inner C-S branch */ + + double HICUMtemp; /* instance temperature */ + double HICUMtemp_Vrth;/* derivative device temperature to temperature at thermal node */ + double HICUMdtemp; /* instance delta temperature */ + double HICUMdtemp_sh; /* instance delta temperature because of self-heating */ + double HICUMm; /* multiply factor for the hicum */ + + double HICUMvt0; + dual_double HICUMvt; + dual_double HICUMdT; + dual_double HICUMibeis_t; + dual_double HICUMireis_t; + dual_double HICUMibeps_t; + dual_double HICUMireps_t; + dual_double HICUMibcis_t; + dual_double HICUMibcxs_t; + dual_double HICUMitss_t; + dual_double HICUMiscs_t; + dual_double HICUMqp0_t; + dual_double HICUMvlim_t; + dual_double HICUMtef0_t; + dual_double HICUMc10_t; + dual_double HICUMrci0_t; + dual_double HICUMvces_t; + dual_double HICUMt0_t; + dual_double HICUMthcs_t; + dual_double HICUMfavl_t; + dual_double HICUMqavl_t; + dual_double HICUMkavl_t; + dual_double HICUMrbi0_t; + dual_double HICUMibets_t; + dual_double HICUMabet_t; + dual_double HICUMcjcx01_t; + dual_double HICUMcjcx02_t; + dual_double HICUMrcx_t; + dual_double HICUMrbx_t; + dual_double HICUMre_t; + dual_double HICUMtsf_t; + dual_double HICUMcscp0_t; + dual_double HICUMvdsp_t; + dual_double HICUMvptsp_t; + dual_double HICUMahjei_t; + dual_double HICUMhjei0_t; + dual_double HICUMhf0_t; + dual_double HICUMhfc_t; + dual_double HICUMhfe_t; + dual_double HICUMrth_t; + + dual_double HICUMvdei_t; + dual_double HICUMajei_t; + dual_double HICUMcjci0_t; + dual_double HICUMvdci_t; + dual_double HICUMvptci_t; + dual_double HICUMvdep_t; + dual_double HICUMajep_t; + dual_double HICUMcjep0_t; + dual_double HICUMcjei0_t; + dual_double HICUMvdcx_t; + dual_double HICUMvptcx_t; + dual_double HICUMcjs0_t; + dual_double HICUMvds_t; + dual_double HICUMvpts_t; + + //model variables that depend on "area" and "m" and are needed in temp + double HICUMqp0_scaled; + double HICUMc10_scaled; + double HICUMicbar_scaled; + double HICUMrth_scaled; + double HICUMcth_scaled; + double HICUMcjei0_scaled; + double HICUMibeis_scaled; + double HICUMireis_scaled; + double HICUMibeps_scaled; + double HICUMireps_scaled; + double HICUMcjep0_scaled; + double HICUMcbepar_scaled; + double HICUMibets_scaled; + double HICUMibcis_scaled; + double HICUMcjci0_scaled; + double HICUMcjcx0_scaled; + double HICUMcbcpar_scaled; + double HICUMibcxs_scaled; + double HICUMqavl_scaled; + double HICUMre_scaled; + double HICUMrci0_scaled; + double HICUMrbx_scaled; + double HICUMrcx_scaled; + double HICUMrbi0_scaled; + double HICUMkf_scaled; + double HICUMkfre_scaled; + + double HICUMrbi; + double HICUMiavl; + double HICUMpterm; + + double HICUMtf; + double HICUMick; + + double *HICUMcollCollPtr; /* pointer to sparse matrix at + * (collector,collector) */ + double *HICUMbaseBasePtr; /* pointer to sparse matrix at + * (base,base) */ + double *HICUMemitEmitPtr; /* pointer to sparse matrix at + * (emitter,emitter) */ + double *HICUMsubsSubsPtr; /* pointer to sparse matrix at + * (substrate,substrate) */ + double *HICUMcollCICollCIPtr; /* pointer to sparse matrix at + * (collector prime,collector prime) */ + double *HICUMbaseBIBaseBIPtr; /* pointer to sparse matrix at + * (collector prime,collector prime) */ + double *HICUMbaseBPBaseBPPtr; /* pointer to sparse matrix at + * (collector prime,collector prime) */ + double *HICUMemitEIEmitEIPtr; /* pointer to sparse matrix at + * (emitter prime,emitter prime) */ + double *HICUMemitEIXfPtr; /* pointer to sparse matrix at + * (emitter prime,xf) */ + double *HICUMbaseBIXfPtr; /* pointer to sparse matrix at + * (base prime,xf) */ + + + double *HICUMsubsSISubsSIPtr; /* pointer to sparse matrix at + * (substrate prime, substrate prime) */ + + double *HICUMbaseEmitPtr; /* pointer to sparse matrix at + * (base,emit) */ + double *HICUMemitBasePtr; /* pointer to sparse matrix at + * (emit,base) */ + double *HICUMcollCollCIPtr; /* pointer to sparse matrix at + * (collector,collector prime) */ + double *HICUMbaseBaseBPPtr; /* pointer to sparse matrix at + * (base,base prime) */ + double *HICUMemitEmitEIPtr; /* pointer to sparse matrix at + * (emitter,emitter prime) */ + double *HICUMsubsSubsSIPtr; /* pointer to sparse matrix at + * (substrate, Substrate connection) */ + double *HICUMcollCIBaseBIPtr; /* pointer to sparse matrix at + * (collector prime,base) */ + double *HICUMcollCIEmitEIPtr; /* pointer to sparse matrix at + * (collector prime,emitter prime) */ + double *HICUMbaseBPBaseBIPtr; /* pointer to sparse matrix at + * (base prime,emitter prime) */ + double *HICUMbaseBPEmitEIPtr; /* pointer to sparse matrix at + * (base prime,emitter prime) */ + double *HICUMbaseBPSubsSIPtr; /* pointer to sparse matrix at + * (base prime,emitter prime) */ + double *HICUMbaseBIEmitEIPtr; /* pointer to sparse matrix at + * (base prime,emitter prime) */ + + double *HICUMcollCICollPtr; /* pointer to sparse matrix at + * (collector prime,collector) */ + double *HICUMbaseBPBasePtr; /* pointer to sparse matrix at + * (base prime,base ) */ + double *HICUMemitEIEmitPtr; /* pointer to sparse matrix at + * (emitter prime,emitter) */ + double *HICUMsubsSISubsPtr; /* pointer to sparse matrix at + * (Substrate connection, substrate) */ + double *HICUMbaseBPCollCIPtr; /* pointer to sparse matrix at + * (base,collector prime) */ + double *HICUMcollCIBaseBPPtr; /* pointer to sparse matrix at + * (collector prime,base) */ + + double *HICUMbaseBICollCIPtr; /* pointer to sparse matrix at + * (base,collector prime) */ + double *HICUMemitEICollCIPtr; /* pointer to sparse matrix at + * (emitter prime,collector prime) */ + double *HICUMsubsSICollCIPtr; /* pointer to sparse matrix at + * (substrate,collector prime) */ + double *HICUMcollCISubsSIPtr; /* pointer to sparse matrix at + * (collector prime,substrate) */ + double *HICUMbaseBIBaseBPPtr; /* pointer to sparse matrix at + * (base prime,emitter prime) */ + double *HICUMemitEIBaseBPPtr; /* pointer to sparse matrix at + * (emitter prime,base prime) */ + double *HICUMsubsSIBaseBPPtr; /* pointer to sparse matrix at + * (substrate,base) */ + double *HICUMsubsSIBaseBIPtr; /* pointer to sparse matrix at + * (substrate,base) */ + double *HICUMemitEIBaseBIPtr; /* pointer to sparse matrix at + * (emitter prime,base prime) */ + double *HICUMsubsTempPtr; /* pointer to sparse matrix at + * (subs ,T) */ + + + double *HICUMcollCIBasePtr; + double *HICUMbaseCollCIPtr; + + double *HICUMbaseBPEmitPtr; + double *HICUMemitBaseBPPtr; + + double *HICUMsubsCollPtr; + double *HICUMcollSubsPtr; + + /* excess phase */ + double *HICUMxfXfPtr; + double *HICUMxfBaseBIPtr; + double *HICUMxfEmitEIPtr; + double *HICUMxfCollCIPtr; + double *HICUMxfTempPtr; + + double *HICUMxf1Xf1Ptr; + double *HICUMxf1TempPtr; + double *HICUMxf1BaseBIPtr; + double *HICUMxf1EmitEIPtr; + double *HICUMxf1CollCIPtr; + double *HICUMxf1Xf2Ptr; + + double *HICUMxf2Xf1Ptr; + double *HICUMxf2TempPtr; + double *HICUMxf2BaseBIPtr; + double *HICUMxf2EmitEIPtr; + double *HICUMxf2CollCIPtr; + double *HICUMxf2Xf2Ptr; + double *HICUMemitXf2Ptr; + double *HICUMemitEIXf2Ptr; + double *HICUMcollCIXf2Ptr; + + /* self heating */ + double *HICUMcollTempPtr; + double *HICUMbaseTempPtr; + double *HICUMemitTempPtr; + + double *HICUMcollCItempPtr; + double *HICUMbaseBItempPtr; + double *HICUMbaseBPtempPtr; + double *HICUMemitEItempPtr; + double *HICUMsubsSItempPtr; + + double *HICUMtempCollPtr; + double *HICUMtempBasePtr; + double *HICUMtempEmitPtr; + + double *HICUMtempCollCIPtr; + double *HICUMtempBaseBIPtr; + double *HICUMtempBaseBPPtr; + double *HICUMtempEmitEIPtr; + double *HICUMtempSubsSIPtr; + double *HICUMtempTempPtr; + + unsigned HICUMareaGiven :1; /* flag to indicate area was specified */ + unsigned HICUMoff :1; /* 'off' flag for hicum */ + unsigned HICUMicVBEGiven :1; /* flag to indicate VBE init. cond. given */ + unsigned HICUMicVCEGiven :1; /* flag to indicate VCE init. cond. given */ + unsigned HICUMicVCSGiven :1; /* flag to indicate VCS init. cond. given */ + unsigned HICUMtempGiven :1; /* temperature given for hicum instance*/ + unsigned HICUMdtempGiven :1; /* delta temperature given for hicum instance*/ + unsigned HICUMmGiven :1; /* flag to indicate multiplier was specified */ + + double HICUMcaprbi; + double HICUMcapdeix; + double HICUMcapjei; + double HICUMcapdci; + double HICUMcapjci; + double HICUMcapjep; + double HICUMcapjcx_t_i; + double HICUMcapjcx_t_ii; + double HICUMcapdsu; + double HICUMcapjs; + double HICUMcapscp; + double HICUMcapsu; + double HICUMcapcth; + + //Caps due to coupling between branches + double HICUMqrbi_Vbiei; + double HICUMqrbi_Vbici; + double HICUMqrbi_Vrth; + double HICUMqjei_Vrth; + double HICUMqjep_Vrth; + double HICUMqf_Vbici; + double HICUMqf_Vxf; + double HICUMqf_Vrth; + double HICUMqr_Vbiei; + double HICUMqr_Vrth; + double HICUMqjci_Vrth; + double HICUMqjcx0_i_Vrth; + double HICUMqjcx0_ii_Vrth; + double HICUMqdsu_Vrth; + double HICUMqdsu_Vsici; + double HICUMqjs_Vrth; + double HICUMqscp_Vrth; + double HICUMicth_dT; + + double HICUMcapxf; + + double HICUMtVcrit; + double HICUMbetadc; + +#ifndef NONOISE + double HICUMnVar[NSTATVARS][HICUMNSRCS]; +#else /*NONOISE*/ + double **HICUMnVar; +#endif /*NONOISE*/ +/* the above to avoid allocating memory when it is not needed */ + +#ifdef KLU + BindElement *HICUMbaseBaseBinding ; + BindElement *HICUMbaseBaseBPBinding ; + BindElement *HICUMbaseBIBaseBIBinding ; + BindElement *HICUMbaseBIBaseBPBinding ; + BindElement *HICUMbaseBICollCIBinding ; + BindElement *HICUMbaseBIEmitEIBinding ; + BindElement *HICUMbaseBItempBinding ; + BindElement *HICUMbaseBIXfBinding ; + BindElement *HICUMbaseBPBaseBIBinding ; + BindElement *HICUMbaseBPBaseBinding ; + BindElement *HICUMbaseBPBaseBPBinding ; + BindElement *HICUMbaseBPCollCIBinding ; + BindElement *HICUMbaseBPEmitBinding ; + BindElement *HICUMbaseBPEmitEIBinding ; + BindElement *HICUMbaseBPSubsSIBinding ; + BindElement *HICUMbaseBPtempBinding ; + BindElement *HICUMbaseCollCIBinding ; + BindElement *HICUMbaseEmitBinding ; + BindElement *HICUMbaseTempBinding ; + BindElement *HICUMcollCIBaseBIBinding ; + BindElement *HICUMcollCIBaseBinding ; + BindElement *HICUMcollCIBaseBPBinding ; + BindElement *HICUMcollCICollBinding ; + BindElement *HICUMcollCICollCIBinding ; + BindElement *HICUMcollCIEmitEIBinding ; + BindElement *HICUMcollCISubsSIBinding ; + BindElement *HICUMcollCItempBinding ; + BindElement *HICUMcollCIXf2Binding ; + BindElement *HICUMcollCollBinding ; + BindElement *HICUMcollCollCIBinding ; + BindElement *HICUMcollSubsBinding ; + BindElement *HICUMcollTempBinding ; + BindElement *HICUMemitBaseBinding ; + BindElement *HICUMemitBaseBPBinding ; + BindElement *HICUMemitEIBaseBIBinding ; + BindElement *HICUMemitEIBaseBPBinding ; + BindElement *HICUMemitEICollCIBinding ; + BindElement *HICUMemitEIEmitBinding ; + BindElement *HICUMemitEIEmitEIBinding ; + BindElement *HICUMemitEItempBinding ; + BindElement *HICUMemitEIXf2Binding ; + BindElement *HICUMemitEIXfBinding ; + BindElement *HICUMemitEmitBinding ; + BindElement *HICUMemitEmitEIBinding ; + BindElement *HICUMemitTempBinding ; + BindElement *HICUMsubsCollBinding ; + BindElement *HICUMsubsSIBaseBPBinding ; + BindElement *HICUMsubsSICollCIBinding ; + BindElement *HICUMsubsSISubsBinding ; + BindElement *HICUMsubsSISubsSIBinding ; + BindElement *HICUMsubsSItempBinding ; + BindElement *HICUMsubsSubsBinding ; + BindElement *HICUMsubsSubsSIBinding ; + BindElement *HICUMsubsTempBinding ; + BindElement *HICUMtempBaseBIBinding ; + BindElement *HICUMtempBaseBinding ; + BindElement *HICUMtempBaseBPBinding ; + BindElement *HICUMtempCollBinding ; + BindElement *HICUMtempCollCIBinding ; + BindElement *HICUMtempEmitBinding ; + BindElement *HICUMtempEmitEIBinding ; + BindElement *HICUMtempSubsSIBinding ; + BindElement *HICUMtempTempBinding ; + BindElement *HICUMxf1BaseBIBinding ; + BindElement *HICUMxf1CollCIBinding ; + BindElement *HICUMxf1EmitEIBinding ; + BindElement *HICUMxf1TempBinding ; + BindElement *HICUMxf1Xf1Binding ; + BindElement *HICUMxf1Xf2Binding ; + BindElement *HICUMxf2BaseBIBinding ; + BindElement *HICUMxf2CollCIBinding ; + BindElement *HICUMxf2EmitEIBinding ; + BindElement *HICUMxf2TempBinding ; + BindElement *HICUMxf2Xf1Binding ; + BindElement *HICUMxf2Xf2Binding ; + BindElement *HICUMxfBaseBIBinding ; + BindElement *HICUMxfCollCIBinding ; + BindElement *HICUMxfEmitEIBinding ; + BindElement *HICUMxfTempBinding ; + BindElement *HICUMxfXfBinding ; +#endif + +} HICUMinstance; + +/* entries in the state vector for hicum: */ + +#define HICUMvbiei HICUMstate +#define HICUMvbici HICUMstate+1 +#define HICUMvbpei HICUMstate+2 +#define HICUMvbpbi HICUMstate+3 +#define HICUMvbpci HICUMstate+4 +#define HICUMvsici HICUMstate+5 +#define HICUMvcic HICUMstate+6 +#define HICUMvbbp HICUMstate+7 +#define HICUMveie HICUMstate+8 +#define HICUMvrth HICUMstate+9 +#define HICUMvxf HICUMstate+10 +#define HICUMvxf1 HICUMstate+11 +#define HICUMvxf2 HICUMstate+12 + +#define HICUMibiei HICUMstate+13 +#define HICUMibiei_Vbiei HICUMstate+14 +#define HICUMibiei_Vxf HICUMstate+15 +#define HICUMibiei_Vbici HICUMstate+16 +#define HICUMibiei_Vrth HICUMstate+17 + +#define HICUMibpei HICUMstate+18 +#define HICUMibpei_Vbpei HICUMstate+19 +#define HICUMibpei_Vrth HICUMstate+20 + +#define HICUMiciei HICUMstate+21 +#define HICUMiciei_Vbiei HICUMstate+22 +#define HICUMiciei_Vbici HICUMstate+23 +#define HICUMiciei_Vxf2 HICUMstate+24 +#define HICUMiciei_Vrth HICUMstate+25 + +#define HICUMibici HICUMstate+26 +#define HICUMibici_Vbici HICUMstate+27 +#define HICUMibici_Vbiei HICUMstate+28 +#define HICUMibici_Vrth HICUMstate+29 + +#define HICUMibpbi HICUMstate+30 +#define HICUMibpbi_Vbpbi HICUMstate+31 +#define HICUMibpbi_Vbiei HICUMstate+32 +#define HICUMibpbi_Vbici HICUMstate+33 +#define HICUMibpbi_Vrth HICUMstate+34 + +#define HICUMibpci HICUMstate+35 +#define HICUMibpci_Vbpci HICUMstate+36 +#define HICUMibpci_Vrth HICUMstate+37 + +#define HICUMisici HICUMstate+38 +#define HICUMisici_Vsici HICUMstate+39 +#define HICUMisici_Vrth HICUMstate+40 + +#define HICUMibpsi HICUMstate+41 +#define HICUMibpsi_Vbpci HICUMstate+42 +#define HICUMibpsi_Vsici HICUMstate+43 +#define HICUMibpsi_Vrth HICUMstate+44 + +#define HICUMisis_Vsis HICUMstate+45 + +#define HICUMieie HICUMstate+46 // needed for re-flicker noise +#define HICUMieie_Vrth HICUMstate+47 + +#define HICUMqrbi HICUMstate+48 +#define HICUMcqrbi HICUMstate+49 + +#define HICUMqjei HICUMstate+50 +#define HICUMcqjei HICUMstate+51 + +#define HICUMqf HICUMstate+52 +#define HICUMcqf HICUMstate+53 + +#define HICUMqr HICUMstate+54 +#define HICUMcqr HICUMstate+55 + +#define HICUMqjci HICUMstate+56 +#define HICUMcqjci HICUMstate+57 + +#define HICUMqjep HICUMstate+58 +#define HICUMcqjep HICUMstate+59 + +#define HICUMqjcx0_i HICUMstate+60 +#define HICUMcqcx0_t_i HICUMstate+61 + +#define HICUMqjcx0_ii HICUMstate+62 +#define HICUMcqcx0_t_ii HICUMstate+63 + +#define HICUMqdsu HICUMstate+64 +#define HICUMcqdsu HICUMstate+65 + +#define HICUMqjs HICUMstate+66 +#define HICUMcqjs HICUMstate+67 + +#define HICUMqscp HICUMstate+68 +#define HICUMcqscp HICUMstate+69 + +#define HICUMqbepar1 HICUMstate+70 +#define HICUMcqbepar1 HICUMstate+71 +#define HICUMgqbepar1 HICUMstate+72 + +#define HICUMqbepar2 HICUMstate+73 +#define HICUMcqbepar2 HICUMstate+74 +#define HICUMgqbepar2 HICUMstate+75 + +#define HICUMqbcpar1 HICUMstate+76 +#define HICUMcqbcpar1 HICUMstate+77 +#define HICUMgqbcpar1 HICUMstate+78 + +#define HICUMqbcpar2 HICUMstate+79 +#define HICUMcqbcpar2 HICUMstate+80 +#define HICUMgqbcpar2 HICUMstate+81 + +#define HICUMqsu HICUMstate+82 +#define HICUMcqsu HICUMstate+83 +#define HICUMgqsu HICUMstate+84 + +#define HICUMqcth HICUMstate+85 +#define HICUMcqcth HICUMstate+86 + +#define HICUMqxf HICUMstate+87 +#define HICUMcqxf HICUMstate+88 +#define HICUMgqxf HICUMstate+89 +#define HICUMixf HICUMstate+90 +#define HICUMixf_Vbiei HICUMstate+91 +#define HICUMixf_Vbici HICUMstate+92 +#define HICUMixf_Vxf HICUMstate+93 +#define HICUMixf_Vrth HICUMstate+94 + +#define HICUMqxf1 HICUMstate+95 +#define HICUMcqxf1 HICUMstate+96 +#define HICUMgqxf1 HICUMstate+97 +#define HICUMixf1 HICUMstate+98 +#define HICUMixf1_Vbiei HICUMstate+99 +#define HICUMixf1_Vbici HICUMstate+100 +#define HICUMixf1_Vxf2 HICUMstate+101 +#define HICUMixf1_Vxf1 HICUMstate+102 +#define HICUMixf1_Vrth HICUMstate+103 + +#define HICUMqxf2 HICUMstate+104 +#define HICUMcqxf2 HICUMstate+105 +#define HICUMgqxf2 HICUMstate+106 +#define HICUMixf2 HICUMstate+107 +#define HICUMixf2_Vbiei HICUMstate+108 +#define HICUMixf2_Vbici HICUMstate+109 +#define HICUMixf2_Vxf1 HICUMstate+110 +#define HICUMixf2_Vxf2 HICUMstate+111 +#define HICUMixf2_Vrth HICUMstate+112 + +#define HICUMith HICUMstate+113 +#define HICUMith_Vrth HICUMstate+114 +#define HICUMith_Vbiei HICUMstate+115 +#define HICUMith_Vbici HICUMstate+116 +#define HICUMith_Vbpbi HICUMstate+117 +#define HICUMith_Vbpci HICUMstate+118 +#define HICUMith_Vbpei HICUMstate+119 +#define HICUMith_Vciei HICUMstate+120 +#define HICUMith_Vsici HICUMstate+121 +#define HICUMith_Vcic HICUMstate+122 +#define HICUMith_Vbbp HICUMstate+123 +#define HICUMith_Veie HICUMstate+124 + +#define HICUMit HICUMstate+125 //for noise + +#define HICUMnumStates 126 + +/* per model data */ +typedef struct sHICUMmodel { /* model structure for a hicum */ + + struct GENmodel gen; + +#define HICUMmodType gen.GENmodType +#define HICUMnextModel(inst) ((struct sHICUMmodel *)((inst)->gen.GENnextModel)) +#define HICUMinstances(inst) ((HICUMinstance *)((inst)->gen.GENinstances)) +#define HICUMmodName gen.GENmodName + +//Circuit simulator specific parameters + int HICUMtype; + double HICUMtnom; + + char *HICUMversion; + +//Transfer current + double HICUMc10; + double HICUMqp0; + double HICUMich; + double HICUMhf0; + double HICUMhfe; + double HICUMhfc; + double HICUMhjei; + double HICUMahjei; + double HICUMrhjei; + double HICUMhjci; + +//Base-Emitter diode; + double HICUMibeis; + double HICUMmbei; + double HICUMireis; + double HICUMmrei; + double HICUMibeps; + double HICUMmbep; + double HICUMireps; + double HICUMmrep; + double HICUMmcf; + +//Transit time for excess recombination current at b-c barrier + double HICUMtbhrec; + +//Base-Collector diode currents + double HICUMibcis; + double HICUMmbci; + double HICUMibcxs; + double HICUMmbcx; + +//Base-Emitter tunneling current + double HICUMibets; + double HICUMabet; + int HICUMtunode; + +//Base-Collector avalanche current + double HICUMfavl; + double HICUMqavl; + double HICUMkavl; + double HICUMalfav; + double HICUMalqav; + double HICUMalkav; + +//Series resistances + double HICUMrbi0; + double HICUMrbx; + double HICUMfgeo; + double HICUMfdqr0; + double HICUMfcrbi; + double HICUMfqi; + double HICUMre; + double HICUMrcx; + +//Substrate transistor + double HICUMitss; + double HICUMmsf; + double HICUMiscs; + double HICUMmsc; + double HICUMtsf; + +//Intra-device substrate coupling + double HICUMrsu; + double HICUMcsu; + +//Depletion Capacitances + double HICUMcjei0; + double HICUMvdei; + double HICUMzei; + double HICUMajei; + double HICUMcjep0; + double HICUMvdep; + double HICUMzep; + double HICUMajep; + double HICUMcjci0; + double HICUMvdci; + double HICUMzci; + double HICUMvptci; + double HICUMcjcx0; + double HICUMvdcx; + double HICUMzcx; + double HICUMvptcx; + double HICUMfbcpar; + double HICUMfbepar; + double HICUMcjs0; + double HICUMvds; + double HICUMzs; + double HICUMvpts; + double HICUMcscp0; + double HICUMvdsp; + double HICUMzsp; + double HICUMvptsp; + +//Diffusion Capacitances + double HICUMt0; + double HICUMdt0h; + double HICUMtbvl; + double HICUMtef0; + double HICUMgtfe; + double HICUMthcs; + double HICUMahc; + double HICUMfthc; + double HICUMrci0; + double HICUMvlim; + double HICUMvces; + double HICUMvpt; + double HICUMaick; + double HICUMdelck; + double HICUMtr; + double HICUMvcbar; + double HICUMicbar; + double HICUMacbar; + +//Isolation Capacitances + double HICUMcbepar; + double HICUMcbcpar; + +//Non-quasi-static Effect + double HICUMalqf; + double HICUMalit; + int HICUMflnqs; + +//Noise + double HICUMkf; + double HICUMaf; + int HICUMcfbe; + int HICUMflcono; + double HICUMkfre; + double HICUMafre; + +//Lateral Geometry Scaling (at high current densities) + double HICUMlatb; + double HICUMlatl; + +//Temperature dependence + double HICUMvgb; + double HICUMalt0; + double HICUMkt0; + double HICUMzetaci; + double HICUMalvs; + double HICUMalces; + double HICUMzetarbi; + double HICUMzetarbx; + double HICUMzetarcx; + double HICUMzetare; + double HICUMzetacx; + double HICUMvge; + double HICUMvgc; + double HICUMvgs; + double HICUMf1vg; + double HICUMf2vg; + double HICUMzetact; + double HICUMzetabet; + double HICUMalb; + double HICUMdvgbe; + double HICUMzetahjei; + double HICUMzetavgbe; + +//Self-Heating + int HICUMflsh; + double HICUMrth; + double HICUMzetarth; + double HICUMalrth; + double HICUMcth; + +//Compatibility with V2.1 + double HICUMflcomp; + +//SOA check parameters + double HICUMvbeMax; /* maximum voltage over B-E junction */ + double HICUMvbcMax; /* maximum voltage over B-C junction */ + double HICUMvceMax; /* maximum voltage over C-E branch */ + +//Model internal switches + int HICUMselfheat; + int HICUMnqs; + +//Circuit simulator specific parameters + unsigned HICUMtypeGiven : 1; + unsigned HICUMtnomGiven : 1; + + unsigned HICUMversionGiven :1; + +//Transfer current + unsigned HICUMc10Given : 1; + unsigned HICUMqp0Given : 1; + unsigned HICUMichGiven : 1; + unsigned HICUMhf0Given : 1; + unsigned HICUMhfeGiven : 1; + unsigned HICUMhfcGiven : 1; + unsigned HICUMhjeiGiven : 1; + unsigned HICUMahjeiGiven : 1; + unsigned HICUMrhjeiGiven : 1; + unsigned HICUMhjciGiven : 1; + +//Base-Emitter diodeGiven : 1; + unsigned HICUMibeisGiven : 1; + unsigned HICUMmbeiGiven : 1; + unsigned HICUMireisGiven : 1; + unsigned HICUMmreiGiven : 1; + unsigned HICUMibepsGiven : 1; + unsigned HICUMmbepGiven : 1; + unsigned HICUMirepsGiven : 1; + unsigned HICUMmrepGiven : 1; + unsigned HICUMmcfGiven : 1; + +//Transit time for excess recombination current at b-c barrier + unsigned HICUMtbhrecGiven : 1; + +//Base-Collector diode currents + unsigned HICUMibcisGiven : 1; + unsigned HICUMmbciGiven : 1; + unsigned HICUMibcxsGiven : 1; + unsigned HICUMmbcxGiven : 1; + +//Base-Emitter tunneling current + unsigned HICUMibetsGiven : 1; + unsigned HICUMabetGiven : 1; + unsigned HICUMtunodeGiven : 1; + +//Base-Collector avalanche current + unsigned HICUMfavlGiven : 1; + unsigned HICUMqavlGiven : 1; + unsigned HICUMkavlGiven : 1; + unsigned HICUMalfavGiven : 1; + unsigned HICUMalqavGiven : 1; + unsigned HICUMalkavGiven : 1; + +//Series resistances + unsigned HICUMrbi0Given : 1; + unsigned HICUMrbxGiven : 1; + unsigned HICUMfgeoGiven : 1; + unsigned HICUMfdqr0Given : 1; + unsigned HICUMfcrbiGiven : 1; + unsigned HICUMfqiGiven : 1; + unsigned HICUMreGiven : 1; + unsigned HICUMrcxGiven : 1; + +//Substrate transistor + unsigned HICUMitssGiven : 1; + unsigned HICUMmsfGiven : 1; + unsigned HICUMiscsGiven : 1; + unsigned HICUMmscGiven : 1; + unsigned HICUMtsfGiven : 1; + +//Intra-device substrate coupling + unsigned HICUMrsuGiven : 1; + unsigned HICUMcsuGiven : 1; + +//Depletion Capacitances + unsigned HICUMcjei0Given : 1; + unsigned HICUMvdeiGiven : 1; + unsigned HICUMzeiGiven : 1; + unsigned HICUMajeiGiven : 1; + unsigned HICUMcjep0Given : 1; + unsigned HICUMvdepGiven : 1; + unsigned HICUMzepGiven : 1; + unsigned HICUMajepGiven : 1; + unsigned HICUMcjci0Given : 1; + unsigned HICUMvdciGiven : 1; + unsigned HICUMzciGiven : 1; + unsigned HICUMvptciGiven : 1; + unsigned HICUMcjcx0Given : 1; + unsigned HICUMvdcxGiven : 1; + unsigned HICUMzcxGiven : 1; + unsigned HICUMvptcxGiven : 1; + unsigned HICUMfbcparGiven : 1; + unsigned HICUMfbeparGiven : 1; + unsigned HICUMcjs0Given : 1; + unsigned HICUMvdsGiven : 1; + unsigned HICUMzsGiven : 1; + unsigned HICUMvptsGiven : 1; + unsigned HICUMcscp0Given : 1; + unsigned HICUMvdspGiven : 1; + unsigned HICUMzspGiven : 1; + unsigned HICUMvptspGiven : 1; + +//Diffusion Capacitances + unsigned HICUMt0Given : 1; + unsigned HICUMdt0hGiven : 1; + unsigned HICUMtbvlGiven : 1; + unsigned HICUMtef0Given : 1; + unsigned HICUMgtfeGiven : 1; + unsigned HICUMthcsGiven : 1; + unsigned HICUMahcGiven : 1; + unsigned HICUMfthcGiven : 1; + unsigned HICUMrci0Given : 1; + unsigned HICUMvlimGiven : 1; + unsigned HICUMvcesGiven : 1; + unsigned HICUMvptGiven : 1; + unsigned HICUMaickGiven : 1; + unsigned HICUMdelckGiven : 1; + unsigned HICUMtrGiven : 1; + unsigned HICUMvcbarGiven : 1; + unsigned HICUMicbarGiven : 1; + unsigned HICUMacbarGiven : 1; + +//Isolation Capacitances + unsigned HICUMcbeparGiven : 1; + unsigned HICUMcbcparGiven : 1; + +//Non-quasi-static Effect + unsigned HICUMalqfGiven : 1; + unsigned HICUMalitGiven : 1; + unsigned HICUMflnqsGiven : 1; + +//Noise + unsigned HICUMkfGiven : 1; + unsigned HICUMafGiven : 1; + unsigned HICUMcfbeGiven : 1; + unsigned HICUMflconoGiven : 1; + unsigned HICUMkfreGiven : 1; + unsigned HICUMafreGiven : 1; + +//Lateral Geometry Scaling (at high current densities) + unsigned HICUMlatbGiven : 1; + unsigned HICUMlatlGiven : 1; + +//Temperature dependence + unsigned HICUMvgbGiven : 1; + unsigned HICUMalt0Given : 1; + unsigned HICUMkt0Given : 1; + unsigned HICUMzetaciGiven : 1; + unsigned HICUMalvsGiven : 1; + unsigned HICUMalcesGiven : 1; + unsigned HICUMzetarbiGiven : 1; + unsigned HICUMzetarbxGiven : 1; + unsigned HICUMzetarcxGiven : 1; + unsigned HICUMzetareGiven : 1; + unsigned HICUMzetacxGiven : 1; + unsigned HICUMvgeGiven : 1; + unsigned HICUMvgcGiven : 1; + unsigned HICUMvgsGiven : 1; + unsigned HICUMf1vgGiven : 1; + unsigned HICUMf2vgGiven : 1; + unsigned HICUMzetactGiven : 1; + unsigned HICUMzetabetGiven : 1; + unsigned HICUMalbGiven : 1; + unsigned HICUMdvgbeGiven : 1; + unsigned HICUMzetahjeiGiven : 1; + unsigned HICUMzetavgbeGiven : 1; + +//Self-Heating + unsigned HICUMflshGiven : 1; + unsigned HICUMrth_deGiven : 1; + unsigned HICUMrthGiven : 1; + unsigned HICUMzetarthGiven : 1; + unsigned HICUMalrthGiven : 1; + unsigned HICUMcthGiven : 1; + +//Compatibility with V2.1 + unsigned HICUMflcompGiven : 1; + + unsigned HICUMvbeMaxGiven : 1; + unsigned HICUMvbcMaxGiven : 1; + unsigned HICUMvceMaxGiven : 1; +} HICUMmodel; + +#ifndef NPN +#define NPN 1 +#define PNP -1 +#endif /*NPN*/ + +/* device parameters */ +enum { + HICUM_AREA = 1, + HICUM_OFF, + HICUM_IC, + HICUM_TEMP, + HICUM_DTEMP, + HICUM_M, +}; + +/* model parameters */ +enum { +//Circuit simulator specific parameters + HICUM_MOD_NPN = 101, + HICUM_MOD_PNP, + HICUM_MOD_TNOM, + + HICUM_MOD_VERSION, + +//Transfer current + HICUM_MOD_C10, + HICUM_MOD_QP0, + HICUM_MOD_ICH, + HICUM_MOD_HF0, + HICUM_MOD_HFE, + HICUM_MOD_HFC, + HICUM_MOD_HJEI, + HICUM_MOD_AHJEI, + HICUM_MOD_RHJEI, + HICUM_MOD_HJCI, + +//Base-Emitter diode, + HICUM_MOD_IBEIS, + HICUM_MOD_MBEI, + HICUM_MOD_IREIS, + HICUM_MOD_MREI, + HICUM_MOD_IBEPS, + HICUM_MOD_MBEP, + HICUM_MOD_IREPS, + HICUM_MOD_MREP, + HICUM_MOD_MCF, + +//Transit time for excess recombination current at b-c barrier + HICUM_MOD_TBHREC, + +//Base-Collector diode currents + HICUM_MOD_IBCIS, + HICUM_MOD_MBCI, + HICUM_MOD_IBCXS, + HICUM_MOD_MBCX, + +//Base-Emitter tunneling current + HICUM_MOD_IBETS, + HICUM_MOD_ABET, + HICUM_MOD_TUNODE, + +//Base-Collector avalanche current + HICUM_MOD_FAVL, + HICUM_MOD_QAVL, + HICUM_MOD_KAVL, + HICUM_MOD_ALFAV, + HICUM_MOD_ALQAV, + HICUM_MOD_ALKAV, + +//Series resistances + HICUM_MOD_RBI0, + HICUM_MOD_RBX, + HICUM_MOD_FGEO, + HICUM_MOD_FDQR0, + HICUM_MOD_FCRBI, + HICUM_MOD_FQI, + HICUM_MOD_RE, + HICUM_MOD_RCX, + +//Substrate transistor + HICUM_MOD_ITSS, + HICUM_MOD_MSF, + HICUM_MOD_ISCS, + HICUM_MOD_MSC, + HICUM_MOD_TSF, + +//Intra-device substrate coupling + HICUM_MOD_RSU, + HICUM_MOD_CSU, + +//Depletion Capacitances + HICUM_MOD_CJEI0, + HICUM_MOD_VDEI, + HICUM_MOD_ZEI, + HICUM_MOD_AJEI, + HICUM_MOD_CJEP0, + HICUM_MOD_VDEP, + HICUM_MOD_ZEP, + HICUM_MOD_AJEP, + HICUM_MOD_CJCI0, + HICUM_MOD_VDCI, + HICUM_MOD_ZCI, + HICUM_MOD_VPTCI, + HICUM_MOD_CJCX0, + HICUM_MOD_VDCX, + HICUM_MOD_ZCX, + HICUM_MOD_VPTCX, + HICUM_MOD_FBCPAR, + HICUM_MOD_FBEPAR, + HICUM_MOD_CJS0, + HICUM_MOD_VDS, + HICUM_MOD_ZS, + HICUM_MOD_VPTS, + HICUM_MOD_CSCP0, + HICUM_MOD_VDSP, + HICUM_MOD_ZSP, + HICUM_MOD_VPTSP, + +//Diffusion Capacitances + HICUM_MOD_T0, + HICUM_MOD_DT0H, + HICUM_MOD_TBVL, + HICUM_MOD_TEF0, + HICUM_MOD_GTFE, + HICUM_MOD_THCS, + HICUM_MOD_AHC, + HICUM_MOD_FTHC, + HICUM_MOD_RCI0, + HICUM_MOD_VLIM, + HICUM_MOD_VCES, + HICUM_MOD_VPT, + HICUM_MOD_AICK, + HICUM_MOD_DELCK, + HICUM_MOD_TR, + HICUM_MOD_VCBAR, + HICUM_MOD_ICBAR, + HICUM_MOD_ACBAR, + +//Isolation Capacitances + HICUM_MOD_CBEPAR, + HICUM_MOD_CBCPAR, + +//Non-quasi-static Effect + HICUM_MOD_ALQF, + HICUM_MOD_ALIT, + HICUM_MOD_FLNQS, + +//Noise + HICUM_MOD_KF, + HICUM_MOD_AF, + HICUM_MOD_CFBE, + HICUM_MOD_FLCONO, + + HICUM_MOD_KFRE, + HICUM_MOD_AFRE, + +//Lateral Geometry Scaling (at high current densities) + HICUM_MOD_LATB, + HICUM_MOD_LATL, + +//Temperature dependence + HICUM_MOD_VGB, + HICUM_MOD_ALT0, + HICUM_MOD_KT0, + HICUM_MOD_ZETACI, + HICUM_MOD_ALVS, + HICUM_MOD_ALCES, + HICUM_MOD_ZETARBI, + HICUM_MOD_ZETARBX, + HICUM_MOD_ZETARCX, + HICUM_MOD_ZETARE, + HICUM_MOD_ZETACX, + HICUM_MOD_VGE, + HICUM_MOD_VGC, + HICUM_MOD_VGS, + HICUM_MOD_F1VG, + HICUM_MOD_F2VG, + HICUM_MOD_ZETACT, + HICUM_MOD_ZETABET, + HICUM_MOD_ALB, + HICUM_MOD_DVGBE, + HICUM_MOD_ZETAHJEI, + HICUM_MOD_ZETAVGBE, + +//Self-Heating + HICUM_MOD_FLSH, + HICUM_MOD_RTH, + HICUM_MOD_ZETARTH, + HICUM_MOD_ALRTH, + HICUM_MOD_CTH, + +//Compatibility with V2.1 + HICUM_MOD_FLCOMP, + +//SOA check + HICUM_MOD_VBE_MAX, + HICUM_MOD_VBC_MAX, + HICUM_MOD_VCE_MAX, +}; + +/* device questions */ +enum { + HICUM_QUEST_COLLNODE = 251, + HICUM_QUEST_BASENODE, + HICUM_QUEST_EMITNODE, + HICUM_QUEST_SUBSNODE, + HICUM_QUEST_TEMPNODE, + HICUM_QUEST_COLLCINODE, + HICUM_QUEST_BASEBPNODE, + HICUM_QUEST_BASEBINODE, + HICUM_QUEST_EMITEINODE, + HICUM_QUEST_SUBSSINODE, + HICUM_QUEST_XFNODE, + HICUM_QUEST_XF1NODE, + HICUM_QUEST_XF2NODE, +/* temperature */ + HICUM_QUEST_TK, + HICUM_QUEST_DTSH, +/* voltages */ + HICUM_QUEST_VBE, + HICUM_QUEST_VBBP, + HICUM_QUEST_VBC, + HICUM_QUEST_VCE, + HICUM_QUEST_VSC, + HICUM_QUEST_VBIEI, + HICUM_QUEST_VBPBI, + HICUM_QUEST_VBICI, + HICUM_QUEST_VCIEI, +/* currents */ + HICUM_QUEST_CC, + HICUM_QUEST_CAVL, + HICUM_QUEST_CB, + HICUM_QUEST_CE, + HICUM_QUEST_CS, + HICUM_QUEST_CBEI, + HICUM_QUEST_CBCI, +/* resistances */ + HICUM_QUEST_RCX_T, + HICUM_QUEST_RE_T, + HICUM_QUEST_IT, + HICUM_QUEST_RBI, + HICUM_QUEST_RB, +/* transconductances and capacitances */ + HICUM_QUEST_BETADC, + HICUM_QUEST_GMI, + HICUM_QUEST_GMS, + HICUM_QUEST_RPII, + HICUM_QUEST_RPIX, + HICUM_QUEST_RMUI, + HICUM_QUEST_RMUX, + HICUM_QUEST_ROI, + HICUM_QUEST_CPII, + HICUM_QUEST_CPIX, + HICUM_QUEST_CMUI, + HICUM_QUEST_CMUX, + HICUM_QUEST_CCS, + HICUM_QUEST_BETAAC, + HICUM_QUEST_CRBI, +/* transit time */ + HICUM_QUEST_TF, + HICUM_QUEST_FT, + HICUM_QUEST_ICK, +/* power */ + HICUM_QUEST_POWER, +}; + +/* model questions */ +enum { + HICUM_MOD_COLLCONDUCT = 301, + HICUM_MOD_BASECONDUCT, + HICUM_MOD_EMITTERCONDUCT, + HICUM_MOD_SUBSTRATECONDUCT, + HICUM_MOD_TYPE, +}; + +#include "hicum2ext.h" +#endif /*HICUM*/ diff --git a/src/spicelib/devices/hicum2/hicum2ext.h b/src/spicelib/devices/hicum2/hicum2ext.h index 928ecb7b8..c388d6c42 100644 --- a/src/spicelib/devices/hicum2/hicum2ext.h +++ b/src/spicelib/devices/hicum2/hicum2ext.h @@ -1,33 +1,33 @@ -/********** -License : 3-clause BSD -Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden -**********/ -#ifndef __HICUMEXT_H -#define __HICUMEXT_H - - -extern int HICUMacLoad(GENmodel *,CKTcircuit*); -extern int HICUMask(CKTcircuit *,GENinstance*,int,IFvalue*,IFvalue*); -extern int HICUMconvTest(GENmodel*,CKTcircuit*); -extern int HICUMmDelete(GENmodel*); -extern int HICUMgetic(GENmodel*,CKTcircuit*); -//extern int HICUMload(GENmodel*,CKTcircuit*);//moved to hicumL2.hpp -extern int HICUMmAsk(CKTcircuit*,GENmodel*,int,IFvalue*); -extern int HICUMmParam(int,IFvalue*,GENmodel*); -extern int HICUMparam(int,IFvalue*,GENinstance*,IFvalue*); -extern int HICUMpzLoad(GENmodel*, CKTcircuit*, SPcomplex*); -extern int HICUMsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*); -extern int HICUMunsetup(GENmodel*,CKTcircuit*); -// extern int HICUMtemp(GENmodel*,CKTcircuit*); // moved to hicum2temp.hpp -extern int HICUMtrunc(GENmodel*,CKTcircuit*,double*); -extern int HICUMnoise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); -extern int HICUMsoaCheck(CKTcircuit *, GENmodel *); - -#ifdef KLU -extern int HICUMbindCSC (GENmodel*, CKTcircuit*) ; -extern int HICUMbindCSCComplex (GENmodel*, CKTcircuit*) ; -extern int HICUMbindCSCComplexToReal (GENmodel*, CKTcircuit*) ; -#endif - -#endif +/********** +License : 3-clause BSD +Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher +Model Author : (Copyright 1993-2024) Michael Schroter +**********/ +#ifndef __HICUMEXT_H +#define __HICUMEXT_H + + +extern int HICUMacLoad(GENmodel *,CKTcircuit*); +extern int HICUMask(CKTcircuit *,GENinstance*,int,IFvalue*,IFvalue*); +extern int HICUMconvTest(GENmodel*,CKTcircuit*); +extern int HICUMmDelete(GENmodel*); +extern int HICUMgetic(GENmodel*,CKTcircuit*); +//extern int HICUMload(GENmodel*,CKTcircuit*);//moved to hicumL2.hpp +extern int HICUMmAsk(CKTcircuit*,GENmodel*,int,IFvalue*); +extern int HICUMmParam(int,IFvalue*,GENmodel*); +extern int HICUMparam(int,IFvalue*,GENinstance*,IFvalue*); +extern int HICUMpzLoad(GENmodel*, CKTcircuit*, SPcomplex*); +extern int HICUMsetup(SMPmatrix*,GENmodel*,CKTcircuit*,int*); +extern int HICUMunsetup(GENmodel*,CKTcircuit*); +// extern int HICUMtemp(GENmodel*,CKTcircuit*); // moved to hicum2temp.hpp +extern int HICUMtrunc(GENmodel*,CKTcircuit*,double*); +extern int HICUMnoise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*); +extern int HICUMsoaCheck(CKTcircuit *, GENmodel *); + +#ifdef KLU +extern int HICUMbindCSC (GENmodel*, CKTcircuit*) ; +extern int HICUMbindCSCComplex (GENmodel*, CKTcircuit*) ; +extern int HICUMbindCSCComplexToReal (GENmodel*, CKTcircuit*) ; +#endif + +#endif diff --git a/src/spicelib/devices/hicum2/hicum2getic.c b/src/spicelib/devices/hicum2/hicum2getic.c index ea36a6e62..0220c44b0 100644 --- a/src/spicelib/devices/hicum2/hicum2getic.c +++ b/src/spicelib/devices/hicum2/hicum2getic.c @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ /* diff --git a/src/spicelib/devices/hicum2/hicum2init.c b/src/spicelib/devices/hicum2/hicum2init.c index 1c90cfe92..5d3c6540a 100644 --- a/src/spicelib/devices/hicum2/hicum2init.c +++ b/src/spicelib/devices/hicum2/hicum2init.c @@ -1,91 +1,91 @@ -/********** -License : 3-clause BSD -Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden -**********/ - - -#include "ngspice/config.h" - -#include "ngspice/devdefs.h" - -#include "hicum2itf.h" -#include "hicum2ext.h" -#include "hicum2init.h" -#include "hicumL2.hpp" -#include "hicumL2temp.hpp" - - -SPICEdev HICUMinfo = { - .DEVpublic = { - .name = "hicum2", - .description = "High Current Model for BJT", - .terms = &HICUMnSize, - .numNames = &HICUMnSize, - .termNames = HICUMnames, - .numInstanceParms = &HICUMpTSize, - .instanceParms = HICUMpTable, - .numModelParms = &HICUMmPTSize, - .modelParms = HICUMmPTable, - .flags = DEV_DEFAULT, - -#ifdef XSPICE - .cm_func = NULL, - .num_conn = 0, - .conn = NULL, - .num_param = 0, - .param = NULL, - .num_inst_var = 0, - .inst_var = NULL, -#endif - }, - - .DEVparam = HICUMparam, - .DEVmodParam = HICUMmParam, - .DEVload = HICUMload, - .DEVsetup = HICUMsetup, - .DEVunsetup = HICUMunsetup, - .DEVpzSetup = HICUMsetup, - .DEVtemperature = HICUMtemp, - .DEVtrunc = HICUMtrunc, - .DEVfindBranch = NULL, - .DEVacLoad = HICUMacLoad, - .DEVaccept = NULL, - .DEVdestroy = NULL, - .DEVmodDelete = HICUMmDelete, - .DEVdelete = NULL, - .DEVsetic = HICUMgetic, - .DEVask = HICUMask, - .DEVmodAsk = HICUMmAsk, - .DEVpzLoad = HICUMpzLoad, - .DEVconvTest = HICUMconvTest, - .DEVsenSetup = NULL, - .DEVsenLoad = NULL, - .DEVsenUpdate = NULL, - .DEVsenAcLoad = NULL, - .DEVsenPrint = NULL, - .DEVsenTrunc = NULL, - .DEVdisto = NULL, - .DEVnoise = HICUMnoise, - .DEVsoaCheck = HICUMsoaCheck, - .DEVinstSize = &HICUMiSize, - .DEVmodSize = &HICUMmSize, - -#ifdef CIDER - .DEVdump = NULL, - .DEVacct = NULL, -#endif - -#ifdef KLU - .DEVbindCSC = HICUMbindCSC, - .DEVbindCSCComplex = HICUMbindCSCComplex, - .DEVbindCSCComplexToReal = HICUMbindCSCComplexToReal, -#endif -}; - - -SPICEdev * -get_hicum_info(void) -{ - return &HICUMinfo; -} +/********** +License : 3-clause BSD +Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher +Model Author : (Copyright 1993-2024) Michael Schroter +**********/ + + +#include "ngspice/config.h" + +#include "ngspice/devdefs.h" + +#include "hicum2itf.h" +#include "hicum2ext.h" +#include "hicum2init.h" +#include "hicumL2.hpp" +#include "hicumL2temp.hpp" + + +SPICEdev HICUMinfo = { + .DEVpublic = { + .name = "hicum2", + .description = "High Current Model for BJT", + .terms = &HICUMnSize, + .numNames = &HICUMnSize, + .termNames = HICUMnames, + .numInstanceParms = &HICUMpTSize, + .instanceParms = HICUMpTable, + .numModelParms = &HICUMmPTSize, + .modelParms = HICUMmPTable, + .flags = DEV_DEFAULT, + +#ifdef XSPICE + .cm_func = NULL, + .num_conn = 0, + .conn = NULL, + .num_param = 0, + .param = NULL, + .num_inst_var = 0, + .inst_var = NULL, +#endif + }, + + .DEVparam = HICUMparam, + .DEVmodParam = HICUMmParam, + .DEVload = HICUMload, + .DEVsetup = HICUMsetup, + .DEVunsetup = HICUMunsetup, + .DEVpzSetup = HICUMsetup, + .DEVtemperature = HICUMtemp, + .DEVtrunc = HICUMtrunc, + .DEVfindBranch = NULL, + .DEVacLoad = HICUMacLoad, + .DEVaccept = NULL, + .DEVdestroy = NULL, + .DEVmodDelete = HICUMmDelete, + .DEVdelete = NULL, + .DEVsetic = HICUMgetic, + .DEVask = HICUMask, + .DEVmodAsk = HICUMmAsk, + .DEVpzLoad = HICUMpzLoad, + .DEVconvTest = HICUMconvTest, + .DEVsenSetup = NULL, + .DEVsenLoad = NULL, + .DEVsenUpdate = NULL, + .DEVsenAcLoad = NULL, + .DEVsenPrint = NULL, + .DEVsenTrunc = NULL, + .DEVdisto = NULL, + .DEVnoise = HICUMnoise, + .DEVsoaCheck = HICUMsoaCheck, + .DEVinstSize = &HICUMiSize, + .DEVmodSize = &HICUMmSize, + +#ifdef CIDER + .DEVdump = NULL, + .DEVacct = NULL, +#endif + +#ifdef KLU + .DEVbindCSC = HICUMbindCSC, + .DEVbindCSCComplex = HICUMbindCSCComplex, + .DEVbindCSCComplexToReal = HICUMbindCSCComplexToReal, +#endif +}; + + +SPICEdev * +get_hicum_info(void) +{ + return &HICUMinfo; +} diff --git a/src/spicelib/devices/hicum2/hicum2init.h b/src/spicelib/devices/hicum2/hicum2init.h index a4e8b73e1..2c9fe4372 100644 --- a/src/spicelib/devices/hicum2/hicum2init.h +++ b/src/spicelib/devices/hicum2/hicum2init.h @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ diff --git a/src/spicelib/devices/hicum2/hicum2itf.h b/src/spicelib/devices/hicum2/hicum2itf.h index f351542a9..f3de53b35 100644 --- a/src/spicelib/devices/hicum2/hicum2itf.h +++ b/src/spicelib/devices/hicum2/hicum2itf.h @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ #ifndef DEV_HICUM #define DEV_HICUM diff --git a/src/spicelib/devices/hicum2/hicum2mask.c b/src/spicelib/devices/hicum2/hicum2mask.c index ba2f43e25..a8215ebee 100644 --- a/src/spicelib/devices/hicum2/hicum2mask.c +++ b/src/spicelib/devices/hicum2/hicum2mask.c @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ #include "ngspice/ngspice.h" diff --git a/src/spicelib/devices/hicum2/hicum2mpar.c b/src/spicelib/devices/hicum2/hicum2mpar.c index 2c436f3d2..a3b22b43d 100644 --- a/src/spicelib/devices/hicum2/hicum2mpar.c +++ b/src/spicelib/devices/hicum2/hicum2mpar.c @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ /* diff --git a/src/spicelib/devices/hicum2/hicum2noise.c b/src/spicelib/devices/hicum2/hicum2noise.c index d1532a561..053970edf 100644 --- a/src/spicelib/devices/hicum2/hicum2noise.c +++ b/src/spicelib/devices/hicum2/hicum2noise.c @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ #include "ngspice/ngspice.h" diff --git a/src/spicelib/devices/hicum2/hicum2param.c b/src/spicelib/devices/hicum2/hicum2param.c index 8191e511e..24f445be4 100644 --- a/src/spicelib/devices/hicum2/hicum2param.c +++ b/src/spicelib/devices/hicum2/hicum2param.c @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ /* diff --git a/src/spicelib/devices/hicum2/hicum2pzld.c b/src/spicelib/devices/hicum2/hicum2pzld.c index ca76a982c..d39558983 100644 --- a/src/spicelib/devices/hicum2/hicum2pzld.c +++ b/src/spicelib/devices/hicum2/hicum2pzld.c @@ -1,759 +1,759 @@ -/********** -License : 3-clause BSD -Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden -**********/ - - -/* - * Function to load the COMPLEX circuit matrix using the - * small signal parameters saved during a previous DC operating - * point analysis. - */ - -#include "ngspice/ngspice.h" -#include "ngspice/cktdefs.h" -#include "hicum2defs.h" -#include "ngspice/sperror.h" -#include "ngspice/suffix.h" - -int -HICUMpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) -{ - HICUMinstance *here; - HICUMmodel *model = (HICUMmodel*)inModel; - double Ibpei_Vbpei; - double Ibpei_Vrth; - - double Ibiei_Vbiei; - double Ibiei_Vxf; - double Ibiei_Vbici; - double Ibiei_Vrth; - - double Ibici_Vbici; - double Ibici_Vbiei; - double Ibici_Vrth; - - double Ibpci_Vbpci; - double Ibpci_Vrth; - - double Isici_Vsici; - double Isici_Vrth; - - double Iciei_Vbiei; - double Iciei_Vbici; - double Iciei_Vrth; - double Iciei_Vxf2; - - - double Ibpbi_Vbpbi; - double Ibpbi_Vbici; - double Ibpbi_Vbiei; - double Ibpbi_Vrth; - - double Isis_Vsis; - double Icic_Vcic, Icic_Vrth; - double Ieie_Veie, Ieie_Vrth; - double Ibbp_Vbbp, Ibbp_Vrth; - double Irth_Vrth; - - double Ibpsi_Vbpci; - double Ibpsi_Vsici; - double Ibpsi_Vrth; - - double XQrbi_Vbpbi; - double XQrbi_Vbiei; - double XQrbi_Vbici; - double XQrbi_Vrth; - double XQjei_Vbiei; - double XQjei_Vrth; - double XQjci_Vbici; - double XQjci_Vrth; - double XQjep_Vbpei; - double XQjep_Vrth; - double volatile Xqjcx0_t_i_Vbci; - double Xqjcx0_t_i_Vrth; - double volatile Xqjcx0_t_ii_Vbpci; - double Xqjcx0_t_ii_Vrth; - double XQdsu_Vbpci; - double XQdsu_Vsici; - double XQdsu_Vrth; - double XQjs_Vsici; - double XQjs_Vrth; - double XQscp_Vsc; - double XQscp_Vrth; - double XQbepar1_Vbe; - double XQbepar2_Vbpe; - double XQbcpar1_Vbci; - double XQbcpar2_Vbpci; - double XQsu_Vsis; - double XQcth_Vrth; - double XQf_Vbiei; - double XQf_Vbici; - double XQf_Vrth; - double XQf_Vxf; - double XQr_Vrth; - double XQr_Vbiei; - double XQr_Vbici; - - double XQxf_Vxf; - double XQxf1_Vxf1; - double XQxf2_Vxf2; - - double Ixf1_Vbiei; - double Ixf1_Vbici; - double Ixf1_Vxf2 ; - double Ixf1_Vxf1 ; - double Ixf1_Vrth ; - - double Ixf2_Vbiei; - double Ixf2_Vbici; - double Ixf2_Vxf2 ; - double Ixf2_Vxf1 ; - double Ixf2_Vrth ; - - double Ixf_Vbiei ; - double Ixf_Vbici ; - double Ixf_Vxf ; - double Ixf_Vrth ; - - double Ith_Vrth, Ith_Vbiei, Ith_Vbici, Ith_Vbpbi, Ith_Vbpci, Ith_Vbpei, Ith_Vciei, Ith_Vsici, Ith_Vcic, Ith_Vbbp, Ith_Veie; - - /* loop through all the models */ - for( ; model != NULL; model = HICUMnextModel(model)) { - - /* loop through all the instances of the model */ - for( here = HICUMinstances(model); here!= NULL; - here = HICUMnextInstance(here)) { - - - // get all derivatives of branch DC currents - if(model->HICUMrcxGiven && model->HICUMrcx != 0) { - Icic_Vcic = 1/here->HICUMrcx_t.rpart; - Icic_Vrth = -*(ckt->CKTstate0 + here->HICUMvcic)/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart*here->HICUMrcx_t.dpart; - } else { - Icic_Vcic = 0.0; - Icic_Vrth = 0.0; - } - if(model->HICUMrbxGiven && model->HICUMrbx != 0) { - Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; - Ibbp_Vrth = -*(ckt->CKTstate0 + here->HICUMvbbp)/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart*here->HICUMrbx_t.dpart; - } else { - Ibbp_Vbbp = 0.0; - Ibbp_Vrth = 0.0; - } - if(model->HICUMreGiven && model->HICUMre != 0) { - Ieie_Veie = 1/here->HICUMre_t.rpart; - Ieie_Vrth = -*(ckt->CKTstate0 + here->HICUMveie)/here->HICUMre_t.rpart/here->HICUMre_t.rpart*here->HICUMre_t.dpart; - } else { - Ieie_Veie = 0.0; - Ieie_Vrth = 0.0; - } - if(model->HICUMrsuGiven && model->HICUMrsu != 0) { - Isis_Vsis = 1/model->HICUMrsu*here->HICUMm; - } else { - Isis_Vsis = 0.0; - } - if(model->HICUMselfheat) { - Irth_Vrth = (1/here->HICUMrth_t.rpart - *(ckt->CKTstate0 + here->HICUMvrth)/(here->HICUMrth_t.rpart*here->HICUMrth_t.rpart) * here->HICUMrth_t.dpart); - } else { - Irth_Vrth = 0.0; - } - - Ibiei_Vbiei = *(ckt->CKTstate0 + here->HICUMibiei_Vbiei); - Ibiei_Vxf = *(ckt->CKTstate0 + here->HICUMibiei_Vxf); - Ibiei_Vbici = *(ckt->CKTstate0 + here->HICUMibiei_Vbici); - Ibiei_Vrth = *(ckt->CKTstate0 + here->HICUMibiei_Vrth); - - Ibpei_Vbpei = *(ckt->CKTstate0 + here->HICUMibpei_Vbpei); - Ibpei_Vrth = *(ckt->CKTstate0 + here->HICUMibpei_Vrth); - - Iciei_Vbiei = *(ckt->CKTstate0 + here->HICUMiciei_Vbiei); - Iciei_Vbici = *(ckt->CKTstate0 + here->HICUMiciei_Vbici); - Iciei_Vrth = *(ckt->CKTstate0 + here->HICUMiciei_Vrth); - Iciei_Vxf2 = *(ckt->CKTstate0 + here->HICUMiciei_Vxf2); - - Ibici_Vbici = *(ckt->CKTstate0 + here->HICUMibici_Vbici); - Ibici_Vbiei = *(ckt->CKTstate0 + here->HICUMibici_Vbiei); - Ibici_Vrth = *(ckt->CKTstate0 + here->HICUMibici_Vrth); - - Ibpbi_Vbpbi = *(ckt->CKTstate0 + here->HICUMibpbi_Vbpbi); - Ibpbi_Vbiei = *(ckt->CKTstate0 + here->HICUMibpbi_Vbiei); - Ibpbi_Vbici = *(ckt->CKTstate0 + here->HICUMibpbi_Vbici); - Ibpbi_Vrth = *(ckt->CKTstate0 + here->HICUMibpbi_Vrth); - - Ibpci_Vbpci = *(ckt->CKTstate0 + here->HICUMibpci_Vbpci); - Ibpci_Vrth = *(ckt->CKTstate0 + here->HICUMibpci_Vrth); - - Isici_Vsici = *(ckt->CKTstate0 + here->HICUMisici_Vsici); - Isici_Vrth = *(ckt->CKTstate0 + here->HICUMisici_Vrth); - - Ibpsi_Vbpci = *(ckt->CKTstate0 + here->HICUMibpsi_Vbpci); - Ibpsi_Vsici = *(ckt->CKTstate0 + here->HICUMibpsi_Vsici); - Ibpsi_Vrth = *(ckt->CKTstate0 + here->HICUMibpsi_Vrth); - - Ith_Vrth = *(ckt->CKTstate0 + here->HICUMith_Vrth); - Ith_Vbiei = *(ckt->CKTstate0 + here->HICUMith_Vbiei); - Ith_Vbici = *(ckt->CKTstate0 + here->HICUMith_Vbici); - Ith_Vbpbi = *(ckt->CKTstate0 + here->HICUMith_Vbpbi); - Ith_Vbpci = *(ckt->CKTstate0 + here->HICUMith_Vbpci); - Ith_Vbpei = *(ckt->CKTstate0 + here->HICUMith_Vbpei); - Ith_Vciei = *(ckt->CKTstate0 + here->HICUMith_Vciei); - Ith_Vsici = *(ckt->CKTstate0 + here->HICUMith_Vsici); - Ith_Vcic = *(ckt->CKTstate0 + here->HICUMith_Vcic); - Ith_Vbbp = *(ckt->CKTstate0 + here->HICUMith_Vbbp); - Ith_Veie = *(ckt->CKTstate0 + here->HICUMith_Veie); - - Ixf1_Vbiei = *(ckt->CKTstate0 + here->HICUMixf1_Vbiei); - Ixf1_Vbici = *(ckt->CKTstate0 + here->HICUMixf1_Vbici); - Ixf1_Vxf2 = *(ckt->CKTstate0 + here->HICUMixf1_Vxf2); - Ixf1_Vxf1 = *(ckt->CKTstate0 + here->HICUMixf1_Vxf1); - Ixf1_Vrth = *(ckt->CKTstate0 + here->HICUMixf1_Vrth); - - Ixf2_Vbiei = *(ckt->CKTstate0 + here->HICUMixf2_Vbiei); - Ixf2_Vbici = *(ckt->CKTstate0 + here->HICUMixf2_Vbici); - Ixf2_Vxf2 = *(ckt->CKTstate0 + here->HICUMixf2_Vxf2); - Ixf2_Vxf1 = *(ckt->CKTstate0 + here->HICUMixf2_Vxf1); - Ixf2_Vrth = *(ckt->CKTstate0 + here->HICUMixf2_Vrth); - - Ixf_Vbiei = *(ckt->CKTstate0 + here->HICUMixf_Vbiei); - Ixf_Vbici = *(ckt->CKTstate0 + here->HICUMixf_Vbici); - Ixf_Vxf = *(ckt->CKTstate0 + here->HICUMixf_Vxf); - Ixf_Vrth = *(ckt->CKTstate0 + here->HICUMixf_Vrth); - -//////////////////////////////////// -////////// The real part ///////// -//////////////////////////////////// - -// Stamp element: Ibiei - *(here->HICUMbaseBIBaseBIPtr) += Ibiei_Vbiei; - *(here->HICUMemitEIEmitEIPtr) += Ibiei_Vbiei; - *(here->HICUMbaseBIEmitEIPtr) += -Ibiei_Vbiei; - *(here->HICUMemitEIBaseBIPtr) += -Ibiei_Vbiei; - *(here->HICUMbaseBIBaseBIPtr) += Ibiei_Vbici; - *(here->HICUMemitEICollCIPtr) += Ibiei_Vbici; - *(here->HICUMbaseBICollCIPtr) += -Ibiei_Vbici; - *(here->HICUMemitEIBaseBIPtr) += -Ibiei_Vbici; - if (model->HICUMnqs) { - *(here->HICUMbaseBIXfPtr) += Ibiei_Vxf; - *(here->HICUMemitEIXfPtr) += -Ibiei_Vxf; - } - -// Stamp element: Ibpei - *(here->HICUMbaseBPBaseBPPtr) += Ibpei_Vbpei; - *(here->HICUMemitEIEmitEIPtr) += Ibpei_Vbpei; - *(here->HICUMbaseBPEmitEIPtr) += -Ibpei_Vbpei; - *(here->HICUMemitEIBaseBPPtr) += -Ibpei_Vbpei;; - -// Stamp element: Ibici - *(here->HICUMbaseBIBaseBIPtr) += Ibici_Vbici; - *(here->HICUMcollCICollCIPtr) += Ibici_Vbici; - *(here->HICUMcollCIBaseBIPtr) += -Ibici_Vbici; - *(here->HICUMbaseBICollCIPtr) += -Ibici_Vbici; - *(here->HICUMbaseBIBaseBIPtr) += Ibici_Vbiei; - *(here->HICUMcollCIEmitEIPtr) += Ibici_Vbiei; - *(here->HICUMcollCIBaseBIPtr) += -Ibici_Vbiei; - *(here->HICUMbaseBIEmitEIPtr) += -Ibici_Vbiei; - -// Stamp element: Iciei - *(here->HICUMcollCIBaseBIPtr) += Iciei_Vbiei; - *(here->HICUMemitEIEmitEIPtr) += Iciei_Vbiei; - *(here->HICUMcollCIEmitEIPtr) += -Iciei_Vbiei; - *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbiei; - *(here->HICUMcollCIBaseBIPtr) += Iciei_Vbici; - *(here->HICUMemitEICollCIPtr) += Iciei_Vbici; - *(here->HICUMcollCICollCIPtr) += -Iciei_Vbici; - *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbici; - if (model->HICUMnqs) { - *(here->HICUMcollCIXf2Ptr) += Iciei_Vxf2; - *(here->HICUMemitEIXf2Ptr) += -Iciei_Vxf2; - } - - -// Stamp element: Ibpci - *(here->HICUMbaseBPBaseBPPtr) += Ibpci_Vbpci; - *(here->HICUMcollCICollCIPtr) += Ibpci_Vbpci; - *(here->HICUMbaseBPCollCIPtr) += -Ibpci_Vbpci; - *(here->HICUMcollCIBaseBPPtr) += -Ibpci_Vbpci; - -// Stamp element: Rcx - *(here->HICUMcollCollPtr) += Icic_Vcic; - *(here->HICUMcollCICollCIPtr) += Icic_Vcic; - *(here->HICUMcollCICollPtr) += -Icic_Vcic; - *(here->HICUMcollCollCIPtr) += -Icic_Vcic; - -// Stamp element: Rbx - *(here->HICUMbaseBasePtr) += Ibbp_Vbbp; - *(here->HICUMbaseBPBaseBPPtr) += Ibbp_Vbbp; - *(here->HICUMbaseBPBasePtr) += -Ibbp_Vbbp; - *(here->HICUMbaseBaseBPPtr) += -Ibbp_Vbbp; - -// Stamp element: Re - *(here->HICUMemitEmitPtr) += Ieie_Veie; - *(here->HICUMemitEIEmitEIPtr) += Ieie_Veie; - *(here->HICUMemitEIEmitPtr) += -Ieie_Veie; - *(here->HICUMemitEmitEIPtr) += -Ieie_Veie; - -// Stamp element: Ibpbi - if (here->HICUMrbi>0.0) { - *(here->HICUMbaseBPBaseBPPtr) += Ibpbi_Vbpbi; - *(here->HICUMbaseBIBaseBIPtr) += Ibpbi_Vbpbi; - *(here->HICUMbaseBPBaseBIPtr) += -Ibpbi_Vbpbi; - *(here->HICUMbaseBIBaseBPPtr) += -Ibpbi_Vbpbi; - *(here->HICUMbaseBPBaseBIPtr) += Ibpbi_Vbiei; - *(here->HICUMbaseBIEmitEIPtr) += Ibpbi_Vbiei; - *(here->HICUMbaseBPEmitEIPtr) += -Ibpbi_Vbiei; - *(here->HICUMbaseBIBaseBIPtr) += -Ibpbi_Vbiei; - *(here->HICUMbaseBPBaseBIPtr) += Ibpbi_Vbici; - *(here->HICUMbaseBICollCIPtr) += Ibpbi_Vbici; - *(here->HICUMbaseBPCollCIPtr) += -Ibpbi_Vbici; - *(here->HICUMbaseBIBaseBIPtr) += -Ibpbi_Vbici; - }; - -// Stamp element: Isici - *(here->HICUMsubsSISubsSIPtr) += Isici_Vsici; - *(here->HICUMcollCICollCIPtr) += Isici_Vsici; - *(here->HICUMsubsSICollCIPtr) += -Isici_Vsici; - *(here->HICUMcollCISubsSIPtr) += -Isici_Vsici;; - -// Stamp element: Ibpsi - *(here->HICUMbaseBPSubsSIPtr) += Ibpsi_Vsici; - *(here->HICUMsubsSICollCIPtr) += Ibpsi_Vsici; - *(here->HICUMbaseBPCollCIPtr) += -Ibpsi_Vsici; - *(here->HICUMsubsSISubsSIPtr) += -Ibpsi_Vsici; - *(here->HICUMbaseBPBaseBPPtr) += Ibpsi_Vbpci; - *(here->HICUMsubsSICollCIPtr) += Ibpsi_Vbpci; - *(here->HICUMbaseBPCollCIPtr) += -Ibpsi_Vbpci; - *(here->HICUMsubsSIBaseBPPtr) += -Ibpsi_Vbpci;; - -// Stamp element: Rsu - *(here->HICUMsubsSubsPtr) += Isis_Vsis; - *(here->HICUMsubsSISubsSIPtr) += Isis_Vsis; - *(here->HICUMsubsSISubsPtr) += -Isis_Vsis; - *(here->HICUMsubsSubsSIPtr) += -Isis_Vsis; - - if (model->HICUMnqs) { - //Ixf1 - *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbiei; - *(here->HICUMxf1EmitEIPtr) += -Ixf1_Vbiei; - *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbici; - *(here->HICUMxf1CollCIPtr) += -Ixf1_Vbici; - *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; - *(here->HICUMxf1Xf1Ptr) += +Ixf1_Vxf1; - //Ixf2 - *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbiei; - *(here->HICUMxf2EmitEIPtr) += -Ixf2_Vbiei; - *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbici; - *(here->HICUMxf2CollCIPtr) += -Ixf2_Vbici; - *(here->HICUMxf2Xf2Ptr) += +Ixf2_Vxf2; - *(here->HICUMxf2Xf1Ptr) += +Ixf2_Vxf1; - //Ixf - *(here->HICUMxfBaseBIPtr) += +Ixf_Vbiei; - *(here->HICUMxfEmitEIPtr) += -Ixf_Vbiei; - *(here->HICUMxfBaseBIPtr) += +Ixf_Vbici; - *(here->HICUMxfCollCIPtr) += -Ixf_Vbici; - *(here->HICUMxfXfPtr) += +Ixf_Vxf; - } - -//////////////////////////////////// -////////// The complex part ////// -//////////////////////////////////// - - //Qrbi - XQrbi_Vbpbi = *(ckt->CKTstate0 + here->HICUMcqrbi); - XQrbi_Vbiei = here->HICUMqrbi_Vbiei; - XQrbi_Vbici = here->HICUMqrbi_Vbici; - XQrbi_Vrth = here->HICUMqrbi_Vrth; - //Qjei - XQjei_Vbiei = *(ckt->CKTstate0 + here->HICUMcqjei); - XQjei_Vrth = here->HICUMqjei_Vrth; - //Qf - XQf_Vbiei = *(ckt->CKTstate0 + here->HICUMcqf); - XQf_Vbici = here->HICUMqf_Vbici; - XQf_Vrth = here->HICUMqf_Vrth; - XQf_Vxf = here->HICUMqf_Vxf; - //Qr - XQr_Vbici = *(ckt->CKTstate0 + here->HICUMcqr); - XQr_Vbiei = here->HICUMqr_Vbiei; - XQr_Vrth = here->HICUMqr_Vrth; - //Qjci - XQjci_Vbici = *(ckt->CKTstate0 + here->HICUMcqjci); - XQjci_Vrth = here->HICUMqjci_Vrth; - //Qjep - XQjep_Vbpei = *(ckt->CKTstate0 + here->HICUMcqjep); - XQjep_Vrth = here->HICUMqjep_Vrth; - //Qjcx_i - Xqjcx0_t_i_Vbci = *(ckt->CKTstate0 + here->HICUMcqcx0_t_i); - Xqjcx0_t_i_Vrth = here->HICUMqjcx0_i_Vrth; - //Qjcx_ii - Xqjcx0_t_ii_Vbpci = *(ckt->CKTstate0 + here->HICUMcqcx0_t_ii); - Xqjcx0_t_ii_Vrth = here->HICUMqjcx0_ii_Vrth; - //Qdsu - XQdsu_Vbpci = *(ckt->CKTstate0 + here->HICUMcqdsu); - XQdsu_Vsici = here->HICUMqdsu_Vsici; - XQdsu_Vrth = here->HICUMqdsu_Vrth; - //Qjs - XQjs_Vsici = *(ckt->CKTstate0 + here->HICUMcqjs); - XQjs_Vrth = here->HICUMqjs_Vrth; - //Qscp - XQscp_Vsc = *(ckt->CKTstate0 + here->HICUMcqscp); - XQscp_Vrth = here->HICUMqscp_Vrth; - //Qbepar1 - XQbepar1_Vbe = *(ckt->CKTstate0 + here->HICUMcqbepar1); - //Qbepar2 - XQbepar2_Vbpe = *(ckt->CKTstate0 + here->HICUMcqbepar2); - //Qbcpar1 - XQbcpar1_Vbci = *(ckt->CKTstate0 + here->HICUMcqbcpar1); - //Qbcpar2 - XQbcpar2_Vbpci = *(ckt->CKTstate0 + here->HICUMcqbcpar2); - //Qsu - XQsu_Vsis = *(ckt->CKTstate0 + here->HICUMcqsu); - //Qcth - XQcth_Vrth = *(ckt->CKTstate0 + here->HICUMcqcth); - //Qxf - XQxf_Vxf = *(ckt->CKTstate0 + here->HICUMcqxf); - XQxf1_Vxf1 = *(ckt->CKTstate0 + here->HICUMcqxf1); - XQxf2_Vxf2 = *(ckt->CKTstate0 + here->HICUMcqxf2); - - //Qrbi f_bp=+ f_bi=- - if (here->HICUMrbi>0.0) { - *(here->HICUMbaseBPBaseBPPtr + 1) += XQrbi_Vbpbi*(s->imag); - *(here->HICUMbaseBPBaseBPPtr ) += XQrbi_Vbpbi*(s->real); - *(here->HICUMbaseBIBaseBIPtr + 1) += XQrbi_Vbpbi*(s->imag); - *(here->HICUMbaseBIBaseBIPtr ) += XQrbi_Vbpbi*(s->real); - *(here->HICUMbaseBPBaseBIPtr + 1) += -XQrbi_Vbpbi*(s->imag); - *(here->HICUMbaseBPBaseBIPtr ) += -XQrbi_Vbpbi*(s->real); - *(here->HICUMbaseBIBaseBPPtr + 1) += -XQrbi_Vbpbi*(s->imag); - *(here->HICUMbaseBIBaseBPPtr ) += -XQrbi_Vbpbi*(s->real); - *(here->HICUMbaseBPBaseBIPtr + 1) += XQrbi_Vbiei*(s->imag); - *(here->HICUMbaseBPBaseBIPtr ) += XQrbi_Vbiei*(s->real); - *(here->HICUMbaseBIEmitEIPtr + 1) += XQrbi_Vbiei*(s->imag); - *(here->HICUMbaseBIEmitEIPtr ) += XQrbi_Vbiei*(s->real); - *(here->HICUMbaseBPEmitEIPtr + 1) += -XQrbi_Vbiei*(s->imag); - *(here->HICUMbaseBPEmitEIPtr ) += -XQrbi_Vbiei*(s->real); - *(here->HICUMbaseBIBaseBIPtr + 1) += -XQrbi_Vbiei*(s->imag); - *(here->HICUMbaseBIBaseBIPtr ) += -XQrbi_Vbiei*(s->real); - *(here->HICUMbaseBPBaseBIPtr + 1) += XQrbi_Vbici*(s->imag); - *(here->HICUMbaseBPBaseBIPtr ) += XQrbi_Vbici*(s->real); - *(here->HICUMbaseBICollCIPtr + 1) += XQrbi_Vbici*(s->imag); - *(here->HICUMbaseBICollCIPtr ) += XQrbi_Vbici*(s->real); - *(here->HICUMbaseBPCollCIPtr + 1) += -XQrbi_Vbici*(s->imag); - *(here->HICUMbaseBPCollCIPtr ) += -XQrbi_Vbici*(s->real); - *(here->HICUMbaseBIBaseBIPtr + 1) += -XQrbi_Vbici*(s->imag); - *(here->HICUMbaseBIBaseBIPtr ) += -XQrbi_Vbici*(s->real); - }; - //Qjei - *(here->HICUMbaseBIBaseBIPtr + 1) += XQjei_Vbiei*(s->imag); - *(here->HICUMbaseBIBaseBIPtr ) += XQjei_Vbiei*(s->real); - *(here->HICUMemitEIEmitEIPtr + 1) += XQjei_Vbiei*(s->imag); - *(here->HICUMemitEIEmitEIPtr ) += XQjei_Vbiei*(s->real); - *(here->HICUMbaseBIEmitEIPtr + 1) += -XQjei_Vbiei*(s->imag); - *(here->HICUMbaseBIEmitEIPtr ) += -XQjei_Vbiei*(s->real); - *(here->HICUMemitEIBaseBIPtr + 1) += -XQjei_Vbiei*(s->imag); - *(here->HICUMemitEIBaseBIPtr ) += -XQjei_Vbiei*(s->real); - //Qf f_Bi=+ f_Ei =- - *(here->HICUMbaseBIBaseBIPtr +1) += XQf_Vbiei*(s->imag); - *(here->HICUMbaseBIBaseBIPtr) += XQf_Vbiei*(s->real); - *(here->HICUMemitEIEmitEIPtr +1) += XQf_Vbiei*(s->imag); - *(here->HICUMemitEIEmitEIPtr) += XQf_Vbiei*(s->real); - *(here->HICUMbaseBIEmitEIPtr +1) += -XQf_Vbiei*(s->imag); - *(here->HICUMbaseBIEmitEIPtr) += -XQf_Vbiei*(s->real); - *(here->HICUMemitEIBaseBIPtr +1) += -XQf_Vbiei*(s->imag); - *(here->HICUMemitEIBaseBIPtr) += -XQf_Vbiei*(s->real); - *(here->HICUMbaseBIBaseBIPtr +1) += XQf_Vbici*(s->imag); - *(here->HICUMbaseBIBaseBIPtr) += XQf_Vbici*(s->real); - *(here->HICUMemitEICollCIPtr +1) += XQf_Vbici*(s->imag); - *(here->HICUMemitEICollCIPtr) += XQf_Vbici*(s->real); - *(here->HICUMbaseBICollCIPtr +1) += -XQf_Vbici*(s->imag); - *(here->HICUMbaseBICollCIPtr) += -XQf_Vbici*(s->real); - *(here->HICUMemitEIBaseBIPtr +1) += -XQf_Vbici*(s->imag); - *(here->HICUMemitEIBaseBIPtr) += -XQf_Vbici*(s->real); - if (model->HICUMnqs) { - *(here->HICUMbaseBIXfPtr +1) += XQf_Vxf*(s->imag); - *(here->HICUMbaseBIXfPtr ) += XQf_Vxf*(s->real); - *(here->HICUMemitEIXfPtr +1) += -XQf_Vxf*(s->imag); - *(here->HICUMemitEIXfPtr ) += -XQf_Vxf*(s->real); - } - //Qjci - *(here->HICUMbaseBIBaseBIPtr +1) += XQjci_Vbici*(s->imag); - *(here->HICUMbaseBIBaseBIPtr) += XQjci_Vbici*(s->real); - *(here->HICUMcollCICollCIPtr +1) += XQjci_Vbici*(s->imag); - *(here->HICUMcollCICollCIPtr) += XQjci_Vbici*(s->real); - *(here->HICUMcollCIBaseBIPtr +1) += -XQjci_Vbici*(s->imag); - *(here->HICUMcollCIBaseBIPtr) += -XQjci_Vbici*(s->real); - *(here->HICUMbaseBICollCIPtr +1) += -XQjci_Vbici*(s->imag); - *(here->HICUMbaseBICollCIPtr) += -XQjci_Vbici*(s->real); - //Qr f_bi = + f_ci=- - *(here->HICUMbaseBIBaseBIPtr +1) += XQr_Vbici*(s->imag); - *(here->HICUMbaseBIBaseBIPtr) += XQr_Vbici*(s->real); - *(here->HICUMcollCICollCIPtr +1) += XQr_Vbici*(s->imag); - *(here->HICUMcollCICollCIPtr) += XQr_Vbici*(s->real); - *(here->HICUMcollCIBaseBIPtr +1) += -XQr_Vbici*(s->imag); - *(here->HICUMcollCIBaseBIPtr) += -XQr_Vbici*(s->real); - *(here->HICUMbaseBICollCIPtr +1) += -XQr_Vbici*(s->imag); - *(here->HICUMbaseBICollCIPtr) += -XQr_Vbici*(s->real); - *(here->HICUMbaseBIBaseBIPtr +1) += XQr_Vbiei*(s->imag); - *(here->HICUMbaseBIBaseBIPtr) += XQr_Vbiei*(s->real); - *(here->HICUMcollCIEmitEIPtr +1) += XQr_Vbiei*(s->imag); - *(here->HICUMcollCIEmitEIPtr) += XQr_Vbiei*(s->real); - *(here->HICUMcollCIBaseBIPtr +1) += -XQr_Vbiei*(s->imag); - *(here->HICUMcollCIBaseBIPtr) += -XQr_Vbiei*(s->real); - *(here->HICUMbaseBIEmitEIPtr +1) += -XQr_Vbiei*(s->imag); - *(here->HICUMbaseBIEmitEIPtr) += -XQr_Vbiei*(s->real); - //Qjep - *(here->HICUMbaseBPBaseBPPtr +1) += XQjep_Vbpei*(s->imag); - *(here->HICUMbaseBPBaseBPPtr) += XQjep_Vbpei*(s->real); - *(here->HICUMemitEIEmitEIPtr +1) += XQjep_Vbpei*(s->imag); - *(here->HICUMemitEIEmitEIPtr) += XQjep_Vbpei*(s->real); - *(here->HICUMbaseBPEmitEIPtr +1) += -XQjep_Vbpei*(s->imag); - *(here->HICUMbaseBPEmitEIPtr) += -XQjep_Vbpei*(s->real); - *(here->HICUMemitEIBaseBPPtr +1) += -XQjep_Vbpei*(s->imag); - *(here->HICUMemitEIBaseBPPtr) += -XQjep_Vbpei*(s->real); - //Qjcx_i - *(here->HICUMbaseBasePtr +1) += Xqjcx0_t_i_Vbci*(s->imag); - *(here->HICUMbaseBasePtr) += Xqjcx0_t_i_Vbci*(s->real); - *(here->HICUMcollCICollCIPtr +1) += Xqjcx0_t_i_Vbci*(s->imag); - *(here->HICUMcollCICollCIPtr) += Xqjcx0_t_i_Vbci*(s->real); - *(here->HICUMbaseCollCIPtr +1) += -Xqjcx0_t_i_Vbci*(s->imag); - *(here->HICUMbaseCollCIPtr) += -Xqjcx0_t_i_Vbci*(s->real); - *(here->HICUMcollCIBasePtr +1) += -Xqjcx0_t_i_Vbci*(s->imag); - *(here->HICUMcollCIBasePtr) += -Xqjcx0_t_i_Vbci*(s->real); - //Qjcx_ii - *(here->HICUMbaseBPBaseBPPtr +1) += Xqjcx0_t_ii_Vbpci*(s->imag); - *(here->HICUMbaseBPBaseBPPtr) += Xqjcx0_t_ii_Vbpci*(s->real); - *(here->HICUMcollCICollCIPtr +1) += Xqjcx0_t_ii_Vbpci*(s->imag); - *(here->HICUMcollCICollCIPtr) += Xqjcx0_t_ii_Vbpci*(s->real); - *(here->HICUMbaseBPCollCIPtr +1) += -Xqjcx0_t_ii_Vbpci*(s->imag); - *(here->HICUMbaseBPCollCIPtr) += -Xqjcx0_t_ii_Vbpci*(s->real); - *(here->HICUMcollCIBaseBPPtr +1) += -Xqjcx0_t_ii_Vbpci*(s->imag); - *(here->HICUMcollCIBaseBPPtr) += -Xqjcx0_t_ii_Vbpci*(s->real); - //Qdsu f_bp=+ f_ci=- - *(here->HICUMbaseBPBaseBPPtr +1) += XQdsu_Vbpci*(s->imag); - *(here->HICUMbaseBPBaseBPPtr) += XQdsu_Vbpci*(s->real); - *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vbpci*(s->imag); - *(here->HICUMcollCICollCIPtr) += XQdsu_Vbpci*(s->real); - *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vbpci*(s->imag); - *(here->HICUMbaseBPCollCIPtr) += -XQdsu_Vbpci*(s->real); - *(here->HICUMcollCIBaseBPPtr +1) += -XQdsu_Vbpci*(s->imag); - *(here->HICUMcollCIBaseBPPtr) += -XQdsu_Vbpci*(s->real); - *(here->HICUMbaseBPSubsSIPtr +1) += XQdsu_Vsici*(s->imag); - *(here->HICUMbaseBPSubsSIPtr) += XQdsu_Vsici*(s->real); - *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vsici*(s->imag); - *(here->HICUMcollCICollCIPtr) += XQdsu_Vsici*(s->real); - *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vsici*(s->imag); - *(here->HICUMbaseBPCollCIPtr) += -XQdsu_Vsici*(s->real); - *(here->HICUMcollCISubsSIPtr +1) += -XQdsu_Vsici*(s->imag); - *(here->HICUMcollCISubsSIPtr) += -XQdsu_Vsici*(s->real); - //Qjs - *(here->HICUMsubsSISubsSIPtr +1) += XQjs_Vsici*(s->imag); - *(here->HICUMsubsSISubsSIPtr) += XQjs_Vsici*(s->real); - *(here->HICUMcollCICollCIPtr +1) += XQjs_Vsici*(s->imag); - *(here->HICUMcollCICollCIPtr) += XQjs_Vsici*(s->real); - *(here->HICUMsubsSICollCIPtr +1) += -XQjs_Vsici*(s->imag); - *(here->HICUMsubsSICollCIPtr) += -XQjs_Vsici*(s->real); - *(here->HICUMcollCISubsSIPtr +1) += -XQjs_Vsici*(s->imag); - *(here->HICUMcollCISubsSIPtr) += -XQjs_Vsici*(s->real); - //Qscp - *(here->HICUMsubsSubsPtr + 1) += XQscp_Vsc*(s->imag); - *(here->HICUMsubsSubsPtr ) += XQscp_Vsc*(s->real); - *(here->HICUMcollCollPtr + 1) += XQscp_Vsc*(s->imag); - *(here->HICUMcollCollPtr ) += XQscp_Vsc*(s->real); - *(here->HICUMcollSubsPtr + 1) += -XQscp_Vsc*(s->imag); - *(here->HICUMcollSubsPtr ) += -XQscp_Vsc*(s->real); - *(here->HICUMsubsCollPtr + 1) += -XQscp_Vsc*(s->imag); - *(here->HICUMsubsCollPtr ) += -XQscp_Vsc*(s->real); - //Qbepar1 - *(here->HICUMbaseBasePtr + 1) += XQbepar1_Vbe*(s->imag); - *(here->HICUMbaseBasePtr ) += XQbepar1_Vbe*(s->real); - *(here->HICUMemitEmitPtr + 1) += XQbepar1_Vbe*(s->imag); - *(here->HICUMemitEmitPtr ) += XQbepar1_Vbe*(s->real); - *(here->HICUMbaseEmitPtr + 1) += -XQbepar1_Vbe*(s->imag); - *(here->HICUMbaseEmitPtr ) += -XQbepar1_Vbe*(s->real); - *(here->HICUMemitBasePtr + 1) += -XQbepar1_Vbe*(s->imag); - *(here->HICUMemitBasePtr ) += -XQbepar1_Vbe*(s->real); - //Qbepar2 - *(here->HICUMbaseBPBaseBPPtr + 1) += XQbepar2_Vbpe*(s->imag); - *(here->HICUMbaseBPBaseBPPtr ) += XQbepar2_Vbpe*(s->real); - *(here->HICUMemitEmitPtr + 1) += XQbepar2_Vbpe*(s->imag); - *(here->HICUMemitEmitPtr ) += XQbepar2_Vbpe*(s->real); - *(here->HICUMemitBaseBPPtr + 1) += -XQbepar2_Vbpe*(s->imag); - *(here->HICUMemitBaseBPPtr ) += -XQbepar2_Vbpe*(s->real); - *(here->HICUMbaseBPEmitPtr + 1) += -XQbepar2_Vbpe*(s->imag); - *(here->HICUMbaseBPEmitPtr ) += -XQbepar2_Vbpe*(s->real); - //Qbcpar1 - *(here->HICUMbaseBasePtr + 1) += XQbcpar1_Vbci*(s->imag); - *(here->HICUMbaseBasePtr ) += XQbcpar1_Vbci*(s->real); - *(here->HICUMcollCICollCIPtr + 1) += XQbcpar1_Vbci*(s->imag); - *(here->HICUMcollCICollCIPtr ) += XQbcpar1_Vbci*(s->real); - *(here->HICUMbaseCollCIPtr + 1) += -XQbcpar1_Vbci*(s->imag); - *(here->HICUMbaseCollCIPtr ) += -XQbcpar1_Vbci*(s->real); - *(here->HICUMcollCIBasePtr + 1) += -XQbcpar1_Vbci*(s->imag); - *(here->HICUMcollCIBasePtr ) += -XQbcpar1_Vbci*(s->real); - //Qbcpar2 - *(here->HICUMbaseBPBaseBPPtr +1) += XQbcpar2_Vbpci*(s->imag); - *(here->HICUMbaseBPBaseBPPtr) += XQbcpar2_Vbpci*(s->real); - *(here->HICUMcollCICollCIPtr +1) += XQbcpar2_Vbpci*(s->imag); - *(here->HICUMcollCICollCIPtr) += XQbcpar2_Vbpci*(s->real); - *(here->HICUMbaseBPCollCIPtr +1) += -XQbcpar2_Vbpci*(s->imag); - *(here->HICUMbaseBPCollCIPtr) += -XQbcpar2_Vbpci*(s->real); - *(here->HICUMcollCIBaseBPPtr +1) += -XQbcpar2_Vbpci*(s->imag); - *(here->HICUMcollCIBaseBPPtr) += -XQbcpar2_Vbpci*(s->real); - //Qsu - *(here->HICUMsubsSubsPtr + 1) += XQsu_Vsis*(s->imag); - *(here->HICUMsubsSubsPtr ) += XQsu_Vsis*(s->real); - *(here->HICUMsubsSISubsSIPtr + 1) += XQsu_Vsis*(s->imag); - *(here->HICUMsubsSISubsSIPtr ) += XQsu_Vsis*(s->real); - *(here->HICUMsubsSISubsPtr + 1) += -XQsu_Vsis*(s->imag); - *(here->HICUMsubsSISubsPtr ) += -XQsu_Vsis*(s->real); - *(here->HICUMsubsSubsSIPtr + 1) += -XQsu_Vsis*(s->imag); - *(here->HICUMsubsSubsSIPtr ) += -XQsu_Vsis*(s->real); - if (model->HICUMnqs) { - //Qxf1 - *(here->HICUMxf1Xf1Ptr + 1) += +XQxf1_Vxf1*(s->imag); - *(here->HICUMxf1Xf1Ptr) += +XQxf1_Vxf1*(s->real); - //Qxf2 - *(here->HICUMxf2Xf2Ptr + 1) += +XQxf2_Vxf2*(s->imag); - *(here->HICUMxf2Xf2Ptr ) += +XQxf2_Vxf2*(s->real); - //Qxf - *(here->HICUMxfXfPtr + 1) += +XQxf_Vxf*(s->imag); - *(here->HICUMxfXfPtr ) += +XQxf_Vxf*(s->real); - } - - // Stamps with SH - if (model->HICUMselfheat) { -// Stamp element: Ibiei f_Bi = + f_Ei = - - *(here->HICUMbaseBItempPtr) += Ibiei_Vrth; - *(here->HICUMemitEItempPtr) += -Ibiei_Vrth; -// Stamp element: Ibpei f_Bp = + f_Ei = - - // with respect to Potential Vrth - *(here->HICUMbaseBPtempPtr) += Ibpei_Vrth; - *(here->HICUMemitEItempPtr) += -Ibpei_Vrth; -// Stamp element: Ibici f_Bi = + f_Ci = - - *(here->HICUMbaseBItempPtr) += Ibici_Vrth; - *(here->HICUMcollCItempPtr) += -Ibici_Vrth; -// Stamp element: Iciei f_Ci = + f_Ei = - - *(here->HICUMcollCItempPtr) += Iciei_Vrth; - *(here->HICUMemitEItempPtr) += -Iciei_Vrth; -// Stamp element: Ibpci f_Bp = + f_Ci = - - *(here->HICUMbaseBPtempPtr) += Ibpci_Vrth; - *(here->HICUMcollCItempPtr) += -Ibpci_Vrth; -// Stamp element: Rcx f_Ci = + f_C = - - *(here->HICUMcollCItempPtr) += Icic_Vrth; - *(here->HICUMcollTempPtr) += -Icic_Vrth; -// Stamp element: Rbx f_B = + f_Bp = - - *(here->HICUMbaseTempPtr) += Ibbp_Vrth; - *(here->HICUMbaseBPtempPtr) += -Ibbp_Vrth; -// Stamp element: Re f_Ei = + f_E = - - *(here->HICUMemitEItempPtr) += Ieie_Vrth; - *(here->HICUMemitTempPtr) += -Ieie_Vrth; - if (here->HICUMrbi>0.0) { -// Stamp element: Rbi f_Bp = + f_Bi = - - *(here->HICUMbaseBPtempPtr) += Ibpbi_Vrth; - *(here->HICUMbaseBItempPtr) += -Ibpbi_Vrth; - }; -// Stamp element: Isici f_Si = + f_Ci = - - *(here->HICUMsubsSItempPtr) += Isici_Vrth; - *(here->HICUMcollCItempPtr) += -Isici_Vrth; -// Branch: bpsi, Stamp element: Its - *(here->HICUMbaseBPtempPtr) += Ibpsi_Vrth; - *(here->HICUMsubsSItempPtr) += -Ibpsi_Vrth; - if (model->HICUMnqs) { - // Stamp element: Ixf f_xf = + - *(here->HICUMxfTempPtr) += Ixf_Vrth; - // Stamp element: Ixf1 f_xf1 = + - *(here->HICUMxf1TempPtr) += Ixf1_Vrth; - // Stamp element: Ixf2 f_xf2 = + - *(here->HICUMxf2TempPtr) += Ixf2_Vrth; - } - -// Stamp element: Rth f_T = + - *(here->HICUMtempTempPtr) += Irth_Vrth; - -// Stamp element: Ith f_T = - Ith - // with respect to Potential Vrth - *(here->HICUMtempTempPtr) += -Ith_Vrth; - // with respect to Potential Vbiei - *(here->HICUMtempBaseBIPtr) += -Ith_Vbiei; - *(here->HICUMtempEmitEIPtr) += +Ith_Vbiei; - // with respect to Potential Vbici - *(here->HICUMtempBaseBIPtr) += -Ith_Vbici; - *(here->HICUMtempCollCIPtr) += +Ith_Vbici; - // with respect to Potential Vciei - *(here->HICUMtempCollCIPtr) += -Ith_Vciei; - *(here->HICUMtempEmitEIPtr) += +Ith_Vciei; - // with respect to Potential Vbpei - *(here->HICUMtempBaseBPPtr) += -Ith_Vbpei; - *(here->HICUMtempEmitEIPtr) += +Ith_Vbpei; - // with respect to Potential Vbpci - *(here->HICUMtempBaseBPPtr) += -Ith_Vbpci; - *(here->HICUMtempCollCIPtr) += +Ith_Vbpci; - // with respect to Potential Vsici - *(here->HICUMtempSubsSIPtr) += -Ith_Vsici; - *(here->HICUMtempCollCIPtr) += +Ith_Vsici; - // with respect to Potential Vbpbi - *(here->HICUMtempBaseBPPtr) += -Ith_Vbpbi; - *(here->HICUMtempBaseBIPtr) += +Ith_Vbpbi; - // with respect to Potential Vcic - *(here->HICUMtempCollCIPtr) += -Ith_Vcic; - *(here->HICUMtempCollPtr) += +Ith_Vcic; - // with respect to Potential Vbbp - *(here->HICUMtempBasePtr) += -Ith_Vbbp; - *(here->HICUMtempBaseBPPtr) += +Ith_Vbbp; - // with respect to Potential Veie - *(here->HICUMtempEmitEIPtr) += -Ith_Veie; - *(here->HICUMtempEmitPtr) += +Ith_Veie; - - //the charges - *(here->HICUMbaseBItempPtr + 1) += +XQrbi_Vrth*(s->imag); - *(here->HICUMbaseBItempPtr ) += +XQrbi_Vrth*(s->real); - *(here->HICUMbaseBPtempPtr + 1) += -XQrbi_Vrth*(s->imag); - *(here->HICUMbaseBPtempPtr ) += -XQrbi_Vrth*(s->real); - *(here->HICUMbaseBItempPtr + 1) += +XQjei_Vrth*(s->imag); - *(here->HICUMbaseBItempPtr ) += +XQjei_Vrth*(s->real); - *(here->HICUMemitEItempPtr + 1) += -XQjei_Vrth*(s->imag); - *(here->HICUMemitEItempPtr ) += -XQjei_Vrth*(s->real); - *(here->HICUMbaseBItempPtr + 1) += +XQf_Vrth*(s->imag); - *(here->HICUMbaseBItempPtr ) += +XQf_Vrth*(s->real); - *(here->HICUMemitEItempPtr + 1) += -XQf_Vrth*(s->imag); - *(here->HICUMemitEItempPtr ) += -XQf_Vrth*(s->real); - *(here->HICUMbaseBItempPtr + 1) += +XQr_Vrth*(s->imag); - *(here->HICUMbaseBItempPtr ) += +XQr_Vrth*(s->real); - *(here->HICUMcollCItempPtr + 1) += -XQr_Vrth*(s->imag); - *(here->HICUMcollCItempPtr ) += -XQr_Vrth*(s->real); - *(here->HICUMbaseBItempPtr + 1) += +XQjci_Vrth*(s->imag); - *(here->HICUMbaseBItempPtr ) += +XQjci_Vrth*(s->real); - *(here->HICUMcollCItempPtr + 1) += -XQjci_Vrth*(s->imag); - *(here->HICUMcollCItempPtr ) += -XQjci_Vrth*(s->real); - *(here->HICUMbaseBPtempPtr + 1) += +XQjep_Vrth*(s->imag); - *(here->HICUMbaseBPtempPtr ) += +XQjep_Vrth*(s->real); - *(here->HICUMemitEItempPtr + 1) += -XQjep_Vrth*(s->imag); - *(here->HICUMemitEItempPtr ) += -XQjep_Vrth*(s->real); - *(here->HICUMbaseTempPtr + 1) += +Xqjcx0_t_i_Vrth*(s->imag); - *(here->HICUMbaseTempPtr ) += +Xqjcx0_t_i_Vrth*(s->real); - *(here->HICUMcollCItempPtr + 1) += -Xqjcx0_t_i_Vrth*(s->imag); - *(here->HICUMcollCItempPtr ) += -Xqjcx0_t_i_Vrth*(s->real); - *(here->HICUMbaseBPtempPtr + 1) += +Xqjcx0_t_ii_Vrth*(s->imag); - *(here->HICUMbaseBPtempPtr ) += +Xqjcx0_t_ii_Vrth*(s->real); - *(here->HICUMcollCItempPtr + 1) += -Xqjcx0_t_ii_Vrth*(s->imag); - *(here->HICUMcollCItempPtr ) += -Xqjcx0_t_ii_Vrth*(s->real); - *(here->HICUMbaseBPtempPtr + 1) += +XQdsu_Vrth*(s->imag); - *(here->HICUMbaseBPtempPtr ) += +XQdsu_Vrth*(s->real); - *(here->HICUMcollCItempPtr + 1) += -XQdsu_Vrth*(s->imag); - *(here->HICUMcollCItempPtr ) += -XQdsu_Vrth*(s->real); - *(here->HICUMsubsSItempPtr + 1) += +XQjs_Vrth*(s->imag); - *(here->HICUMsubsSItempPtr ) += +XQjs_Vrth*(s->real); - *(here->HICUMcollCItempPtr + 1) += -XQjs_Vrth*(s->imag); - *(here->HICUMcollCItempPtr ) += -XQjs_Vrth*(s->real); - *(here->HICUMsubsTempPtr + 1) += +XQscp_Vrth*(s->imag); - *(here->HICUMsubsTempPtr ) += +XQscp_Vrth*(s->real); - *(here->HICUMcollTempPtr + 1) += -XQscp_Vrth*(s->imag); - *(here->HICUMcollTempPtr ) += -XQscp_Vrth*(s->real); - *(here->HICUMtempTempPtr + 1) += +XQcth_Vrth*(s->imag); - *(here->HICUMtempTempPtr ) += +XQcth_Vrth*(s->real); - - } - - } - } - return(OK); -} +/********** +License : 3-clause BSD +Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher +Model Author : (Copyright 1993-2024) Michael Schroter +**********/ + + +/* + * Function to load the COMPLEX circuit matrix using the + * small signal parameters saved during a previous DC operating + * point analysis. + */ + +#include "ngspice/ngspice.h" +#include "ngspice/cktdefs.h" +#include "hicum2defs.h" +#include "ngspice/sperror.h" +#include "ngspice/suffix.h" + +int +HICUMpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) +{ + HICUMinstance *here; + HICUMmodel *model = (HICUMmodel*)inModel; + double Ibpei_Vbpei; + double Ibpei_Vrth; + + double Ibiei_Vbiei; + double Ibiei_Vxf; + double Ibiei_Vbici; + double Ibiei_Vrth; + + double Ibici_Vbici; + double Ibici_Vbiei; + double Ibici_Vrth; + + double Ibpci_Vbpci; + double Ibpci_Vrth; + + double Isici_Vsici; + double Isici_Vrth; + + double Iciei_Vbiei; + double Iciei_Vbici; + double Iciei_Vrth; + double Iciei_Vxf2; + + + double Ibpbi_Vbpbi; + double Ibpbi_Vbici; + double Ibpbi_Vbiei; + double Ibpbi_Vrth; + + double Isis_Vsis; + double Icic_Vcic, Icic_Vrth; + double Ieie_Veie, Ieie_Vrth; + double Ibbp_Vbbp, Ibbp_Vrth; + double Irth_Vrth; + + double Ibpsi_Vbpci; + double Ibpsi_Vsici; + double Ibpsi_Vrth; + + double XQrbi_Vbpbi; + double XQrbi_Vbiei; + double XQrbi_Vbici; + double XQrbi_Vrth; + double XQjei_Vbiei; + double XQjei_Vrth; + double XQjci_Vbici; + double XQjci_Vrth; + double XQjep_Vbpei; + double XQjep_Vrth; + double volatile Xqjcx0_t_i_Vbci; + double Xqjcx0_t_i_Vrth; + double volatile Xqjcx0_t_ii_Vbpci; + double Xqjcx0_t_ii_Vrth; + double XQdsu_Vbpci; + double XQdsu_Vsici; + double XQdsu_Vrth; + double XQjs_Vsici; + double XQjs_Vrth; + double XQscp_Vsc; + double XQscp_Vrth; + double XQbepar1_Vbe; + double XQbepar2_Vbpe; + double XQbcpar1_Vbci; + double XQbcpar2_Vbpci; + double XQsu_Vsis; + double XQcth_Vrth; + double XQf_Vbiei; + double XQf_Vbici; + double XQf_Vrth; + double XQf_Vxf; + double XQr_Vrth; + double XQr_Vbiei; + double XQr_Vbici; + + double XQxf_Vxf; + double XQxf1_Vxf1; + double XQxf2_Vxf2; + + double Ixf1_Vbiei; + double Ixf1_Vbici; + double Ixf1_Vxf2 ; + double Ixf1_Vxf1 ; + double Ixf1_Vrth ; + + double Ixf2_Vbiei; + double Ixf2_Vbici; + double Ixf2_Vxf2 ; + double Ixf2_Vxf1 ; + double Ixf2_Vrth ; + + double Ixf_Vbiei ; + double Ixf_Vbici ; + double Ixf_Vxf ; + double Ixf_Vrth ; + + double Ith_Vrth, Ith_Vbiei, Ith_Vbici, Ith_Vbpbi, Ith_Vbpci, Ith_Vbpei, Ith_Vciei, Ith_Vsici, Ith_Vcic, Ith_Vbbp, Ith_Veie; + + /* loop through all the models */ + for( ; model != NULL; model = HICUMnextModel(model)) { + + /* loop through all the instances of the model */ + for( here = HICUMinstances(model); here!= NULL; + here = HICUMnextInstance(here)) { + + + // get all derivatives of branch DC currents + if(model->HICUMrcxGiven && model->HICUMrcx != 0) { + Icic_Vcic = 1/here->HICUMrcx_t.rpart; + Icic_Vrth = -*(ckt->CKTstate0 + here->HICUMvcic)/here->HICUMrcx_t.rpart/here->HICUMrcx_t.rpart*here->HICUMrcx_t.dpart; + } else { + Icic_Vcic = 0.0; + Icic_Vrth = 0.0; + } + if(model->HICUMrbxGiven && model->HICUMrbx != 0) { + Ibbp_Vbbp = 1/here->HICUMrbx_t.rpart; + Ibbp_Vrth = -*(ckt->CKTstate0 + here->HICUMvbbp)/here->HICUMrbx_t.rpart/here->HICUMrbx_t.rpart*here->HICUMrbx_t.dpart; + } else { + Ibbp_Vbbp = 0.0; + Ibbp_Vrth = 0.0; + } + if(model->HICUMreGiven && model->HICUMre != 0) { + Ieie_Veie = 1/here->HICUMre_t.rpart; + Ieie_Vrth = -*(ckt->CKTstate0 + here->HICUMveie)/here->HICUMre_t.rpart/here->HICUMre_t.rpart*here->HICUMre_t.dpart; + } else { + Ieie_Veie = 0.0; + Ieie_Vrth = 0.0; + } + if(model->HICUMrsuGiven && model->HICUMrsu != 0) { + Isis_Vsis = 1/model->HICUMrsu*here->HICUMm; + } else { + Isis_Vsis = 0.0; + } + if(model->HICUMselfheat) { + Irth_Vrth = (1/here->HICUMrth_t.rpart - *(ckt->CKTstate0 + here->HICUMvrth)/(here->HICUMrth_t.rpart*here->HICUMrth_t.rpart) * here->HICUMrth_t.dpart); + } else { + Irth_Vrth = 0.0; + } + + Ibiei_Vbiei = *(ckt->CKTstate0 + here->HICUMibiei_Vbiei); + Ibiei_Vxf = *(ckt->CKTstate0 + here->HICUMibiei_Vxf); + Ibiei_Vbici = *(ckt->CKTstate0 + here->HICUMibiei_Vbici); + Ibiei_Vrth = *(ckt->CKTstate0 + here->HICUMibiei_Vrth); + + Ibpei_Vbpei = *(ckt->CKTstate0 + here->HICUMibpei_Vbpei); + Ibpei_Vrth = *(ckt->CKTstate0 + here->HICUMibpei_Vrth); + + Iciei_Vbiei = *(ckt->CKTstate0 + here->HICUMiciei_Vbiei); + Iciei_Vbici = *(ckt->CKTstate0 + here->HICUMiciei_Vbici); + Iciei_Vrth = *(ckt->CKTstate0 + here->HICUMiciei_Vrth); + Iciei_Vxf2 = *(ckt->CKTstate0 + here->HICUMiciei_Vxf2); + + Ibici_Vbici = *(ckt->CKTstate0 + here->HICUMibici_Vbici); + Ibici_Vbiei = *(ckt->CKTstate0 + here->HICUMibici_Vbiei); + Ibici_Vrth = *(ckt->CKTstate0 + here->HICUMibici_Vrth); + + Ibpbi_Vbpbi = *(ckt->CKTstate0 + here->HICUMibpbi_Vbpbi); + Ibpbi_Vbiei = *(ckt->CKTstate0 + here->HICUMibpbi_Vbiei); + Ibpbi_Vbici = *(ckt->CKTstate0 + here->HICUMibpbi_Vbici); + Ibpbi_Vrth = *(ckt->CKTstate0 + here->HICUMibpbi_Vrth); + + Ibpci_Vbpci = *(ckt->CKTstate0 + here->HICUMibpci_Vbpci); + Ibpci_Vrth = *(ckt->CKTstate0 + here->HICUMibpci_Vrth); + + Isici_Vsici = *(ckt->CKTstate0 + here->HICUMisici_Vsici); + Isici_Vrth = *(ckt->CKTstate0 + here->HICUMisici_Vrth); + + Ibpsi_Vbpci = *(ckt->CKTstate0 + here->HICUMibpsi_Vbpci); + Ibpsi_Vsici = *(ckt->CKTstate0 + here->HICUMibpsi_Vsici); + Ibpsi_Vrth = *(ckt->CKTstate0 + here->HICUMibpsi_Vrth); + + Ith_Vrth = *(ckt->CKTstate0 + here->HICUMith_Vrth); + Ith_Vbiei = *(ckt->CKTstate0 + here->HICUMith_Vbiei); + Ith_Vbici = *(ckt->CKTstate0 + here->HICUMith_Vbici); + Ith_Vbpbi = *(ckt->CKTstate0 + here->HICUMith_Vbpbi); + Ith_Vbpci = *(ckt->CKTstate0 + here->HICUMith_Vbpci); + Ith_Vbpei = *(ckt->CKTstate0 + here->HICUMith_Vbpei); + Ith_Vciei = *(ckt->CKTstate0 + here->HICUMith_Vciei); + Ith_Vsici = *(ckt->CKTstate0 + here->HICUMith_Vsici); + Ith_Vcic = *(ckt->CKTstate0 + here->HICUMith_Vcic); + Ith_Vbbp = *(ckt->CKTstate0 + here->HICUMith_Vbbp); + Ith_Veie = *(ckt->CKTstate0 + here->HICUMith_Veie); + + Ixf1_Vbiei = *(ckt->CKTstate0 + here->HICUMixf1_Vbiei); + Ixf1_Vbici = *(ckt->CKTstate0 + here->HICUMixf1_Vbici); + Ixf1_Vxf2 = *(ckt->CKTstate0 + here->HICUMixf1_Vxf2); + Ixf1_Vxf1 = *(ckt->CKTstate0 + here->HICUMixf1_Vxf1); + Ixf1_Vrth = *(ckt->CKTstate0 + here->HICUMixf1_Vrth); + + Ixf2_Vbiei = *(ckt->CKTstate0 + here->HICUMixf2_Vbiei); + Ixf2_Vbici = *(ckt->CKTstate0 + here->HICUMixf2_Vbici); + Ixf2_Vxf2 = *(ckt->CKTstate0 + here->HICUMixf2_Vxf2); + Ixf2_Vxf1 = *(ckt->CKTstate0 + here->HICUMixf2_Vxf1); + Ixf2_Vrth = *(ckt->CKTstate0 + here->HICUMixf2_Vrth); + + Ixf_Vbiei = *(ckt->CKTstate0 + here->HICUMixf_Vbiei); + Ixf_Vbici = *(ckt->CKTstate0 + here->HICUMixf_Vbici); + Ixf_Vxf = *(ckt->CKTstate0 + here->HICUMixf_Vxf); + Ixf_Vrth = *(ckt->CKTstate0 + here->HICUMixf_Vrth); + +//////////////////////////////////// +////////// The real part ///////// +//////////////////////////////////// + +// Stamp element: Ibiei + *(here->HICUMbaseBIBaseBIPtr) += Ibiei_Vbiei; + *(here->HICUMemitEIEmitEIPtr) += Ibiei_Vbiei; + *(here->HICUMbaseBIEmitEIPtr) += -Ibiei_Vbiei; + *(here->HICUMemitEIBaseBIPtr) += -Ibiei_Vbiei; + *(here->HICUMbaseBIBaseBIPtr) += Ibiei_Vbici; + *(here->HICUMemitEICollCIPtr) += Ibiei_Vbici; + *(here->HICUMbaseBICollCIPtr) += -Ibiei_Vbici; + *(here->HICUMemitEIBaseBIPtr) += -Ibiei_Vbici; + if (model->HICUMnqs) { + *(here->HICUMbaseBIXfPtr) += Ibiei_Vxf; + *(here->HICUMemitEIXfPtr) += -Ibiei_Vxf; + } + +// Stamp element: Ibpei + *(here->HICUMbaseBPBaseBPPtr) += Ibpei_Vbpei; + *(here->HICUMemitEIEmitEIPtr) += Ibpei_Vbpei; + *(here->HICUMbaseBPEmitEIPtr) += -Ibpei_Vbpei; + *(here->HICUMemitEIBaseBPPtr) += -Ibpei_Vbpei;; + +// Stamp element: Ibici + *(here->HICUMbaseBIBaseBIPtr) += Ibici_Vbici; + *(here->HICUMcollCICollCIPtr) += Ibici_Vbici; + *(here->HICUMcollCIBaseBIPtr) += -Ibici_Vbici; + *(here->HICUMbaseBICollCIPtr) += -Ibici_Vbici; + *(here->HICUMbaseBIBaseBIPtr) += Ibici_Vbiei; + *(here->HICUMcollCIEmitEIPtr) += Ibici_Vbiei; + *(here->HICUMcollCIBaseBIPtr) += -Ibici_Vbiei; + *(here->HICUMbaseBIEmitEIPtr) += -Ibici_Vbiei; + +// Stamp element: Iciei + *(here->HICUMcollCIBaseBIPtr) += Iciei_Vbiei; + *(here->HICUMemitEIEmitEIPtr) += Iciei_Vbiei; + *(here->HICUMcollCIEmitEIPtr) += -Iciei_Vbiei; + *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbiei; + *(here->HICUMcollCIBaseBIPtr) += Iciei_Vbici; + *(here->HICUMemitEICollCIPtr) += Iciei_Vbici; + *(here->HICUMcollCICollCIPtr) += -Iciei_Vbici; + *(here->HICUMemitEIBaseBIPtr) += -Iciei_Vbici; + if (model->HICUMnqs) { + *(here->HICUMcollCIXf2Ptr) += Iciei_Vxf2; + *(here->HICUMemitEIXf2Ptr) += -Iciei_Vxf2; + } + + +// Stamp element: Ibpci + *(here->HICUMbaseBPBaseBPPtr) += Ibpci_Vbpci; + *(here->HICUMcollCICollCIPtr) += Ibpci_Vbpci; + *(here->HICUMbaseBPCollCIPtr) += -Ibpci_Vbpci; + *(here->HICUMcollCIBaseBPPtr) += -Ibpci_Vbpci; + +// Stamp element: Rcx + *(here->HICUMcollCollPtr) += Icic_Vcic; + *(here->HICUMcollCICollCIPtr) += Icic_Vcic; + *(here->HICUMcollCICollPtr) += -Icic_Vcic; + *(here->HICUMcollCollCIPtr) += -Icic_Vcic; + +// Stamp element: Rbx + *(here->HICUMbaseBasePtr) += Ibbp_Vbbp; + *(here->HICUMbaseBPBaseBPPtr) += Ibbp_Vbbp; + *(here->HICUMbaseBPBasePtr) += -Ibbp_Vbbp; + *(here->HICUMbaseBaseBPPtr) += -Ibbp_Vbbp; + +// Stamp element: Re + *(here->HICUMemitEmitPtr) += Ieie_Veie; + *(here->HICUMemitEIEmitEIPtr) += Ieie_Veie; + *(here->HICUMemitEIEmitPtr) += -Ieie_Veie; + *(here->HICUMemitEmitEIPtr) += -Ieie_Veie; + +// Stamp element: Ibpbi + if (here->HICUMrbi>0.0) { + *(here->HICUMbaseBPBaseBPPtr) += Ibpbi_Vbpbi; + *(here->HICUMbaseBIBaseBIPtr) += Ibpbi_Vbpbi; + *(here->HICUMbaseBPBaseBIPtr) += -Ibpbi_Vbpbi; + *(here->HICUMbaseBIBaseBPPtr) += -Ibpbi_Vbpbi; + *(here->HICUMbaseBPBaseBIPtr) += Ibpbi_Vbiei; + *(here->HICUMbaseBIEmitEIPtr) += Ibpbi_Vbiei; + *(here->HICUMbaseBPEmitEIPtr) += -Ibpbi_Vbiei; + *(here->HICUMbaseBIBaseBIPtr) += -Ibpbi_Vbiei; + *(here->HICUMbaseBPBaseBIPtr) += Ibpbi_Vbici; + *(here->HICUMbaseBICollCIPtr) += Ibpbi_Vbici; + *(here->HICUMbaseBPCollCIPtr) += -Ibpbi_Vbici; + *(here->HICUMbaseBIBaseBIPtr) += -Ibpbi_Vbici; + }; + +// Stamp element: Isici + *(here->HICUMsubsSISubsSIPtr) += Isici_Vsici; + *(here->HICUMcollCICollCIPtr) += Isici_Vsici; + *(here->HICUMsubsSICollCIPtr) += -Isici_Vsici; + *(here->HICUMcollCISubsSIPtr) += -Isici_Vsici;; + +// Stamp element: Ibpsi + *(here->HICUMbaseBPSubsSIPtr) += Ibpsi_Vsici; + *(here->HICUMsubsSICollCIPtr) += Ibpsi_Vsici; + *(here->HICUMbaseBPCollCIPtr) += -Ibpsi_Vsici; + *(here->HICUMsubsSISubsSIPtr) += -Ibpsi_Vsici; + *(here->HICUMbaseBPBaseBPPtr) += Ibpsi_Vbpci; + *(here->HICUMsubsSICollCIPtr) += Ibpsi_Vbpci; + *(here->HICUMbaseBPCollCIPtr) += -Ibpsi_Vbpci; + *(here->HICUMsubsSIBaseBPPtr) += -Ibpsi_Vbpci;; + +// Stamp element: Rsu + *(here->HICUMsubsSubsPtr) += Isis_Vsis; + *(here->HICUMsubsSISubsSIPtr) += Isis_Vsis; + *(here->HICUMsubsSISubsPtr) += -Isis_Vsis; + *(here->HICUMsubsSubsSIPtr) += -Isis_Vsis; + + if (model->HICUMnqs) { + //Ixf1 + *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbiei; + *(here->HICUMxf1EmitEIPtr) += -Ixf1_Vbiei; + *(here->HICUMxf1BaseBIPtr) += +Ixf1_Vbici; + *(here->HICUMxf1CollCIPtr) += -Ixf1_Vbici; + *(here->HICUMxf1Xf2Ptr) += +Ixf1_Vxf2; + *(here->HICUMxf1Xf1Ptr) += +Ixf1_Vxf1; + //Ixf2 + *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbiei; + *(here->HICUMxf2EmitEIPtr) += -Ixf2_Vbiei; + *(here->HICUMxf2BaseBIPtr) += +Ixf2_Vbici; + *(here->HICUMxf2CollCIPtr) += -Ixf2_Vbici; + *(here->HICUMxf2Xf2Ptr) += +Ixf2_Vxf2; + *(here->HICUMxf2Xf1Ptr) += +Ixf2_Vxf1; + //Ixf + *(here->HICUMxfBaseBIPtr) += +Ixf_Vbiei; + *(here->HICUMxfEmitEIPtr) += -Ixf_Vbiei; + *(here->HICUMxfBaseBIPtr) += +Ixf_Vbici; + *(here->HICUMxfCollCIPtr) += -Ixf_Vbici; + *(here->HICUMxfXfPtr) += +Ixf_Vxf; + } + +//////////////////////////////////// +////////// The complex part ////// +//////////////////////////////////// + + //Qrbi + XQrbi_Vbpbi = *(ckt->CKTstate0 + here->HICUMcqrbi); + XQrbi_Vbiei = here->HICUMqrbi_Vbiei; + XQrbi_Vbici = here->HICUMqrbi_Vbici; + XQrbi_Vrth = here->HICUMqrbi_Vrth; + //Qjei + XQjei_Vbiei = *(ckt->CKTstate0 + here->HICUMcqjei); + XQjei_Vrth = here->HICUMqjei_Vrth; + //Qf + XQf_Vbiei = *(ckt->CKTstate0 + here->HICUMcqf); + XQf_Vbici = here->HICUMqf_Vbici; + XQf_Vrth = here->HICUMqf_Vrth; + XQf_Vxf = here->HICUMqf_Vxf; + //Qr + XQr_Vbici = *(ckt->CKTstate0 + here->HICUMcqr); + XQr_Vbiei = here->HICUMqr_Vbiei; + XQr_Vrth = here->HICUMqr_Vrth; + //Qjci + XQjci_Vbici = *(ckt->CKTstate0 + here->HICUMcqjci); + XQjci_Vrth = here->HICUMqjci_Vrth; + //Qjep + XQjep_Vbpei = *(ckt->CKTstate0 + here->HICUMcqjep); + XQjep_Vrth = here->HICUMqjep_Vrth; + //Qjcx_i + Xqjcx0_t_i_Vbci = *(ckt->CKTstate0 + here->HICUMcqcx0_t_i); + Xqjcx0_t_i_Vrth = here->HICUMqjcx0_i_Vrth; + //Qjcx_ii + Xqjcx0_t_ii_Vbpci = *(ckt->CKTstate0 + here->HICUMcqcx0_t_ii); + Xqjcx0_t_ii_Vrth = here->HICUMqjcx0_ii_Vrth; + //Qdsu + XQdsu_Vbpci = *(ckt->CKTstate0 + here->HICUMcqdsu); + XQdsu_Vsici = here->HICUMqdsu_Vsici; + XQdsu_Vrth = here->HICUMqdsu_Vrth; + //Qjs + XQjs_Vsici = *(ckt->CKTstate0 + here->HICUMcqjs); + XQjs_Vrth = here->HICUMqjs_Vrth; + //Qscp + XQscp_Vsc = *(ckt->CKTstate0 + here->HICUMcqscp); + XQscp_Vrth = here->HICUMqscp_Vrth; + //Qbepar1 + XQbepar1_Vbe = *(ckt->CKTstate0 + here->HICUMcqbepar1); + //Qbepar2 + XQbepar2_Vbpe = *(ckt->CKTstate0 + here->HICUMcqbepar2); + //Qbcpar1 + XQbcpar1_Vbci = *(ckt->CKTstate0 + here->HICUMcqbcpar1); + //Qbcpar2 + XQbcpar2_Vbpci = *(ckt->CKTstate0 + here->HICUMcqbcpar2); + //Qsu + XQsu_Vsis = *(ckt->CKTstate0 + here->HICUMcqsu); + //Qcth + XQcth_Vrth = *(ckt->CKTstate0 + here->HICUMcqcth); + //Qxf + XQxf_Vxf = *(ckt->CKTstate0 + here->HICUMcqxf); + XQxf1_Vxf1 = *(ckt->CKTstate0 + here->HICUMcqxf1); + XQxf2_Vxf2 = *(ckt->CKTstate0 + here->HICUMcqxf2); + + //Qrbi f_bp=+ f_bi=- + if (here->HICUMrbi>0.0) { + *(here->HICUMbaseBPBaseBPPtr + 1) += XQrbi_Vbpbi*(s->imag); + *(here->HICUMbaseBPBaseBPPtr ) += XQrbi_Vbpbi*(s->real); + *(here->HICUMbaseBIBaseBIPtr + 1) += XQrbi_Vbpbi*(s->imag); + *(here->HICUMbaseBIBaseBIPtr ) += XQrbi_Vbpbi*(s->real); + *(here->HICUMbaseBPBaseBIPtr + 1) += -XQrbi_Vbpbi*(s->imag); + *(here->HICUMbaseBPBaseBIPtr ) += -XQrbi_Vbpbi*(s->real); + *(here->HICUMbaseBIBaseBPPtr + 1) += -XQrbi_Vbpbi*(s->imag); + *(here->HICUMbaseBIBaseBPPtr ) += -XQrbi_Vbpbi*(s->real); + *(here->HICUMbaseBPBaseBIPtr + 1) += XQrbi_Vbiei*(s->imag); + *(here->HICUMbaseBPBaseBIPtr ) += XQrbi_Vbiei*(s->real); + *(here->HICUMbaseBIEmitEIPtr + 1) += XQrbi_Vbiei*(s->imag); + *(here->HICUMbaseBIEmitEIPtr ) += XQrbi_Vbiei*(s->real); + *(here->HICUMbaseBPEmitEIPtr + 1) += -XQrbi_Vbiei*(s->imag); + *(here->HICUMbaseBPEmitEIPtr ) += -XQrbi_Vbiei*(s->real); + *(here->HICUMbaseBIBaseBIPtr + 1) += -XQrbi_Vbiei*(s->imag); + *(here->HICUMbaseBIBaseBIPtr ) += -XQrbi_Vbiei*(s->real); + *(here->HICUMbaseBPBaseBIPtr + 1) += XQrbi_Vbici*(s->imag); + *(here->HICUMbaseBPBaseBIPtr ) += XQrbi_Vbici*(s->real); + *(here->HICUMbaseBICollCIPtr + 1) += XQrbi_Vbici*(s->imag); + *(here->HICUMbaseBICollCIPtr ) += XQrbi_Vbici*(s->real); + *(here->HICUMbaseBPCollCIPtr + 1) += -XQrbi_Vbici*(s->imag); + *(here->HICUMbaseBPCollCIPtr ) += -XQrbi_Vbici*(s->real); + *(here->HICUMbaseBIBaseBIPtr + 1) += -XQrbi_Vbici*(s->imag); + *(here->HICUMbaseBIBaseBIPtr ) += -XQrbi_Vbici*(s->real); + }; + //Qjei + *(here->HICUMbaseBIBaseBIPtr + 1) += XQjei_Vbiei*(s->imag); + *(here->HICUMbaseBIBaseBIPtr ) += XQjei_Vbiei*(s->real); + *(here->HICUMemitEIEmitEIPtr + 1) += XQjei_Vbiei*(s->imag); + *(here->HICUMemitEIEmitEIPtr ) += XQjei_Vbiei*(s->real); + *(here->HICUMbaseBIEmitEIPtr + 1) += -XQjei_Vbiei*(s->imag); + *(here->HICUMbaseBIEmitEIPtr ) += -XQjei_Vbiei*(s->real); + *(here->HICUMemitEIBaseBIPtr + 1) += -XQjei_Vbiei*(s->imag); + *(here->HICUMemitEIBaseBIPtr ) += -XQjei_Vbiei*(s->real); + //Qf f_Bi=+ f_Ei =- + *(here->HICUMbaseBIBaseBIPtr +1) += XQf_Vbiei*(s->imag); + *(here->HICUMbaseBIBaseBIPtr) += XQf_Vbiei*(s->real); + *(here->HICUMemitEIEmitEIPtr +1) += XQf_Vbiei*(s->imag); + *(here->HICUMemitEIEmitEIPtr) += XQf_Vbiei*(s->real); + *(here->HICUMbaseBIEmitEIPtr +1) += -XQf_Vbiei*(s->imag); + *(here->HICUMbaseBIEmitEIPtr) += -XQf_Vbiei*(s->real); + *(here->HICUMemitEIBaseBIPtr +1) += -XQf_Vbiei*(s->imag); + *(here->HICUMemitEIBaseBIPtr) += -XQf_Vbiei*(s->real); + *(here->HICUMbaseBIBaseBIPtr +1) += XQf_Vbici*(s->imag); + *(here->HICUMbaseBIBaseBIPtr) += XQf_Vbici*(s->real); + *(here->HICUMemitEICollCIPtr +1) += XQf_Vbici*(s->imag); + *(here->HICUMemitEICollCIPtr) += XQf_Vbici*(s->real); + *(here->HICUMbaseBICollCIPtr +1) += -XQf_Vbici*(s->imag); + *(here->HICUMbaseBICollCIPtr) += -XQf_Vbici*(s->real); + *(here->HICUMemitEIBaseBIPtr +1) += -XQf_Vbici*(s->imag); + *(here->HICUMemitEIBaseBIPtr) += -XQf_Vbici*(s->real); + if (model->HICUMnqs) { + *(here->HICUMbaseBIXfPtr +1) += XQf_Vxf*(s->imag); + *(here->HICUMbaseBIXfPtr ) += XQf_Vxf*(s->real); + *(here->HICUMemitEIXfPtr +1) += -XQf_Vxf*(s->imag); + *(here->HICUMemitEIXfPtr ) += -XQf_Vxf*(s->real); + } + //Qjci + *(here->HICUMbaseBIBaseBIPtr +1) += XQjci_Vbici*(s->imag); + *(here->HICUMbaseBIBaseBIPtr) += XQjci_Vbici*(s->real); + *(here->HICUMcollCICollCIPtr +1) += XQjci_Vbici*(s->imag); + *(here->HICUMcollCICollCIPtr) += XQjci_Vbici*(s->real); + *(here->HICUMcollCIBaseBIPtr +1) += -XQjci_Vbici*(s->imag); + *(here->HICUMcollCIBaseBIPtr) += -XQjci_Vbici*(s->real); + *(here->HICUMbaseBICollCIPtr +1) += -XQjci_Vbici*(s->imag); + *(here->HICUMbaseBICollCIPtr) += -XQjci_Vbici*(s->real); + //Qr f_bi = + f_ci=- + *(here->HICUMbaseBIBaseBIPtr +1) += XQr_Vbici*(s->imag); + *(here->HICUMbaseBIBaseBIPtr) += XQr_Vbici*(s->real); + *(here->HICUMcollCICollCIPtr +1) += XQr_Vbici*(s->imag); + *(here->HICUMcollCICollCIPtr) += XQr_Vbici*(s->real); + *(here->HICUMcollCIBaseBIPtr +1) += -XQr_Vbici*(s->imag); + *(here->HICUMcollCIBaseBIPtr) += -XQr_Vbici*(s->real); + *(here->HICUMbaseBICollCIPtr +1) += -XQr_Vbici*(s->imag); + *(here->HICUMbaseBICollCIPtr) += -XQr_Vbici*(s->real); + *(here->HICUMbaseBIBaseBIPtr +1) += XQr_Vbiei*(s->imag); + *(here->HICUMbaseBIBaseBIPtr) += XQr_Vbiei*(s->real); + *(here->HICUMcollCIEmitEIPtr +1) += XQr_Vbiei*(s->imag); + *(here->HICUMcollCIEmitEIPtr) += XQr_Vbiei*(s->real); + *(here->HICUMcollCIBaseBIPtr +1) += -XQr_Vbiei*(s->imag); + *(here->HICUMcollCIBaseBIPtr) += -XQr_Vbiei*(s->real); + *(here->HICUMbaseBIEmitEIPtr +1) += -XQr_Vbiei*(s->imag); + *(here->HICUMbaseBIEmitEIPtr) += -XQr_Vbiei*(s->real); + //Qjep + *(here->HICUMbaseBPBaseBPPtr +1) += XQjep_Vbpei*(s->imag); + *(here->HICUMbaseBPBaseBPPtr) += XQjep_Vbpei*(s->real); + *(here->HICUMemitEIEmitEIPtr +1) += XQjep_Vbpei*(s->imag); + *(here->HICUMemitEIEmitEIPtr) += XQjep_Vbpei*(s->real); + *(here->HICUMbaseBPEmitEIPtr +1) += -XQjep_Vbpei*(s->imag); + *(here->HICUMbaseBPEmitEIPtr) += -XQjep_Vbpei*(s->real); + *(here->HICUMemitEIBaseBPPtr +1) += -XQjep_Vbpei*(s->imag); + *(here->HICUMemitEIBaseBPPtr) += -XQjep_Vbpei*(s->real); + //Qjcx_i + *(here->HICUMbaseBasePtr +1) += Xqjcx0_t_i_Vbci*(s->imag); + *(here->HICUMbaseBasePtr) += Xqjcx0_t_i_Vbci*(s->real); + *(here->HICUMcollCICollCIPtr +1) += Xqjcx0_t_i_Vbci*(s->imag); + *(here->HICUMcollCICollCIPtr) += Xqjcx0_t_i_Vbci*(s->real); + *(here->HICUMbaseCollCIPtr +1) += -Xqjcx0_t_i_Vbci*(s->imag); + *(here->HICUMbaseCollCIPtr) += -Xqjcx0_t_i_Vbci*(s->real); + *(here->HICUMcollCIBasePtr +1) += -Xqjcx0_t_i_Vbci*(s->imag); + *(here->HICUMcollCIBasePtr) += -Xqjcx0_t_i_Vbci*(s->real); + //Qjcx_ii + *(here->HICUMbaseBPBaseBPPtr +1) += Xqjcx0_t_ii_Vbpci*(s->imag); + *(here->HICUMbaseBPBaseBPPtr) += Xqjcx0_t_ii_Vbpci*(s->real); + *(here->HICUMcollCICollCIPtr +1) += Xqjcx0_t_ii_Vbpci*(s->imag); + *(here->HICUMcollCICollCIPtr) += Xqjcx0_t_ii_Vbpci*(s->real); + *(here->HICUMbaseBPCollCIPtr +1) += -Xqjcx0_t_ii_Vbpci*(s->imag); + *(here->HICUMbaseBPCollCIPtr) += -Xqjcx0_t_ii_Vbpci*(s->real); + *(here->HICUMcollCIBaseBPPtr +1) += -Xqjcx0_t_ii_Vbpci*(s->imag); + *(here->HICUMcollCIBaseBPPtr) += -Xqjcx0_t_ii_Vbpci*(s->real); + //Qdsu f_bp=+ f_ci=- + *(here->HICUMbaseBPBaseBPPtr +1) += XQdsu_Vbpci*(s->imag); + *(here->HICUMbaseBPBaseBPPtr) += XQdsu_Vbpci*(s->real); + *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vbpci*(s->imag); + *(here->HICUMcollCICollCIPtr) += XQdsu_Vbpci*(s->real); + *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vbpci*(s->imag); + *(here->HICUMbaseBPCollCIPtr) += -XQdsu_Vbpci*(s->real); + *(here->HICUMcollCIBaseBPPtr +1) += -XQdsu_Vbpci*(s->imag); + *(here->HICUMcollCIBaseBPPtr) += -XQdsu_Vbpci*(s->real); + *(here->HICUMbaseBPSubsSIPtr +1) += XQdsu_Vsici*(s->imag); + *(here->HICUMbaseBPSubsSIPtr) += XQdsu_Vsici*(s->real); + *(here->HICUMcollCICollCIPtr +1) += XQdsu_Vsici*(s->imag); + *(here->HICUMcollCICollCIPtr) += XQdsu_Vsici*(s->real); + *(here->HICUMbaseBPCollCIPtr +1) += -XQdsu_Vsici*(s->imag); + *(here->HICUMbaseBPCollCIPtr) += -XQdsu_Vsici*(s->real); + *(here->HICUMcollCISubsSIPtr +1) += -XQdsu_Vsici*(s->imag); + *(here->HICUMcollCISubsSIPtr) += -XQdsu_Vsici*(s->real); + //Qjs + *(here->HICUMsubsSISubsSIPtr +1) += XQjs_Vsici*(s->imag); + *(here->HICUMsubsSISubsSIPtr) += XQjs_Vsici*(s->real); + *(here->HICUMcollCICollCIPtr +1) += XQjs_Vsici*(s->imag); + *(here->HICUMcollCICollCIPtr) += XQjs_Vsici*(s->real); + *(here->HICUMsubsSICollCIPtr +1) += -XQjs_Vsici*(s->imag); + *(here->HICUMsubsSICollCIPtr) += -XQjs_Vsici*(s->real); + *(here->HICUMcollCISubsSIPtr +1) += -XQjs_Vsici*(s->imag); + *(here->HICUMcollCISubsSIPtr) += -XQjs_Vsici*(s->real); + //Qscp + *(here->HICUMsubsSubsPtr + 1) += XQscp_Vsc*(s->imag); + *(here->HICUMsubsSubsPtr ) += XQscp_Vsc*(s->real); + *(here->HICUMcollCollPtr + 1) += XQscp_Vsc*(s->imag); + *(here->HICUMcollCollPtr ) += XQscp_Vsc*(s->real); + *(here->HICUMcollSubsPtr + 1) += -XQscp_Vsc*(s->imag); + *(here->HICUMcollSubsPtr ) += -XQscp_Vsc*(s->real); + *(here->HICUMsubsCollPtr + 1) += -XQscp_Vsc*(s->imag); + *(here->HICUMsubsCollPtr ) += -XQscp_Vsc*(s->real); + //Qbepar1 + *(here->HICUMbaseBasePtr + 1) += XQbepar1_Vbe*(s->imag); + *(here->HICUMbaseBasePtr ) += XQbepar1_Vbe*(s->real); + *(here->HICUMemitEmitPtr + 1) += XQbepar1_Vbe*(s->imag); + *(here->HICUMemitEmitPtr ) += XQbepar1_Vbe*(s->real); + *(here->HICUMbaseEmitPtr + 1) += -XQbepar1_Vbe*(s->imag); + *(here->HICUMbaseEmitPtr ) += -XQbepar1_Vbe*(s->real); + *(here->HICUMemitBasePtr + 1) += -XQbepar1_Vbe*(s->imag); + *(here->HICUMemitBasePtr ) += -XQbepar1_Vbe*(s->real); + //Qbepar2 + *(here->HICUMbaseBPBaseBPPtr + 1) += XQbepar2_Vbpe*(s->imag); + *(here->HICUMbaseBPBaseBPPtr ) += XQbepar2_Vbpe*(s->real); + *(here->HICUMemitEmitPtr + 1) += XQbepar2_Vbpe*(s->imag); + *(here->HICUMemitEmitPtr ) += XQbepar2_Vbpe*(s->real); + *(here->HICUMemitBaseBPPtr + 1) += -XQbepar2_Vbpe*(s->imag); + *(here->HICUMemitBaseBPPtr ) += -XQbepar2_Vbpe*(s->real); + *(here->HICUMbaseBPEmitPtr + 1) += -XQbepar2_Vbpe*(s->imag); + *(here->HICUMbaseBPEmitPtr ) += -XQbepar2_Vbpe*(s->real); + //Qbcpar1 + *(here->HICUMbaseBasePtr + 1) += XQbcpar1_Vbci*(s->imag); + *(here->HICUMbaseBasePtr ) += XQbcpar1_Vbci*(s->real); + *(here->HICUMcollCICollCIPtr + 1) += XQbcpar1_Vbci*(s->imag); + *(here->HICUMcollCICollCIPtr ) += XQbcpar1_Vbci*(s->real); + *(here->HICUMbaseCollCIPtr + 1) += -XQbcpar1_Vbci*(s->imag); + *(here->HICUMbaseCollCIPtr ) += -XQbcpar1_Vbci*(s->real); + *(here->HICUMcollCIBasePtr + 1) += -XQbcpar1_Vbci*(s->imag); + *(here->HICUMcollCIBasePtr ) += -XQbcpar1_Vbci*(s->real); + //Qbcpar2 + *(here->HICUMbaseBPBaseBPPtr +1) += XQbcpar2_Vbpci*(s->imag); + *(here->HICUMbaseBPBaseBPPtr) += XQbcpar2_Vbpci*(s->real); + *(here->HICUMcollCICollCIPtr +1) += XQbcpar2_Vbpci*(s->imag); + *(here->HICUMcollCICollCIPtr) += XQbcpar2_Vbpci*(s->real); + *(here->HICUMbaseBPCollCIPtr +1) += -XQbcpar2_Vbpci*(s->imag); + *(here->HICUMbaseBPCollCIPtr) += -XQbcpar2_Vbpci*(s->real); + *(here->HICUMcollCIBaseBPPtr +1) += -XQbcpar2_Vbpci*(s->imag); + *(here->HICUMcollCIBaseBPPtr) += -XQbcpar2_Vbpci*(s->real); + //Qsu + *(here->HICUMsubsSubsPtr + 1) += XQsu_Vsis*(s->imag); + *(here->HICUMsubsSubsPtr ) += XQsu_Vsis*(s->real); + *(here->HICUMsubsSISubsSIPtr + 1) += XQsu_Vsis*(s->imag); + *(here->HICUMsubsSISubsSIPtr ) += XQsu_Vsis*(s->real); + *(here->HICUMsubsSISubsPtr + 1) += -XQsu_Vsis*(s->imag); + *(here->HICUMsubsSISubsPtr ) += -XQsu_Vsis*(s->real); + *(here->HICUMsubsSubsSIPtr + 1) += -XQsu_Vsis*(s->imag); + *(here->HICUMsubsSubsSIPtr ) += -XQsu_Vsis*(s->real); + if (model->HICUMnqs) { + //Qxf1 + *(here->HICUMxf1Xf1Ptr + 1) += +XQxf1_Vxf1*(s->imag); + *(here->HICUMxf1Xf1Ptr) += +XQxf1_Vxf1*(s->real); + //Qxf2 + *(here->HICUMxf2Xf2Ptr + 1) += +XQxf2_Vxf2*(s->imag); + *(here->HICUMxf2Xf2Ptr ) += +XQxf2_Vxf2*(s->real); + //Qxf + *(here->HICUMxfXfPtr + 1) += +XQxf_Vxf*(s->imag); + *(here->HICUMxfXfPtr ) += +XQxf_Vxf*(s->real); + } + + // Stamps with SH + if (model->HICUMselfheat) { +// Stamp element: Ibiei f_Bi = + f_Ei = - + *(here->HICUMbaseBItempPtr) += Ibiei_Vrth; + *(here->HICUMemitEItempPtr) += -Ibiei_Vrth; +// Stamp element: Ibpei f_Bp = + f_Ei = - + // with respect to Potential Vrth + *(here->HICUMbaseBPtempPtr) += Ibpei_Vrth; + *(here->HICUMemitEItempPtr) += -Ibpei_Vrth; +// Stamp element: Ibici f_Bi = + f_Ci = - + *(here->HICUMbaseBItempPtr) += Ibici_Vrth; + *(here->HICUMcollCItempPtr) += -Ibici_Vrth; +// Stamp element: Iciei f_Ci = + f_Ei = - + *(here->HICUMcollCItempPtr) += Iciei_Vrth; + *(here->HICUMemitEItempPtr) += -Iciei_Vrth; +// Stamp element: Ibpci f_Bp = + f_Ci = - + *(here->HICUMbaseBPtempPtr) += Ibpci_Vrth; + *(here->HICUMcollCItempPtr) += -Ibpci_Vrth; +// Stamp element: Rcx f_Ci = + f_C = - + *(here->HICUMcollCItempPtr) += Icic_Vrth; + *(here->HICUMcollTempPtr) += -Icic_Vrth; +// Stamp element: Rbx f_B = + f_Bp = - + *(here->HICUMbaseTempPtr) += Ibbp_Vrth; + *(here->HICUMbaseBPtempPtr) += -Ibbp_Vrth; +// Stamp element: Re f_Ei = + f_E = - + *(here->HICUMemitEItempPtr) += Ieie_Vrth; + *(here->HICUMemitTempPtr) += -Ieie_Vrth; + if (here->HICUMrbi>0.0) { +// Stamp element: Rbi f_Bp = + f_Bi = - + *(here->HICUMbaseBPtempPtr) += Ibpbi_Vrth; + *(here->HICUMbaseBItempPtr) += -Ibpbi_Vrth; + }; +// Stamp element: Isici f_Si = + f_Ci = - + *(here->HICUMsubsSItempPtr) += Isici_Vrth; + *(here->HICUMcollCItempPtr) += -Isici_Vrth; +// Branch: bpsi, Stamp element: Its + *(here->HICUMbaseBPtempPtr) += Ibpsi_Vrth; + *(here->HICUMsubsSItempPtr) += -Ibpsi_Vrth; + if (model->HICUMnqs) { + // Stamp element: Ixf f_xf = + + *(here->HICUMxfTempPtr) += Ixf_Vrth; + // Stamp element: Ixf1 f_xf1 = + + *(here->HICUMxf1TempPtr) += Ixf1_Vrth; + // Stamp element: Ixf2 f_xf2 = + + *(here->HICUMxf2TempPtr) += Ixf2_Vrth; + } + +// Stamp element: Rth f_T = + + *(here->HICUMtempTempPtr) += Irth_Vrth; + +// Stamp element: Ith f_T = - Ith + // with respect to Potential Vrth + *(here->HICUMtempTempPtr) += -Ith_Vrth; + // with respect to Potential Vbiei + *(here->HICUMtempBaseBIPtr) += -Ith_Vbiei; + *(here->HICUMtempEmitEIPtr) += +Ith_Vbiei; + // with respect to Potential Vbici + *(here->HICUMtempBaseBIPtr) += -Ith_Vbici; + *(here->HICUMtempCollCIPtr) += +Ith_Vbici; + // with respect to Potential Vciei + *(here->HICUMtempCollCIPtr) += -Ith_Vciei; + *(here->HICUMtempEmitEIPtr) += +Ith_Vciei; + // with respect to Potential Vbpei + *(here->HICUMtempBaseBPPtr) += -Ith_Vbpei; + *(here->HICUMtempEmitEIPtr) += +Ith_Vbpei; + // with respect to Potential Vbpci + *(here->HICUMtempBaseBPPtr) += -Ith_Vbpci; + *(here->HICUMtempCollCIPtr) += +Ith_Vbpci; + // with respect to Potential Vsici + *(here->HICUMtempSubsSIPtr) += -Ith_Vsici; + *(here->HICUMtempCollCIPtr) += +Ith_Vsici; + // with respect to Potential Vbpbi + *(here->HICUMtempBaseBPPtr) += -Ith_Vbpbi; + *(here->HICUMtempBaseBIPtr) += +Ith_Vbpbi; + // with respect to Potential Vcic + *(here->HICUMtempCollCIPtr) += -Ith_Vcic; + *(here->HICUMtempCollPtr) += +Ith_Vcic; + // with respect to Potential Vbbp + *(here->HICUMtempBasePtr) += -Ith_Vbbp; + *(here->HICUMtempBaseBPPtr) += +Ith_Vbbp; + // with respect to Potential Veie + *(here->HICUMtempEmitEIPtr) += -Ith_Veie; + *(here->HICUMtempEmitPtr) += +Ith_Veie; + + //the charges + *(here->HICUMbaseBItempPtr + 1) += +XQrbi_Vrth*(s->imag); + *(here->HICUMbaseBItempPtr ) += +XQrbi_Vrth*(s->real); + *(here->HICUMbaseBPtempPtr + 1) += -XQrbi_Vrth*(s->imag); + *(here->HICUMbaseBPtempPtr ) += -XQrbi_Vrth*(s->real); + *(here->HICUMbaseBItempPtr + 1) += +XQjei_Vrth*(s->imag); + *(here->HICUMbaseBItempPtr ) += +XQjei_Vrth*(s->real); + *(here->HICUMemitEItempPtr + 1) += -XQjei_Vrth*(s->imag); + *(here->HICUMemitEItempPtr ) += -XQjei_Vrth*(s->real); + *(here->HICUMbaseBItempPtr + 1) += +XQf_Vrth*(s->imag); + *(here->HICUMbaseBItempPtr ) += +XQf_Vrth*(s->real); + *(here->HICUMemitEItempPtr + 1) += -XQf_Vrth*(s->imag); + *(here->HICUMemitEItempPtr ) += -XQf_Vrth*(s->real); + *(here->HICUMbaseBItempPtr + 1) += +XQr_Vrth*(s->imag); + *(here->HICUMbaseBItempPtr ) += +XQr_Vrth*(s->real); + *(here->HICUMcollCItempPtr + 1) += -XQr_Vrth*(s->imag); + *(here->HICUMcollCItempPtr ) += -XQr_Vrth*(s->real); + *(here->HICUMbaseBItempPtr + 1) += +XQjci_Vrth*(s->imag); + *(here->HICUMbaseBItempPtr ) += +XQjci_Vrth*(s->real); + *(here->HICUMcollCItempPtr + 1) += -XQjci_Vrth*(s->imag); + *(here->HICUMcollCItempPtr ) += -XQjci_Vrth*(s->real); + *(here->HICUMbaseBPtempPtr + 1) += +XQjep_Vrth*(s->imag); + *(here->HICUMbaseBPtempPtr ) += +XQjep_Vrth*(s->real); + *(here->HICUMemitEItempPtr + 1) += -XQjep_Vrth*(s->imag); + *(here->HICUMemitEItempPtr ) += -XQjep_Vrth*(s->real); + *(here->HICUMbaseTempPtr + 1) += +Xqjcx0_t_i_Vrth*(s->imag); + *(here->HICUMbaseTempPtr ) += +Xqjcx0_t_i_Vrth*(s->real); + *(here->HICUMcollCItempPtr + 1) += -Xqjcx0_t_i_Vrth*(s->imag); + *(here->HICUMcollCItempPtr ) += -Xqjcx0_t_i_Vrth*(s->real); + *(here->HICUMbaseBPtempPtr + 1) += +Xqjcx0_t_ii_Vrth*(s->imag); + *(here->HICUMbaseBPtempPtr ) += +Xqjcx0_t_ii_Vrth*(s->real); + *(here->HICUMcollCItempPtr + 1) += -Xqjcx0_t_ii_Vrth*(s->imag); + *(here->HICUMcollCItempPtr ) += -Xqjcx0_t_ii_Vrth*(s->real); + *(here->HICUMbaseBPtempPtr + 1) += +XQdsu_Vrth*(s->imag); + *(here->HICUMbaseBPtempPtr ) += +XQdsu_Vrth*(s->real); + *(here->HICUMcollCItempPtr + 1) += -XQdsu_Vrth*(s->imag); + *(here->HICUMcollCItempPtr ) += -XQdsu_Vrth*(s->real); + *(here->HICUMsubsSItempPtr + 1) += +XQjs_Vrth*(s->imag); + *(here->HICUMsubsSItempPtr ) += +XQjs_Vrth*(s->real); + *(here->HICUMcollCItempPtr + 1) += -XQjs_Vrth*(s->imag); + *(here->HICUMcollCItempPtr ) += -XQjs_Vrth*(s->real); + *(here->HICUMsubsTempPtr + 1) += +XQscp_Vrth*(s->imag); + *(here->HICUMsubsTempPtr ) += +XQscp_Vrth*(s->real); + *(here->HICUMcollTempPtr + 1) += -XQscp_Vrth*(s->imag); + *(here->HICUMcollTempPtr ) += -XQscp_Vrth*(s->real); + *(here->HICUMtempTempPtr + 1) += +XQcth_Vrth*(s->imag); + *(here->HICUMtempTempPtr ) += +XQcth_Vrth*(s->real); + + } + + } + } + return(OK); +} diff --git a/src/spicelib/devices/hicum2/hicum2setup.c b/src/spicelib/devices/hicum2/hicum2setup.c index 24c7ccd58..4bcab408f 100644 --- a/src/spicelib/devices/hicum2/hicum2setup.c +++ b/src/spicelib/devices/hicum2/hicum2setup.c @@ -1,868 +1,868 @@ -/********** -License : 3-clause BSD -Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden -**********/ - -/* - * This routine should only be called when circuit topology - * changes, since its computations do not depend on most - * device or model parameters, only on topology (as - * affected by emitter, collector, and base resistances) - */ - -#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" - -int -HICUMsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) - /* load the HICUM structure with those pointers needed later - * for fast matrix loading - */ -{ - HICUMmodel *model = (HICUMmodel*)inModel; - HICUMinstance *here; - int error; - CKTnode *tmp; - - /* loop through all the transistor models */ - for( ; model != NULL; model = HICUMnextModel(model)) { - -//Circuit simulator specific parameters - if(model->HICUMtype != NPN && model->HICUMtype != PNP) - model->HICUMtype = NPN; - - if(!model->HICUMtnomGiven) - model->HICUMtnom = ckt->CKTnomTemp; - - if (!model->HICUMversionGiven) - model->HICUMversion = copy("2.4.0"); - -//Transfer current - if(!model->HICUMc10Given) - model->HICUMc10 = 2e-30; - - if(!model->HICUMqp0Given) - model->HICUMqp0 = 2e-14; - - if(!model->HICUMichGiven) - model->HICUMich = 0.0; - - if(!model->HICUMhf0Given) - model->HICUMhf0 = 1.0; - - if(!model->HICUMhfeGiven) - model->HICUMhfe = 1.0; - - if(!model->HICUMhfcGiven) - model->HICUMhfc = 1.0; - - if(!model->HICUMhjeiGiven) - model->HICUMhjei = 1.0; - - if(!model->HICUMahjeiGiven) - model->HICUMahjei = 0.0; - - if(!model->HICUMrhjeiGiven) - model->HICUMrhjei = 1.0; - - if(!model->HICUMhjciGiven) - model->HICUMhjci = 1.0; - -//Base-Emitter diode; - if(!model->HICUMibeisGiven) - model->HICUMibeis = 1e-18; - - if(!model->HICUMmbeiGiven) - model->HICUMmbei = 1.0; - - if(!model->HICUMireisGiven) - model->HICUMireis = 0.0; - - if(!model->HICUMmreiGiven) - model->HICUMmrei = 2.0; - - if(!model->HICUMibepsGiven) - model->HICUMibeps = 0.0; - - if(!model->HICUMmbepGiven) - model->HICUMmbep = 1.0; - - if(!model->HICUMirepsGiven) - model->HICUMireps = 0.0; - - if(!model->HICUMmrepGiven) - model->HICUMmrep = 2.0; - - if(!model->HICUMmcfGiven) - model->HICUMmcf = 1.0; - -//Transit time for excess recombination current at b-c barrier - if(!model->HICUMtbhrecGiven) - model->HICUMtbhrec = 0.0; - -//Base-Collector diode currents - if(!model->HICUMibcisGiven) - model->HICUMibcis = 1e-16; - - if(!model->HICUMmbciGiven) - model->HICUMmbci = 1.0; - - if(!model->HICUMibcxsGiven) - model->HICUMibcxs = 0.0; - - if(!model->HICUMmbcxGiven) - model->HICUMmbcx = 1.0; - -//Base-Emitter tunneling current - if(!model->HICUMibetsGiven) - model->HICUMibets = 0.0; - - if(!model->HICUMabetGiven) - model->HICUMabet = 40.0; - - if(!model->HICUMtunodeGiven) - model->HICUMtunode = 1; - -//Base-Collector avalanche current - if(!model->HICUMfavlGiven) - model->HICUMfavl = 0.0; - - if(!model->HICUMqavlGiven) - model->HICUMqavl = 0.0; - - if(!model->HICUMkavlGiven) - model->HICUMkavl = 0.0; - - if(!model->HICUMalfavGiven) - model->HICUMalfav = 0.0; - - if(!model->HICUMalqavGiven) - model->HICUMalqav = 0.0; - - if(!model->HICUMalkavGiven) - model->HICUMalkav = 0.0; - -//Series resistances - if(!model->HICUMrbi0Given) - model->HICUMrbi0 = 0.0; - - if(!model->HICUMrbxGiven) - model->HICUMrbx = 0.0; - - if(!model->HICUMfgeoGiven) - model->HICUMfgeo = 0.6557; - - if(!model->HICUMfdqr0Given) - model->HICUMfdqr0 = 0.0; - - if(!model->HICUMfcrbiGiven) - model->HICUMfcrbi = 0.0; - - if(!model->HICUMfqiGiven) - model->HICUMfqi = 1.0; - - if(!model->HICUMreGiven) - model->HICUMre = 0.0; - - if(!model->HICUMrcxGiven) - model->HICUMrcx = 0.0; - -//Substrate transistor - if(!model->HICUMitssGiven) - model->HICUMitss = 0.0; - - if(!model->HICUMmsfGiven) - model->HICUMmsf = 1.0; - - if(!model->HICUMiscsGiven) - model->HICUMiscs = 0.0; - - if(!model->HICUMmscGiven) - model->HICUMmsc = 1.0; - - if(!model->HICUMtsfGiven) - model->HICUMtsf = 0.0; - -//Intra-device substrate coupling - if(!model->HICUMrsuGiven) - model->HICUMrsu = 0.0; - - if(!model->HICUMcsuGiven) - model->HICUMcsu = 0.0; - -//Depletion Capacitances - if(!model->HICUMcjei0Given) - model->HICUMcjei0 = 1.0e-20; - - if(!model->HICUMvdeiGiven) - model->HICUMvdei = 0.9; - - if(!model->HICUMzeiGiven) - model->HICUMzei = 0.5; - - if(!model->HICUMajeiGiven) - model->HICUMajei = 2.5; - - if(!model->HICUMcjep0Given) - model->HICUMcjep0 = 1.0e-20; - - if(!model->HICUMvdepGiven) - model->HICUMvdep = 0.9; - - if(!model->HICUMzepGiven) - model->HICUMzep = 0.5; - - if(!model->HICUMajepGiven) - model->HICUMajep = 2.5; - - if(!model->HICUMcjci0Given) - model->HICUMcjci0 = 1.0e-20; - - if(!model->HICUMvdciGiven) - model->HICUMvdci = 0.7; - - if(!model->HICUMzciGiven) - model->HICUMzci = 0.4; - - if(!model->HICUMvptciGiven) - model->HICUMvptci = 100.0; - - if(!model->HICUMcjcx0Given) - model->HICUMcjcx0 = 1.0e-20; - - if(!model->HICUMvdcxGiven) - model->HICUMvdcx = 0.7; - - if(!model->HICUMzcxGiven) - model->HICUMzcx = 0.4; - - if(!model->HICUMvptcxGiven) - model->HICUMvptcx = 100.0; - - if(!model->HICUMfbcparGiven) - model->HICUMfbcpar = 0.0; - - if(!model->HICUMfbeparGiven) - model->HICUMfbepar = 1.0; - - if(!model->HICUMcjs0Given) - model->HICUMcjs0 = 0.0; - - if(!model->HICUMvdsGiven) - model->HICUMvds = 0.6; - - if(!model->HICUMzsGiven) - model->HICUMzs = 0.5; - - if(!model->HICUMvptsGiven) - model->HICUMvpts = 100.0; - - if(!model->HICUMcscp0Given) - model->HICUMcscp0 = 0.0; - - if(!model->HICUMvdspGiven) - model->HICUMvdsp = 0.6; - - if(!model->HICUMzspGiven) - model->HICUMzsp = 0.5; - - if(!model->HICUMvptspGiven) - model->HICUMvptsp = 100.0; - -//Diffusion Capacitances - if(!model->HICUMt0Given) - model->HICUMt0 = 0.0; - - if(!model->HICUMdt0hGiven) - model->HICUMdt0h = 0.0; - - if(!model->HICUMtbvlGiven) - model->HICUMtbvl = 0.0; - - if(!model->HICUMtef0Given) - model->HICUMtef0 = 0.0; - - if(!model->HICUMgtfeGiven) - model->HICUMgtfe = 1.0; - - if(!model->HICUMthcsGiven) - model->HICUMthcs = 0.0; - - if(!model->HICUMahcGiven) - model->HICUMahc = 0.1; - - if(!model->HICUMfthcGiven) - model->HICUMfthc = 0.0; - - if(!model->HICUMrci0Given) - model->HICUMrci0 = 150; - - if(!model->HICUMvlimGiven) - model->HICUMvlim = 0.5; - - if(!model->HICUMvcesGiven) - model->HICUMvces = 0.1; - - if(!model->HICUMvptGiven) - model->HICUMvpt = 100.0; - - if(!model->HICUMaickGiven) - model->HICUMaick = 1.0e-03; - - if(!model->HICUMdelckGiven) - model->HICUMdelck = 2.0; - - if(!model->HICUMtrGiven) - model->HICUMtr = 0.0; - - if(!model->HICUMvcbarGiven) - model->HICUMvcbar = 0.0; - - if(!model->HICUMicbarGiven) - model->HICUMicbar = 0.0; - - if(!model->HICUMacbarGiven) - model->HICUMacbar = 0.01; - -//Isolation Capacitances - if(!model->HICUMcbeparGiven) - model->HICUMcbepar = 0.0; - - if(!model->HICUMcbcparGiven) - model->HICUMcbcpar = 0.0; - -//Non-quasi-static Effect - if(!model->HICUMalqfGiven) - model->HICUMalqf = 0.167; - - if(!model->HICUMalitGiven) - model->HICUMalit = 0.333; - - if(!model->HICUMflnqsGiven) - model->HICUMflnqs = 0; - -//Noise - if(!model->HICUMkfGiven) - model->HICUMkf = 0.0; - - if(!model->HICUMafGiven) - model->HICUMaf = 2.0; - - if(!model->HICUMcfbeGiven) - model->HICUMcfbe = -1; - - if(!model->HICUMflconoGiven) - model->HICUMflcono = 0; - - if(!model->HICUMkfreGiven) - model->HICUMkfre = 0.0; - - if(!model->HICUMafreGiven) - model->HICUMafre = 2.0; - -//Lateral Geometry Scaling (at high current densities) - if(!model->HICUMlatbGiven) - model->HICUMlatb = 0.0; - - if(!model->HICUMlatlGiven) - model->HICUMlatl = 0.0; - -//Temperature dependence - if(!model->HICUMvgbGiven) - model->HICUMvgb = 1.17; - - if(!model->HICUMalt0Given) - model->HICUMalt0 = 0.0; - - if(!model->HICUMkt0Given) - model->HICUMkt0 = 0.0; - - if(!model->HICUMzetaciGiven) - model->HICUMzetaci = 0.0; - - if(!model->HICUMalvsGiven) - model->HICUMalvs = 0.0; - - if(!model->HICUMalcesGiven) - model->HICUMalces = 0.0; - - if(!model->HICUMzetarbiGiven) - model->HICUMzetarbi = 0.0; - - if(!model->HICUMzetarbxGiven) - model->HICUMzetarbx = 0.0; - - if(!model->HICUMzetarcxGiven) - model->HICUMzetarcx = 0.0; - - if(!model->HICUMzetareGiven) - model->HICUMzetare = 0.0; - - if(!model->HICUMzetacxGiven) - model->HICUMzetacx = 1.0; - - if(!model->HICUMvgeGiven) - model->HICUMvge = 1.17; - - if(!model->HICUMvgcGiven) - model->HICUMvgc = 1.17; - - if(!model->HICUMvgsGiven) - model->HICUMvgs = 1.17; - - if(!model->HICUMf1vgGiven) - model->HICUMf1vg = -1.02377e-4; - - if(!model->HICUMf2vgGiven) - model->HICUMf2vg = 4.3215e-4; - - if(!model->HICUMzetactGiven) - model->HICUMzetact = 3.0; - - if(!model->HICUMzetabetGiven) - model->HICUMzetabet = 3.5; - - if(!model->HICUMalbGiven) - model->HICUMalb = 0.0; - - if(!model->HICUMdvgbeGiven) - model->HICUMdvgbe = 0.0; - - if(!model->HICUMzetahjeiGiven) - model->HICUMzetahjei = 1.0; - - if(!model->HICUMzetavgbeGiven) - model->HICUMzetavgbe = 1.0; - -//Self-Heating - if(!model->HICUMflshGiven) - model->HICUMflsh = 0; - - if(!model->HICUMrthGiven) - model->HICUMrth = 0.0; - - if(!model->HICUMzetarthGiven) - model->HICUMzetarth = 0.0; - - if(!model->HICUMalrthGiven) - model->HICUMalrth = 0.0; - - if(!model->HICUMcthGiven) - model->HICUMcth = 0.0; - - if((model->HICUMrthGiven) && (model->HICUMcth < 1e-12)) - model->HICUMcth = 1e-12; - -//Compatibility with V2.1 - if(!model->HICUMflcompGiven) - model->HICUMflcomp = 0.0; - - if(!model->HICUMvbeMaxGiven) - model->HICUMvbeMax = 1e99; - - if(!model->HICUMvbcMaxGiven) - model->HICUMvbcMax = 1e99; - - if(!model->HICUMvceMaxGiven) - model->HICUMvceMax = 1e99; - - model->HICUMselfheat = (((model->HICUMflsh == 1) || (model->HICUMflsh == 2)) && (model->HICUMrthGiven) && (model->HICUMrth > 0.0)); - model->HICUMnqs = ((model->HICUMflnqs != 0 || model->HICUMflcomp < 2.3) && (model->HICUMt0Given) && (model->HICUMt0 > 0.0) && (model->HICUMalit > 0 || model->HICUMalqf > 0)); - - /* loop through all the instances of the model */ - for (here = HICUMinstances(model); here != NULL ; - here=HICUMnextInstance(here)) { - CKTnode *tmpNode; - IFuid tmpName; - - if(!here->HICUMareaGiven) { - here->HICUMarea = 1.0; - } - if(!here->HICUMmGiven) { - here->HICUMm = 1.0; - } - if(!here->HICUMdtempGiven) { - here->HICUMdtemp = 0.0; - } - - // Warning: - // The scaling with HICUMm and HICUMarea is done here from model to here variables in order to save memory. - // Classical spice scaling with "area" is implemented, but it is not recommended to be used. If you want - // scaling, more sophisticated expressions should be used. Those can be found in modern PDKs or should be - // provided by modeling engineers. - // For discrete devices, the multiplication factor "m" should give reasonable results. - // - // The HICUMm device multiplicaton factor can be exected to give good results. - // The following variables need scaling in HICUM: - // IT : qp0 ~ (area m)**2 qp0 ~ area m icbar ~ area m - // BE junction: cjei0 ~ area m cjep0 ~ m - // ibeis ~ area m ibeps ~ m - // cbepar ~ m -> area scaling not reasonable - // BC junction: cjci0 ~ area m cjcx0 ~ m - // ibcis ~ area m ibcxs ~ m - // ireis ~ area m ireps ~ m - // cbcpar ~ m -> area scaling not reasonable - // qavl ~ area m - // re ~1/(area*m) - // rci0 ~1/(area*m) - // rbx ~1/(area*m) -> assume that scaling with "area" is due to lE0 increase - // rcx ~1/(area*m) -> assume that scaling with "area" is due to lE0 increase - // rbi0 ~1/(area*m) -> assume that scaling with "area" is due to lE0 increase - // rth ~1/(area*m) -> bad assumption, but more transistor geometry needs to be known for accurate scaling - // cth ~ area*m -> bad assumption, but more transistor geometry needs to be known for accurate scaling - // Substrate related parameters not scaled on purpose. This is very geometry dependent? - - double area_times_m = here->HICUMm*here->HICUMarea; - //IT - here->HICUMqp0_scaled = model->HICUMqp0 * area_times_m; - here->HICUMc10_scaled = model->HICUMc10 * area_times_m*area_times_m; - here->HICUMicbar_scaled = model->HICUMicbar * area_times_m; - here->HICUMrth_scaled = model->HICUMrth / area_times_m; //very poor assumption - here->HICUMcth_scaled = model->HICUMcth * area_times_m; //very poor assumption - //BE junction - here->HICUMcjei0_scaled = model->HICUMcjei0 * area_times_m; - here->HICUMibeis_scaled = model->HICUMibeis * area_times_m; - here->HICUMireis_scaled = model->HICUMireis * area_times_m; - here->HICUMibeps_scaled = model->HICUMibeps * here->HICUMm; - here->HICUMireps_scaled = model->HICUMireps * here->HICUMm; - here->HICUMcjep0_scaled = model->HICUMcjep0 * here->HICUMm; - here->HICUMcbepar_scaled = model->HICUMcbepar * here->HICUMm; - here->HICUMibets_scaled = model->HICUMibets * area_times_m; - //BC junction - here->HICUMibcis_scaled = model->HICUMibcis * area_times_m; - here->HICUMcjci0_scaled = model->HICUMcjci0 * area_times_m; - here->HICUMcjcx0_scaled = model->HICUMcjcx0 * here->HICUMm; - here->HICUMcbcpar_scaled = model->HICUMcbcpar * here->HICUMm; - here->HICUMibcxs_scaled = model->HICUMibcxs * here->HICUMm; - here->HICUMqavl_scaled = model->HICUMqavl * area_times_m; - //resistances - here->HICUMre_scaled = model->HICUMre / area_times_m; - here->HICUMrci0_scaled = model->HICUMrci0 / area_times_m; - here->HICUMrbx_scaled = model->HICUMrbx / area_times_m; - here->HICUMrcx_scaled = model->HICUMrcx / area_times_m; - here->HICUMrbi0_scaled = model->HICUMrbi0 / area_times_m; - //noise - here->HICUMkf_scaled = model->HICUMkf * pow(here->HICUMm, (1-model->HICUMaf)); - here->HICUMkfre_scaled = model->HICUMkfre * pow(here->HICUMm, (1-model->HICUMafre)); - - here->HICUMstate = *states; - *states += HICUMnumStates; - - if(model->HICUMrcx == 0) { - here->HICUMcollCINode = here->HICUMcollNode; - } else if(here->HICUMcollCINode == 0) { - error = CKTmkVolt(ckt,&tmp,here->HICUMname,"collCI"); - if(error) return(error); - here->HICUMcollCINode = tmp->number; - if (ckt->CKTcopyNodesets) { - if (CKTinst2Node(ckt,here,1,&tmpNode,&tmpName)==OK) { - if (tmpNode->nsGiven) { - tmp->nodeset=tmpNode->nodeset; - tmp->nsGiven=tmpNode->nsGiven; - } - } - } - } - if(model->HICUMrbx == 0) { - here->HICUMbaseBPNode = here->HICUMbaseNode; - } else if(here->HICUMbaseBPNode == 0){ - error = CKTmkVolt(ckt,&tmp,here->HICUMname, "baseBP"); - if(error) return(error); - here->HICUMbaseBPNode = tmp->number; - if (ckt->CKTcopyNodesets) { - if (CKTinst2Node(ckt,here,2,&tmpNode,&tmpName)==OK) { - if (tmpNode->nsGiven) { - tmp->nodeset=tmpNode->nodeset; - tmp->nsGiven=tmpNode->nsGiven; - } - } - } - } - if(model->HICUMre == 0) { - here->HICUMemitEINode = here->HICUMemitNode; - } else if(here->HICUMemitEINode == 0) { - error = CKTmkVolt(ckt,&tmp,here->HICUMname, "emitEI"); - if(error) return(error); - here->HICUMemitEINode = tmp->number; - if (ckt->CKTcopyNodesets) { - if (CKTinst2Node(ckt,here,3,&tmpNode,&tmpName)==OK) { - if (tmpNode->nsGiven) { - tmp->nodeset=tmpNode->nodeset; - tmp->nsGiven=tmpNode->nsGiven; - } - } - } - } - if(model->HICUMrsu == 0) { - here->HICUMsubsSINode = here->HICUMsubsNode; - } else if(here->HICUMsubsSINode == 0) { - error = CKTmkVolt(ckt,&tmp,here->HICUMname, "subsSI"); - if(error) return(error); - here->HICUMsubsSINode = tmp->number; - if (ckt->CKTcopyNodesets) { - if (CKTinst2Node(ckt,here,4,&tmpNode,&tmpName)==OK) { - if (tmpNode->nsGiven) { - tmp->nodeset=tmpNode->nodeset; - tmp->nsGiven=tmpNode->nsGiven; - } - } - } - } - if(model->HICUMrbi0 == 0) { - here->HICUMbaseBINode = here->HICUMbaseBPNode; - } else if(here->HICUMbaseBINode == 0) { - error = CKTmkVolt(ckt, &tmp, here->HICUMname, "baseBI"); - if(error) return(error); - here->HICUMbaseBINode = tmp->number; - if (ckt->CKTcopyNodesets) { - if (CKTinst2Node(ckt,here,5,&tmpNode,&tmpName)==OK) { - if (tmpNode->nsGiven) { - tmp->nodeset=tmpNode->nodeset; - tmp->nsGiven=tmpNode->nsGiven; - } - } - } - } - - if (model->HICUMselfheat) { - if (here->HICUMtempNode == 0) { // no external node for temperature - error = CKTmkVolt(ckt,&tmp,here->HICUMname,"dT"); // create internal node - if (error) return(error); - here->HICUMtempNode = tmp->number; - } - } else { - if (here->HICUMtempNode > 0) { // external temp node is given, but no she parameter - here->HICUMtempNode = 0; - } - } - - if (model->HICUMnqs) { - if(here->HICUMxfNode == 0) { - error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf"); - if(error) return(error); - here->HICUMxfNode = tmp->number; - } - if(here->HICUMxf1Node == 0) { - error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf1"); - if(error) return(error); - here->HICUMxf1Node = tmp->number; - } - if(here->HICUMxf2Node == 0) { - error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf2"); - if(error) return(error); - here->HICUMxf2Node = tmp->number; - } - } else { - here->HICUMxfNode = 0; - here->HICUMxf1Node = 0; - here->HICUMxf2Node = 0; - } - -/* macro to make elements with built in test for out of memory */ -#define TSTALLOC(ptr,first,second) \ -do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ - return(E_NOMEM);\ -} } while(0) - TSTALLOC(HICUMcollCollPtr,HICUMcollNode,HICUMcollNode); - TSTALLOC(HICUMbaseBasePtr,HICUMbaseNode,HICUMbaseNode); - TSTALLOC(HICUMemitEmitPtr,HICUMemitNode,HICUMemitNode); - TSTALLOC(HICUMsubsSubsPtr,HICUMsubsNode,HICUMsubsNode); - - TSTALLOC(HICUMcollCICollCIPtr,HICUMcollCINode,HICUMcollCINode); - TSTALLOC(HICUMbaseBIBaseBIPtr,HICUMbaseBINode,HICUMbaseBINode); - TSTALLOC(HICUMemitEIEmitEIPtr,HICUMemitEINode,HICUMemitEINode); - TSTALLOC(HICUMbaseBPBaseBPPtr,HICUMbaseBPNode,HICUMbaseBPNode); - TSTALLOC(HICUMsubsSISubsSIPtr,HICUMsubsSINode,HICUMsubsSINode); - - TSTALLOC(HICUMbaseEmitPtr,HICUMbaseNode,HICUMemitNode); //b-e - TSTALLOC(HICUMemitBasePtr,HICUMemitNode,HICUMbaseNode); //e-b - - TSTALLOC(HICUMbaseBaseBPPtr,HICUMbaseNode,HICUMbaseBPNode); //b-bp - TSTALLOC(HICUMbaseBPBasePtr,HICUMbaseBPNode,HICUMbaseNode); //bp-b - TSTALLOC(HICUMemitEmitEIPtr,HICUMemitNode,HICUMemitEINode); //e-ei - TSTALLOC(HICUMemitEIEmitPtr,HICUMemitEINode,HICUMemitNode); //ei-e - - TSTALLOC(HICUMsubsSubsSIPtr,HICUMsubsNode,HICUMsubsSINode); //s-si - TSTALLOC(HICUMsubsSISubsPtr,HICUMsubsSINode,HICUMsubsNode); //si-s - - TSTALLOC(HICUMcollCIBasePtr,HICUMcollCINode,HICUMbaseNode); //b-ci - TSTALLOC(HICUMbaseCollCIPtr,HICUMbaseNode,HICUMcollCINode); //ci-b - - TSTALLOC(HICUMcollCIEmitEIPtr,HICUMcollCINode,HICUMemitEINode); //ci-ei - TSTALLOC(HICUMemitEICollCIPtr,HICUMemitEINode,HICUMcollCINode); //ei-ci - - TSTALLOC(HICUMbaseBPBaseBIPtr,HICUMbaseBPNode,HICUMbaseBINode); //bp-bi - TSTALLOC(HICUMbaseBIBaseBPPtr,HICUMbaseBINode,HICUMbaseBPNode); //bi-bp - - TSTALLOC(HICUMbaseBPEmitEIPtr,HICUMbaseBPNode,HICUMemitEINode); //bp-ei - TSTALLOC(HICUMemitEIBaseBPPtr,HICUMemitEINode,HICUMbaseBPNode); //ei-bp - - TSTALLOC(HICUMbaseBPEmitPtr,HICUMbaseBPNode,HICUMemitNode); //bp-e - TSTALLOC(HICUMemitBaseBPPtr,HICUMemitNode,HICUMbaseBPNode); //e-bp - - TSTALLOC(HICUMbaseBPSubsSIPtr,HICUMbaseBPNode,HICUMsubsSINode); //bp-si - TSTALLOC(HICUMsubsSIBaseBPPtr,HICUMsubsSINode,HICUMbaseBPNode); //si-bp - - TSTALLOC(HICUMbaseBIEmitEIPtr,HICUMbaseBINode,HICUMemitEINode); //ei-bi - TSTALLOC(HICUMemitEIBaseBIPtr,HICUMemitEINode,HICUMbaseBINode); //bi-ei - if (model->HICUMnqs) { - TSTALLOC(HICUMbaseBIXfPtr ,HICUMbaseBINode,HICUMxfNode); //bi - xf - TSTALLOC(HICUMemitEIXfPtr ,HICUMemitEINode,HICUMxfNode); //ei - xf - } - - TSTALLOC(HICUMbaseBICollCIPtr,HICUMbaseBINode,HICUMcollCINode); //ci-bi - TSTALLOC(HICUMcollCIBaseBIPtr,HICUMcollCINode,HICUMbaseBINode); //bi-ci - - TSTALLOC(HICUMbaseBPCollCIPtr,HICUMbaseBPNode,HICUMcollCINode); //bp-ci - TSTALLOC(HICUMcollCIBaseBPPtr,HICUMcollCINode,HICUMbaseBPNode); //ci-bp - - TSTALLOC(HICUMsubsSICollCIPtr,HICUMsubsSINode,HICUMcollCINode); //si-ci - TSTALLOC(HICUMcollCISubsSIPtr,HICUMcollCINode,HICUMsubsSINode); //ci-si - - TSTALLOC(HICUMcollCICollPtr,HICUMcollCINode,HICUMcollNode); //ci-c - TSTALLOC(HICUMcollCollCIPtr,HICUMcollNode,HICUMcollCINode); //c-ci - - TSTALLOC(HICUMsubsCollPtr,HICUMsubsNode,HICUMcollNode); //s-c - TSTALLOC(HICUMcollSubsPtr,HICUMcollNode,HICUMsubsNode); //c-s - - if (model->HICUMnqs) { - TSTALLOC(HICUMxf1Xf1Ptr ,HICUMxf1Node ,HICUMxf1Node); - TSTALLOC(HICUMxf1BaseBIPtr,HICUMxf1Node ,HICUMbaseBINode); - TSTALLOC(HICUMxf1EmitEIPtr,HICUMxf1Node ,HICUMemitEINode); - TSTALLOC(HICUMxf1CollCIPtr,HICUMxf1Node ,HICUMcollCINode); - TSTALLOC(HICUMxf1Xf2Ptr ,HICUMxf1Node ,HICUMxf2Node); - - TSTALLOC(HICUMxf2Xf1Ptr ,HICUMxf2Node ,HICUMxf1Node); - TSTALLOC(HICUMxf2BaseBIPtr,HICUMxf2Node ,HICUMbaseBINode); - TSTALLOC(HICUMxf2EmitEIPtr,HICUMxf2Node ,HICUMemitEINode); - TSTALLOC(HICUMxf2CollCIPtr,HICUMxf2Node ,HICUMcollCINode); - TSTALLOC(HICUMxf2Xf2Ptr ,HICUMxf2Node ,HICUMxf2Node); - TSTALLOC(HICUMemitEIXf2Ptr,HICUMemitEINode,HICUMxf2Node); - TSTALLOC(HICUMcollCIXf2Ptr,HICUMcollCINode,HICUMxf2Node); - - TSTALLOC(HICUMxfXfPtr ,HICUMxfNode,HICUMxfNode); - TSTALLOC(HICUMxfEmitEIPtr ,HICUMxfNode,HICUMemitEINode); - TSTALLOC(HICUMxfCollCIPtr ,HICUMxfNode,HICUMcollCINode); - TSTALLOC(HICUMxfBaseBIPtr ,HICUMxfNode,HICUMbaseBINode); - - } - - if (model->HICUMselfheat) { - TSTALLOC(HICUMcollTempPtr, HICUMcollNode, HICUMtempNode); - TSTALLOC(HICUMbaseTempPtr,HICUMbaseNode,HICUMtempNode); - TSTALLOC(HICUMemitTempPtr,HICUMemitNode,HICUMtempNode); - - TSTALLOC(HICUMcollCItempPtr,HICUMcollCINode,HICUMtempNode); - TSTALLOC(HICUMbaseBItempPtr,HICUMbaseBINode,HICUMtempNode); - TSTALLOC(HICUMbaseBPtempPtr,HICUMbaseBPNode,HICUMtempNode); - TSTALLOC(HICUMemitEItempPtr,HICUMemitEINode,HICUMtempNode); - TSTALLOC(HICUMsubsSItempPtr,HICUMsubsSINode,HICUMtempNode); - TSTALLOC(HICUMsubsTempPtr ,HICUMsubsNode ,HICUMtempNode); - TSTALLOC(HICUMcollTempPtr ,HICUMcollNode ,HICUMtempNode); - - TSTALLOC(HICUMtempCollPtr,HICUMtempNode,HICUMcollNode); - TSTALLOC(HICUMtempBasePtr,HICUMtempNode,HICUMbaseNode); - TSTALLOC(HICUMtempEmitPtr,HICUMtempNode,HICUMemitNode); - - TSTALLOC(HICUMtempCollCIPtr,HICUMtempNode,HICUMcollCINode); - TSTALLOC(HICUMtempBaseBIPtr,HICUMtempNode,HICUMbaseBINode); - TSTALLOC(HICUMtempBaseBPPtr,HICUMtempNode,HICUMbaseBPNode); - TSTALLOC(HICUMtempEmitEIPtr,HICUMtempNode,HICUMemitEINode); - TSTALLOC(HICUMtempSubsSIPtr,HICUMtempNode,HICUMsubsSINode); - - TSTALLOC(HICUMtempTempPtr,HICUMtempNode,HICUMtempNode); - - if (model->HICUMnqs) { - TSTALLOC(HICUMxfTempPtr ,HICUMxfNode,HICUMtempNode); - TSTALLOC(HICUMxf2TempPtr ,HICUMxf2Node ,HICUMtempNode); - TSTALLOC(HICUMxf1TempPtr ,HICUMxf1Node ,HICUMtempNode); - } - } - } - } - return(OK); -} - -int -HICUMunsetup( - GENmodel *inModel, - CKTcircuit *ckt) -{ - HICUMmodel *model; - HICUMinstance *here; - - for (model = (HICUMmodel *)inModel; model != NULL; - model = HICUMnextModel(model)) - { - - for (here = HICUMinstances(model); here != NULL; - here=HICUMnextInstance(here)) - { - if (here->HICUMcollCINode > 0 - && here->HICUMcollCINode != here->HICUMcollNode) - CKTdltNNum(ckt, here->HICUMcollCINode); - here->HICUMcollCINode = 0; - - if (here->HICUMbaseBINode > 0 - && here->HICUMbaseBPNode != here->HICUMbaseBINode) - CKTdltNNum(ckt, here->HICUMbaseBINode); - here->HICUMbaseBINode = 0; - - if (here->HICUMbaseBPNode > 0 - && here->HICUMbaseBPNode != here->HICUMbaseNode) - CKTdltNNum(ckt, here->HICUMbaseBPNode); - here->HICUMbaseBPNode = 0; - - if (here->HICUMemitEINode > 0 - && here->HICUMemitEINode != here->HICUMemitNode) - CKTdltNNum(ckt, here->HICUMemitEINode); - here->HICUMemitEINode = 0; - - if (here->HICUMsubsSINode > 0 - && here->HICUMsubsSINode != here->HICUMsubsNode) - CKTdltNNum(ckt, here->HICUMsubsSINode); - here->HICUMsubsSINode = 0; - - if (model->HICUMselfheat) { - if (here->HICUMtempNode > 6) { // it is an internal node - CKTdltNNum(ckt, here->HICUMtempNode); - here->HICUMtempNode = 0; - } - } - - if (model->HICUMnqs) { - - if(here->HICUMxfNode > 0) - CKTdltNNum(ckt, here->HICUMxfNode); - here->HICUMxfNode = 0; - - if(here->HICUMxf1Node > 0) - CKTdltNNum(ckt, here->HICUMxf1Node); - here->HICUMxf1Node = 0; - - if(here->HICUMxf2Node > 0) - CKTdltNNum(ckt, here->HICUMxf2Node); - here->HICUMxf2Node = 0; - } - - } - } - return OK; -} - -int -HICUMmDelete(GENmodel* gen_model) -{ - HICUMmodel* model = (HICUMmodel*)gen_model; - - FREE(model->HICUMversion); - - return OK; -} +/********** +License : 3-clause BSD +Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher +Model Author : (Copyright 1993-2024) Michael Schroter +**********/ + +/* + * This routine should only be called when circuit topology + * changes, since its computations do not depend on most + * device or model parameters, only on topology (as + * affected by emitter, collector, and base resistances) + */ + +#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" + +int +HICUMsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states) + /* load the HICUM structure with those pointers needed later + * for fast matrix loading + */ +{ + HICUMmodel *model = (HICUMmodel*)inModel; + HICUMinstance *here; + int error; + CKTnode *tmp; + + /* loop through all the transistor models */ + for( ; model != NULL; model = HICUMnextModel(model)) { + +//Circuit simulator specific parameters + if(model->HICUMtype != NPN && model->HICUMtype != PNP) + model->HICUMtype = NPN; + + if(!model->HICUMtnomGiven) + model->HICUMtnom = ckt->CKTnomTemp; + + if (!model->HICUMversionGiven) + model->HICUMversion = copy("2.4.0"); + +//Transfer current + if(!model->HICUMc10Given) + model->HICUMc10 = 2e-30; + + if(!model->HICUMqp0Given) + model->HICUMqp0 = 2e-14; + + if(!model->HICUMichGiven) + model->HICUMich = 0.0; + + if(!model->HICUMhf0Given) + model->HICUMhf0 = 1.0; + + if(!model->HICUMhfeGiven) + model->HICUMhfe = 1.0; + + if(!model->HICUMhfcGiven) + model->HICUMhfc = 1.0; + + if(!model->HICUMhjeiGiven) + model->HICUMhjei = 1.0; + + if(!model->HICUMahjeiGiven) + model->HICUMahjei = 0.0; + + if(!model->HICUMrhjeiGiven) + model->HICUMrhjei = 1.0; + + if(!model->HICUMhjciGiven) + model->HICUMhjci = 1.0; + +//Base-Emitter diode; + if(!model->HICUMibeisGiven) + model->HICUMibeis = 1e-18; + + if(!model->HICUMmbeiGiven) + model->HICUMmbei = 1.0; + + if(!model->HICUMireisGiven) + model->HICUMireis = 0.0; + + if(!model->HICUMmreiGiven) + model->HICUMmrei = 2.0; + + if(!model->HICUMibepsGiven) + model->HICUMibeps = 0.0; + + if(!model->HICUMmbepGiven) + model->HICUMmbep = 1.0; + + if(!model->HICUMirepsGiven) + model->HICUMireps = 0.0; + + if(!model->HICUMmrepGiven) + model->HICUMmrep = 2.0; + + if(!model->HICUMmcfGiven) + model->HICUMmcf = 1.0; + +//Transit time for excess recombination current at b-c barrier + if(!model->HICUMtbhrecGiven) + model->HICUMtbhrec = 0.0; + +//Base-Collector diode currents + if(!model->HICUMibcisGiven) + model->HICUMibcis = 1e-16; + + if(!model->HICUMmbciGiven) + model->HICUMmbci = 1.0; + + if(!model->HICUMibcxsGiven) + model->HICUMibcxs = 0.0; + + if(!model->HICUMmbcxGiven) + model->HICUMmbcx = 1.0; + +//Base-Emitter tunneling current + if(!model->HICUMibetsGiven) + model->HICUMibets = 0.0; + + if(!model->HICUMabetGiven) + model->HICUMabet = 40.0; + + if(!model->HICUMtunodeGiven) + model->HICUMtunode = 1; + +//Base-Collector avalanche current + if(!model->HICUMfavlGiven) + model->HICUMfavl = 0.0; + + if(!model->HICUMqavlGiven) + model->HICUMqavl = 0.0; + + if(!model->HICUMkavlGiven) + model->HICUMkavl = 0.0; + + if(!model->HICUMalfavGiven) + model->HICUMalfav = 0.0; + + if(!model->HICUMalqavGiven) + model->HICUMalqav = 0.0; + + if(!model->HICUMalkavGiven) + model->HICUMalkav = 0.0; + +//Series resistances + if(!model->HICUMrbi0Given) + model->HICUMrbi0 = 0.0; + + if(!model->HICUMrbxGiven) + model->HICUMrbx = 0.0; + + if(!model->HICUMfgeoGiven) + model->HICUMfgeo = 0.6557; + + if(!model->HICUMfdqr0Given) + model->HICUMfdqr0 = 0.0; + + if(!model->HICUMfcrbiGiven) + model->HICUMfcrbi = 0.0; + + if(!model->HICUMfqiGiven) + model->HICUMfqi = 1.0; + + if(!model->HICUMreGiven) + model->HICUMre = 0.0; + + if(!model->HICUMrcxGiven) + model->HICUMrcx = 0.0; + +//Substrate transistor + if(!model->HICUMitssGiven) + model->HICUMitss = 0.0; + + if(!model->HICUMmsfGiven) + model->HICUMmsf = 1.0; + + if(!model->HICUMiscsGiven) + model->HICUMiscs = 0.0; + + if(!model->HICUMmscGiven) + model->HICUMmsc = 1.0; + + if(!model->HICUMtsfGiven) + model->HICUMtsf = 0.0; + +//Intra-device substrate coupling + if(!model->HICUMrsuGiven) + model->HICUMrsu = 0.0; + + if(!model->HICUMcsuGiven) + model->HICUMcsu = 0.0; + +//Depletion Capacitances + if(!model->HICUMcjei0Given) + model->HICUMcjei0 = 1.0e-20; + + if(!model->HICUMvdeiGiven) + model->HICUMvdei = 0.9; + + if(!model->HICUMzeiGiven) + model->HICUMzei = 0.5; + + if(!model->HICUMajeiGiven) + model->HICUMajei = 2.5; + + if(!model->HICUMcjep0Given) + model->HICUMcjep0 = 1.0e-20; + + if(!model->HICUMvdepGiven) + model->HICUMvdep = 0.9; + + if(!model->HICUMzepGiven) + model->HICUMzep = 0.5; + + if(!model->HICUMajepGiven) + model->HICUMajep = 2.5; + + if(!model->HICUMcjci0Given) + model->HICUMcjci0 = 1.0e-20; + + if(!model->HICUMvdciGiven) + model->HICUMvdci = 0.7; + + if(!model->HICUMzciGiven) + model->HICUMzci = 0.4; + + if(!model->HICUMvptciGiven) + model->HICUMvptci = 100.0; + + if(!model->HICUMcjcx0Given) + model->HICUMcjcx0 = 1.0e-20; + + if(!model->HICUMvdcxGiven) + model->HICUMvdcx = 0.7; + + if(!model->HICUMzcxGiven) + model->HICUMzcx = 0.4; + + if(!model->HICUMvptcxGiven) + model->HICUMvptcx = 100.0; + + if(!model->HICUMfbcparGiven) + model->HICUMfbcpar = 0.0; + + if(!model->HICUMfbeparGiven) + model->HICUMfbepar = 1.0; + + if(!model->HICUMcjs0Given) + model->HICUMcjs0 = 0.0; + + if(!model->HICUMvdsGiven) + model->HICUMvds = 0.6; + + if(!model->HICUMzsGiven) + model->HICUMzs = 0.5; + + if(!model->HICUMvptsGiven) + model->HICUMvpts = 100.0; + + if(!model->HICUMcscp0Given) + model->HICUMcscp0 = 0.0; + + if(!model->HICUMvdspGiven) + model->HICUMvdsp = 0.6; + + if(!model->HICUMzspGiven) + model->HICUMzsp = 0.5; + + if(!model->HICUMvptspGiven) + model->HICUMvptsp = 100.0; + +//Diffusion Capacitances + if(!model->HICUMt0Given) + model->HICUMt0 = 0.0; + + if(!model->HICUMdt0hGiven) + model->HICUMdt0h = 0.0; + + if(!model->HICUMtbvlGiven) + model->HICUMtbvl = 0.0; + + if(!model->HICUMtef0Given) + model->HICUMtef0 = 0.0; + + if(!model->HICUMgtfeGiven) + model->HICUMgtfe = 1.0; + + if(!model->HICUMthcsGiven) + model->HICUMthcs = 0.0; + + if(!model->HICUMahcGiven) + model->HICUMahc = 0.1; + + if(!model->HICUMfthcGiven) + model->HICUMfthc = 0.0; + + if(!model->HICUMrci0Given) + model->HICUMrci0 = 150; + + if(!model->HICUMvlimGiven) + model->HICUMvlim = 0.5; + + if(!model->HICUMvcesGiven) + model->HICUMvces = 0.1; + + if(!model->HICUMvptGiven) + model->HICUMvpt = 100.0; + + if(!model->HICUMaickGiven) + model->HICUMaick = 1.0e-03; + + if(!model->HICUMdelckGiven) + model->HICUMdelck = 2.0; + + if(!model->HICUMtrGiven) + model->HICUMtr = 0.0; + + if(!model->HICUMvcbarGiven) + model->HICUMvcbar = 0.0; + + if(!model->HICUMicbarGiven) + model->HICUMicbar = 0.0; + + if(!model->HICUMacbarGiven) + model->HICUMacbar = 0.01; + +//Isolation Capacitances + if(!model->HICUMcbeparGiven) + model->HICUMcbepar = 0.0; + + if(!model->HICUMcbcparGiven) + model->HICUMcbcpar = 0.0; + +//Non-quasi-static Effect + if(!model->HICUMalqfGiven) + model->HICUMalqf = 0.167; + + if(!model->HICUMalitGiven) + model->HICUMalit = 0.333; + + if(!model->HICUMflnqsGiven) + model->HICUMflnqs = 0; + +//Noise + if(!model->HICUMkfGiven) + model->HICUMkf = 0.0; + + if(!model->HICUMafGiven) + model->HICUMaf = 2.0; + + if(!model->HICUMcfbeGiven) + model->HICUMcfbe = -1; + + if(!model->HICUMflconoGiven) + model->HICUMflcono = 0; + + if(!model->HICUMkfreGiven) + model->HICUMkfre = 0.0; + + if(!model->HICUMafreGiven) + model->HICUMafre = 2.0; + +//Lateral Geometry Scaling (at high current densities) + if(!model->HICUMlatbGiven) + model->HICUMlatb = 0.0; + + if(!model->HICUMlatlGiven) + model->HICUMlatl = 0.0; + +//Temperature dependence + if(!model->HICUMvgbGiven) + model->HICUMvgb = 1.17; + + if(!model->HICUMalt0Given) + model->HICUMalt0 = 0.0; + + if(!model->HICUMkt0Given) + model->HICUMkt0 = 0.0; + + if(!model->HICUMzetaciGiven) + model->HICUMzetaci = 0.0; + + if(!model->HICUMalvsGiven) + model->HICUMalvs = 0.0; + + if(!model->HICUMalcesGiven) + model->HICUMalces = 0.0; + + if(!model->HICUMzetarbiGiven) + model->HICUMzetarbi = 0.0; + + if(!model->HICUMzetarbxGiven) + model->HICUMzetarbx = 0.0; + + if(!model->HICUMzetarcxGiven) + model->HICUMzetarcx = 0.0; + + if(!model->HICUMzetareGiven) + model->HICUMzetare = 0.0; + + if(!model->HICUMzetacxGiven) + model->HICUMzetacx = 1.0; + + if(!model->HICUMvgeGiven) + model->HICUMvge = 1.17; + + if(!model->HICUMvgcGiven) + model->HICUMvgc = 1.17; + + if(!model->HICUMvgsGiven) + model->HICUMvgs = 1.17; + + if(!model->HICUMf1vgGiven) + model->HICUMf1vg = -1.02377e-4; + + if(!model->HICUMf2vgGiven) + model->HICUMf2vg = 4.3215e-4; + + if(!model->HICUMzetactGiven) + model->HICUMzetact = 3.0; + + if(!model->HICUMzetabetGiven) + model->HICUMzetabet = 3.5; + + if(!model->HICUMalbGiven) + model->HICUMalb = 0.0; + + if(!model->HICUMdvgbeGiven) + model->HICUMdvgbe = 0.0; + + if(!model->HICUMzetahjeiGiven) + model->HICUMzetahjei = 1.0; + + if(!model->HICUMzetavgbeGiven) + model->HICUMzetavgbe = 1.0; + +//Self-Heating + if(!model->HICUMflshGiven) + model->HICUMflsh = 0; + + if(!model->HICUMrthGiven) + model->HICUMrth = 0.0; + + if(!model->HICUMzetarthGiven) + model->HICUMzetarth = 0.0; + + if(!model->HICUMalrthGiven) + model->HICUMalrth = 0.0; + + if(!model->HICUMcthGiven) + model->HICUMcth = 0.0; + + if((model->HICUMrthGiven) && (model->HICUMcth < 1e-12)) + model->HICUMcth = 1e-12; + +//Compatibility with V2.1 + if(!model->HICUMflcompGiven) + model->HICUMflcomp = 0.0; + + if(!model->HICUMvbeMaxGiven) + model->HICUMvbeMax = 1e99; + + if(!model->HICUMvbcMaxGiven) + model->HICUMvbcMax = 1e99; + + if(!model->HICUMvceMaxGiven) + model->HICUMvceMax = 1e99; + + model->HICUMselfheat = (((model->HICUMflsh == 1) || (model->HICUMflsh == 2)) && (model->HICUMrthGiven) && (model->HICUMrth > 0.0)); + model->HICUMnqs = ((model->HICUMflnqs != 0 || model->HICUMflcomp < 2.3) && (model->HICUMt0Given) && (model->HICUMt0 > 0.0) && (model->HICUMalit > 0 || model->HICUMalqf > 0)); + + /* loop through all the instances of the model */ + for (here = HICUMinstances(model); here != NULL ; + here=HICUMnextInstance(here)) { + CKTnode *tmpNode; + IFuid tmpName; + + if(!here->HICUMareaGiven) { + here->HICUMarea = 1.0; + } + if(!here->HICUMmGiven) { + here->HICUMm = 1.0; + } + if(!here->HICUMdtempGiven) { + here->HICUMdtemp = 0.0; + } + + // Warning: + // The scaling with HICUMm and HICUMarea is done here from model to here variables in order to save memory. + // Classical spice scaling with "area" is implemented, but it is not recommended to be used. If you want + // scaling, more sophisticated expressions should be used. Those can be found in modern PDKs or should be + // provided by modeling engineers. + // For discrete devices, the multiplication factor "m" should give reasonable results. + // + // The HICUMm device multiplicaton factor can be exected to give good results. + // The following variables need scaling in HICUM: + // IT : qp0 ~ (area m)**2 qp0 ~ area m icbar ~ area m + // BE junction: cjei0 ~ area m cjep0 ~ m + // ibeis ~ area m ibeps ~ m + // cbepar ~ m -> area scaling not reasonable + // BC junction: cjci0 ~ area m cjcx0 ~ m + // ibcis ~ area m ibcxs ~ m + // ireis ~ area m ireps ~ m + // cbcpar ~ m -> area scaling not reasonable + // qavl ~ area m + // re ~1/(area*m) + // rci0 ~1/(area*m) + // rbx ~1/(area*m) -> assume that scaling with "area" is due to lE0 increase + // rcx ~1/(area*m) -> assume that scaling with "area" is due to lE0 increase + // rbi0 ~1/(area*m) -> assume that scaling with "area" is due to lE0 increase + // rth ~1/(area*m) -> bad assumption, but more transistor geometry needs to be known for accurate scaling + // cth ~ area*m -> bad assumption, but more transistor geometry needs to be known for accurate scaling + // Substrate related parameters not scaled on purpose. This is very geometry dependent? + + double area_times_m = here->HICUMm*here->HICUMarea; + //IT + here->HICUMqp0_scaled = model->HICUMqp0 * area_times_m; + here->HICUMc10_scaled = model->HICUMc10 * area_times_m*area_times_m; + here->HICUMicbar_scaled = model->HICUMicbar * area_times_m; + here->HICUMrth_scaled = model->HICUMrth / area_times_m; //very poor assumption + here->HICUMcth_scaled = model->HICUMcth * area_times_m; //very poor assumption + //BE junction + here->HICUMcjei0_scaled = model->HICUMcjei0 * area_times_m; + here->HICUMibeis_scaled = model->HICUMibeis * area_times_m; + here->HICUMireis_scaled = model->HICUMireis * area_times_m; + here->HICUMibeps_scaled = model->HICUMibeps * here->HICUMm; + here->HICUMireps_scaled = model->HICUMireps * here->HICUMm; + here->HICUMcjep0_scaled = model->HICUMcjep0 * here->HICUMm; + here->HICUMcbepar_scaled = model->HICUMcbepar * here->HICUMm; + here->HICUMibets_scaled = model->HICUMibets * area_times_m; + //BC junction + here->HICUMibcis_scaled = model->HICUMibcis * area_times_m; + here->HICUMcjci0_scaled = model->HICUMcjci0 * area_times_m; + here->HICUMcjcx0_scaled = model->HICUMcjcx0 * here->HICUMm; + here->HICUMcbcpar_scaled = model->HICUMcbcpar * here->HICUMm; + here->HICUMibcxs_scaled = model->HICUMibcxs * here->HICUMm; + here->HICUMqavl_scaled = model->HICUMqavl * area_times_m; + //resistances + here->HICUMre_scaled = model->HICUMre / area_times_m; + here->HICUMrci0_scaled = model->HICUMrci0 / area_times_m; + here->HICUMrbx_scaled = model->HICUMrbx / area_times_m; + here->HICUMrcx_scaled = model->HICUMrcx / area_times_m; + here->HICUMrbi0_scaled = model->HICUMrbi0 / area_times_m; + //noise + here->HICUMkf_scaled = model->HICUMkf * pow(here->HICUMm, (1-model->HICUMaf)); + here->HICUMkfre_scaled = model->HICUMkfre * pow(here->HICUMm, (1-model->HICUMafre)); + + here->HICUMstate = *states; + *states += HICUMnumStates; + + if(model->HICUMrcx == 0) { + here->HICUMcollCINode = here->HICUMcollNode; + } else if(here->HICUMcollCINode == 0) { + error = CKTmkVolt(ckt,&tmp,here->HICUMname,"collCI"); + if(error) return(error); + here->HICUMcollCINode = tmp->number; + if (ckt->CKTcopyNodesets) { + if (CKTinst2Node(ckt,here,1,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + } + if(model->HICUMrbx == 0) { + here->HICUMbaseBPNode = here->HICUMbaseNode; + } else if(here->HICUMbaseBPNode == 0){ + error = CKTmkVolt(ckt,&tmp,here->HICUMname, "baseBP"); + if(error) return(error); + here->HICUMbaseBPNode = tmp->number; + if (ckt->CKTcopyNodesets) { + if (CKTinst2Node(ckt,here,2,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + } + if(model->HICUMre == 0) { + here->HICUMemitEINode = here->HICUMemitNode; + } else if(here->HICUMemitEINode == 0) { + error = CKTmkVolt(ckt,&tmp,here->HICUMname, "emitEI"); + if(error) return(error); + here->HICUMemitEINode = tmp->number; + if (ckt->CKTcopyNodesets) { + if (CKTinst2Node(ckt,here,3,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + } + if(model->HICUMrsu == 0) { + here->HICUMsubsSINode = here->HICUMsubsNode; + } else if(here->HICUMsubsSINode == 0) { + error = CKTmkVolt(ckt,&tmp,here->HICUMname, "subsSI"); + if(error) return(error); + here->HICUMsubsSINode = tmp->number; + if (ckt->CKTcopyNodesets) { + if (CKTinst2Node(ckt,here,4,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + } + if(model->HICUMrbi0 == 0) { + here->HICUMbaseBINode = here->HICUMbaseBPNode; + } else if(here->HICUMbaseBINode == 0) { + error = CKTmkVolt(ckt, &tmp, here->HICUMname, "baseBI"); + if(error) return(error); + here->HICUMbaseBINode = tmp->number; + if (ckt->CKTcopyNodesets) { + if (CKTinst2Node(ckt,here,5,&tmpNode,&tmpName)==OK) { + if (tmpNode->nsGiven) { + tmp->nodeset=tmpNode->nodeset; + tmp->nsGiven=tmpNode->nsGiven; + } + } + } + } + + if (model->HICUMselfheat) { + if (here->HICUMtempNode == 0) { // no external node for temperature + error = CKTmkVolt(ckt,&tmp,here->HICUMname,"dT"); // create internal node + if (error) return(error); + here->HICUMtempNode = tmp->number; + } + } else { + if (here->HICUMtempNode > 0) { // external temp node is given, but no she parameter + here->HICUMtempNode = 0; + } + } + + if (model->HICUMnqs) { + if(here->HICUMxfNode == 0) { + error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf"); + if(error) return(error); + here->HICUMxfNode = tmp->number; + } + if(here->HICUMxf1Node == 0) { + error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf1"); + if(error) return(error); + here->HICUMxf1Node = tmp->number; + } + if(here->HICUMxf2Node == 0) { + error = CKTmkVolt(ckt, &tmp, here->HICUMname, "xf2"); + if(error) return(error); + here->HICUMxf2Node = tmp->number; + } + } else { + here->HICUMxfNode = 0; + here->HICUMxf1Node = 0; + here->HICUMxf2Node = 0; + } + +/* macro to make elements with built in test for out of memory */ +#define TSTALLOC(ptr,first,second) \ +do { if((here->ptr = SMPmakeElt(matrix, here->first, here->second)) == NULL){\ + return(E_NOMEM);\ +} } while(0) + TSTALLOC(HICUMcollCollPtr,HICUMcollNode,HICUMcollNode); + TSTALLOC(HICUMbaseBasePtr,HICUMbaseNode,HICUMbaseNode); + TSTALLOC(HICUMemitEmitPtr,HICUMemitNode,HICUMemitNode); + TSTALLOC(HICUMsubsSubsPtr,HICUMsubsNode,HICUMsubsNode); + + TSTALLOC(HICUMcollCICollCIPtr,HICUMcollCINode,HICUMcollCINode); + TSTALLOC(HICUMbaseBIBaseBIPtr,HICUMbaseBINode,HICUMbaseBINode); + TSTALLOC(HICUMemitEIEmitEIPtr,HICUMemitEINode,HICUMemitEINode); + TSTALLOC(HICUMbaseBPBaseBPPtr,HICUMbaseBPNode,HICUMbaseBPNode); + TSTALLOC(HICUMsubsSISubsSIPtr,HICUMsubsSINode,HICUMsubsSINode); + + TSTALLOC(HICUMbaseEmitPtr,HICUMbaseNode,HICUMemitNode); //b-e + TSTALLOC(HICUMemitBasePtr,HICUMemitNode,HICUMbaseNode); //e-b + + TSTALLOC(HICUMbaseBaseBPPtr,HICUMbaseNode,HICUMbaseBPNode); //b-bp + TSTALLOC(HICUMbaseBPBasePtr,HICUMbaseBPNode,HICUMbaseNode); //bp-b + TSTALLOC(HICUMemitEmitEIPtr,HICUMemitNode,HICUMemitEINode); //e-ei + TSTALLOC(HICUMemitEIEmitPtr,HICUMemitEINode,HICUMemitNode); //ei-e + + TSTALLOC(HICUMsubsSubsSIPtr,HICUMsubsNode,HICUMsubsSINode); //s-si + TSTALLOC(HICUMsubsSISubsPtr,HICUMsubsSINode,HICUMsubsNode); //si-s + + TSTALLOC(HICUMcollCIBasePtr,HICUMcollCINode,HICUMbaseNode); //b-ci + TSTALLOC(HICUMbaseCollCIPtr,HICUMbaseNode,HICUMcollCINode); //ci-b + + TSTALLOC(HICUMcollCIEmitEIPtr,HICUMcollCINode,HICUMemitEINode); //ci-ei + TSTALLOC(HICUMemitEICollCIPtr,HICUMemitEINode,HICUMcollCINode); //ei-ci + + TSTALLOC(HICUMbaseBPBaseBIPtr,HICUMbaseBPNode,HICUMbaseBINode); //bp-bi + TSTALLOC(HICUMbaseBIBaseBPPtr,HICUMbaseBINode,HICUMbaseBPNode); //bi-bp + + TSTALLOC(HICUMbaseBPEmitEIPtr,HICUMbaseBPNode,HICUMemitEINode); //bp-ei + TSTALLOC(HICUMemitEIBaseBPPtr,HICUMemitEINode,HICUMbaseBPNode); //ei-bp + + TSTALLOC(HICUMbaseBPEmitPtr,HICUMbaseBPNode,HICUMemitNode); //bp-e + TSTALLOC(HICUMemitBaseBPPtr,HICUMemitNode,HICUMbaseBPNode); //e-bp + + TSTALLOC(HICUMbaseBPSubsSIPtr,HICUMbaseBPNode,HICUMsubsSINode); //bp-si + TSTALLOC(HICUMsubsSIBaseBPPtr,HICUMsubsSINode,HICUMbaseBPNode); //si-bp + + TSTALLOC(HICUMbaseBIEmitEIPtr,HICUMbaseBINode,HICUMemitEINode); //ei-bi + TSTALLOC(HICUMemitEIBaseBIPtr,HICUMemitEINode,HICUMbaseBINode); //bi-ei + if (model->HICUMnqs) { + TSTALLOC(HICUMbaseBIXfPtr ,HICUMbaseBINode,HICUMxfNode); //bi - xf + TSTALLOC(HICUMemitEIXfPtr ,HICUMemitEINode,HICUMxfNode); //ei - xf + } + + TSTALLOC(HICUMbaseBICollCIPtr,HICUMbaseBINode,HICUMcollCINode); //ci-bi + TSTALLOC(HICUMcollCIBaseBIPtr,HICUMcollCINode,HICUMbaseBINode); //bi-ci + + TSTALLOC(HICUMbaseBPCollCIPtr,HICUMbaseBPNode,HICUMcollCINode); //bp-ci + TSTALLOC(HICUMcollCIBaseBPPtr,HICUMcollCINode,HICUMbaseBPNode); //ci-bp + + TSTALLOC(HICUMsubsSICollCIPtr,HICUMsubsSINode,HICUMcollCINode); //si-ci + TSTALLOC(HICUMcollCISubsSIPtr,HICUMcollCINode,HICUMsubsSINode); //ci-si + + TSTALLOC(HICUMcollCICollPtr,HICUMcollCINode,HICUMcollNode); //ci-c + TSTALLOC(HICUMcollCollCIPtr,HICUMcollNode,HICUMcollCINode); //c-ci + + TSTALLOC(HICUMsubsCollPtr,HICUMsubsNode,HICUMcollNode); //s-c + TSTALLOC(HICUMcollSubsPtr,HICUMcollNode,HICUMsubsNode); //c-s + + if (model->HICUMnqs) { + TSTALLOC(HICUMxf1Xf1Ptr ,HICUMxf1Node ,HICUMxf1Node); + TSTALLOC(HICUMxf1BaseBIPtr,HICUMxf1Node ,HICUMbaseBINode); + TSTALLOC(HICUMxf1EmitEIPtr,HICUMxf1Node ,HICUMemitEINode); + TSTALLOC(HICUMxf1CollCIPtr,HICUMxf1Node ,HICUMcollCINode); + TSTALLOC(HICUMxf1Xf2Ptr ,HICUMxf1Node ,HICUMxf2Node); + + TSTALLOC(HICUMxf2Xf1Ptr ,HICUMxf2Node ,HICUMxf1Node); + TSTALLOC(HICUMxf2BaseBIPtr,HICUMxf2Node ,HICUMbaseBINode); + TSTALLOC(HICUMxf2EmitEIPtr,HICUMxf2Node ,HICUMemitEINode); + TSTALLOC(HICUMxf2CollCIPtr,HICUMxf2Node ,HICUMcollCINode); + TSTALLOC(HICUMxf2Xf2Ptr ,HICUMxf2Node ,HICUMxf2Node); + TSTALLOC(HICUMemitEIXf2Ptr,HICUMemitEINode,HICUMxf2Node); + TSTALLOC(HICUMcollCIXf2Ptr,HICUMcollCINode,HICUMxf2Node); + + TSTALLOC(HICUMxfXfPtr ,HICUMxfNode,HICUMxfNode); + TSTALLOC(HICUMxfEmitEIPtr ,HICUMxfNode,HICUMemitEINode); + TSTALLOC(HICUMxfCollCIPtr ,HICUMxfNode,HICUMcollCINode); + TSTALLOC(HICUMxfBaseBIPtr ,HICUMxfNode,HICUMbaseBINode); + + } + + if (model->HICUMselfheat) { + TSTALLOC(HICUMcollTempPtr, HICUMcollNode, HICUMtempNode); + TSTALLOC(HICUMbaseTempPtr,HICUMbaseNode,HICUMtempNode); + TSTALLOC(HICUMemitTempPtr,HICUMemitNode,HICUMtempNode); + + TSTALLOC(HICUMcollCItempPtr,HICUMcollCINode,HICUMtempNode); + TSTALLOC(HICUMbaseBItempPtr,HICUMbaseBINode,HICUMtempNode); + TSTALLOC(HICUMbaseBPtempPtr,HICUMbaseBPNode,HICUMtempNode); + TSTALLOC(HICUMemitEItempPtr,HICUMemitEINode,HICUMtempNode); + TSTALLOC(HICUMsubsSItempPtr,HICUMsubsSINode,HICUMtempNode); + TSTALLOC(HICUMsubsTempPtr ,HICUMsubsNode ,HICUMtempNode); + TSTALLOC(HICUMcollTempPtr ,HICUMcollNode ,HICUMtempNode); + + TSTALLOC(HICUMtempCollPtr,HICUMtempNode,HICUMcollNode); + TSTALLOC(HICUMtempBasePtr,HICUMtempNode,HICUMbaseNode); + TSTALLOC(HICUMtempEmitPtr,HICUMtempNode,HICUMemitNode); + + TSTALLOC(HICUMtempCollCIPtr,HICUMtempNode,HICUMcollCINode); + TSTALLOC(HICUMtempBaseBIPtr,HICUMtempNode,HICUMbaseBINode); + TSTALLOC(HICUMtempBaseBPPtr,HICUMtempNode,HICUMbaseBPNode); + TSTALLOC(HICUMtempEmitEIPtr,HICUMtempNode,HICUMemitEINode); + TSTALLOC(HICUMtempSubsSIPtr,HICUMtempNode,HICUMsubsSINode); + + TSTALLOC(HICUMtempTempPtr,HICUMtempNode,HICUMtempNode); + + if (model->HICUMnqs) { + TSTALLOC(HICUMxfTempPtr ,HICUMxfNode,HICUMtempNode); + TSTALLOC(HICUMxf2TempPtr ,HICUMxf2Node ,HICUMtempNode); + TSTALLOC(HICUMxf1TempPtr ,HICUMxf1Node ,HICUMtempNode); + } + } + } + } + return(OK); +} + +int +HICUMunsetup( + GENmodel *inModel, + CKTcircuit *ckt) +{ + HICUMmodel *model; + HICUMinstance *here; + + for (model = (HICUMmodel *)inModel; model != NULL; + model = HICUMnextModel(model)) + { + + for (here = HICUMinstances(model); here != NULL; + here=HICUMnextInstance(here)) + { + if (here->HICUMcollCINode > 0 + && here->HICUMcollCINode != here->HICUMcollNode) + CKTdltNNum(ckt, here->HICUMcollCINode); + here->HICUMcollCINode = 0; + + if (here->HICUMbaseBINode > 0 + && here->HICUMbaseBPNode != here->HICUMbaseBINode) + CKTdltNNum(ckt, here->HICUMbaseBINode); + here->HICUMbaseBINode = 0; + + if (here->HICUMbaseBPNode > 0 + && here->HICUMbaseBPNode != here->HICUMbaseNode) + CKTdltNNum(ckt, here->HICUMbaseBPNode); + here->HICUMbaseBPNode = 0; + + if (here->HICUMemitEINode > 0 + && here->HICUMemitEINode != here->HICUMemitNode) + CKTdltNNum(ckt, here->HICUMemitEINode); + here->HICUMemitEINode = 0; + + if (here->HICUMsubsSINode > 0 + && here->HICUMsubsSINode != here->HICUMsubsNode) + CKTdltNNum(ckt, here->HICUMsubsSINode); + here->HICUMsubsSINode = 0; + + if (model->HICUMselfheat) { + if (here->HICUMtempNode > 6) { // it is an internal node + CKTdltNNum(ckt, here->HICUMtempNode); + here->HICUMtempNode = 0; + } + } + + if (model->HICUMnqs) { + + if(here->HICUMxfNode > 0) + CKTdltNNum(ckt, here->HICUMxfNode); + here->HICUMxfNode = 0; + + if(here->HICUMxf1Node > 0) + CKTdltNNum(ckt, here->HICUMxf1Node); + here->HICUMxf1Node = 0; + + if(here->HICUMxf2Node > 0) + CKTdltNNum(ckt, here->HICUMxf2Node); + here->HICUMxf2Node = 0; + } + + } + } + return OK; +} + +int +HICUMmDelete(GENmodel* gen_model) +{ + HICUMmodel* model = (HICUMmodel*)gen_model; + + FREE(model->HICUMversion); + + return OK; +} diff --git a/src/spicelib/devices/hicum2/hicum2soachk.c b/src/spicelib/devices/hicum2/hicum2soachk.c index ac010e186..380619d90 100644 --- a/src/spicelib/devices/hicum2/hicum2soachk.c +++ b/src/spicelib/devices/hicum2/hicum2soachk.c @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ #include "ngspice/ngspice.h" diff --git a/src/spicelib/devices/hicum2/hicum2trunc.c b/src/spicelib/devices/hicum2/hicum2trunc.c index d59990668..f15f46e22 100644 --- a/src/spicelib/devices/hicum2/hicum2trunc.c +++ b/src/spicelib/devices/hicum2/hicum2trunc.c @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ /* diff --git a/src/spicelib/devices/hicum2/hicumL2.cpp b/src/spicelib/devices/hicum2/hicumL2.cpp index c1f835411..ca4be24ac 100644 --- a/src/spicelib/devices/hicum2/hicumL2.cpp +++ b/src/spicelib/devices/hicum2/hicumL2.cpp @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ /* diff --git a/src/spicelib/devices/hicum2/hicumL2.hpp b/src/spicelib/devices/hicum2/hicumL2.hpp index 799e29856..7aabbfc15 100644 --- a/src/spicelib/devices/hicum2/hicumL2.hpp +++ b/src/spicelib/devices/hicum2/hicumL2.hpp @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ #ifndef hicumL2_H #define hicumL2_H diff --git a/src/spicelib/devices/hicum2/hicumL2temp.cpp b/src/spicelib/devices/hicum2/hicumL2temp.cpp index 0318754aa..6d410e597 100644 --- a/src/spicelib/devices/hicum2/hicumL2temp.cpp +++ b/src/spicelib/devices/hicum2/hicumL2temp.cpp @@ -1,520 +1,520 @@ -/********** -License : 3-clause BSD -Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden -**********/ - -#include -#ifndef M_PI -#define M_PI 3.1415926535897932384626433832795 -#endif -#include "duals/dual" -#include "hicumL2.hpp" -#include - -//ngspice header files written in C -#ifdef __cplusplus -extern "C" -{ -#endif -#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" -#ifdef __cplusplus -} -#endif - -using namespace duals; -#define e1 (dual(0.0, 1.0)) - -#define TMAX 326.85 -#define TMIN -100.0 -#define LN_EXP_LIMIT 11.0 - -duals::duald clip_temperature(duals::duald T){ - // smooth clipping function for device temperature, if self heating increases temperature beyond - // T0+TMAX or below T0-TMIN - duals::duald Tdev; - Tdev = T; - if (T<(TMIN+CONSTCtoK+1.0)){ - Tdev = TMIN+CONSTCtoK+exp(T-TMIN+CONSTCtoK-1.0); - } else if (T>(TMAX+CONSTCtoK-1.0)) { - Tdev = TMAX+CONSTCtoK-exp(TMAX+CONSTCtoK-T-1.0); - }; - return Tdev; -}; - -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(duals::duald vt, double vt0, duals::duald qtt0, duals::duald ln_qtt0, double mg, - double c_j, double vd0, double z, double w, double is_al, double vgeff, - duals::duald *c_j_t, duals::duald *vd_t, duals::duald *w_t) -{ -duals::duald 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; - } -} - -void hicum_TMPHICJ(duals::duald vt, double vt0, duals::duald qtt0, duals::duald 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 *c_j_t_dT, double *vd_t_dT, double *w_t_dT) -{ - duals::duald c_j_t_result; - duals::duald vd_t_result; - duals::duald w_t_result; - TMPHICJ(vt, vt0, qtt0, ln_qtt0, mg, c_j, vd0, z, w, is_al, vgeff, &c_j_t_result, &vd_t_result, &w_t_result); - *c_j_t = c_j_t_result.rpart(); - *c_j_t_dT = c_j_t_result.dpart(); - *vd_t = vd_t_result.rpart(); - *vd_t_dT = vd_t_result.dpart(); - *w_t = w_t_result.rpart(); - *w_t_dT = w_t_result.dpart(); -} - - -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; - - hicum_thermal_update(model, here, &here -> HICUMtemp, &here->HICUMtemp_Vrth); - - } - } - return(OK); -} - -void hicum_thermal_update(HICUMmodel *inModel, HICUMinstance *inInstance, double * HICUMTemp, double * Tdev_Vrth) -{ - HICUMmodel *model = (HICUMmodel *)inModel; - HICUMinstance *here = (HICUMinstance *)inInstance; - - double mg,k10,k20,avs,vgb_t0,vge_t0,vgbe_t0,vgbe0,vgbc0,vgsc0; - double zetabci,zetabcxt,zetasct; - duals::duald temp, dT, vt, qtt0, ln_qtt0; - duals::duald k1,k2,dvg0,vge_t,vgb_t,vgbe_t,cratio_t,a; - double cratio_t_real, cratio_t_dual; - double Tnom, zetatef, cjcx01, cjcx02, C_1; - duals::duald cjei0_t, vdei_t, cjep0_t, vdep_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; - - mg = 3-model->HICUMf1vg/CONSTKoverQ; - zetabci = mg+1-model->HICUMzetaci; - zetabcxt= mg+1-model->HICUMzetacx; - zetasct = mg-1.5; - - - // Smooth ngspice T clipping - temp = clip_temperature( *(HICUMTemp)+e1 ); - *(HICUMTemp) = temp.rpart(); - *(Tdev_Vrth) = temp.dpart(); - - // original HICUM clipping for Tdev => left here for reference - // *(Tdev_Vrth) = 1.0; - // if(*(HICUMTemp) < TMIN + CONSTCtoK) { - // *(HICUMTemp) = TMIN + CONSTCtoK; - // *(Tdev_Vrth) = 0.0; - // } else { - // if (*(HICUMTemp) > TMAX + CONSTCtoK) { - // *(HICUMTemp) = TMAX + CONSTCtoK; - // *(Tdev_Vrth) = 0.0; - // } - //} - - //This routine calculates the derivatives with respect to Vrth. Since at some point - // Tdev becomes constant (see above), we need to account for this like below. - //temp = *(HICUMTemp)+e1* *(Tdev_Vrth); // dual number device temperature - - vt = temp*CONSTKoverQ; // dual valued temperature voltage - - here->HICUMvt0 = Tnom * CONSTKoverQ; - here->HICUMvt.rpart = vt.rpart(); - here->HICUMvt.dpart = vt.dpart(); - dT = temp-Tnom; - qtt0 = temp/Tnom; - ln_qtt0 = log(qtt0); - - k1 = model->HICUMf1vg*temp*log(temp); - k2 = model->HICUMf2vg*temp; - vgb_t = model->HICUMvgb+k1+k2; - vge_t = model->HICUMvge+k1+k2; - vgbe_t = (vgb_t+vge_t)/2; - - here->HICUMtVcrit = here->HICUMvt.rpart * - log(here->HICUMvt.rpart / (CONSTroot2*here->HICUMibeis_scaled)); - - //Internal b-e junction capacitance - hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, - here->HICUMcjei0_scaled, model->HICUMvdei, model->HICUMzei, model->HICUMajei, 1, vgbe0, - &here->HICUMcjei0_t.rpart, &here->HICUMvdei_t.rpart, &here->HICUMajei_t.rpart, - &here->HICUMcjei0_t.dpart, &here->HICUMvdei_t.dpart, &here->HICUMajei_t.dpart); - cjei0_t.rpart(here->HICUMcjei0_t.rpart); - cjei0_t.dpart(here->HICUMcjei0_t.dpart); - vdei_t.rpart(here->HICUMvdei_t.rpart); - vdei_t.dpart(here->HICUMvdei_t.dpart); - - if (model->HICUMflcomp < 2.3) { - duals::duald V_gT, r_VgVT, k; - V_gT = 3.0*vt*ln_qtt0 + model->HICUMvgb*(qtt0-1.0); - r_VgVT = V_gT/vt; - //Internal b-e diode saturation currents - a = model->HICUMmcf*r_VgVT/model->HICUMmbei - model->HICUMalb*dT; - a = here->HICUMibeis_scaled*exp(a); - here->HICUMibeis_t.rpart = a.rpart(); - here->HICUMibeis_t.dpart = a.dpart(); - - a = model->HICUMmcf*r_VgVT/model->HICUMmrei - model->HICUMalb*dT; - a = here->HICUMireis_scaled*exp(a); - here->HICUMireis_t.rpart = a.rpart(); - here->HICUMireis_t.dpart = a.dpart(); - - //Peripheral b-e diode saturation currents - a = model->HICUMmcf*r_VgVT/model->HICUMmbep - model->HICUMalb*dT; - a = here->HICUMibeps_scaled*exp(a); - here->HICUMibeps_t.rpart = a.rpart(); - here->HICUMibeps_t.dpart = a.dpart(); - - a = model->HICUMmcf*r_VgVT/model->HICUMmrep - model->HICUMalb*dT; - a = here->HICUMireps_scaled*exp(a); - here->HICUMireps_t.rpart = a.rpart(); - here->HICUMireps_t.dpart = a.dpart(); - //Internal b-c diode saturation current - a = r_VgVT/model->HICUMmbci; - a = here->HICUMibcis_scaled*exp(a); - here->HICUMibcis_t.rpart = a.rpart(); - here->HICUMibcis_t.dpart = a.dpart(); - //External b-c diode saturation currents - a = r_VgVT/model->HICUMmbcx; - a = here->HICUMibcxs_scaled*exp(a); - here->HICUMibcxs_t.rpart = a.rpart(); - here->HICUMibcxs_t.dpart = a.dpart(); - //Saturation transfer current for substrate transistor - a = r_VgVT/model->HICUMmsf; - a = model->HICUMitss*exp(a); - here->HICUMitss_t.rpart = a.rpart(); - here->HICUMitss_t.rpart = a.dpart(); - //Saturation current for c-s diode - a = r_VgVT/model->HICUMmsc; - a = model->HICUMiscs*exp(a); - here->HICUMiscs_t.rpart = a.rpart(); - here->HICUMiscs_t.dpart = a.dpart(); - //Zero bias hole charge - a = vdei_t/model->HICUMvdei; - a = here->HICUMqp0_scaled*(1.0+0.5*model->HICUMzei*(1.0-a)); - here->HICUMqp0_t.rpart = a.rpart(); - here->HICUMqp0_t.dpart = a.dpart(); - //Voltage separating ohmic and saturation velocity regime - a = model->HICUMvlim*(1.0-model->HICUMalvs*dT)*exp(model->HICUMzetaci*ln_qtt0); - k = (a-vt)/vt; - if (k.rpart() < LN_EXP_LIMIT) { - a = vt + vt*log(1.0+exp(k)); - } - here->HICUMvlim_t.rpart = a.rpart(); - here->HICUMvlim_t.dpart = a.dpart(); - - //Neutral emitter storage time - a = 1.0+model->HICUMalb*dT; - k = 0.5*(a+sqrt(a*a+0.01)); - a = model->HICUMtef0*qtt0/k; - here->HICUMtef0_t.rpart = a.rpart(); - here->HICUMtef0_t.dpart = a.dpart(); - } else { - //Internal b-e diode saturation currents - a = here->HICUMibeis_scaled*exp(model->HICUMzetabet*ln_qtt0+model->HICUMvge/vt*(qtt0-1)); - here->HICUMibeis_t.rpart = a.rpart(); - here->HICUMibeis_t.dpart = a.dpart(); - if (model->HICUMflcomp>=2.3) { - a = here->HICUMireis_scaled*exp(mg/model->HICUMmrei*ln_qtt0+vgbe0/(model->HICUMmrei*vt)*(qtt0-1)); - } else { - a = here->HICUMireis_scaled*exp(0.5*mg*ln_qtt0+0.5*vgbe0/vt*(qtt0-1)); - } - here->HICUMireis_t.rpart = a.rpart(); - here->HICUMireis_t.dpart = a.dpart(); - //Peripheral b-e diode saturation currents - a = here->HICUMibeps_scaled*exp(model->HICUMzetabet*ln_qtt0+model->HICUMvge/vt*(qtt0-1)); - here->HICUMibeps_t.rpart = a.rpart(); - here->HICUMibeps_t.dpart = a.dpart(); - if (model->HICUMflcomp>=2.3) { - a = here->HICUMireps_scaled*exp(mg/model->HICUMmrep*ln_qtt0+vgbe0/(model->HICUMmrep*vt)*(qtt0-1)); - } else { - a = here->HICUMireps_scaled*exp(0.5*mg*qtt0+0.5*vgbe0/vt*(qtt0-1)); - } - here->HICUMireps_t.rpart = a.rpart(); - here->HICUMireps_t.dpart = a.dpart(); - //Internal b-c diode saturation currents - a = here->HICUMibcis_scaled*exp(zetabci*ln_qtt0+model->HICUMvgc/vt*(qtt0-1)); - here->HICUMibcis_t.rpart = a.rpart(); - here->HICUMibcis_t.dpart = a.dpart(); - //External b-c diode saturation currents - a = here->HICUMibcxs_scaled*exp(zetabcxt*ln_qtt0+model->HICUMvgc/vt*(qtt0-1)); - here->HICUMibcxs_t.rpart = a.rpart(); - here->HICUMibcxs_t.dpart = a.dpart(); - //Saturation transfer current for substrate transistor - a = model->HICUMitss*exp(zetasct*ln_qtt0+model->HICUMvgc/vt*(qtt0-1)); - here->HICUMitss_t.rpart = a.rpart(); - here->HICUMitss_t.dpart = a.dpart(); - //Saturation current for c-s diode - a = model->HICUMiscs*exp(zetasct*ln_qtt0+model->HICUMvgs/vt*(qtt0-1)); - here->HICUMiscs_t.rpart = a.rpart(); - here->HICUMiscs_t.dpart = a.dpart(); - //Zero bias hole charge - a = exp(model->HICUMzei*log(vdei_t/model->HICUMvdei)); - a = here->HICUMqp0_scaled*(2.0-a); - here->HICUMqp0_t.rpart = a.rpart(); - here->HICUMqp0_t.dpart = a.dpart(); - //Voltage separating ohmic and saturation velocity regime - a = model->HICUMvlim*exp((model->HICUMzetaci-avs)*ln_qtt0); - here->HICUMvlim_t.rpart = a.rpart(); - here->HICUMvlim_t.dpart = a.dpart(); - //Neutral emitter storage time - if (model->HICUMflcomp >= 2.3) { - a = model->HICUMtef0; - } else { - zetatef = model->HICUMzetabet-model->HICUMzetact-0.5; - dvg0 = model->HICUMvgb-model->HICUMvge; - a = model->HICUMtef0*exp(zetatef*ln_qtt0-dvg0/vt*(qtt0-1)); - } - here->HICUMtef0_t.rpart = a.rpart(); - here->HICUMtef0_t.dpart = a.dpart(); - } - - //GICCR prefactor - a = here->HICUMc10_scaled*exp(model->HICUMzetact*ln_qtt0+model->HICUMvgb/vt*(qtt0-1)); - here->HICUMc10_t.rpart = a.rpart(); - here->HICUMc10_t.dpart = a.dpart(); - - // Low-field internal collector resistance - a = here->HICUMrci0_scaled*exp(model->HICUMzetaci*ln_qtt0); - here->HICUMrci0_t.rpart = a.rpart(); - here->HICUMrci0_t.dpart = a.dpart(); - - //Internal c-e saturation voltage - a = model->HICUMvces*(1+model->HICUMalces*dT); - here->HICUMvces_t.rpart = a.rpart(); - here->HICUMvces_t.dpart = a.dpart(); - - //Internal b-c junction capacitance - hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, - here->HICUMcjci0_scaled, model->HICUMvdci, model->HICUMzci, model->HICUMvptci, 0, vgbc0, - &here->HICUMcjci0_t.rpart, &here->HICUMvdci_t.rpart, &here->HICUMvptci_t.rpart, - &here->HICUMcjci0_t.dpart, &here->HICUMvdci_t.dpart, &here->HICUMvptci_t.dpart); - - //Low-current forward transit time - a = model->HICUMt0*(1+model->HICUMalt0*dT+model->HICUMkt0*dT*dT); - here->HICUMt0_t.rpart = a.rpart(); - here->HICUMt0_t.dpart = a.dpart(); - - //Saturation time constant at high current densities - a = model->HICUMthcs*exp((model->HICUMzetaci-1)*ln_qtt0); - here->HICUMthcs_t.rpart = a.rpart(); - here->HICUMthcs_t.dpart = a.dpart(); - - //Avalanche current factors - a = model->HICUMfavl*exp(model->HICUMalfav*dT); - here->HICUMfavl_t.rpart = a.rpart(); - here->HICUMfavl_t.dpart = a.dpart(); - a = here->HICUMqavl_scaled*exp(model->HICUMalqav*dT); - here->HICUMqavl_t.rpart = a.rpart(); - here->HICUMqavl_t.dpart = a.dpart(); - a = model->HICUMkavl*exp(model->HICUMalkav*dT); - here->HICUMkavl_t.rpart = a.rpart(); - here->HICUMkavl_t.dpart = a.dpart(); - - //Zero bias internal base resistance - a = here->HICUMrbi0_scaled*exp(model->HICUMzetarbi*ln_qtt0); - here->HICUMrbi0_t.rpart = a.rpart(); - here->HICUMrbi0_t.dpart = a.dpart(); - - //Peripheral b-e junction capacitance - hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, - here->HICUMcjep0_scaled, model->HICUMvdep, model->HICUMzep, model->HICUMajep, 1, vgbe0, - &here->HICUMcjep0_t.rpart, &here->HICUMvdep_t.rpart, &here->HICUMajep_t.rpart, - &here->HICUMcjep0_t.dpart, &here->HICUMvdep_t.dpart, &here->HICUMajep_t.dpart); - cjep0_t.rpart(here->HICUMcjep0_t.rpart); - cjep0_t.dpart(here->HICUMcjep0_t.dpart); - vdep_t.rpart(here->HICUMvdep_t.rpart); - vdep_t.dpart(here->HICUMvdep_t.dpart); - - //Tunneling current factors - if (here->HICUMibets_scaled > 0) { // HICTUN_T - duals::duald a_eg,ab,aa; - ab = 1.0; - aa = 1.0; - a_eg = vgbe_t0/vgbe_t; - if(model->HICUMtunode==1 && here->HICUMcjep0_scaled > 0.0 && model->HICUMvdep >0.0) { - ab = (cjep0_t/here->HICUMcjep0_scaled)*sqrt(a_eg)*vdep_t*vdep_t/(model->HICUMvdep*model->HICUMvdep); - aa = (model->HICUMvdep/vdep_t)*(here->HICUMcjep0_scaled/cjep0_t)*pow(a_eg,-1.5); - } else if (model->HICUMtunode==0 && here->HICUMcjei0_scaled > 0.0 && model->HICUMvdei >0.0) { - ab = (cjei0_t/here->HICUMcjei0_scaled)*sqrt(a_eg)*vdei_t*vdei_t/(model->HICUMvdei*model->HICUMvdei); - aa = (model->HICUMvdei/vdei_t)*(here->HICUMcjei0_scaled/cjei0_t)*pow(a_eg,-1.5); - } - a = here->HICUMibets_scaled*ab; - here->HICUMibets_t.rpart = a.rpart(); - here->HICUMibets_t.dpart = a.dpart(); - a = model->HICUMabet*aa; - here->HICUMabet_t.rpart = a.rpart(); - here->HICUMabet_t.dpart = a.dpart(); - } else { - here->HICUMibets_t.rpart = 0; - here->HICUMibets_t.dpart = 0; - here->HICUMabet_t.rpart = 1; - here->HICUMabet_t.dpart = 0; - } - - //Depletion capacitance splitting at b-c junction - //Capacitances at peripheral and external base node - C_1 = (1.0-model->HICUMfbcpar)*(here->HICUMcjcx0_scaled+here->HICUMcbcpar_scaled); - if (C_1 >= here->HICUMcbcpar_scaled) { - cjcx01 = C_1-here->HICUMcbcpar_scaled; - cjcx02 = here->HICUMcjcx0_scaled-cjcx01; - } else { - cjcx01 = 0.0; - cjcx02 = here->HICUMcjcx0_scaled; - } - - //Temperature mapping for tunneling current is done inside HICTUN - hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, - 1.0, model->HICUMvdcx, model->HICUMzcx, model->HICUMvptcx, 0, vgbc0, - &cratio_t_real, &here->HICUMvdcx_t.rpart, &here->HICUMvptcx_t.rpart, - &cratio_t_dual, &here->HICUMvdcx_t.dpart, &here->HICUMvptcx_t.dpart); - cratio_t.rpart(cratio_t_real); - cratio_t.dpart(cratio_t_dual); - a = cratio_t*cjcx01; - here->HICUMcjcx01_t.rpart = a.rpart(); - here->HICUMcjcx01_t.dpart = a.dpart(); - a = cratio_t*cjcx02; - here->HICUMcjcx02_t.rpart = a.rpart(); - here->HICUMcjcx02_t.dpart = a.dpart(); - - //Constant external series resistances - a = here->HICUMrcx_scaled*exp(model->HICUMzetarcx*ln_qtt0); - here->HICUMrcx_t.rpart = a.rpart(); - here->HICUMrcx_t.dpart = a.dpart(); - a = here->HICUMrbx_scaled*exp(model->HICUMzetarbx*ln_qtt0); - here->HICUMrbx_t.rpart = a.rpart(); - here->HICUMrbx_t.dpart = a.dpart(); - a = here->HICUMre_scaled*exp(model->HICUMzetare*ln_qtt0); - here->HICUMre_t.rpart = a.rpart(); - here->HICUMre_t.dpart = a.dpart(); - - //Forward transit time in substrate transistor - a = model->HICUMtsf*exp((model->HICUMzetacx-1.0)*ln_qtt0); - here->HICUMtsf_t.rpart = a.rpart(); - here->HICUMtsf_t.dpart = a.dpart(); - - //Capacitance for c-s junction - hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, - model->HICUMcjs0, model->HICUMvds, model->HICUMzs, model->HICUMvpts, 0, vgsc0, - &here->HICUMcjs0_t.rpart, &here->HICUMvds_t.rpart, &here->HICUMvpts_t.rpart, - &here->HICUMcjs0_t.dpart, &here->HICUMvds_t.dpart, &here->HICUMvpts_t.dpart); - /*Peripheral s-c capacitance - * Note, thermal update only required for model->HICUMvds > 0 - * Save computional effort otherwise - */ - if (model->HICUMvdsp > 0) { - hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, - model->HICUMcscp0, model->HICUMvdsp, model->HICUMzsp, model->HICUMvptsp, 0, vgsc0, - &here->HICUMcscp0_t.rpart, &here->HICUMvdsp_t.rpart, &here->HICUMvptsp_t.rpart, - &here->HICUMcscp0_t.dpart, &here->HICUMvdsp_t.dpart, &here->HICUMvptsp_t.dpart); - } else { - // Avoid uninitialized variables - here->HICUMcscp0_t.rpart = model->HICUMcscp0; - here->HICUMcscp0_t.dpart = 0; - here->HICUMvdsp_t.rpart = model->HICUMvdsp; - here->HICUMvdsp_t.dpart = 0; - here->HICUMvptsp_t.rpart = model->HICUMvptsp; - here->HICUMvptsp_t.dpart = 0; - } - - a = model->HICUMahjei*exp(model->HICUMzetahjei*ln_qtt0); - here->HICUMahjei_t.rpart = a.rpart(); - here->HICUMahjei_t.dpart = a.dpart(); - a = model->HICUMhjei*exp(model->HICUMdvgbe/vt*(exp(model->HICUMzetavgbe*log(qtt0))-1)); - here->HICUMhjei0_t.rpart = a.rpart(); - here->HICUMhjei0_t.dpart = a.dpart(); - a = model->HICUMhf0*exp(model->HICUMdvgbe/vt*(qtt0-1)); - here->HICUMhf0_t.rpart = a.rpart(); - here->HICUMhf0_t.dpart = a.dpart(); - if (model->HICUMflcomp >= 2.3) { - a = model->HICUMhfe*exp((model->HICUMvgb-model->HICUMvge)/vt*(qtt0-1)); - here->HICUMhfe_t.rpart = a.rpart(); - here->HICUMhfe_t.dpart = a.dpart(); - a = model->HICUMhfc*exp((model->HICUMvgb-model->HICUMvgc)/vt*(qtt0-1)); - here->HICUMhfc_t.rpart = a.rpart(); - here->HICUMhfc_t.dpart = a.dpart(); - } else { - here->HICUMhfe_t.rpart = model->HICUMhfe; - here->HICUMhfe_t.dpart = 0; - here->HICUMhfc_t.rpart = model->HICUMhfc; - here->HICUMhfc_t.dpart = 0; - } - - a = here->HICUMrth_scaled*exp(model->HICUMzetarth*ln_qtt0)*(1+model->HICUMalrth*dT); - here->HICUMrth_t.rpart = a.rpart(); - here->HICUMrth_t.dpart = a.dpart(); - -} +/********** +License : 3-clause BSD +Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher +Model Author : (Copyright 1993-2024) Michael Schroter +**********/ + +#include +#ifndef M_PI +#define M_PI 3.1415926535897932384626433832795 +#endif +#include "duals/dual" +#include "hicumL2.hpp" +#include + +//ngspice header files written in C +#ifdef __cplusplus +extern "C" +{ +#endif +#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" +#ifdef __cplusplus +} +#endif + +using namespace duals; +#define e1 (dual(0.0, 1.0)) + +#define TMAX 326.85 +#define TMIN -100.0 +#define LN_EXP_LIMIT 11.0 + +duals::duald clip_temperature(duals::duald T){ + // smooth clipping function for device temperature, if self heating increases temperature beyond + // T0+TMAX or below T0-TMIN + duals::duald Tdev; + Tdev = T; + if (T<(TMIN+CONSTCtoK+1.0)){ + Tdev = TMIN+CONSTCtoK+exp(T-TMIN+CONSTCtoK-1.0); + } else if (T>(TMAX+CONSTCtoK-1.0)) { + Tdev = TMAX+CONSTCtoK-exp(TMAX+CONSTCtoK-T-1.0); + }; + return Tdev; +}; + +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(duals::duald vt, double vt0, duals::duald qtt0, duals::duald ln_qtt0, double mg, + double c_j, double vd0, double z, double w, double is_al, double vgeff, + duals::duald *c_j_t, duals::duald *vd_t, duals::duald *w_t) +{ +duals::duald 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; + } +} + +void hicum_TMPHICJ(duals::duald vt, double vt0, duals::duald qtt0, duals::duald 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 *c_j_t_dT, double *vd_t_dT, double *w_t_dT) +{ + duals::duald c_j_t_result; + duals::duald vd_t_result; + duals::duald w_t_result; + TMPHICJ(vt, vt0, qtt0, ln_qtt0, mg, c_j, vd0, z, w, is_al, vgeff, &c_j_t_result, &vd_t_result, &w_t_result); + *c_j_t = c_j_t_result.rpart(); + *c_j_t_dT = c_j_t_result.dpart(); + *vd_t = vd_t_result.rpart(); + *vd_t_dT = vd_t_result.dpart(); + *w_t = w_t_result.rpart(); + *w_t_dT = w_t_result.dpart(); +} + + +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; + + hicum_thermal_update(model, here, &here -> HICUMtemp, &here->HICUMtemp_Vrth); + + } + } + return(OK); +} + +void hicum_thermal_update(HICUMmodel *inModel, HICUMinstance *inInstance, double * HICUMTemp, double * Tdev_Vrth) +{ + HICUMmodel *model = (HICUMmodel *)inModel; + HICUMinstance *here = (HICUMinstance *)inInstance; + + double mg,k10,k20,avs,vgb_t0,vge_t0,vgbe_t0,vgbe0,vgbc0,vgsc0; + double zetabci,zetabcxt,zetasct; + duals::duald temp, dT, vt, qtt0, ln_qtt0; + duals::duald k1,k2,dvg0,vge_t,vgb_t,vgbe_t,cratio_t,a; + double cratio_t_real, cratio_t_dual; + double Tnom, zetatef, cjcx01, cjcx02, C_1; + duals::duald cjei0_t, vdei_t, cjep0_t, vdep_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; + + mg = 3-model->HICUMf1vg/CONSTKoverQ; + zetabci = mg+1-model->HICUMzetaci; + zetabcxt= mg+1-model->HICUMzetacx; + zetasct = mg-1.5; + + + // Smooth ngspice T clipping + temp = clip_temperature( *(HICUMTemp)+e1 ); + *(HICUMTemp) = temp.rpart(); + *(Tdev_Vrth) = temp.dpart(); + + // original HICUM clipping for Tdev => left here for reference + // *(Tdev_Vrth) = 1.0; + // if(*(HICUMTemp) < TMIN + CONSTCtoK) { + // *(HICUMTemp) = TMIN + CONSTCtoK; + // *(Tdev_Vrth) = 0.0; + // } else { + // if (*(HICUMTemp) > TMAX + CONSTCtoK) { + // *(HICUMTemp) = TMAX + CONSTCtoK; + // *(Tdev_Vrth) = 0.0; + // } + //} + + //This routine calculates the derivatives with respect to Vrth. Since at some point + // Tdev becomes constant (see above), we need to account for this like below. + //temp = *(HICUMTemp)+e1* *(Tdev_Vrth); // dual number device temperature + + vt = temp*CONSTKoverQ; // dual valued temperature voltage + + here->HICUMvt0 = Tnom * CONSTKoverQ; + here->HICUMvt.rpart = vt.rpart(); + here->HICUMvt.dpart = vt.dpart(); + dT = temp-Tnom; + qtt0 = temp/Tnom; + ln_qtt0 = log(qtt0); + + k1 = model->HICUMf1vg*temp*log(temp); + k2 = model->HICUMf2vg*temp; + vgb_t = model->HICUMvgb+k1+k2; + vge_t = model->HICUMvge+k1+k2; + vgbe_t = (vgb_t+vge_t)/2; + + here->HICUMtVcrit = here->HICUMvt.rpart * + log(here->HICUMvt.rpart / (CONSTroot2*here->HICUMibeis_scaled)); + + //Internal b-e junction capacitance + hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, + here->HICUMcjei0_scaled, model->HICUMvdei, model->HICUMzei, model->HICUMajei, 1, vgbe0, + &here->HICUMcjei0_t.rpart, &here->HICUMvdei_t.rpart, &here->HICUMajei_t.rpart, + &here->HICUMcjei0_t.dpart, &here->HICUMvdei_t.dpart, &here->HICUMajei_t.dpart); + cjei0_t.rpart(here->HICUMcjei0_t.rpart); + cjei0_t.dpart(here->HICUMcjei0_t.dpart); + vdei_t.rpart(here->HICUMvdei_t.rpart); + vdei_t.dpart(here->HICUMvdei_t.dpart); + + if (model->HICUMflcomp < 2.3) { + duals::duald V_gT, r_VgVT, k; + V_gT = 3.0*vt*ln_qtt0 + model->HICUMvgb*(qtt0-1.0); + r_VgVT = V_gT/vt; + //Internal b-e diode saturation currents + a = model->HICUMmcf*r_VgVT/model->HICUMmbei - model->HICUMalb*dT; + a = here->HICUMibeis_scaled*exp(a); + here->HICUMibeis_t.rpart = a.rpart(); + here->HICUMibeis_t.dpart = a.dpart(); + + a = model->HICUMmcf*r_VgVT/model->HICUMmrei - model->HICUMalb*dT; + a = here->HICUMireis_scaled*exp(a); + here->HICUMireis_t.rpart = a.rpart(); + here->HICUMireis_t.dpart = a.dpart(); + + //Peripheral b-e diode saturation currents + a = model->HICUMmcf*r_VgVT/model->HICUMmbep - model->HICUMalb*dT; + a = here->HICUMibeps_scaled*exp(a); + here->HICUMibeps_t.rpart = a.rpart(); + here->HICUMibeps_t.dpart = a.dpart(); + + a = model->HICUMmcf*r_VgVT/model->HICUMmrep - model->HICUMalb*dT; + a = here->HICUMireps_scaled*exp(a); + here->HICUMireps_t.rpart = a.rpart(); + here->HICUMireps_t.dpart = a.dpart(); + //Internal b-c diode saturation current + a = r_VgVT/model->HICUMmbci; + a = here->HICUMibcis_scaled*exp(a); + here->HICUMibcis_t.rpart = a.rpart(); + here->HICUMibcis_t.dpart = a.dpart(); + //External b-c diode saturation currents + a = r_VgVT/model->HICUMmbcx; + a = here->HICUMibcxs_scaled*exp(a); + here->HICUMibcxs_t.rpart = a.rpart(); + here->HICUMibcxs_t.dpart = a.dpart(); + //Saturation transfer current for substrate transistor + a = r_VgVT/model->HICUMmsf; + a = model->HICUMitss*exp(a); + here->HICUMitss_t.rpart = a.rpart(); + here->HICUMitss_t.rpart = a.dpart(); + //Saturation current for c-s diode + a = r_VgVT/model->HICUMmsc; + a = model->HICUMiscs*exp(a); + here->HICUMiscs_t.rpart = a.rpart(); + here->HICUMiscs_t.dpart = a.dpart(); + //Zero bias hole charge + a = vdei_t/model->HICUMvdei; + a = here->HICUMqp0_scaled*(1.0+0.5*model->HICUMzei*(1.0-a)); + here->HICUMqp0_t.rpart = a.rpart(); + here->HICUMqp0_t.dpart = a.dpart(); + //Voltage separating ohmic and saturation velocity regime + a = model->HICUMvlim*(1.0-model->HICUMalvs*dT)*exp(model->HICUMzetaci*ln_qtt0); + k = (a-vt)/vt; + if (k.rpart() < LN_EXP_LIMIT) { + a = vt + vt*log(1.0+exp(k)); + } + here->HICUMvlim_t.rpart = a.rpart(); + here->HICUMvlim_t.dpart = a.dpart(); + + //Neutral emitter storage time + a = 1.0+model->HICUMalb*dT; + k = 0.5*(a+sqrt(a*a+0.01)); + a = model->HICUMtef0*qtt0/k; + here->HICUMtef0_t.rpart = a.rpart(); + here->HICUMtef0_t.dpart = a.dpart(); + } else { + //Internal b-e diode saturation currents + a = here->HICUMibeis_scaled*exp(model->HICUMzetabet*ln_qtt0+model->HICUMvge/vt*(qtt0-1)); + here->HICUMibeis_t.rpart = a.rpart(); + here->HICUMibeis_t.dpart = a.dpart(); + if (model->HICUMflcomp>=2.3) { + a = here->HICUMireis_scaled*exp(mg/model->HICUMmrei*ln_qtt0+vgbe0/(model->HICUMmrei*vt)*(qtt0-1)); + } else { + a = here->HICUMireis_scaled*exp(0.5*mg*ln_qtt0+0.5*vgbe0/vt*(qtt0-1)); + } + here->HICUMireis_t.rpart = a.rpart(); + here->HICUMireis_t.dpart = a.dpart(); + //Peripheral b-e diode saturation currents + a = here->HICUMibeps_scaled*exp(model->HICUMzetabet*ln_qtt0+model->HICUMvge/vt*(qtt0-1)); + here->HICUMibeps_t.rpart = a.rpart(); + here->HICUMibeps_t.dpart = a.dpart(); + if (model->HICUMflcomp>=2.3) { + a = here->HICUMireps_scaled*exp(mg/model->HICUMmrep*ln_qtt0+vgbe0/(model->HICUMmrep*vt)*(qtt0-1)); + } else { + a = here->HICUMireps_scaled*exp(0.5*mg*qtt0+0.5*vgbe0/vt*(qtt0-1)); + } + here->HICUMireps_t.rpart = a.rpart(); + here->HICUMireps_t.dpart = a.dpart(); + //Internal b-c diode saturation currents + a = here->HICUMibcis_scaled*exp(zetabci*ln_qtt0+model->HICUMvgc/vt*(qtt0-1)); + here->HICUMibcis_t.rpart = a.rpart(); + here->HICUMibcis_t.dpart = a.dpart(); + //External b-c diode saturation currents + a = here->HICUMibcxs_scaled*exp(zetabcxt*ln_qtt0+model->HICUMvgc/vt*(qtt0-1)); + here->HICUMibcxs_t.rpart = a.rpart(); + here->HICUMibcxs_t.dpart = a.dpart(); + //Saturation transfer current for substrate transistor + a = model->HICUMitss*exp(zetasct*ln_qtt0+model->HICUMvgc/vt*(qtt0-1)); + here->HICUMitss_t.rpart = a.rpart(); + here->HICUMitss_t.dpart = a.dpart(); + //Saturation current for c-s diode + a = model->HICUMiscs*exp(zetasct*ln_qtt0+model->HICUMvgs/vt*(qtt0-1)); + here->HICUMiscs_t.rpart = a.rpart(); + here->HICUMiscs_t.dpart = a.dpart(); + //Zero bias hole charge + a = exp(model->HICUMzei*log(vdei_t/model->HICUMvdei)); + a = here->HICUMqp0_scaled*(2.0-a); + here->HICUMqp0_t.rpart = a.rpart(); + here->HICUMqp0_t.dpart = a.dpart(); + //Voltage separating ohmic and saturation velocity regime + a = model->HICUMvlim*exp((model->HICUMzetaci-avs)*ln_qtt0); + here->HICUMvlim_t.rpart = a.rpart(); + here->HICUMvlim_t.dpart = a.dpart(); + //Neutral emitter storage time + if (model->HICUMflcomp >= 2.3) { + a = model->HICUMtef0; + } else { + zetatef = model->HICUMzetabet-model->HICUMzetact-0.5; + dvg0 = model->HICUMvgb-model->HICUMvge; + a = model->HICUMtef0*exp(zetatef*ln_qtt0-dvg0/vt*(qtt0-1)); + } + here->HICUMtef0_t.rpart = a.rpart(); + here->HICUMtef0_t.dpart = a.dpart(); + } + + //GICCR prefactor + a = here->HICUMc10_scaled*exp(model->HICUMzetact*ln_qtt0+model->HICUMvgb/vt*(qtt0-1)); + here->HICUMc10_t.rpart = a.rpart(); + here->HICUMc10_t.dpart = a.dpart(); + + // Low-field internal collector resistance + a = here->HICUMrci0_scaled*exp(model->HICUMzetaci*ln_qtt0); + here->HICUMrci0_t.rpart = a.rpart(); + here->HICUMrci0_t.dpart = a.dpart(); + + //Internal c-e saturation voltage + a = model->HICUMvces*(1+model->HICUMalces*dT); + here->HICUMvces_t.rpart = a.rpart(); + here->HICUMvces_t.dpart = a.dpart(); + + //Internal b-c junction capacitance + hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, + here->HICUMcjci0_scaled, model->HICUMvdci, model->HICUMzci, model->HICUMvptci, 0, vgbc0, + &here->HICUMcjci0_t.rpart, &here->HICUMvdci_t.rpart, &here->HICUMvptci_t.rpart, + &here->HICUMcjci0_t.dpart, &here->HICUMvdci_t.dpart, &here->HICUMvptci_t.dpart); + + //Low-current forward transit time + a = model->HICUMt0*(1+model->HICUMalt0*dT+model->HICUMkt0*dT*dT); + here->HICUMt0_t.rpart = a.rpart(); + here->HICUMt0_t.dpart = a.dpart(); + + //Saturation time constant at high current densities + a = model->HICUMthcs*exp((model->HICUMzetaci-1)*ln_qtt0); + here->HICUMthcs_t.rpart = a.rpart(); + here->HICUMthcs_t.dpart = a.dpart(); + + //Avalanche current factors + a = model->HICUMfavl*exp(model->HICUMalfav*dT); + here->HICUMfavl_t.rpart = a.rpart(); + here->HICUMfavl_t.dpart = a.dpart(); + a = here->HICUMqavl_scaled*exp(model->HICUMalqav*dT); + here->HICUMqavl_t.rpart = a.rpart(); + here->HICUMqavl_t.dpart = a.dpart(); + a = model->HICUMkavl*exp(model->HICUMalkav*dT); + here->HICUMkavl_t.rpart = a.rpart(); + here->HICUMkavl_t.dpart = a.dpart(); + + //Zero bias internal base resistance + a = here->HICUMrbi0_scaled*exp(model->HICUMzetarbi*ln_qtt0); + here->HICUMrbi0_t.rpart = a.rpart(); + here->HICUMrbi0_t.dpart = a.dpart(); + + //Peripheral b-e junction capacitance + hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, + here->HICUMcjep0_scaled, model->HICUMvdep, model->HICUMzep, model->HICUMajep, 1, vgbe0, + &here->HICUMcjep0_t.rpart, &here->HICUMvdep_t.rpart, &here->HICUMajep_t.rpart, + &here->HICUMcjep0_t.dpart, &here->HICUMvdep_t.dpart, &here->HICUMajep_t.dpart); + cjep0_t.rpart(here->HICUMcjep0_t.rpart); + cjep0_t.dpart(here->HICUMcjep0_t.dpart); + vdep_t.rpart(here->HICUMvdep_t.rpart); + vdep_t.dpart(here->HICUMvdep_t.dpart); + + //Tunneling current factors + if (here->HICUMibets_scaled > 0) { // HICTUN_T + duals::duald a_eg,ab,aa; + ab = 1.0; + aa = 1.0; + a_eg = vgbe_t0/vgbe_t; + if(model->HICUMtunode==1 && here->HICUMcjep0_scaled > 0.0 && model->HICUMvdep >0.0) { + ab = (cjep0_t/here->HICUMcjep0_scaled)*sqrt(a_eg)*vdep_t*vdep_t/(model->HICUMvdep*model->HICUMvdep); + aa = (model->HICUMvdep/vdep_t)*(here->HICUMcjep0_scaled/cjep0_t)*pow(a_eg,-1.5); + } else if (model->HICUMtunode==0 && here->HICUMcjei0_scaled > 0.0 && model->HICUMvdei >0.0) { + ab = (cjei0_t/here->HICUMcjei0_scaled)*sqrt(a_eg)*vdei_t*vdei_t/(model->HICUMvdei*model->HICUMvdei); + aa = (model->HICUMvdei/vdei_t)*(here->HICUMcjei0_scaled/cjei0_t)*pow(a_eg,-1.5); + } + a = here->HICUMibets_scaled*ab; + here->HICUMibets_t.rpart = a.rpart(); + here->HICUMibets_t.dpart = a.dpart(); + a = model->HICUMabet*aa; + here->HICUMabet_t.rpart = a.rpart(); + here->HICUMabet_t.dpart = a.dpart(); + } else { + here->HICUMibets_t.rpart = 0; + here->HICUMibets_t.dpart = 0; + here->HICUMabet_t.rpart = 1; + here->HICUMabet_t.dpart = 0; + } + + //Depletion capacitance splitting at b-c junction + //Capacitances at peripheral and external base node + C_1 = (1.0-model->HICUMfbcpar)*(here->HICUMcjcx0_scaled+here->HICUMcbcpar_scaled); + if (C_1 >= here->HICUMcbcpar_scaled) { + cjcx01 = C_1-here->HICUMcbcpar_scaled; + cjcx02 = here->HICUMcjcx0_scaled-cjcx01; + } else { + cjcx01 = 0.0; + cjcx02 = here->HICUMcjcx0_scaled; + } + + //Temperature mapping for tunneling current is done inside HICTUN + hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, + 1.0, model->HICUMvdcx, model->HICUMzcx, model->HICUMvptcx, 0, vgbc0, + &cratio_t_real, &here->HICUMvdcx_t.rpart, &here->HICUMvptcx_t.rpart, + &cratio_t_dual, &here->HICUMvdcx_t.dpart, &here->HICUMvptcx_t.dpart); + cratio_t.rpart(cratio_t_real); + cratio_t.dpart(cratio_t_dual); + a = cratio_t*cjcx01; + here->HICUMcjcx01_t.rpart = a.rpart(); + here->HICUMcjcx01_t.dpart = a.dpart(); + a = cratio_t*cjcx02; + here->HICUMcjcx02_t.rpart = a.rpart(); + here->HICUMcjcx02_t.dpart = a.dpart(); + + //Constant external series resistances + a = here->HICUMrcx_scaled*exp(model->HICUMzetarcx*ln_qtt0); + here->HICUMrcx_t.rpart = a.rpart(); + here->HICUMrcx_t.dpart = a.dpart(); + a = here->HICUMrbx_scaled*exp(model->HICUMzetarbx*ln_qtt0); + here->HICUMrbx_t.rpart = a.rpart(); + here->HICUMrbx_t.dpart = a.dpart(); + a = here->HICUMre_scaled*exp(model->HICUMzetare*ln_qtt0); + here->HICUMre_t.rpart = a.rpart(); + here->HICUMre_t.dpart = a.dpart(); + + //Forward transit time in substrate transistor + a = model->HICUMtsf*exp((model->HICUMzetacx-1.0)*ln_qtt0); + here->HICUMtsf_t.rpart = a.rpart(); + here->HICUMtsf_t.dpart = a.dpart(); + + //Capacitance for c-s junction + hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, + model->HICUMcjs0, model->HICUMvds, model->HICUMzs, model->HICUMvpts, 0, vgsc0, + &here->HICUMcjs0_t.rpart, &here->HICUMvds_t.rpart, &here->HICUMvpts_t.rpart, + &here->HICUMcjs0_t.dpart, &here->HICUMvds_t.dpart, &here->HICUMvpts_t.dpart); + /*Peripheral s-c capacitance + * Note, thermal update only required for model->HICUMvds > 0 + * Save computional effort otherwise + */ + if (model->HICUMvdsp > 0) { + hicum_TMPHICJ(vt, here->HICUMvt0, qtt0, ln_qtt0, mg, + model->HICUMcscp0, model->HICUMvdsp, model->HICUMzsp, model->HICUMvptsp, 0, vgsc0, + &here->HICUMcscp0_t.rpart, &here->HICUMvdsp_t.rpart, &here->HICUMvptsp_t.rpart, + &here->HICUMcscp0_t.dpart, &here->HICUMvdsp_t.dpart, &here->HICUMvptsp_t.dpart); + } else { + // Avoid uninitialized variables + here->HICUMcscp0_t.rpart = model->HICUMcscp0; + here->HICUMcscp0_t.dpart = 0; + here->HICUMvdsp_t.rpart = model->HICUMvdsp; + here->HICUMvdsp_t.dpart = 0; + here->HICUMvptsp_t.rpart = model->HICUMvptsp; + here->HICUMvptsp_t.dpart = 0; + } + + a = model->HICUMahjei*exp(model->HICUMzetahjei*ln_qtt0); + here->HICUMahjei_t.rpart = a.rpart(); + here->HICUMahjei_t.dpart = a.dpart(); + a = model->HICUMhjei*exp(model->HICUMdvgbe/vt*(exp(model->HICUMzetavgbe*log(qtt0))-1)); + here->HICUMhjei0_t.rpart = a.rpart(); + here->HICUMhjei0_t.dpart = a.dpart(); + a = model->HICUMhf0*exp(model->HICUMdvgbe/vt*(qtt0-1)); + here->HICUMhf0_t.rpart = a.rpart(); + here->HICUMhf0_t.dpart = a.dpart(); + if (model->HICUMflcomp >= 2.3) { + a = model->HICUMhfe*exp((model->HICUMvgb-model->HICUMvge)/vt*(qtt0-1)); + here->HICUMhfe_t.rpart = a.rpart(); + here->HICUMhfe_t.dpart = a.dpart(); + a = model->HICUMhfc*exp((model->HICUMvgb-model->HICUMvgc)/vt*(qtt0-1)); + here->HICUMhfc_t.rpart = a.rpart(); + here->HICUMhfc_t.dpart = a.dpart(); + } else { + here->HICUMhfe_t.rpart = model->HICUMhfe; + here->HICUMhfe_t.dpart = 0; + here->HICUMhfc_t.rpart = model->HICUMhfc; + here->HICUMhfc_t.dpart = 0; + } + + a = here->HICUMrth_scaled*exp(model->HICUMzetarth*ln_qtt0)*(1+model->HICUMalrth*dT); + here->HICUMrth_t.rpart = a.rpart(); + here->HICUMrth_t.dpart = a.dpart(); + +} diff --git a/src/spicelib/devices/hicum2/hicumL2temp.hpp b/src/spicelib/devices/hicum2/hicumL2temp.hpp index 02a648d85..8efc67451 100644 --- a/src/spicelib/devices/hicum2/hicumL2temp.hpp +++ b/src/spicelib/devices/hicum2/hicumL2temp.hpp @@ -1,7 +1,7 @@ /********** License : 3-clause BSD Spice3 Implementation: 2019-2020 Dietmar Warning, Markus Müller, Mario Krattenmacher -Model Author : 1990 Michael Schröter TU Dresden +Model Author : (Copyright 1993-2024) Michael Schroter **********/ #ifndef hicumL2_temp #define hicumL2_temp