1 /********** 2 Copyright 1990 Regents of the University of California. All rights reserved. 3 Author: 1985 Thomas L. Quarles 4 Modified: September 2003 Paolo Nenzi 5 **********/ 6 /* 7 */ 8 9 #include "ngspice/ngspice.h" 10 #include "ngspice/ifsim.h" 11 #include "capdefs.h" 12 #include "ngspice/sperror.h" 13 #include "ngspice/suffix.h" 14 15 16 int CAPmParam(int param,IFvalue * value,GENmodel * inModel)17CAPmParam(int param, IFvalue *value, GENmodel *inModel) 18 { 19 CAPmodel *mod = (CAPmodel*)inModel; 20 switch(param) { 21 case CAP_MOD_TNOM: 22 mod->CAPtnom = value->rValue+CONSTCtoK; 23 mod->CAPtnomGiven = TRUE; 24 break; 25 case CAP_MOD_TC1: 26 mod->CAPtempCoeff1 = value->rValue; 27 mod->CAPtc1Given = TRUE; 28 break; 29 case CAP_MOD_TC2: 30 mod->CAPtempCoeff2 = value->rValue; 31 mod->CAPtc2Given = TRUE; 32 break; 33 case CAP_MOD_CAP: 34 mod->CAPmCap = value->rValue; 35 mod->CAPmCapGiven = TRUE; 36 break; 37 case CAP_MOD_CJ : 38 mod->CAPcj = value->rValue; 39 mod->CAPcjGiven = TRUE; 40 break; 41 case CAP_MOD_CJSW : 42 mod->CAPcjsw = value->rValue; 43 mod->CAPcjswGiven = TRUE; 44 break; 45 case CAP_MOD_DEFWIDTH: 46 mod->CAPdefWidth = value->rValue; 47 mod->CAPdefWidthGiven = TRUE; 48 break; 49 case CAP_MOD_DEFLENGTH: 50 mod->CAPdefLength = value->rValue; 51 mod->CAPdefLengthGiven = TRUE; 52 break; 53 case CAP_MOD_NARROW: 54 mod->CAPnarrow = value->rValue; 55 mod->CAPnarrowGiven = TRUE; 56 break; 57 case CAP_MOD_SHORT: 58 mod->CAPshort = value->rValue; 59 mod->CAPshortGiven = TRUE; 60 break; 61 case CAP_MOD_DEL: 62 mod->CAPdel = value->rValue; 63 mod->CAPdelGiven = TRUE; 64 break; 65 case CAP_MOD_DI: 66 mod->CAPdi = value->rValue; 67 mod->CAPdiGiven = TRUE; 68 break; 69 case CAP_MOD_THICK: 70 mod->CAPthick = value->rValue; 71 mod->CAPthickGiven = TRUE; 72 break; 73 case CAP_MOD_BV_MAX: 74 mod->CAPbv_max = value->rValue; 75 mod->CAPbv_maxGiven = TRUE; 76 break; 77 case CAP_MOD_C: 78 /* just being reassured by the user that we are a capacitor */ 79 /* no-op */ 80 break; 81 default: 82 return(E_BADPARM); 83 } 84 return(OK); 85 } 86 87