Added "dtemp" anf "m" to jfet model. Added a test netlist and updated DEVICES.
This commit is contained in:
parent
531fb3575a
commit
14eef00d5c
10
ChangeLog
10
ChangeLog
|
|
@ -1,3 +1,13 @@
|
|||
2003-12-26 Paolo Nenzi <p.nenzi@ieee.org>
|
||||
|
||||
* src/spicelibe/devices/jfet/*: Added parallel multiplier and
|
||||
"dtemp" parameter.
|
||||
|
||||
* DEVICES: Updated jfet status
|
||||
|
||||
* tests/jfet, tests/jfet/jfet_vds-vgs.cir: added jfet directory
|
||||
and one netlist.
|
||||
|
||||
2003-12-24 Paolo Nenzi <p.nenzi@ieee.org>
|
||||
|
||||
* src/maths/cmaths/cmath4.c: Applied
|
||||
|
|
|
|||
13
DEVICES
13
DEVICES
|
|
@ -171,7 +171,18 @@ BJT2 - Bipolar Junction Trasistor
|
|||
***************************************************************************
|
||||
|
||||
JFET - Junction Field Effect transistor
|
||||
Initial Release
|
||||
Initial Release.
|
||||
Ver: N/A
|
||||
Class: J
|
||||
Level: 1
|
||||
Status:
|
||||
|
||||
This is the original spice JFET model.
|
||||
|
||||
Enhancements over the original model:
|
||||
|
||||
- Parallel multiplier
|
||||
- Instance temperature as difference for circuit temperature
|
||||
|
||||
JFET2 - Jfet PS model
|
||||
Initial release. TO BE TESTED
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "ifsim.h"
|
||||
#include "devdefs.h"
|
||||
#include "jfetdefs.h"
|
||||
|
|
@ -17,9 +16,11 @@ IFparm JFETpTable[] = { /* device parameters */
|
|||
IOPU("off", JFET_OFF, IF_FLAG, "Device initially off"),
|
||||
IOPAU("ic", JFET_IC, IF_REALVEC,"Initial VDS,VGS vector"),
|
||||
IOPU("area", JFET_AREA, IF_REAL, "Area factor"),
|
||||
IOPU("m", JFET_M, IF_REAL, "Parallel multiplier"),
|
||||
IOPAU("ic-vds", JFET_IC_VDS, IF_REAL, "Initial D-S voltage"),
|
||||
IOPAU("ic-vgs", JFET_IC_VGS, IF_REAL, "Initial G-S volrage"),
|
||||
IOPU("temp", JFET_TEMP, IF_REAL, "Instance temperature"),
|
||||
IOPU("dtemp", JFET_DTEMP, IF_REAL, "Instance temperature difference"),
|
||||
OPU("drain-node", JFET_DRAINNODE, IF_INTEGER,"Number of drain node"),
|
||||
OPU("gate-node", JFET_GATENODE, IF_INTEGER,"Number of gate node"),
|
||||
OPU("source-node", JFET_SOURCENODE, IF_INTEGER,"Number of source node"),
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "jfetdefs.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -14,9 +13,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
JFETacLoad(inModel,ckt)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
JFETacLoad(GENmodel *inModel, CKTcircuit *ckt)
|
||||
{
|
||||
JFETmodel *model = (JFETmodel*)inModel;
|
||||
JFETinstance *here;
|
||||
|
|
@ -29,6 +26,8 @@ JFETacLoad(inModel,ckt)
|
|||
double ggd;
|
||||
double xgd;
|
||||
|
||||
double m;
|
||||
|
||||
for( ; model != NULL; model = model->JFETnextModel ) {
|
||||
|
||||
for( here = model->JFETinstances; here != NULL;
|
||||
|
|
@ -43,28 +42,31 @@ JFETacLoad(inModel,ckt)
|
|||
xgs= *(ckt->CKTstate0 + here->JFETqgs) * ckt->CKTomega ;
|
||||
ggd= *(ckt->CKTstate0 + here->JFETggd) ;
|
||||
xgd= *(ckt->CKTstate0 + here->JFETqgd) * ckt->CKTomega ;
|
||||
*(here->JFETdrainDrainPtr ) += gdpr;
|
||||
*(here->JFETgateGatePtr ) += ggd+ggs;
|
||||
*(here->JFETgateGatePtr +1) += xgd+xgs;
|
||||
*(here->JFETsourceSourcePtr ) += gspr;
|
||||
*(here->JFETdrainPrimeDrainPrimePtr ) += gdpr+gds+ggd;
|
||||
*(here->JFETdrainPrimeDrainPrimePtr +1) += xgd;
|
||||
*(here->JFETsourcePrimeSourcePrimePtr ) += gspr+gds+gm+ggs;
|
||||
*(here->JFETsourcePrimeSourcePrimePtr +1) += xgs;
|
||||
*(here->JFETdrainDrainPrimePtr ) -= gdpr;
|
||||
*(here->JFETgateDrainPrimePtr ) -= ggd;
|
||||
*(here->JFETgateDrainPrimePtr +1) -= xgd;
|
||||
*(here->JFETgateSourcePrimePtr ) -= ggs;
|
||||
*(here->JFETgateSourcePrimePtr +1) -= xgs;
|
||||
*(here->JFETsourceSourcePrimePtr ) -= gspr;
|
||||
*(here->JFETdrainPrimeDrainPtr ) -= gdpr;
|
||||
*(here->JFETdrainPrimeGatePtr ) += (-ggd+gm);
|
||||
*(here->JFETdrainPrimeGatePtr +1) -= xgd;
|
||||
*(here->JFETdrainPrimeSourcePrimePtr ) += (-gds-gm);
|
||||
*(here->JFETsourcePrimeGatePtr ) += (-ggs-gm);
|
||||
*(here->JFETsourcePrimeGatePtr +1) -= xgs;
|
||||
*(here->JFETsourcePrimeSourcePtr ) -= gspr;
|
||||
*(here->JFETsourcePrimeDrainPrimePtr ) -= gds;
|
||||
|
||||
m = here->JFETm;
|
||||
|
||||
*(here->JFETdrainDrainPtr ) += m * (gdpr);
|
||||
*(here->JFETgateGatePtr ) += m * (ggd+ggs);
|
||||
*(here->JFETgateGatePtr +1) += m * (xgd+xgs);
|
||||
*(here->JFETsourceSourcePtr ) += m * (gspr);
|
||||
*(here->JFETdrainPrimeDrainPrimePtr ) += m * (gdpr+gds+ggd);
|
||||
*(here->JFETdrainPrimeDrainPrimePtr +1) += m * (xgd);
|
||||
*(here->JFETsourcePrimeSourcePrimePtr ) += m * (gspr+gds+gm+ggs);
|
||||
*(here->JFETsourcePrimeSourcePrimePtr +1) += m * (xgs);
|
||||
*(here->JFETdrainDrainPrimePtr ) -= m * (gdpr);
|
||||
*(here->JFETgateDrainPrimePtr ) -= m * (ggd);
|
||||
*(here->JFETgateDrainPrimePtr +1) -= m * (xgd);
|
||||
*(here->JFETgateSourcePrimePtr ) -= m * (ggs);
|
||||
*(here->JFETgateSourcePrimePtr +1) -= m * (xgs);
|
||||
*(here->JFETsourceSourcePrimePtr ) -= m * (gspr);
|
||||
*(here->JFETdrainPrimeDrainPtr ) -= m * (gdpr);
|
||||
*(here->JFETdrainPrimeGatePtr ) += m * (-ggd+gm);
|
||||
*(here->JFETdrainPrimeGatePtr +1) -= m * (xgd);
|
||||
*(here->JFETdrainPrimeSourcePrimePtr ) += m * (-gds-gm);
|
||||
*(here->JFETsourcePrimeGatePtr ) += m * (-ggs-gm);
|
||||
*(here->JFETsourcePrimeGatePtr +1) -= m * (xgs);
|
||||
*(here->JFETsourcePrimeSourcePtr ) -= m * (gspr);
|
||||
*(here->JFETsourcePrimeDrainPrimePtr ) -= m * (gds);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1987 Mathew Lew and Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "const.h"
|
||||
#include "ifsim.h"
|
||||
#include "cktdefs.h"
|
||||
|
|
@ -18,12 +17,8 @@ Author: 1987 Mathew Lew and Thomas L. Quarles
|
|||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
JFETask(ckt,inst,which,value,select)
|
||||
CKTcircuit *ckt;
|
||||
GENinstance *inst;
|
||||
int which;
|
||||
IFvalue *value;
|
||||
IFvalue *select;
|
||||
JFETask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value,
|
||||
IFvalue *select)
|
||||
{
|
||||
JFETinstance *here = (JFETinstance*)inst;
|
||||
static char *msg = "Current and power not available for ac analysis";
|
||||
|
|
@ -31,8 +26,15 @@ JFETask(ckt,inst,which,value,select)
|
|||
case JFET_TEMP:
|
||||
value->rValue = here->JFETtemp-CONSTCtoK;
|
||||
return(OK);
|
||||
case JFET_DTEMP:
|
||||
value->rValue = here->JFETdtemp;
|
||||
return(OK);
|
||||
case JFET_AREA:
|
||||
value->rValue = here->JFETarea;
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_M:
|
||||
value->rValue = here->JFETm;
|
||||
return(OK);
|
||||
case JFET_IC_VDS:
|
||||
value->rValue = here->JFETicVDS;
|
||||
|
|
@ -66,36 +68,47 @@ JFETask(ckt,inst,which,value,select)
|
|||
return(OK);
|
||||
case JFET_CG:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETcg);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_CD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETcd);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_CGD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETcgd);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_GM:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETgm);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_GDS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETgds);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_GGS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETggs);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_GGD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETggd);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_QGS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETqgs);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_CQGS:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETcqgs);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_QGD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETqgd);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_CQGD:
|
||||
value->rValue = *(ckt->CKTstate0 + here->JFETcqgd);
|
||||
value->rValue *= here->JFETm;
|
||||
return(OK);
|
||||
case JFET_CS :
|
||||
if (ckt->CKTcurrentAnalysis & DOING_AC) {
|
||||
|
|
@ -106,6 +119,7 @@ JFETask(ckt,inst,which,value,select)
|
|||
} else {
|
||||
value->rValue = -*(ckt->CKTstate0 + here->JFETcd);
|
||||
value->rValue -= *(ckt->CKTstate0 + here->JFETcg);
|
||||
value->rValue *= here->JFETm;
|
||||
}
|
||||
return(OK);
|
||||
case JFET_POWER :
|
||||
|
|
@ -122,6 +136,7 @@ JFETask(ckt,inst,which,value,select)
|
|||
value->rValue -= (*(ckt->CKTstate0 + here->JFETcd) +
|
||||
*(ckt->CKTstate0 + here->JFETcg)) *
|
||||
*(ckt->CKTrhsOld + here->JFETsourceNode);
|
||||
value->rValue *= here->JFETm;
|
||||
}
|
||||
return(OK);
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -127,15 +127,19 @@ typedef struct sJFETinstance {
|
|||
|
||||
unsigned JFEToff :1; /* 'off' flag for jfet */
|
||||
unsigned JFETareaGiven : 1; /* flag to indicate area was specified */
|
||||
unsigned JFETmGiven : 1; /* flag to indicate parallel multiplier given */
|
||||
unsigned JFETicVDSGiven : 1; /* initial condition given flag for V D-S*/
|
||||
unsigned JFETicVGSGiven : 1; /* initial condition given flag for V G-S*/
|
||||
unsigned JFETtempGiven : 1; /* flag to indicate instance temp given */
|
||||
unsigned JFETdtempGiven : 1; /* flag to indicate instance dtemp given */
|
||||
|
||||
|
||||
double JFETarea; /* area factor for the jfet */
|
||||
double JFETm; /* Parallel multiplier */
|
||||
double JFETicVDS; /* initial condition voltage D-S*/
|
||||
double JFETicVGS; /* initial condition voltage G-S*/
|
||||
double JFETtemp; /* operating temperature */
|
||||
double JFETdtemp; /* instance temperature difference */
|
||||
double JFETtSatCur; /* temperature adjusted saturation current */
|
||||
double JFETtGatePot; /* temperature adjusted gate potential */
|
||||
double JFETtCGS; /* temperature corrected G-S capacitance */
|
||||
|
|
@ -230,6 +234,8 @@ typedef struct sJFETmodel { /* model structure for a jfet */
|
|||
#define JFET_IC 4
|
||||
#define JFET_OFF 5
|
||||
#define JFET_TEMP 6
|
||||
#define JFET_DTEMP 7
|
||||
#define JFET_M 8
|
||||
|
||||
/* model parameters */
|
||||
#define JFET_MOD_VTO 101
|
||||
|
|
|
|||
|
|
@ -6,17 +6,13 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "jfetdefs.h"
|
||||
#include "sperror.h"
|
||||
#include "suffix.h"
|
||||
|
||||
|
||||
int
|
||||
JFETdelete(inModel,name,inst)
|
||||
GENmodel *inModel;
|
||||
IFuid name;
|
||||
GENinstance **inst;
|
||||
JFETdelete(GENmodel *inModel, IFuid name, GENinstance **inst)
|
||||
{
|
||||
JFETmodel *model = (JFETmodel*)inModel;
|
||||
JFETinstance **fast = (JFETinstance**)inst;
|
||||
|
|
|
|||
|
|
@ -6,14 +6,12 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "jfetdefs.h"
|
||||
#include "suffix.h"
|
||||
|
||||
|
||||
void
|
||||
JFETdestroy(inModel)
|
||||
GENmodel **inModel;
|
||||
JFETdestroy(GENmodel **inModel)
|
||||
{
|
||||
JFETmodel **model = (JFETmodel**)inModel;
|
||||
JFETinstance *here;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1988 Jaijeet S Roychowdhury
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "jfetdefs.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -12,11 +11,7 @@ Author: 1988 Jaijeet S Roychowdhury
|
|||
#include "suffix.h"
|
||||
|
||||
int
|
||||
JFETdisto(mode,genmodel,ckt)
|
||||
GENmodel *genmodel;
|
||||
CKTcircuit *ckt;
|
||||
int mode;
|
||||
|
||||
JFETdisto(int mode, GENmodel *genmodel, CKTcircuit *ckt)
|
||||
/* assuming here that ckt->CKTomega has been initialised to
|
||||
* the correct value
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1988 Jaijeet S Roychowdhury
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "distodef.h"
|
||||
#include "cktdefs.h"
|
||||
#include "jfetdefs.h"
|
||||
|
|
@ -15,9 +14,7 @@ Author: 1988 Jaijeet S Roychowdhury
|
|||
#include "suffix.h"
|
||||
|
||||
int
|
||||
JFETdSetup(inModel,ckt)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
JFETdSetup(GENmodel *inModel, CKTcircuit *ckt)
|
||||
/* actually load the current resistance value into the
|
||||
* sparse matrix previously provided
|
||||
*/
|
||||
|
|
@ -81,10 +78,10 @@ JFETdSetup(inModel,ckt)
|
|||
/*
|
||||
* dc model parameters
|
||||
*/
|
||||
beta = model->JFETbeta * here->JFETarea;
|
||||
gdpr=model->JFETdrainConduct*here->JFETarea;
|
||||
gspr=model->JFETsourceConduct*here->JFETarea;
|
||||
csat=here->JFETtSatCur*here->JFETarea;
|
||||
beta = model->JFETbeta * here->JFETarea * here->JFETm;
|
||||
gdpr=model->JFETdrainConduct*here->JFETarea * here->JFETm;
|
||||
gspr=model->JFETsourceConduct*here->JFETarea * here-> JFETm;
|
||||
csat=here->JFETtSatCur*here->JFETarea * here-> JFETm;
|
||||
/*
|
||||
* initialization
|
||||
*/
|
||||
|
|
@ -189,8 +186,8 @@ JFETdSetup(inModel,ckt)
|
|||
/*
|
||||
* charge storage elements
|
||||
*/
|
||||
czgs=here->JFETtCGS*here->JFETarea;
|
||||
czgd=here->JFETtCGD*here->JFETarea;
|
||||
czgs=here->JFETtCGS*here->JFETarea * here->JFETm;
|
||||
czgd=here->JFETtCGD*here->JFETarea * here->JFETm;
|
||||
twop=here->JFETtGatePot+here->JFETtGatePot;
|
||||
fcpb2=here->JFETcorDepCap*here->JFETcorDepCap;
|
||||
czgsf2=czgs/model->JFETf2;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1985 Thomas L. Quarles
|
|||
Modified: 2000 AlansFixes
|
||||
**********/
|
||||
|
||||
#ifdef __STDC__
|
||||
extern int JFETacLoad(GENmodel*,CKTcircuit*);
|
||||
extern int JFETask(CKTcircuit*,GENinstance*,int,IFvalue*,IFvalue*);
|
||||
extern int JFETdelete(GENmodel*,IFuid,GENinstance**);
|
||||
|
|
@ -22,25 +21,4 @@ extern int JFETtemp(GENmodel*,CKTcircuit*);
|
|||
extern int JFETtrunc(GENmodel*,CKTcircuit*,double*);
|
||||
extern int JFETdisto(int,GENmodel*,CKTcircuit*);
|
||||
extern int JFETnoise(int,int,GENmodel*,CKTcircuit*,Ndata*,double*);
|
||||
|
||||
extern int JFETdSetup(GENmodel*,CKTcircuit*);
|
||||
|
||||
#else /* stdc */
|
||||
extern int JFETacLoad();
|
||||
extern int JFETask();
|
||||
extern int JFETdelete();
|
||||
extern void JFETdestroy();
|
||||
extern int JFETgetic();
|
||||
extern int JFETload();
|
||||
extern int JFETmAsk();
|
||||
extern int JFETmDelete();
|
||||
extern int JFETmParam();
|
||||
extern int JFETparam();
|
||||
extern int JFETpzLoad();
|
||||
extern int JFETsetup();
|
||||
extern int JFETunsetup();
|
||||
extern int JFETtemp();
|
||||
extern int JFETtrunc();
|
||||
extern int JFETdisto();
|
||||
extern int JFETnoise();
|
||||
#endif /* stdc */
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "jfetdefs.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -14,9 +13,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
JFETgetic(inModel,ckt)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
JFETgetic(GENmodel *inModel, CKTcircuit *ckt)
|
||||
{
|
||||
JFETmodel *model = (JFETmodel*)inModel;
|
||||
JFETinstance *here;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "jfetdefs.h"
|
||||
#include "const.h"
|
||||
|
|
@ -18,9 +17,7 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern
|
|||
#include "suffix.h"
|
||||
|
||||
int
|
||||
JFETload(inModel,ckt)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
JFETload(GENmodel *inModel, CKTcircuit *ckt)
|
||||
/* actually load the current resistance value into the
|
||||
* sparse matrix previously provided
|
||||
*/
|
||||
|
|
@ -78,6 +75,8 @@ JFETload(inModel,ckt)
|
|||
|
||||
double arg, vt_temp;
|
||||
|
||||
double m;
|
||||
|
||||
/* loop through all the models */
|
||||
for( ; model != NULL; model = model->JFETnextModel ) {
|
||||
|
||||
|
|
@ -424,32 +423,35 @@ JFETload(inModel,ckt)
|
|||
* load current vector
|
||||
*/
|
||||
load:
|
||||
|
||||
m = here->JFETm;
|
||||
|
||||
ceqgd=model->JFETtype*(cgd-ggd*vgd);
|
||||
ceqgs=model->JFETtype*((cg-cgd)-ggs*vgs);
|
||||
cdreq=model->JFETtype*((cd+cgd)-gds*vds-gm*vgs);
|
||||
*(ckt->CKTrhs + here->JFETgateNode) += (-ceqgs-ceqgd);
|
||||
*(ckt->CKTrhs + here->JFETgateNode) += m * (-ceqgs-ceqgd);
|
||||
*(ckt->CKTrhs + here->JFETdrainPrimeNode) +=
|
||||
(-cdreq+ceqgd);
|
||||
m * (-cdreq+ceqgd);
|
||||
*(ckt->CKTrhs + here->JFETsourcePrimeNode) +=
|
||||
(cdreq+ceqgs);
|
||||
m * (cdreq+ceqgs);
|
||||
/*
|
||||
* load y matrix
|
||||
*/
|
||||
*(here->JFETdrainDrainPrimePtr) += (-gdpr);
|
||||
*(here->JFETgateDrainPrimePtr) += (-ggd);
|
||||
*(here->JFETgateSourcePrimePtr) += (-ggs);
|
||||
*(here->JFETsourceSourcePrimePtr) += (-gspr);
|
||||
*(here->JFETdrainPrimeDrainPtr) += (-gdpr);
|
||||
*(here->JFETdrainPrimeGatePtr) += (gm-ggd);
|
||||
*(here->JFETdrainPrimeSourcePrimePtr) += (-gds-gm);
|
||||
*(here->JFETsourcePrimeGatePtr) += (-ggs-gm);
|
||||
*(here->JFETsourcePrimeSourcePtr) += (-gspr);
|
||||
*(here->JFETsourcePrimeDrainPrimePtr) += (-gds);
|
||||
*(here->JFETdrainDrainPtr) += (gdpr);
|
||||
*(here->JFETgateGatePtr) += (ggd+ggs);
|
||||
*(here->JFETsourceSourcePtr) += (gspr);
|
||||
*(here->JFETdrainPrimeDrainPrimePtr) += (gdpr+gds+ggd);
|
||||
*(here->JFETsourcePrimeSourcePrimePtr) += (gspr+gds+gm+ggs);
|
||||
*(here->JFETdrainDrainPrimePtr) += m * (-gdpr);
|
||||
*(here->JFETgateDrainPrimePtr) += m * (-ggd);
|
||||
*(here->JFETgateSourcePrimePtr) += m * (-ggs);
|
||||
*(here->JFETsourceSourcePrimePtr) += m * (-gspr);
|
||||
*(here->JFETdrainPrimeDrainPtr) += m * (-gdpr);
|
||||
*(here->JFETdrainPrimeGatePtr) += m * (gm-ggd);
|
||||
*(here->JFETdrainPrimeSourcePrimePtr) += m * (-gds-gm);
|
||||
*(here->JFETsourcePrimeGatePtr) += m * (-ggs-gm);
|
||||
*(here->JFETsourcePrimeSourcePtr) += m * (-gspr);
|
||||
*(here->JFETsourcePrimeDrainPrimePtr) += m * (-gds);
|
||||
*(here->JFETdrainDrainPtr) += m * (gdpr);
|
||||
*(here->JFETgateGatePtr) += m * (ggd+ggs);
|
||||
*(here->JFETsourceSourcePtr) += m * (gspr);
|
||||
*(here->JFETdrainPrimeDrainPrimePtr) += m * (gdpr+gds+ggd);
|
||||
*(here->JFETsourcePrimeSourcePrimePtr) += m * (gspr+gds+gm+ggs);
|
||||
}
|
||||
}
|
||||
return(OK);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "const.h"
|
||||
#include "ifsim.h"
|
||||
#include "cktdefs.h"
|
||||
|
|
@ -21,11 +20,7 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern
|
|||
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
JFETmAsk(ckt,inModel,which,value)
|
||||
CKTcircuit *ckt;
|
||||
GENmodel *inModel;
|
||||
int which;
|
||||
IFvalue *value;
|
||||
JFETmAsk(CKTcircuit *ckt, GENmodel *inModel, int which, IFvalue *value)
|
||||
{
|
||||
JFETmodel *model = (JFETmodel*)inModel;
|
||||
switch(which) {
|
||||
|
|
|
|||
|
|
@ -6,17 +6,13 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "jfetdefs.h"
|
||||
#include "sperror.h"
|
||||
#include "suffix.h"
|
||||
|
||||
|
||||
int
|
||||
JFETmDelete(inModel,modname,kill)
|
||||
GENmodel **inModel;
|
||||
IFuid modname;
|
||||
GENmodel *kill;
|
||||
JFETmDelete(GENmodel **inModel, IFuid modname, GENmodel *kill)
|
||||
{
|
||||
JFETmodel **model = (JFETmodel**)inModel;
|
||||
JFETmodel *modfast = (JFETmodel*)kill;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "const.h"
|
||||
#include "ifsim.h"
|
||||
#include "jfetdefs.h"
|
||||
|
|
@ -15,10 +14,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
JFETmParam(param,value,inModels)
|
||||
int param;
|
||||
IFvalue *value;
|
||||
GENmodel *inModels;
|
||||
JFETmParam(int param, IFvalue *value, GENmodel *inModels)
|
||||
{
|
||||
JFETmodel *model = (JFETmodel*)inModels;
|
||||
switch(param) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ Author: 1987 Gary W. Ng
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "jfetdefs.h"
|
||||
#include "cktdefs.h"
|
||||
#include "iferrmsg.h"
|
||||
|
|
@ -24,13 +23,8 @@ extern void NevalSrc();
|
|||
extern double Nintegrate();
|
||||
|
||||
int
|
||||
JFETnoise (mode, operation, genmodel, ckt, data, OnDens)
|
||||
int mode;
|
||||
int operation;
|
||||
GENmodel *genmodel;
|
||||
CKTcircuit *ckt;
|
||||
Ndata *data;
|
||||
double *OnDens;
|
||||
JFETnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *data,
|
||||
double *OnDens)
|
||||
{
|
||||
JFETmodel *firstModel = (JFETmodel *) genmodel;
|
||||
JFETmodel *model;
|
||||
|
|
@ -117,21 +111,22 @@ if (!data->namelist) return(E_NOMEM);
|
|||
case N_DENS:
|
||||
NevalSrc(&noizDens[JFETRDNOIZ],&lnNdens[JFETRDNOIZ],
|
||||
ckt,THERMNOISE,inst->JFETdrainPrimeNode,inst->JFETdrainNode,
|
||||
model->JFETdrainConduct * inst->JFETarea);
|
||||
model->JFETdrainConduct * inst->JFETarea * inst->JFETm);
|
||||
|
||||
NevalSrc(&noizDens[JFETRSNOIZ],&lnNdens[JFETRSNOIZ],
|
||||
ckt,THERMNOISE,inst->JFETsourcePrimeNode,
|
||||
inst->JFETsourceNode,model->JFETsourceConduct*inst->JFETarea);
|
||||
inst->JFETsourceNode,model->JFETsourceConduct
|
||||
* inst->JFETarea * inst->JFETm);
|
||||
|
||||
NevalSrc(&noizDens[JFETIDNOIZ],&lnNdens[JFETIDNOIZ],
|
||||
ckt,THERMNOISE,inst->JFETdrainPrimeNode,
|
||||
inst->JFETsourcePrimeNode,
|
||||
(2.0/3.0 * fabs(*(ckt->CKTstate0 + inst->JFETgm))));
|
||||
(2.0/3.0 * inst->JFETm * fabs(*(ckt->CKTstate0 + inst->JFETgm))));
|
||||
|
||||
NevalSrc(&noizDens[JFETFLNOIZ],(double*)NULL,ckt,
|
||||
N_GAIN,inst->JFETdrainPrimeNode,
|
||||
inst->JFETsourcePrimeNode, (double)0.0);
|
||||
noizDens[JFETFLNOIZ] *= model->JFETfNcoef *
|
||||
noizDens[JFETFLNOIZ] *= inst->JFETm * model->JFETfNcoef *
|
||||
exp(model->JFETfNexp *
|
||||
log(MAX(fabs(*(ckt->CKTstate0 + inst->JFETcd)),N_MINLOG))) /
|
||||
data->freq;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "const.h"
|
||||
#include "ifsim.h"
|
||||
#include "jfetdefs.h"
|
||||
|
|
@ -16,11 +15,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
JFETparam(param,value,inst,select)
|
||||
int param;
|
||||
IFvalue *value;
|
||||
GENinstance *inst;
|
||||
IFvalue *select;
|
||||
JFETparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
||||
{
|
||||
JFETinstance *here = (JFETinstance *)inst;
|
||||
switch(param) {
|
||||
|
|
@ -28,10 +23,18 @@ JFETparam(param,value,inst,select)
|
|||
here->JFETtemp = value->rValue+CONSTCtoK;
|
||||
here->JFETtempGiven = TRUE;
|
||||
break;
|
||||
case JFET_DTEMP:
|
||||
here->JFETdtemp = value->rValue;
|
||||
here->JFETdtempGiven = TRUE;
|
||||
break;
|
||||
case JFET_AREA:
|
||||
here->JFETarea = value->rValue;
|
||||
here->JFETareaGiven = TRUE;
|
||||
break;
|
||||
case JFET_M:
|
||||
here->JFETm = value->rValue;
|
||||
here->JFETmGiven = TRUE;
|
||||
break;
|
||||
case JFET_IC_VDS:
|
||||
here->JFETicVDS = value->rValue;
|
||||
here->JFETicVDSGiven = TRUE;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "complex.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -15,10 +14,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
JFETpzLoad(inModel,ckt,s)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
SPcomplex *s;
|
||||
JFETpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
|
||||
{
|
||||
JFETmodel *model = (JFETmodel*)inModel;
|
||||
JFETinstance *here;
|
||||
|
|
@ -31,12 +27,16 @@ JFETpzLoad(inModel,ckt,s)
|
|||
double ggd;
|
||||
double xgd;
|
||||
|
||||
double m;
|
||||
|
||||
for( ; model != NULL; model = model->JFETnextModel ) {
|
||||
|
||||
for( here = model->JFETinstances; here != NULL;
|
||||
here = here->JFETnextInstance) {
|
||||
if (here->JFETowner != ARCHme) continue;
|
||||
|
||||
m = here->JFETm;
|
||||
|
||||
gdpr=model->JFETdrainResist * here->JFETarea;
|
||||
gspr=model->JFETsourceResist * here->JFETarea;
|
||||
gm= *(ckt->CKTstate0 + here->JFETgm) ;
|
||||
|
|
@ -45,35 +45,36 @@ JFETpzLoad(inModel,ckt,s)
|
|||
xgs= *(ckt->CKTstate0 + here->JFETqgs) ;
|
||||
ggd= *(ckt->CKTstate0 + here->JFETggd) ;
|
||||
xgd= *(ckt->CKTstate0 + here->JFETqgd) ;
|
||||
*(here->JFETdrainDrainPtr ) += gdpr;
|
||||
*(here->JFETgateGatePtr ) += ggd+ggs;
|
||||
*(here->JFETgateGatePtr ) += (xgd+xgs) * s->real;
|
||||
*(here->JFETgateGatePtr +1) += (xgd+xgs) * s->imag;
|
||||
*(here->JFETsourceSourcePtr ) += gspr;
|
||||
*(here->JFETdrainPrimeDrainPrimePtr ) += gdpr+gds+ggd;
|
||||
*(here->JFETdrainPrimeDrainPrimePtr ) += xgd * s->real;
|
||||
*(here->JFETdrainPrimeDrainPrimePtr +1) += xgd * s->imag;
|
||||
*(here->JFETsourcePrimeSourcePrimePtr ) += gspr+gds+gm+ggs;
|
||||
*(here->JFETsourcePrimeSourcePrimePtr ) += xgs * s->real;
|
||||
*(here->JFETsourcePrimeSourcePrimePtr +1) += xgs * s->imag;
|
||||
*(here->JFETdrainDrainPrimePtr ) -= gdpr;
|
||||
*(here->JFETgateDrainPrimePtr ) -= ggd;
|
||||
*(here->JFETgateDrainPrimePtr ) -= xgd * s->real;
|
||||
*(here->JFETgateDrainPrimePtr +1) -= xgd * s->imag;
|
||||
*(here->JFETgateSourcePrimePtr ) -= ggs;
|
||||
*(here->JFETgateSourcePrimePtr ) -= xgs * s->real;
|
||||
*(here->JFETgateSourcePrimePtr +1) -= xgs * s->imag;
|
||||
*(here->JFETsourceSourcePrimePtr ) -= gspr;
|
||||
*(here->JFETdrainPrimeDrainPtr ) -= gdpr;
|
||||
*(here->JFETdrainPrimeGatePtr ) += (-ggd+gm);
|
||||
*(here->JFETdrainPrimeGatePtr ) -= xgd * s->real;
|
||||
*(here->JFETdrainPrimeGatePtr +1) -= xgd * s->imag;
|
||||
*(here->JFETdrainPrimeSourcePrimePtr ) += (-gds-gm);
|
||||
*(here->JFETsourcePrimeGatePtr ) += (-ggs-gm);
|
||||
*(here->JFETsourcePrimeGatePtr ) -= xgs * s->real;
|
||||
*(here->JFETsourcePrimeGatePtr +1) -= xgs * s->imag;
|
||||
*(here->JFETsourcePrimeSourcePtr ) -= gspr;
|
||||
*(here->JFETsourcePrimeDrainPrimePtr ) -= gds;
|
||||
|
||||
*(here->JFETdrainDrainPtr ) += m * gdpr;
|
||||
*(here->JFETgateGatePtr ) += m * (ggd+ggs);
|
||||
*(here->JFETgateGatePtr ) += m * ((xgd+xgs) * s->real);
|
||||
*(here->JFETgateGatePtr +1) += m * ((xgd+xgs) * s->imag);
|
||||
*(here->JFETsourceSourcePtr ) += m * (gspr);
|
||||
*(here->JFETdrainPrimeDrainPrimePtr ) += m * (gdpr+gds+ggd);
|
||||
*(here->JFETdrainPrimeDrainPrimePtr ) += m * (xgd * s->real);
|
||||
*(here->JFETdrainPrimeDrainPrimePtr +1) += m * (xgd * s->imag);
|
||||
*(here->JFETsourcePrimeSourcePrimePtr ) += m * (gspr+gds+gm+ggs);
|
||||
*(here->JFETsourcePrimeSourcePrimePtr ) += m * (xgs * s->real);
|
||||
*(here->JFETsourcePrimeSourcePrimePtr +1) += m * (xgs * s->imag);
|
||||
*(here->JFETdrainDrainPrimePtr ) -= m * (gdpr);
|
||||
*(here->JFETgateDrainPrimePtr ) -= m * (ggd);
|
||||
*(here->JFETgateDrainPrimePtr ) -= m * (xgd * s->real);
|
||||
*(here->JFETgateDrainPrimePtr +1) -= m * (xgd * s->imag);
|
||||
*(here->JFETgateSourcePrimePtr ) -= m * (ggs);
|
||||
*(here->JFETgateSourcePrimePtr ) -= m * (xgs * s->real);
|
||||
*(here->JFETgateSourcePrimePtr +1) -= m * (xgs * s->imag);
|
||||
*(here->JFETsourceSourcePrimePtr ) -= m * (gspr);
|
||||
*(here->JFETdrainPrimeDrainPtr ) -= m * (gdpr);
|
||||
*(here->JFETdrainPrimeGatePtr ) += m * (-ggd+gm);
|
||||
*(here->JFETdrainPrimeGatePtr ) -= m * (xgd * s->real);
|
||||
*(here->JFETdrainPrimeGatePtr +1) -= m * (xgd * s->imag);
|
||||
*(here->JFETdrainPrimeSourcePrimePtr ) += m * (-gds-gm);
|
||||
*(here->JFETsourcePrimeGatePtr ) += m * (-ggs-gm);
|
||||
*(here->JFETsourcePrimeGatePtr ) -= m * (xgs * s->real);
|
||||
*(here->JFETsourcePrimeGatePtr +1) -= m * (xgs * s->imag);
|
||||
*(here->JFETsourcePrimeSourcePtr ) -= m * (gspr);
|
||||
*(here->JFETsourcePrimeDrainPrimePtr ) -= m * (gds);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "smpdefs.h"
|
||||
#include "cktdefs.h"
|
||||
#include "jfetdefs.h"
|
||||
|
|
@ -17,11 +16,7 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern
|
|||
#include "suffix.h"
|
||||
|
||||
int
|
||||
JFETsetup(matrix,inModel,ckt,states)
|
||||
SMPmatrix *matrix;
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
int *states;
|
||||
JFETsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
|
||||
/* load the diode structure with those pointers needed later
|
||||
* for fast matrix loading
|
||||
*/
|
||||
|
|
@ -99,6 +94,9 @@ JFETsetup(matrix,inModel,ckt,states)
|
|||
if(!here->JFETareaGiven) {
|
||||
here->JFETarea = 1;
|
||||
}
|
||||
if(!here->JFETmGiven) {
|
||||
here->JFETm = 1;
|
||||
}
|
||||
here->JFETstate = *states;
|
||||
*states += 13;
|
||||
|
||||
|
|
@ -177,9 +175,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\
|
|||
}
|
||||
|
||||
int
|
||||
JFETunsetup(inModel,ckt)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
JFETunsetup(GENmodel *inModel, CKTcircuit *ckt)
|
||||
{
|
||||
JFETmodel *model;
|
||||
JFETinstance *here;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern
|
|||
**********/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "smpdefs.h"
|
||||
#include "cktdefs.h"
|
||||
#include "jfetdefs.h"
|
||||
|
|
@ -16,9 +15,7 @@ Sydney University mods Copyright(c) 1989 Anthony E. Parker, David J. Skellern
|
|||
#include "suffix.h"
|
||||
|
||||
int
|
||||
JFETtemp(inModel,ckt)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
JFETtemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||
/* Pre-process the model parameters after a possible change
|
||||
*/
|
||||
{
|
||||
|
|
@ -84,8 +81,11 @@ JFETtemp(inModel,ckt)
|
|||
here=here->JFETnextInstance) {
|
||||
if (here->JFETowner != ARCHme) continue;
|
||||
|
||||
if(!(here->JFETdtempGiven)) {
|
||||
here->JFETdtemp = 0.0;
|
||||
}
|
||||
if(!(here->JFETtempGiven)) {
|
||||
here->JFETtemp = ckt->CKTtemp;
|
||||
here->JFETtemp = ckt->CKTtemp + here->JFETdtemp;
|
||||
}
|
||||
vt = here->JFETtemp * CONSTKoverQ;
|
||||
fact2 = here->JFETtemp/REFTEMP;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Author: 1985 Thomas L. Quarles
|
|||
*/
|
||||
|
||||
#include "ngspice.h"
|
||||
#include <stdio.h>
|
||||
#include "cktdefs.h"
|
||||
#include "jfetdefs.h"
|
||||
#include "sperror.h"
|
||||
|
|
@ -14,10 +13,7 @@ Author: 1985 Thomas L. Quarles
|
|||
|
||||
|
||||
int
|
||||
JFETtrunc(inModel,ckt,timeStep)
|
||||
GENmodel *inModel;
|
||||
CKTcircuit *ckt;
|
||||
double *timeStep;
|
||||
JFETtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep)
|
||||
{
|
||||
JFETmodel *model = (JFETmodel*)inModel;
|
||||
JFETinstance *here;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
* I-V Characteristics of JFET 2N4221
|
||||
*
|
||||
*
|
||||
j1 2 1 0 MODJ
|
||||
VD 2 0 25
|
||||
VG 1 0 -2
|
||||
*
|
||||
.model MODJ NJF LEVEL=1 VTO=-3.5 BETA=4.1E-4 LAMBDA=0.002 RD=200
|
||||
*
|
||||
.op
|
||||
.dc VD 0 25 1 VG -3 0 1
|
||||
*.print DC I(VD)
|
||||
.END
|
||||
Loading…
Reference in New Issue