Add multiplier 'm' to the ASRC instance line.
Default value is 1. A new 'reciprocm' will determine, if m is multiplied into numerator or denominator.
This commit is contained in:
parent
30ccbc9a18
commit
03556b2215
|
|
@ -19,6 +19,8 @@ IFparm ASRCpTable[] = { /* parameters */
|
|||
IOPU("tc1", ASRC_TC1, IF_REAL, "First order temp. coefficient"),
|
||||
IOPU("tc2", ASRC_TC2, IF_REAL, "Second order temp. coefficient"),
|
||||
IOPU("reciproctc", ASRC_RTC, IF_INTEGER, "Flag to calculate reciprocal temperature behaviour"),
|
||||
IOPU("m", ASRC_M, IF_REAL, "Multiplier"),
|
||||
IOPU("reciprocm", ASRC_RM, IF_INTEGER, "Flag to calculate reciprocal multiplier behaviour"),
|
||||
OP("i", ASRC_OUTPUTCURRENT, IF_REAL, "Current through source"),
|
||||
OP("v", ASRC_OUTPUTVOLTAGE, IF_REAL, "Voltage across source"),
|
||||
OP("pos_node", ASRC_POS_NODE, IF_INTEGER, "Positive Node"),
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ ASRCacLoad(GENmodel *inModel, CKTcircuit *ckt)
|
|||
if (here->ASRCreciproctc == 1)
|
||||
factor = 1 / factor;
|
||||
|
||||
if (here->ASRCreciprocm == 1)
|
||||
factor = factor / here->ASRCm;
|
||||
else
|
||||
factor = factor * here->ASRCm;
|
||||
|
||||
/*
|
||||
* Get the function and its derivatives from the
|
||||
* field in the instance structure. The field is
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ ASRCask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalu
|
|||
case ASRC_TC2:
|
||||
value->rValue = here->ASRCtc2;
|
||||
return(OK);
|
||||
case ASRC_M:
|
||||
value->rValue = here->ASRCm;
|
||||
return(OK);
|
||||
case ASRC_CURRENT:
|
||||
value->tValue =
|
||||
(here->ASRCtype == ASRC_CURRENT) ? here->ASRCtree : NULL;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ typedef struct sASRCinstance {
|
|||
double ASRCdtemp; /* delta-temperature of a particular instance */
|
||||
double ASRCtc1; /* first temperature coefficient of resistors */
|
||||
double ASRCtc2; /* second temperature coefficient of resistors */
|
||||
double ASRCm; /* Output multiplier */
|
||||
int ASRCreciproctc; /* Flag to calculate reciprocal temperature behaviour */
|
||||
int ASRCreciprocm; /* Flag to calculate reciprocal multiplier behaviour */
|
||||
double **ASRCposPtr; /* pointer to pointers of the elements
|
||||
* in the sparce matrix */
|
||||
double ASRCprev_value; /* Previous value for the convergence test */
|
||||
|
|
@ -48,7 +50,9 @@ typedef struct sASRCinstance {
|
|||
unsigned ASRCdtempGiven : 1; /* indicates delta-temp specified */
|
||||
unsigned ASRCtc1Given : 1; /* indicates tc1 parameter specified */
|
||||
unsigned ASRCtc2Given : 1; /* indicates tc2 parameter specified */
|
||||
unsigned ASRCmGiven : 1; /* indicates tc2 parameter specified */
|
||||
unsigned ASRCreciproctcGiven : 1; /* indicates reciproctc flag parameter specified */
|
||||
unsigned ASRCreciprocmGiven : 1; /* indicates reciprocm flag parameter specified */
|
||||
|
||||
} ASRCinstance;
|
||||
|
||||
|
|
@ -84,6 +88,8 @@ enum {
|
|||
ASRC_TC1,
|
||||
ASRC_TC2,
|
||||
ASRC_RTC,
|
||||
ASRC_M,
|
||||
ASRC_RM,
|
||||
};
|
||||
|
||||
/* module-wide variables */
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ ASRCload(GENmodel *inModel, CKTcircuit *ckt)
|
|||
if (here->ASRCreciproctc == 1)
|
||||
factor = 1 / factor;
|
||||
|
||||
if (here->ASRCreciprocm == 1)
|
||||
factor = factor / here->ASRCm;
|
||||
else
|
||||
factor = factor * here->ASRCm;
|
||||
|
||||
/*
|
||||
* Get the function and its derivatives evaluated
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -34,10 +34,18 @@ ASRCparam(int param, IFvalue *value, GENinstance *fast, IFvalue *select)
|
|||
here->ASRCtc2 = value->rValue;
|
||||
here->ASRCtc2Given = TRUE;
|
||||
break;
|
||||
case ASRC_M:
|
||||
here->ASRCm = value->rValue;
|
||||
here->ASRCmGiven = TRUE;
|
||||
break;
|
||||
case ASRC_RTC:
|
||||
here->ASRCreciproctc = value->iValue;
|
||||
here->ASRCreciproctcGiven = TRUE;
|
||||
break;
|
||||
case ASRC_RM:
|
||||
here->ASRCreciprocm = value->iValue;
|
||||
here->ASRCreciprocmGiven = TRUE;
|
||||
break;
|
||||
default:
|
||||
return(E_BADPARM);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ ASRCpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
|
|||
if (here->ASRCreciproctc == 1)
|
||||
factor = 1 / factor;
|
||||
|
||||
if (here->ASRCreciprocm == 1)
|
||||
factor = factor / here->ASRCm;
|
||||
else
|
||||
factor = factor * here->ASRCm;
|
||||
|
||||
j = 0;
|
||||
|
||||
/* Get the function evaluated and the derivatives too */
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@ int ASRCsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt,
|
|||
here->ASRCtc2 = 0.0;
|
||||
if (!here->ASRCreciproctcGiven)
|
||||
here->ASRCreciproctc = 0;
|
||||
if (!here->ASRCreciprocmGiven)
|
||||
here->ASRCreciprocm = 0;
|
||||
if (!here->ASRCmGiven)
|
||||
here->ASRCm = 1.0;
|
||||
|
||||
switch (here->ASRCtype) {
|
||||
case ASRC_VOLTAGE:
|
||||
|
|
|
|||
Loading…
Reference in New Issue