cleanup initial conditions to the traditional spice usage

This commit is contained in:
dwarning 2020-07-15 10:11:46 +02:00
parent c3cadb8de1
commit 284583e0cc
5 changed files with 55 additions and 146 deletions

View File

@ -37,30 +37,6 @@ HICUMask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFval
case HICUM_OFF:
value->iValue = here->HICUMoff;
return(OK);
// case HICUM_IC_VB:
// value->rValue = here->HICUMicVB;
// return(OK);
// case HICUM_IC_VE:
// value->rValue = here->HICUMicVE;
// return(OK);
// case HICUM_IC_VC:
// value->rValue = here->HICUMicVC;
// return(OK);
// case HICUM_IC_VBi:
// value->rValue = here->HICUMicVBi;
// return(OK);
// case HICUM_IC_VBp:
// value->rValue = here->HICUMicVBp;
// return(OK);
// case HICUM_IC_VEi:
// value->rValue = here->HICUMicVEi;
// return(OK);
// case HICUM_IC_VCi:
// value->rValue = here->HICUMicVCi;
// return(OK);
// case HICUM_IC_Vt:
// value->rValue = here->HICUMicVt;
// return(OK);
case HICUM_TEMP:
value->rValue = here->HICUMtemp - CONSTCtoK;
return(OK);

View File

@ -70,14 +70,9 @@ typedef struct sHICUMinstance {
double HICUMarea; /* area factor for the hicum */
//initial conditions
double HICUMicVBi; /* initial condition potential Bi */
double HICUMicVBp; /* initial condition potential Bp */
double HICUMicVB; /* initial condition potential B */
double HICUMicVCi; /* initial condition potential Ci */
double HICUMicVt; /* initial condition potential T */
double HICUMicVEi; /* initial condition potential Ei */
double HICUMicVC; /* initial condition potential C */
double HICUMicVE; /* initial condition potential E */
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 HICUMdtemp; /* instance delta temperature */
@ -315,14 +310,9 @@ typedef struct sHICUMinstance {
unsigned HICUMareaGiven :1; /* flag to indicate area was specified */
unsigned HICUMoff :1; /* 'off' flag for hicum */
unsigned HICUMicVBGiven :1; /* flag to indicate VB init. cond. given */
unsigned HICUMicVEGiven :1; /* flag to indicate VE init. cond. given */
unsigned HICUMicVCGiven :1; /* flag to indicate VC init. cond. given */
unsigned HICUMicVBiGiven :1; /* flag to indicate VBi init. cond. given */
unsigned HICUMicVBpGiven :1; /* flag to indicate VBp init. cond. given */
unsigned HICUMicVEiGiven :1; /* flag to indicate VEi init. cond. given */
unsigned HICUMicVCiGiven :1; /* flag to indicate VCi init. cond. given */
unsigned HICUMicVtGiven :1; /* flag to indicate VCi init. cond. given */
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 */
@ -917,14 +907,6 @@ enum {
HICUM_AREA = 1,
HICUM_OFF,
HICUM_IC,
// HICUM_IC_VB, //removed for the time beeing, they are not spice-like
// HICUM_IC_VE,
// HICUM_IC_VC,
// HICUM_IC_VBi,
// HICUM_IC_VBp,
// HICUM_IC_VEi,
// HICUM_IC_VCi,
// HICUM_IC_Vt,
HICUM_TEMP,
HICUM_DTEMP,
HICUM_M,

View File

@ -24,44 +24,27 @@ HICUMgetic(GENmodel *inModel, CKTcircuit *ckt)
HICUMmodel *model = (HICUMmodel*)inModel;
HICUMinstance *here;
/*
* grab initial conditions out of rhs array. User specified, so use
* grab initial conditions out of rhs array. User specified, so use
* external nodes to get values
*/
for( ; model ; model = HICUMnextModel(model)) {
for(here = HICUMinstances(model); here ; here = HICUMnextInstance(here)) {
if(!here->HICUMicVBGiven) {
here->HICUMicVB =
*(ckt->CKTrhs + here->HICUMbaseNode);
}
if(!here->HICUMicVCGiven) {
here->HICUMicVC =
*(ckt->CKTrhs + here->HICUMcollNode);
}
if(!here->HICUMicVEGiven) {
here->HICUMicVE =
if(!here->HICUMicVBEGiven) {
here->HICUMicVBE =
*(ckt->CKTrhs + here->HICUMbaseNode) -
*(ckt->CKTrhs + here->HICUMemitNode);
}
if(!here->HICUMicVBiGiven) {
here->HICUMicVBi =
*(ckt->CKTrhs + here->HICUMbaseBINode);
if(!here->HICUMicVCEGiven) {
here->HICUMicVCE =
*(ckt->CKTrhs + here->HICUMcollNode) -
*(ckt->CKTrhs + here->HICUMemitNode);
}
if(!here->HICUMicVBpGiven) {
here->HICUMicVBp =
*(ckt->CKTrhs + here->HICUMbaseBPNode);
}
if(!here->HICUMicVCiGiven) {
here->HICUMicVCi =
*(ckt->CKTrhs + here->HICUMcollCINode);
}
if(!here->HICUMicVtGiven) {
here->HICUMicVt =
*(ckt->CKTrhs + here->HICUMtempNode);
}
if(!here->HICUMicVEiGiven) {
here->HICUMicVEi =
*(ckt->CKTrhs + here->HICUMemitEINode);
if(!here->HICUMicVCSGiven) {
here->HICUMicVCS =
*(ckt->CKTrhs + here->HICUMcollNode) -
*(ckt->CKTrhs + here->HICUMsubsNode);
}
}
}

View File

@ -34,38 +34,6 @@ HICUMparam(int param, IFvalue *value, GENinstance *instPtr, IFvalue *select)
case HICUM_OFF:
here->HICUMoff = (value->iValue != 0);
break;
// case HICUM_IC_VB:
// here->HICUMicVB = value->rValue;
// here->HICUMicVBGiven = TRUE;
// break;
// case HICUM_IC_VE:
// here->HICUMicVE = value->rValue;
// here->HICUMicVEGiven = TRUE;
// break;
// case HICUM_IC_VC:
// here->HICUMicVC = value->rValue;
// here->HICUMicVCGiven = TRUE;
// break;
// case HICUM_IC_VBi:
// here->HICUMicVBi = value->rValue;
// here->HICUMicVBiGiven = TRUE;
// break;
// case HICUM_IC_VBp:
// here->HICUMicVBp = value->rValue;
// here->HICUMicVBpGiven = TRUE;
// break;
// case HICUM_IC_VEi:
// here->HICUMicVEi = value->rValue;
// here->HICUMicVEiGiven = TRUE;
// break;
// case HICUM_IC_VCi:
// here->HICUMicVCi = value->rValue;
// here->HICUMicVCiGiven = TRUE;
// break;
// case HICUM_IC_Vt:
// here->HICUMicVt = value->rValue;
// here->HICUMicVtGiven = TRUE;
// break;
case HICUM_TEMP:
here->HICUMtemp = value->rValue+CONSTCtoK;
here->HICUMtempGiven = TRUE;
@ -80,13 +48,17 @@ HICUMparam(int param, IFvalue *value, GENinstance *instPtr, IFvalue *select)
break;
case HICUM_IC :
switch(value->v.numValue) {
case 2: //todo
here->HICUMicVC = *(value->v.vec.rVec+1);
here->HICUMicVCGiven = TRUE;
case 3:
here->HICUMicVCS = *(value->v.vec.rVec+2);
here->HICUMicVCSGiven = TRUE;
/* fallthrough */
case 2:
here->HICUMicVCE = *(value->v.vec.rVec+1);
here->HICUMicVCEGiven = TRUE;
/* fallthrough */
case 1:
here->HICUMicVB = *(value->v.vec.rVec);
here->HICUMicVBGiven = TRUE;
here->HICUMicVBE = *(value->v.vec.rVec);
here->HICUMicVBEGiven = TRUE;
break;
default:
return(E_BADPARM);

View File

@ -1321,40 +1321,36 @@ HICUMload(GENmodel *inModel, CKTcircuit *ckt)
}
} else if((ckt->CKTmode & MODEINITJCT) &&
(ckt->CKTmode & MODETRANOP) && (ckt->CKTmode & MODEUIC)){
Vbe = here->HICUMicVB-here->HICUMicVE; //here was a hicumtype before, why?
Vbiei = here->HICUMicVBi-here->HICUMicVEi; //here was a hicumtype before, why?
Vciei = here->HICUMicVCi-here->HICUMicVEi; //here was a hicumtype before, why?
Vbci = here->HICUMicVB-here->HICUMicVCi;
Vbici = here->HICUMicVBi-here->HICUMicVCi;
Vbpci = here->HICUMicVBp-here->HICUMicVCi;
Vbpei = here->HICUMicVBp-here->HICUMicVEi;
Vbpbi = here->HICUMicVBp-here->HICUMicVBi;
Vbbp = here->HICUMicVB-here->HICUMicVBp;
Vbpe = here->HICUMicVBp-here->HICUMicVE;
Vcic = here->HICUMicVCi-here->HICUMicVC;
Veie = here->HICUMicVEi-here->HICUMicVE;
Vrth = here->HICUMicVt;
Vsc=Vsici=0.0;
Vsis=0.0;
Icth=0.0,Icth_Vrth=0.0;
Vbiei = model->HICUMtype * here->HICUMicVBE; // multiplication by type has historical reasons
Vciei = model->HICUMtype * here->HICUMicVCE; // the user sets anytime positive numbers independent from type
Vbici = Vbiei - Vciei;
Vsc = Vsici = model->HICUMtype * here->HICUMicVCS;
Vbe = Vbpei = Vbiei;
Vbci = Vbpci = Vbici;
Vbpbi = 0.0;
Vbbp = 0.0;
Vbpe = 0.0;
Vcic = 0.0;
Veie = 0.0;
Vrth = 0.0;
Vsis = 0.0;
Icth = 0.0, Icth_Vrth=0.0;
Vxf=Vxf1=Vxf2=0.0;
} else if((ckt->CKTmode & MODEINITJCT) && (here->HICUMoff==0)) {
Vbe = here->HICUMicVB-here->HICUMicVE;
Vbiei = here->HICUMicVBi-here->HICUMicVEi; //here was a hicumtype before, why?
Vciei = here->HICUMicVCi-here->HICUMicVEi; //here was a hicumtype before, why?
Vbci = here->HICUMicVB-here->HICUMicVCi;
Vbici = here->HICUMicVBi-here->HICUMicVCi;
Vbpci = here->HICUMicVBp-here->HICUMicVCi;
Vbpei = here->HICUMicVBp-here->HICUMicVEi;
Vbpbi = here->HICUMicVBp-here->HICUMicVBi;
Vbbp = here->HICUMicVB-here->HICUMicVBp;
Vbpe = here->HICUMicVBp-here->HICUMicVE;
Vcic = here->HICUMicVCi-here->HICUMicVC;
Veie = here->HICUMicVEi-here->HICUMicVE;
Vrth = here->HICUMicVt;
Vsc=Vsici=0.0;
Vsis=0.0;
Icth=0.0,Icth_Vrth=0.0;
Vbiei = here->HICUMtVcrit;
Vbici = 0.0;
Vciei = Vbiei - Vbici;
Vsc = Vsici = 0.0;
Vbe = Vbpei = Vbiei;
Vbci = Vbpci = Vbici;
Vbpbi = 0.0;
Vbbp = 0.0;
Vbpe = 0.0;
Vcic = 0.0;
Veie = 0.0;
Vrth = 0.0;
Vsis = 0.0;
Icth = 0.0, Icth_Vrth=0.0;
Vxf=Vxf1=Vxf2=0.0;
} else if((ckt->CKTmode & MODEINITJCT) ||
( (ckt->CKTmode & MODEINITFIX) && (here->HICUMoff!=0))) {