Browse Source
New model for inductor, parallel multiplier, scale factor, temp dependence.
pre-master-46
New model for inductor, parallel multiplier, scale factor, temp dependence.
pre-master-46
35 changed files with 482 additions and 180 deletions
-
6src/spicelib/devices/ind/Makefile.am
-
56src/spicelib/devices/ind/ind.c
-
16src/spicelib/devices/ind/indacld.c
-
22src/spicelib/devices/ind/indask.c
-
43src/spicelib/devices/ind/inddefs.h
-
5src/spicelib/devices/ind/inddel.c
-
3src/spicelib/devices/ind/inddest.c
-
5src/spicelib/devices/ind/indext.h
-
71src/spicelib/devices/ind/indinit.c
-
3src/spicelib/devices/ind/indinit.h
-
36src/spicelib/devices/ind/indload.c
-
50src/spicelib/devices/ind/indmask.c
-
5src/spicelib/devices/ind/indmdel.c
-
61src/spicelib/devices/ind/indmpar.c
-
22src/spicelib/devices/ind/indparam.c
-
17src/spicelib/devices/ind/indpzld.c
-
4src/spicelib/devices/ind/indsacl.c
-
56src/spicelib/devices/ind/indsetup.c
-
4src/spicelib/devices/ind/indsload.c
-
4src/spicelib/devices/ind/indsprt.c
-
4src/spicelib/devices/ind/indsset.c
-
4src/spicelib/devices/ind/indsupd.c
-
63src/spicelib/devices/ind/indtemp.c
-
5src/spicelib/devices/ind/indtrunc.c
-
4src/spicelib/devices/ind/mutacld.c
-
8src/spicelib/devices/ind/mutask.c
-
5src/spicelib/devices/ind/mutdel.c
-
3src/spicelib/devices/ind/mutdest.c
-
5src/spicelib/devices/ind/mutmdel.c
-
6src/spicelib/devices/ind/mutparam.c
-
5src/spicelib/devices/ind/mutpzld.c
-
9src/spicelib/devices/ind/mutsetup.c
-
4src/spicelib/devices/ind/mutsprt.c
-
4src/spicelib/devices/ind/mutsset.c
-
44src/spicelib/devices/ind/muttemp.c
@ -0,0 +1,50 @@ |
|||||
|
/********** |
||||
|
Copyright 2003 Paolo Nenzi |
||||
|
Author: 2003 Paolo Nenzi |
||||
|
**********/ |
||||
|
/* |
||||
|
*/ |
||||
|
|
||||
|
#include "ngspice.h" |
||||
|
#include "cktdefs.h" |
||||
|
#include "devdefs.h" |
||||
|
#include "inddefs.h" |
||||
|
#include "sperror.h" |
||||
|
#include "ifsim.h" |
||||
|
#include "suffix.h" |
||||
|
|
||||
|
|
||||
|
/* ARGSUSED */ |
||||
|
int |
||||
|
INDmAsk(CKTcircuit *ckt, GENmodel *inst, int which, IFvalue *value) |
||||
|
{ |
||||
|
INDmodel *here = (INDmodel*)inst; |
||||
|
switch(which) { |
||||
|
case IND_MOD_IND: |
||||
|
value->rValue = here->INDmInd; |
||||
|
return(OK); |
||||
|
case IND_MOD_TNOM: |
||||
|
value->rValue = here->INDtnom-CONSTCtoK; |
||||
|
return(OK); |
||||
|
case IND_MOD_TC1: |
||||
|
value->rValue = here->INDtempCoeff1; |
||||
|
return(OK); |
||||
|
case IND_MOD_TC2: |
||||
|
value->rValue = here->INDtempCoeff2; |
||||
|
return(OK); |
||||
|
case IND_MOD_CSECT: |
||||
|
value->rValue = here->INDcsect; |
||||
|
return(OK); |
||||
|
case IND_MOD_LENGTH: |
||||
|
value->rValue = here->INDlength; |
||||
|
return(OK); |
||||
|
case IND_MOD_N: |
||||
|
value->rValue = here->INDn; |
||||
|
return(OK); |
||||
|
case IND_MOD_MU: |
||||
|
value->rValue = here->INDmu; |
||||
|
return(OK); |
||||
|
default: |
||||
|
return(E_BADPARM); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
/********** |
||||
|
Copyright 2003 Paolo Nenzi |
||||
|
Author: 2003 Paolo Nenzi |
||||
|
**********/ |
||||
|
/* |
||||
|
*/ |
||||
|
|
||||
|
#include "ngspice.h" |
||||
|
#include "ifsim.h" |
||||
|
#include "inddefs.h" |
||||
|
#include "sperror.h" |
||||
|
#include "suffix.h" |
||||
|
|
||||
|
|
||||
|
int |
||||
|
INDmParam(int param, IFvalue *value, GENmodel *inModel) |
||||
|
{ |
||||
|
INDmodel *mod = (INDmodel*)inModel; |
||||
|
switch(param) { |
||||
|
case IND_MOD_IND: |
||||
|
mod->INDmInd = value->rValue; |
||||
|
mod->INDmIndGiven = TRUE; |
||||
|
break; |
||||
|
case IND_MOD_TNOM: |
||||
|
mod->INDtnom = value->rValue+CONSTCtoK; |
||||
|
mod->INDtnomGiven = TRUE; |
||||
|
break; |
||||
|
case IND_MOD_TC1: |
||||
|
mod->INDtempCoeff1 = value->rValue; |
||||
|
mod->INDtc1Given = TRUE; |
||||
|
break; |
||||
|
case IND_MOD_TC2: |
||||
|
mod->INDtempCoeff2 = value->rValue; |
||||
|
mod->INDtc2Given = TRUE; |
||||
|
break; |
||||
|
case IND_MOD_CSECT: |
||||
|
mod->INDcsect = value->rValue; |
||||
|
mod->INDcsectGiven = TRUE; |
||||
|
break; |
||||
|
case IND_MOD_LENGTH : |
||||
|
mod->INDlength = value->rValue; |
||||
|
mod->INDlengthGiven = TRUE; |
||||
|
break; |
||||
|
case IND_MOD_N : |
||||
|
mod->INDn = value->rValue; |
||||
|
mod->INDnGiven = TRUE; |
||||
|
break; |
||||
|
case IND_MOD_MU: |
||||
|
mod->INDmu = value->rValue; |
||||
|
mod->INDmuGiven = TRUE; |
||||
|
break; |
||||
|
case IND_MOD_L: |
||||
|
/* just being reassured by the user that we are an inductor */ |
||||
|
/* no-op */ |
||||
|
break; |
||||
|
default: |
||||
|
return(E_BADPARM); |
||||
|
} |
||||
|
return(OK); |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,63 @@ |
|||||
|
/********** |
||||
|
Copyright 2003 Paolo Nenzi |
||||
|
Author: 2003 Paolo Nenzi |
||||
|
**********/ |
||||
|
/* |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
#include "ngspice.h" |
||||
|
#include "cktdefs.h" |
||||
|
#include "inddefs.h" |
||||
|
#include "sperror.h" |
||||
|
#include "suffix.h" |
||||
|
|
||||
|
|
||||
|
/*ARGSUSED*/ |
||||
|
int |
||||
|
INDtemp(GENmodel *inModel, CKTcircuit *ckt) |
||||
|
{ |
||||
|
INDmodel *model = (INDmodel*)inModel; |
||||
|
INDinstance *here; |
||||
|
double difference; |
||||
|
double factor; |
||||
|
|
||||
|
/* loop through all the inductor models */ |
||||
|
for( ; model != NULL; model = model->INDnextModel ) { |
||||
|
|
||||
|
/* loop through all the instances of the model */ |
||||
|
for (here = model->INDinstances; here != NULL ; |
||||
|
here=here->INDnextInstance) { |
||||
|
if (here->INDowner != ARCHme) continue; |
||||
|
|
||||
|
/* Default Value Processing for Inductor Instance */ |
||||
|
|
||||
|
if(!here->INDtempGiven) { |
||||
|
here->INDtemp = ckt->CKTtemp; |
||||
|
if(!here->INDdtempGiven) here->INDdtemp = 0.0; |
||||
|
} else { /* INDtempGiven */ |
||||
|
here->INDdtemp = 0.0; |
||||
|
if (here->INDdtempGiven) |
||||
|
printf("%s: Instance temperature specified, dtemp ignored\n", |
||||
|
here->INDname); |
||||
|
} |
||||
|
|
||||
|
if (!here->INDscaleGiven) here->INDscale = 1.0; |
||||
|
if (!here->INDmGiven) here->INDm = 1.0; |
||||
|
|
||||
|
if (!here->INDindGiven) /* No instance inductance given */ |
||||
|
here->INDinduct = model->INDmInd; |
||||
|
|
||||
|
difference = (here->INDtemp + here->INDdtemp) - model->INDtnom; |
||||
|
|
||||
|
factor = 1.0 + (model->INDtempCoeff1)*difference + |
||||
|
(model->INDtempCoeff2)*difference*difference; |
||||
|
|
||||
|
here->INDinduct = here->INDinduct * factor * here->INDscale; |
||||
|
here->INDinduct = here->INDinduct / here->INDm; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
return(OK); |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,44 @@ |
|||||
|
/********** |
||||
|
Copyright 2003 Paolo Nenzi |
||||
|
Author: 2003 Paolo Nenzi |
||||
|
**********/ |
||||
|
/* |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
#include "ngspice.h" |
||||
|
#include "cktdefs.h" |
||||
|
#include "inddefs.h" |
||||
|
#include "sperror.h" |
||||
|
#include "suffix.h" |
||||
|
|
||||
|
|
||||
|
/*ARGSUSED*/ |
||||
|
int |
||||
|
MUTtemp(GENmodel *inModel, CKTcircuit *ckt) |
||||
|
{ |
||||
|
MUTmodel *model = (MUTmodel*)inModel; |
||||
|
MUTinstance *here; |
||||
|
double ind1, ind2; |
||||
|
|
||||
|
/* loop through all the inductor models */ |
||||
|
for( ; model != NULL; model = model->MUTnextModel ) { |
||||
|
|
||||
|
/* loop through all the instances of the model */ |
||||
|
for (here = model->MUTinstances; here != NULL ; |
||||
|
here=here->MUTnextInstance) { |
||||
|
if (here->MUTowner != ARCHme) continue; |
||||
|
|
||||
|
/* Value Processing for mutual inductors */ |
||||
|
|
||||
|
ind1 = here->MUTind1->INDinduct; |
||||
|
ind2 = here->MUTind2->INDinduct; |
||||
|
|
||||
|
|
||||
|
here->MUTfactor = here->MUTcoupling * sqrt(ind1 * ind2); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
return(OK); |
||||
|
} |
||||
|
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue