res...c: indentations, white spaces
This commit is contained in:
parent
4c589a1c71
commit
c9d4ab1d13
|
|
@ -10,51 +10,51 @@ Modified: 2000 AlansFixes
|
||||||
#include "ngspice/devdefs.h"
|
#include "ngspice/devdefs.h"
|
||||||
#include "ngspice/ifsim.h"
|
#include "ngspice/ifsim.h"
|
||||||
|
|
||||||
IFparm RESpTable[] = { /* parameters */
|
IFparm RESpTable[] = { /* parameters */
|
||||||
IOPP( "resistance", RES_RESIST, IF_REAL, "Resistance"),
|
IOPP( "resistance", RES_RESIST, IF_REAL, "Resistance"),
|
||||||
IOPAA( "ac", RES_ACRESIST, IF_REAL, "AC resistance value"),
|
IOPAA( "ac", RES_ACRESIST, IF_REAL, "AC resistance value"),
|
||||||
IOPZU( "temp", RES_TEMP, IF_REAL, "Instance operating temperature"),
|
IOPZU( "temp", RES_TEMP, IF_REAL, "Instance operating temperature"),
|
||||||
IOPZ( "dtemp", RES_DTEMP, IF_REAL,
|
IOPZ( "dtemp", RES_DTEMP, IF_REAL,
|
||||||
"Instance temperature difference with the rest of the circuit"),
|
"Instance temperature difference with the rest of the circuit"),
|
||||||
IOPQU( "l", RES_LENGTH, IF_REAL, "Length"),
|
IOPQU( "l", RES_LENGTH, IF_REAL, "Length"),
|
||||||
IOPZU( "w", RES_WIDTH, IF_REAL, "Width"),
|
IOPZU( "w", RES_WIDTH, IF_REAL, "Width"),
|
||||||
IOPU( "m", RES_M, IF_REAL, "Multiplication factor"),
|
IOPU( "m", RES_M, IF_REAL, "Multiplication factor"),
|
||||||
IOPU( "tc", RES_TC1, IF_REAL, "First order temp. coefficient"),
|
IOPU( "tc", RES_TC1, IF_REAL, "First order temp. coefficient"),
|
||||||
IOPU( "tc1", RES_TC1, IF_REAL, "First order temp. coefficient"),
|
IOPU( "tc1", RES_TC1, IF_REAL, "First order temp. coefficient"),
|
||||||
IOPU( "tc2", RES_TC2, IF_REAL, "Second order temp. coefficient"),
|
IOPU( "tc2", RES_TC2, IF_REAL, "Second order temp. coefficient"),
|
||||||
IOPU( "scale", RES_SCALE, IF_REAL, "Scale factor"),
|
IOPU( "scale", RES_SCALE, IF_REAL, "Scale factor"),
|
||||||
IOP( "noisy", RES_NOISY, IF_INTEGER, "Resistor generate noise"),
|
IOP( "noisy", RES_NOISY, IF_INTEGER, "Resistor generate noise"),
|
||||||
IP( "sens_resist", RES_RESIST_SENS, IF_FLAG,
|
IP( "sens_resist", RES_RESIST_SENS, IF_FLAG,
|
||||||
"flag to request sensitivity WRT resistance"),
|
"flag to request sensitivity WRT resistance"),
|
||||||
OP( "i", RES_CURRENT, IF_REAL, "Current"),
|
OP( "i", RES_CURRENT, IF_REAL, "Current"),
|
||||||
OP( "p", RES_POWER, IF_REAL, "Power"),
|
OP( "p", RES_POWER, IF_REAL, "Power"),
|
||||||
OPU( "sens_dc", RES_QUEST_SENS_DC, IF_REAL, "dc sensitivity "),
|
OPU( "sens_dc", RES_QUEST_SENS_DC, IF_REAL, "dc sensitivity "),
|
||||||
OPU( "sens_real", RES_QUEST_SENS_REAL, IF_REAL,
|
OPU( "sens_real", RES_QUEST_SENS_REAL, IF_REAL,
|
||||||
"dc sensitivity and real part of ac sensitivity"),
|
"dc sensitivity and real part of ac sensitivity"),
|
||||||
OPU( "sens_imag", RES_QUEST_SENS_IMAG, IF_REAL,
|
OPU( "sens_imag", RES_QUEST_SENS_IMAG, IF_REAL,
|
||||||
"dc sensitivity and imag part of ac sensitivity"),
|
"dc sensitivity and imag part of ac sensitivity"),
|
||||||
OPU( "sens_mag", RES_QUEST_SENS_MAG, IF_REAL, "ac sensitivity of magnitude"),
|
OPU( "sens_mag", RES_QUEST_SENS_MAG, IF_REAL, "ac sensitivity of magnitude"),
|
||||||
OPU( "sens_ph", RES_QUEST_SENS_PH, IF_REAL, "ac sensitivity of phase"),
|
OPU( "sens_ph", RES_QUEST_SENS_PH, IF_REAL, "ac sensitivity of phase"),
|
||||||
OPU( "sens_cplx", RES_QUEST_SENS_CPLX, IF_COMPLEX, "ac sensitivity")
|
OPU( "sens_cplx", RES_QUEST_SENS_CPLX, IF_COMPLEX, "ac sensitivity")
|
||||||
};
|
};
|
||||||
|
|
||||||
IFparm RESmPTable[] = { /* model parameters */
|
IFparm RESmPTable[] = { /* model parameters */
|
||||||
IOPQ( "rsh", RES_MOD_RSH, IF_REAL,"Sheet resistance"),
|
IOPQ( "rsh", RES_MOD_RSH, IF_REAL,"Sheet resistance"),
|
||||||
IOPZ( "narrow", RES_MOD_NARROW, IF_REAL,"Narrowing of resistor"),
|
IOPZ( "narrow", RES_MOD_NARROW, IF_REAL,"Narrowing of resistor"),
|
||||||
IOPR( "dw", RES_MOD_NARROW, IF_REAL,"Narrowing of resistor"),
|
IOPR( "dw", RES_MOD_NARROW, IF_REAL,"Narrowing of resistor"),
|
||||||
IOPZ( "short", RES_MOD_SHORT, IF_REAL,"Shortening of resistor"),
|
IOPZ( "short", RES_MOD_SHORT, IF_REAL,"Shortening of resistor"),
|
||||||
IOPR( "dlr", RES_MOD_SHORT, IF_REAL,"Shortening of resistor"),
|
IOPR( "dlr", RES_MOD_SHORT, IF_REAL,"Shortening of resistor"),
|
||||||
IOPQ( "tc1", RES_MOD_TC1, IF_REAL,"First order temp. coefficient"),
|
IOPQ( "tc1", RES_MOD_TC1, IF_REAL,"First order temp. coefficient"),
|
||||||
IOPR( "tc1r", RES_MOD_TC1, IF_REAL,"First order temp. coefficient"),
|
IOPR( "tc1r", RES_MOD_TC1, IF_REAL,"First order temp. coefficient"),
|
||||||
IOPQO( "tc2", RES_MOD_TC2, IF_REAL,"Second order temp. coefficient"),
|
IOPQO( "tc2", RES_MOD_TC2, IF_REAL,"Second order temp. coefficient"),
|
||||||
IOPR( "tc2r", RES_MOD_TC2, IF_REAL,"Second order temp. coefficient"),
|
IOPR( "tc2r", RES_MOD_TC2, IF_REAL,"Second order temp. coefficient"),
|
||||||
IOPX( "defw", RES_MOD_DEFWIDTH, IF_REAL,"Default device width"),
|
IOPX( "defw", RES_MOD_DEFWIDTH, IF_REAL,"Default device width"),
|
||||||
IOPR( "w", RES_MOD_DEFWIDTH, IF_REAL,"Default device width"),
|
IOPR( "w", RES_MOD_DEFWIDTH, IF_REAL,"Default device width"),
|
||||||
IOPX( "l", RES_MOD_DEFLENGTH,IF_REAL,"Default device length"),
|
IOPX( "l", RES_MOD_DEFLENGTH,IF_REAL,"Default device length"),
|
||||||
IOPQ( "kf", RES_MOD_KF, IF_REAL,"Flicker noise coefficient"),
|
IOPQ( "kf", RES_MOD_KF, IF_REAL,"Flicker noise coefficient"),
|
||||||
IOPQ( "af", RES_MOD_AF, IF_REAL,"Flicker noise exponent"),
|
IOPQ( "af", RES_MOD_AF, IF_REAL,"Flicker noise exponent"),
|
||||||
IOPXU( "tnom", RES_MOD_TNOM, IF_REAL,"Parameter measurement temperature"),
|
IOPXU( "tnom", RES_MOD_TNOM, IF_REAL,"Parameter measurement temperature"),
|
||||||
IP( "r", RES_MOD_R, IF_FLAG,"Device is a resistor model")
|
IP( "r", RES_MOD_R, IF_FLAG,"Device is a resistor model")
|
||||||
};
|
};
|
||||||
|
|
||||||
char *RESnames[] = {
|
char *RESnames[] = {
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,14 @@ Modified: 2000 AlansFixes
|
||||||
#include "ngspice/complex.h"
|
#include "ngspice/complex.h"
|
||||||
#include "ngspice/noisedef.h"
|
#include "ngspice/noisedef.h"
|
||||||
|
|
||||||
/* definitions used to describe resistors */
|
/* definitions used to describe resistors */
|
||||||
|
|
||||||
|
|
||||||
/* information used to describe a single instance */
|
/* information used to describe a single instance */
|
||||||
|
|
||||||
typedef struct sRESinstance {
|
typedef struct sRESinstance {
|
||||||
struct sRESmodel *RESmodPtr; /* backpointer to model */
|
struct sRESmodel *RESmodPtr; /* backpointer to model */
|
||||||
struct sRESinstance *RESnextInstance; /* pointer to next instance of
|
struct sRESinstance *RESnextInstance; /* pointer to next instance of
|
||||||
* current model*/
|
* current model*/
|
||||||
|
|
||||||
IFuid RESname; /* pointer to character string naming this instance */
|
IFuid RESname; /* pointer to character string naming this instance */
|
||||||
|
|
@ -33,7 +33,7 @@ typedef struct sRESinstance {
|
||||||
double RESconduct; /* conductance at current analysis temperature */
|
double RESconduct; /* conductance at current analysis temperature */
|
||||||
double RESresist; /* resistance at temperature Tnom */
|
double RESresist; /* resistance at temperature Tnom */
|
||||||
double REScurrent; /* The dc current in the resistor */
|
double REScurrent; /* The dc current in the resistor */
|
||||||
/* serban */
|
/* serban */
|
||||||
double RESacResist; /* AC resistance, useful for fancy .ac analyses */
|
double RESacResist; /* AC resistance, useful for fancy .ac analyses */
|
||||||
double RESacConduct; /* AC conductance */
|
double RESacConduct; /* AC conductance */
|
||||||
double RESwidth; /* width of the resistor */
|
double RESwidth; /* width of the resistor */
|
||||||
|
|
@ -43,13 +43,13 @@ typedef struct sRESinstance {
|
||||||
double REStc1; /* first temperature coefficient of resistors */
|
double REStc1; /* first temperature coefficient of resistors */
|
||||||
double REStc2; /* second temperature coefficient of resistors */
|
double REStc2; /* second temperature coefficient of resistors */
|
||||||
int RESnoisy; /* Set if the resistor generates noise */
|
int RESnoisy; /* Set if the resistor generates noise */
|
||||||
double *RESposPosptr; /* pointer to sparse matrix diagonal at
|
double *RESposPosptr; /* pointer to sparse matrix diagonal at
|
||||||
* (positive,positive) */
|
* (positive,positive) */
|
||||||
double *RESnegNegptr; /* pointer to sparse matrix diagonal at
|
double *RESnegNegptr; /* pointer to sparse matrix diagonal at
|
||||||
* (negative,negative) */
|
* (negative,negative) */
|
||||||
double *RESposNegptr; /* pointer to sparse matrix offdiagonal at
|
double *RESposNegptr; /* pointer to sparse matrix offdiagonal at
|
||||||
* (positive,negative) */
|
* (positive,negative) */
|
||||||
double *RESnegPosptr; /* pointer to sparse matrix offdiagonal at
|
double *RESnegPosptr; /* pointer to sparse matrix offdiagonal at
|
||||||
* (negative,positive) */
|
* (negative,positive) */
|
||||||
unsigned RESresGiven : 1; /* flag to indicate resistance was specified */
|
unsigned RESresGiven : 1; /* flag to indicate resistance was specified */
|
||||||
unsigned RESwidthGiven : 1; /* flag to indicate width given */
|
unsigned RESwidthGiven : 1; /* flag to indicate width given */
|
||||||
|
|
@ -57,7 +57,7 @@ typedef struct sRESinstance {
|
||||||
unsigned RESscaleGiven : 1; /* flag to indicate scale given */
|
unsigned RESscaleGiven : 1; /* flag to indicate scale given */
|
||||||
unsigned REStempGiven : 1; /* indicates temperature specified */
|
unsigned REStempGiven : 1; /* indicates temperature specified */
|
||||||
unsigned RESdtempGiven : 1; /* indicates delta-temp specified */
|
unsigned RESdtempGiven : 1; /* indicates delta-temp specified */
|
||||||
/* serban */
|
/* serban */
|
||||||
unsigned RESacresGiven : 1; /* indicates AC value specified */
|
unsigned RESacresGiven : 1; /* indicates AC value specified */
|
||||||
unsigned RESmGiven : 1; /* indicates M parameter specified */
|
unsigned RESmGiven : 1; /* indicates M parameter specified */
|
||||||
unsigned REStc1Given : 1; /* indicates tc1 parameter specified */
|
unsigned REStc1Given : 1; /* indicates tc1 parameter specified */
|
||||||
|
|
@ -66,7 +66,7 @@ typedef struct sRESinstance {
|
||||||
int RESsenParmNo; /* parameter # for sensitivity use;
|
int RESsenParmNo; /* parameter # for sensitivity use;
|
||||||
* set equal to 0 if not a design parameter*/
|
* set equal to 0 if not a design parameter*/
|
||||||
|
|
||||||
/* indices to array of RES noise sources */
|
/* indices to array of RES noise sources */
|
||||||
|
|
||||||
#define RESTHNOIZ 0 /* Thermal noise source */
|
#define RESTHNOIZ 0 /* Thermal noise source */
|
||||||
#define RESFLNOIZ 1 /* Flicker noise source */
|
#define RESFLNOIZ 1 /* Flicker noise source */
|
||||||
|
|
@ -88,7 +88,7 @@ typedef struct sRESinstance {
|
||||||
|
|
||||||
typedef struct sRESmodel { /* model structure for a resistor */
|
typedef struct sRESmodel { /* model structure for a resistor */
|
||||||
int RESmodType; /* type index of this device type */
|
int RESmodType; /* type index of this device type */
|
||||||
struct sRESmodel *RESnextModel; /* pointer to next possible model in
|
struct sRESmodel *RESnextModel; /* pointer to next possible model in
|
||||||
* linked list */
|
* linked list */
|
||||||
RESinstance * RESinstances; /* pointer to list of instances that have this
|
RESinstance * RESinstances; /* pointer to list of instances that have this
|
||||||
* model */
|
* model */
|
||||||
|
|
|
||||||
|
|
@ -17,23 +17,23 @@ RESload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
{
|
{
|
||||||
RESmodel *model = (RESmodel *)inModel;
|
RESmodel *model = (RESmodel *)inModel;
|
||||||
double m;
|
double m;
|
||||||
|
|
||||||
/* loop through all the resistor models */
|
/* loop through all the resistor models */
|
||||||
for( ; model != NULL; model = model->RESnextModel ) {
|
for( ; model != NULL; model = model->RESnextModel ) {
|
||||||
RESinstance *here;
|
RESinstance *here;
|
||||||
|
|
||||||
/* loop through all the instances of the model */
|
/* loop through all the instances of the model */
|
||||||
for (here = model->RESinstances; here != NULL ;
|
for (here = model->RESinstances; here != NULL ;
|
||||||
here = here->RESnextInstance) {
|
here = here->RESnextInstance) {
|
||||||
|
|
||||||
here->REScurrent = (*(ckt->CKTrhsOld+here->RESposNode) -
|
|
||||||
*(ckt->CKTrhsOld+here->RESnegNode)) * here->RESconduct;
|
|
||||||
|
|
||||||
m = (here->RESm);
|
here->REScurrent = (*(ckt->CKTrhsOld+here->RESposNode) -
|
||||||
*(here->RESposPosptr) += m * here->RESconduct;
|
*(ckt->CKTrhsOld+here->RESnegNode)) * here->RESconduct;
|
||||||
*(here->RESnegNegptr) += m * here->RESconduct;
|
|
||||||
*(here->RESposNegptr) -= m * here->RESconduct;
|
m = (here->RESm);
|
||||||
*(here->RESnegPosptr) -= m * here->RESconduct;
|
*(here->RESposPosptr) += m * here->RESconduct;
|
||||||
|
*(here->RESnegNegptr) += m * here->RESconduct;
|
||||||
|
*(here->RESposNegptr) -= m * here->RESconduct;
|
||||||
|
*(here->RESnegPosptr) -= m * here->RESconduct;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(OK);
|
return(OK);
|
||||||
|
|
@ -56,9 +56,9 @@ RESacload(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
|
|
||||||
/* loop through all the instances of the model */
|
/* loop through all the instances of the model */
|
||||||
for (here = model->RESinstances; here != NULL ;
|
for (here = model->RESinstances; here != NULL ;
|
||||||
here = here->RESnextInstance) {
|
here = here->RESnextInstance) {
|
||||||
|
|
||||||
if(!here->RESmGiven)
|
if(!here->RESmGiven)
|
||||||
here->RESm = 1.0;
|
here->RESm = 1.0;
|
||||||
|
|
||||||
m = (here->RESm);
|
m = (here->RESm);
|
||||||
|
|
|
||||||
|
|
@ -16,55 +16,55 @@ int
|
||||||
RESmParam(int param, IFvalue *value, GENmodel *inModel)
|
RESmParam(int param, IFvalue *value, GENmodel *inModel)
|
||||||
{
|
{
|
||||||
RESmodel *model = (RESmodel *)inModel;
|
RESmodel *model = (RESmodel *)inModel;
|
||||||
|
|
||||||
switch(param) {
|
switch(param) {
|
||||||
case RES_MOD_TNOM:
|
case RES_MOD_TNOM:
|
||||||
model->REStnom = value->rValue+CONSTCtoK;
|
model->REStnom = value->rValue+CONSTCtoK;
|
||||||
model->REStnomGiven = TRUE;
|
model->REStnomGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_MOD_TC1:
|
case RES_MOD_TC1:
|
||||||
model->REStempCoeff1 = value->rValue;
|
model->REStempCoeff1 = value->rValue;
|
||||||
model->REStc1Given = TRUE;
|
model->REStc1Given = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_MOD_TC2:
|
case RES_MOD_TC2:
|
||||||
model->REStempCoeff2 = value->rValue;
|
model->REStempCoeff2 = value->rValue;
|
||||||
model->REStc2Given = TRUE;
|
model->REStc2Given = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_MOD_RSH:
|
case RES_MOD_RSH:
|
||||||
model->RESsheetRes = value->rValue;
|
model->RESsheetRes = value->rValue;
|
||||||
model->RESsheetResGiven = TRUE;
|
model->RESsheetResGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_MOD_DEFWIDTH:
|
case RES_MOD_DEFWIDTH:
|
||||||
model->RESdefWidth = value->rValue;
|
model->RESdefWidth = value->rValue;
|
||||||
model->RESdefWidthGiven = TRUE;
|
model->RESdefWidthGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_MOD_DEFLENGTH:
|
case RES_MOD_DEFLENGTH:
|
||||||
model->RESdefLength = value->rValue;
|
model->RESdefLength = value->rValue;
|
||||||
model->RESdefLengthGiven = TRUE;
|
model->RESdefLengthGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_MOD_NARROW:
|
case RES_MOD_NARROW:
|
||||||
model->RESnarrow = value->rValue;
|
model->RESnarrow = value->rValue;
|
||||||
model->RESnarrowGiven = TRUE;
|
model->RESnarrowGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_MOD_SHORT:
|
case RES_MOD_SHORT:
|
||||||
model->RESshort = value->rValue;
|
model->RESshort = value->rValue;
|
||||||
model->RESshortGiven = TRUE;
|
model->RESshortGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_MOD_KF:
|
case RES_MOD_KF:
|
||||||
model->RESfNcoef = value->rValue;
|
model->RESfNcoef = value->rValue;
|
||||||
model->RESfNcoefGiven = TRUE;
|
model->RESfNcoefGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_MOD_AF:
|
case RES_MOD_AF:
|
||||||
model->RESfNexp = value->rValue;
|
model->RESfNexp = value->rValue;
|
||||||
model->RESfNexpGiven = TRUE;
|
model->RESfNexpGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RES_MOD_R:
|
case RES_MOD_R:
|
||||||
/* just being reassured by user that this is a resistor model */
|
/* just being reassured by user that this is a resistor model */
|
||||||
/* no-op */
|
/* no-op */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return(E_BADPARM);
|
return(E_BADPARM);
|
||||||
}
|
}
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,59 +19,59 @@ RESparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
||||||
NG_IGNORE(select);
|
NG_IGNORE(select);
|
||||||
|
|
||||||
switch(param) {
|
switch(param) {
|
||||||
case RES_TEMP:
|
case RES_TEMP:
|
||||||
here->REStemp = value->rValue + CONSTCtoK;
|
here->REStemp = value->rValue + CONSTCtoK;
|
||||||
here->REStempGiven = TRUE;
|
here->REStempGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_DTEMP:
|
case RES_DTEMP:
|
||||||
here->RESdtemp = value->rValue;
|
here->RESdtemp = value->rValue;
|
||||||
here->RESdtempGiven = TRUE;
|
here->RESdtempGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_RESIST:
|
case RES_RESIST:
|
||||||
/* 0 valued resistor causes ngspice to hang -- can't solve for initial voltage */
|
/* 0 valued resistor causes ngspice to hang -- can't solve for initial voltage */
|
||||||
if ( AlmostEqualUlps( value->rValue, 0, 3 ) ) value->rValue = 0.001; /* 0.0001 should be sufficiently small */
|
if ( AlmostEqualUlps( value->rValue, 0, 3 ) ) value->rValue = 0.001; /* 0.0001 should be sufficiently small */
|
||||||
/* it's the value that smartspice uses */
|
/* it's the value that smartspice uses */
|
||||||
|
|
||||||
here->RESresist = value->rValue;
|
here->RESresist = value->rValue;
|
||||||
here->RESresGiven = TRUE;
|
here->RESresGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_ACRESIST:
|
case RES_ACRESIST:
|
||||||
here->RESacResist = value->rValue;
|
here->RESacResist = value->rValue;
|
||||||
here->RESacresGiven = TRUE;
|
here->RESacresGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_WIDTH:
|
case RES_WIDTH:
|
||||||
here->RESwidth = value->rValue;
|
here->RESwidth = value->rValue;
|
||||||
here->RESwidthGiven = TRUE;
|
here->RESwidthGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_LENGTH:
|
case RES_LENGTH:
|
||||||
here->RESlength = value->rValue;
|
here->RESlength = value->rValue;
|
||||||
here->RESlengthGiven = TRUE;
|
here->RESlengthGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_SCALE:
|
case RES_SCALE:
|
||||||
here->RESscale = value->rValue;
|
here->RESscale = value->rValue;
|
||||||
here->RESscaleGiven = TRUE;
|
here->RESscaleGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_RESIST_SENS:
|
case RES_RESIST_SENS:
|
||||||
here->RESsenParmNo = value->iValue;
|
here->RESsenParmNo = value->iValue;
|
||||||
break;
|
break;
|
||||||
case RES_M:
|
case RES_M:
|
||||||
here->RESm = value->rValue;
|
here->RESm = value->rValue;
|
||||||
here->RESmGiven = TRUE;
|
here->RESmGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_TC1:
|
case RES_TC1:
|
||||||
here->REStc1 = value->rValue;
|
here->REStc1 = value->rValue;
|
||||||
here->REStc1Given = TRUE;
|
here->REStc1Given = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_TC2:
|
case RES_TC2:
|
||||||
here->REStc2 = value->rValue;
|
here->REStc2 = value->rValue;
|
||||||
here->REStc2Given = TRUE;
|
here->REStc2Given = TRUE;
|
||||||
break;
|
break;
|
||||||
case RES_NOISY:
|
case RES_NOISY:
|
||||||
here->RESnoisy = value->iValue;
|
here->RESnoisy = value->iValue;
|
||||||
here->RESnoisyGiven = TRUE;
|
here->RESnoisyGiven = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return(E_BADPARM);
|
return(E_BADPARM);
|
||||||
}
|
}
|
||||||
return(OK);
|
return(OK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**********
|
/**********
|
||||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||||
Author: 1985 Thomas L. Quarles
|
Author: 1985 Thomas L. Quarles
|
||||||
Modified Apr 2000 - Paolo Nenzi
|
Modified Apr 2000 - Paolo Nenzi
|
||||||
Modified: 2000 AlanSfixes
|
Modified: 2000 AlanSfixes
|
||||||
**********/
|
**********/
|
||||||
|
|
||||||
|
|
@ -12,12 +12,12 @@ Modified: 2000 AlanSfixes
|
||||||
|
|
||||||
int
|
int
|
||||||
REStemp(GENmodel *inModel, CKTcircuit *ckt)
|
REStemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
/* perform the temperature update to the resistors
|
/* perform the temperature update to the resistors
|
||||||
* calculate the conductance as a function of the
|
* calculate the conductance as a function of the
|
||||||
* given nominal and current temperatures - the
|
* given nominal and current temperatures - the
|
||||||
* resistance given in the struct is the nominal
|
* resistance given in the struct is the nominal
|
||||||
* temperature resistance
|
* temperature resistance
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
RESmodel *model = (RESmodel *)inModel;
|
RESmodel *model = (RESmodel *)inModel;
|
||||||
RESinstance *here;
|
RESinstance *here;
|
||||||
|
|
@ -46,16 +46,16 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
here=here->RESnextInstance) {
|
here=here->RESnextInstance) {
|
||||||
|
|
||||||
/* Default Value Processing for Resistor Instance */
|
/* Default Value Processing for Resistor Instance */
|
||||||
|
|
||||||
if(!here->REStempGiven) {
|
if(!here->REStempGiven) {
|
||||||
here->REStemp = ckt->CKTtemp;
|
here->REStemp = ckt->CKTtemp;
|
||||||
if(!here->RESdtempGiven) here->RESdtemp = 0.0;
|
if(!here->RESdtempGiven) here->RESdtemp = 0.0;
|
||||||
} else { /* REStempGiven */
|
} else { /* REStempGiven */
|
||||||
here->RESdtemp = 0.0;
|
here->RESdtemp = 0.0;
|
||||||
if (here->RESdtempGiven)
|
if (here->RESdtempGiven)
|
||||||
printf("%s: Instance temperature specified, dtemp ignored\n", here->RESname);
|
printf("%s: Instance temperature specified, dtemp ignored\n", here->RESname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!here->RESwidthGiven) here->RESwidth = model->RESdefWidth;
|
if(!here->RESwidthGiven) here->RESwidth = model->RESdefWidth;
|
||||||
if(!here->RESlengthGiven) here->RESlength = model->RESdefLength;
|
if(!here->RESlengthGiven) here->RESlength = model->RESdefLength;
|
||||||
if(!here->RESscaleGiven) here->RESscale = 1.0;
|
if(!here->RESscaleGiven) here->RESscale = 1.0;
|
||||||
|
|
@ -65,16 +65,16 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
if(model->RESsheetResGiven && (model->RESsheetRes != 0) &&
|
if(model->RESsheetResGiven && (model->RESsheetRes != 0) &&
|
||||||
(here->RESlength != 0)) {
|
(here->RESlength != 0)) {
|
||||||
here->RESresist = model->RESsheetRes * (here->RESlength -
|
here->RESresist = model->RESsheetRes * (here->RESlength -
|
||||||
model->RESshort) / (here->RESwidth - model->RESnarrow);
|
model->RESshort) / (here->RESwidth - model->RESnarrow);
|
||||||
} else {
|
} else {
|
||||||
SPfrontEnd->IFerror (ERR_WARNING,
|
SPfrontEnd->IFerror (ERR_WARNING,
|
||||||
"%s: resistance = 0 ohm, set to 1000 ohm",&(here->RESname));
|
"%s: resistance = 0 ohm, set to 1000 ohm",&(here->RESname));
|
||||||
here->RESresist=1000;
|
here->RESresist=1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
difference = (here->REStemp + here->RESdtemp) - model->REStnom;
|
difference = (here->REStemp + here->RESdtemp) - model->REStnom;
|
||||||
|
|
||||||
/* instance parameters tc1 and tc2 will override
|
/* instance parameters tc1 and tc2 will override
|
||||||
model parameters tc1 and tc2 */
|
model parameters tc1 and tc2 */
|
||||||
if (here->REStc1Given)
|
if (here->REStc1Given)
|
||||||
|
|
@ -88,17 +88,17 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt)
|
||||||
tc2 = model->REStempCoeff2;
|
tc2 = model->REStempCoeff2;
|
||||||
|
|
||||||
factor = 1.0 + tc1*difference +
|
factor = 1.0 + tc1*difference +
|
||||||
tc2*difference*difference;
|
tc2*difference*difference;
|
||||||
|
|
||||||
here -> RESconduct = (1.0/(here->RESresist * factor * here->RESscale));
|
here -> RESconduct = (1.0/(here->RESresist * factor * here->RESscale));
|
||||||
|
|
||||||
/* Paolo Nenzi: AC value */
|
/* Paolo Nenzi: AC value */
|
||||||
if(here->RESacresGiven)
|
if(here->RESacresGiven)
|
||||||
here->RESacConduct = (1.0/(here->RESacResist * factor * here->RESscale));
|
here->RESacConduct = (1.0/(here->RESacResist * factor * here->RESscale));
|
||||||
else {
|
else {
|
||||||
here -> RESacConduct = here -> RESconduct;
|
here -> RESacConduct = here -> RESconduct;
|
||||||
here -> RESacResist = here -> RESresist;
|
here -> RESacResist = here -> RESresist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(OK);
|
return(OK);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue