|
|
@ -28,6 +28,8 @@ ASRCload(GENmodel *inModel, CKTcircuit *ckt) |
|
|
ASRCinstance *here; |
|
|
ASRCinstance *here; |
|
|
int i, j; |
|
|
int i, j; |
|
|
double rhs; |
|
|
double rhs; |
|
|
|
|
|
double difference; |
|
|
|
|
|
double factor; |
|
|
|
|
|
|
|
|
/* loop through all the Arbitrary source models */ |
|
|
/* loop through all the Arbitrary source models */ |
|
|
for( ; model != NULL; model = model->ASRCnextModel ) { |
|
|
for( ; model != NULL; model = model->ASRCnextModel ) { |
|
|
@ -39,6 +41,12 @@ ASRCload(GENmodel *inModel, CKTcircuit *ckt) |
|
|
if (here->ASRCowner != ARCHme) |
|
|
if (here->ASRCowner != ARCHme) |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
if(!here->ASRCtc1Given) here->ASRCtc1 = 0.0; |
|
|
|
|
|
if(!here->ASRCtc2Given) here->ASRCtc2 = 0.0; |
|
|
|
|
|
|
|
|
|
|
|
difference = (here->ASRCtemp + here->ASRCdtemp) - 300.15; |
|
|
|
|
|
factor = 1.0 + (here->ASRCtc1)*difference + (here->ASRCtc2)*difference*difference; |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* Get the function and its derivatives evaluated |
|
|
* Get the function and its derivatives evaluated |
|
|
*/ |
|
|
*/ |
|
|
@ -96,22 +104,22 @@ ASRCload(GENmodel *inModel, CKTcircuit *ckt) |
|
|
case IF_INSTANCE: |
|
|
case IF_INSTANCE: |
|
|
if( here->ASRCtype == ASRC_VOLTAGE) { |
|
|
if( here->ASRCtype == ASRC_VOLTAGE) { |
|
|
/* CCVS */ |
|
|
/* CCVS */ |
|
|
*(here->ASRCposptr[j++]) -= asrc_derivs[i]; |
|
|
|
|
|
|
|
|
*(here->ASRCposptr[j++]) -= asrc_derivs[i] * factor; |
|
|
} else{ |
|
|
} else{ |
|
|
/* CCCS */ |
|
|
/* CCCS */ |
|
|
*(here->ASRCposptr[j++]) += asrc_derivs[i]; |
|
|
|
|
|
*(here->ASRCposptr[j++]) -= asrc_derivs[i]; |
|
|
|
|
|
|
|
|
*(here->ASRCposptr[j++]) += asrc_derivs[i] * factor; |
|
|
|
|
|
*(here->ASRCposptr[j++]) -= asrc_derivs[i] * factor; |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case IF_NODE: |
|
|
case IF_NODE: |
|
|
if(here->ASRCtype == ASRC_VOLTAGE) { |
|
|
if(here->ASRCtype == ASRC_VOLTAGE) { |
|
|
/* VCVS */ |
|
|
/* VCVS */ |
|
|
*(here->ASRCposptr[j++]) -= asrc_derivs[i]; |
|
|
|
|
|
|
|
|
*(here->ASRCposptr[j++]) -= asrc_derivs[i] * factor; |
|
|
} else { |
|
|
} else { |
|
|
/* VCCS */ |
|
|
/* VCCS */ |
|
|
*(here->ASRCposptr[j++]) += asrc_derivs[i]; |
|
|
|
|
|
*(here->ASRCposptr[j++]) -= asrc_derivs[i]; |
|
|
|
|
|
|
|
|
*(here->ASRCposptr[j++]) += asrc_derivs[i] * factor; |
|
|
|
|
|
*(here->ASRCposptr[j++]) -= asrc_derivs[i] * factor; |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
@ -122,15 +130,15 @@ ASRCload(GENmodel *inModel, CKTcircuit *ckt) |
|
|
|
|
|
|
|
|
/* Insert the RHS */ |
|
|
/* Insert the RHS */ |
|
|
if( here->ASRCtype == ASRC_VOLTAGE) { |
|
|
if( here->ASRCtype == ASRC_VOLTAGE) { |
|
|
*(ckt->CKTrhs+(here->ASRCbranch)) += rhs; |
|
|
|
|
|
|
|
|
*(ckt->CKTrhs+(here->ASRCbranch)) += factor * rhs; |
|
|
} else { |
|
|
} else { |
|
|
*(ckt->CKTrhs+(here->ASRCposNode)) -= rhs; |
|
|
|
|
|
*(ckt->CKTrhs+(here->ASRCnegNode)) += rhs; |
|
|
|
|
|
|
|
|
*(ckt->CKTrhs+(here->ASRCposNode)) -= factor * rhs; |
|
|
|
|
|
*(ckt->CKTrhs+(here->ASRCnegNode)) += factor * rhs; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* Store the rhs for small signal analysis */ |
|
|
/* Store the rhs for small signal analysis */ |
|
|
if (ckt->CKTmode & MODEINITSMSIG) { |
|
|
if (ckt->CKTmode & MODEINITSMSIG) { |
|
|
here->ASRCacValues[here->ASRCtree->numVars] = rhs; |
|
|
|
|
|
|
|
|
here->ASRCacValues[here->ASRCtree->numVars] = factor * rhs; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|