home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************/
- /* Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991 */
- /* By MicroSim Corporation, All Rights Reserved */
- /****************************************************************************/
- /* acdiode.c
- * $Revision: 1.4 $
- * $Author: sv $
- * $Date: 01 Feb 1990 14:58:12 $ */
-
- /******************* USERS OF DEVICE EQUATIONS OPTION ***********************/
- /******** The procedure for changing the diode model parameters **********/
- /******** and device equations is the same as for the MOSFET. See **********/
- /******** the comments in the files mos.c and m.h for details. **********/
-
- #include "option1.h"
- #ifdef USE_DECL_ARGS
- void ACLoad_D( struct d_ *, double );
- _complex ACPrb_D( struct d_ *, double);
- #else
- void ACLoad_D();
- _complex ACPrb_D();
- #endif
-
- #define GD (Instance->dcv_gj) /* diode conductance */
- #define CJ (Instance->d_sda.d_ac.dac_cj) /* diode capacitance */
-
- void ACLoad_D( /* Process diode for AC analysis */
- Instance, /* device to evaluate */
- Omega /* 2*pi*frequency */
- )
- struct d_ *Instance;
- double Omega;
-
- /*
- whjb 24 Mar 87 created (from code taken from ACLoad)
- pwt 06 Aug 87 re-written
- pwt 04 Mar 88 re-named
- */
- { double gspr; /* area-scaled series cond. */
-
- /* Stuff terms into matrix */
-
- AC_MAT_I(d_Np) = AC_MAT_I(d_pN) = -(
- AC_MAT_I(d_NN) = AC_MAT_I(d_pp) = Omega*CJ );
-
- AC_MAT_R(d_Np) = AC_MAT_R(d_pN) = -GD;
- AC_MAT_R(d_NN) = GD;
-
- AC_MAT_R(d_Pp) = AC_MAT_R(d_pP) = -(
- AC_MAT_R(d_PP) = gspr = Instance->d_area * Instance->d_model->D_rs );
-
- AC_MAT_R(d_pp) = gspr + GD;
-
- } /* End ACLoad_D */
-
- _complex ACPrb_D( /* Calc. diode current (for Probe) for AC analysis */
- Instance, /* device to evaluate */
- Omega /* 2*pi*frequency */
- ) /* return: complex current */
- struct d_ *Instance;
- double Omega;
- /*
- pwt 04 Mar 88 creation
- */
- { _complex vj, yj;
-
- vj.re = VltVct [Instance->d_p] - VltVct [Instance->d_N];
- vj.im = VltVctI[Instance->d_p] - VltVctI[Instance->d_N];
-
- yj.re = GD; yj.im = Omega*CJ;
-
- return cmul(yj,vj);
- }