Added multiplicity parameter m to resistors and updated tests

This commit is contained in:
pnenzi 2000-06-04 09:02:39 +00:00
parent 1025e978bc
commit 090c6b6d6f
8 changed files with 1073 additions and 72 deletions

View File

@ -19,8 +19,8 @@ IND - Inductor
RES - Resistor
This is a modified version of the spice3 resistance model. This
model supports different ac and dc values (ac=...). This changes
are introduced by Serban Popescu. This device needs more
testing.
are introduced by Serban Popescu. The "multiplicity factor" (m)
has been introduced.
*)Rework 11: The code has been modified to reflect spice parsing
standard.

View File

@ -16,6 +16,7 @@ IFparm RESpTable[] = { /* parameters */
IOPZU( "temp", RES_TEMP, IF_REAL,"Instance operating temperature"),
IOPQU( "l", RES_LENGTH, IF_REAL,"Length"),
IOPZU( "w", RES_WIDTH, IF_REAL,"Width"),
IOPU( "m", RES_M, IF_REAL, "Multiplication factor"),
IP( "sens_resist", RES_RESIST_SENS, IF_FLAG,
"flag to request sensitivity WRT resistance"),
OP( "i", RES_CURRENT,IF_REAL,"Current"),

View File

@ -43,9 +43,12 @@ RESask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value,
case RES_LENGTH:
value->rValue = fast->RESlength;
return(OK);
case RES_WIDTH :
case RES_WIDTH:
value->rValue = fast->RESwidth;
return(OK);
case RES_M:
value->rValue = fast->RESm;
return(OK);
case RES_QUEST_SENS_DC:
if(ckt->CKTsenInfo){
value->rValue = *(ckt->CKTsenInfo->SEN_Sap[select->iValue + 1]+

View File

@ -36,6 +36,7 @@ typedef struct sRESinstance {
double RESacConduct; /* AC conductance */
double RESwidth; /* width of the resistor */
double RESlength; /* length of the resistor */
double RESm; /* Multiplicity factor for this instance */
double *RESposPosptr; /* pointer to sparse matrix diagonal at
* (positive,positive) */
double *RESnegNegptr; /* pointer to sparse matrix diagonal at
@ -49,7 +50,8 @@ typedef struct sRESinstance {
unsigned RESlengthGiven : 1; /* flag to indicate length given */
unsigned REStempGiven : 1; /* indicates temperature specified */
/* serban */
unsigned RESacresGiven : 1; /* indicates AC value specified */
unsigned RESacresGiven : 1; /* indicates AC value specified */
unsigned RESmGiven : 1; /* indicates M parameter specified */
int RESsenParmNo; /* parameter # for sensitivity use;
set equal to 0 if not a design parameter*/
#ifndef NONOISE
@ -97,6 +99,7 @@ typedef struct sRESmodel { /* model structure for a resistor */
/* serban */
#define RES_ACRESIST 10
#define RES_ACCONDUCT 11
#define RES_M 12 /* pn */
/* model parameters */

View File

@ -39,6 +39,10 @@ RESparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
break;
case RES_RESIST_SENS:
here->RESsenParmNo = value->iValue;
break;
case RES_M:
here->RESm = value->rValue;
here->RESmGiven = TRUE;
break;
default:
return(E_BADPARM);

View File

@ -64,9 +64,14 @@ REStemp(GENmodel *inModel, CKTcircuit *ckt)
here->RESconduct = 1.0/(here->RESresist * factor);
if(here->RESmGiven)
here->RESconduct = here->RESconduct * here->RESm;
/* Paolo Nenzi: Temperature effects for AC value */
if(here->RESacresGiven)
here->RESacConduct = 1.0/(here->RESacResist * factor);
if (here->RESmGiven)
here->RESacConduct = here->RESacConduct * here->RESm;
}
}
return(OK);

View File

@ -1,9 +1,24 @@
A simple resistor with a voltage source
A paralled resistor array
R1 1 0 10k
V1 1 0 1
Vin 1 0 DC 1 SIN (0 1 100MEG 1NS 0.0) AC 1
.TRAN 1ns 6ns
.PRINT TRAN I(V1)
VR1 1 2 DC 0
R1 2 0 10K
VR2 1 3 DC 0
R2 3 0 10K ac=5K
VR3 1 4 DC 0
R3 4 0 rmodel1 L=11u W=2u ac=2.5k
VR4 1 5 DC 0
R4 5 0 10K ac=5k m=2
.model rmodel1 R RSH = 1000 NARROW = 1u
.OP
.TRAN 1ns 10ns
.AC DEC 100 1MEG 100MEG
.PRINT TRAN I(VR1), I(VR2), I(VR3), I(VR4)
.PRINT AC I(VR1), I(VR2), I(VR3), I(VR4)
.END

File diff suppressed because it is too large Load Diff