devices/vccs: implement multiplier `m' (G source)

This commit is contained in:
h_vogt 2013-05-30 10:43:47 +02:00 committed by rlar
parent 2ccf0a7097
commit a469aa9387
4 changed files with 13 additions and 0 deletions

View File

@ -11,6 +11,7 @@ Author: 1987 Thomas L. Quarles
IFparm VCCSpTable[] = { /* parameters */
IOPU("gain", VCCS_TRANS, IF_REAL, "Transconductance of source (gain)"),
IOP ( "m", VCCS_M, IF_REAL , "Parallel multiplier"),
IP("sens_trans", VCCS_TRANS_SENS,IF_FLAG,
"flag to request sensitivity WRT transconductance"),
OPU("pos_node", VCCS_POS_NODE, IF_INTEGER, "Positive node of source"),

View File

@ -31,6 +31,9 @@ VCCSask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *
case VCCS_TRANS:
value->rValue = here->VCCScoeff;
return (OK);
case VCCS_M:
value->rValue = here->VCCSmValue;
return (OK);
case VCCS_POS_NODE:
value->iValue = here->VCCSposNode;
return (OK);

View File

@ -31,6 +31,7 @@ typedef struct sVCCSinstance {
double VCCSinitCond; /* initial condition (of controlling source) */
double VCCScoeff; /* coefficient */
double VCCSmValue; /* Parallel multiplier */
double *VCCSposContPosptr; /* pointer to sparse matrix element at
* (positive node, control positive node) */
@ -41,6 +42,7 @@ typedef struct sVCCSinstance {
double *VCCSnegContNegptr; /* pointer to sparse matrix element at
* (negative node, control negative node) */
unsigned VCCScoeffGiven :1 ;/* flag to indicate function coeffs given */
unsigned VCCSmGiven :1 ;/* flag to indicate multiplier given */
int VCCSsenParmNo; /* parameter # for sensitivity use;
set equal to 0 if not a design parameter*/
@ -73,6 +75,7 @@ typedef struct sVCCSmodel { /* model structure for a source */
#define VCCS_CURRENT 9
#define VCCS_POWER 10
#define VCCS_VOLTS 11
#define VCCS_M 12
/* model parameters */

View File

@ -24,6 +24,12 @@ VCCSparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
case VCCS_TRANS:
here->VCCScoeff = value->rValue;
here->VCCScoeffGiven = TRUE;
if (here->VCCSmGiven)
here->VCCScoeff *= here->VCCSmValue;
break;
case VCCS_M:
here->VCCSmValue = value->rValue;
here->VCCSmGiven = TRUE;
break;
case VCCS_TRANS_SENS:
here->VCCSsenParmNo = value->iValue;