home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p064 / 3.ddi / ACDIODE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-01  |  2.1 KB  |  74 lines

  1. /****************************************************************************/
  2. /*        Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991                  */
  3. /*          By MicroSim Corporation, All Rights Reserved                    */
  4. /****************************************************************************/
  5. /* acdiode.c
  6.  *   $Revision:   1.4  $
  7.  *   $Author:   sv  $
  8.  *   $Date:   01 Feb 1990 14:58:12  $ */
  9.  
  10. /******************* USERS OF DEVICE EQUATIONS OPTION ***********************/
  11. /******** The procedure for changing the diode model parameters    **********/
  12. /******** and device equations is the same as for the MOSFET.  See **********/
  13. /******** the comments in the files mos.c and m.h for details.     **********/
  14.  
  15. #include "option1.h"
  16. #ifdef USE_DECL_ARGS
  17. void ACLoad_D(    struct d_ *, double );
  18. _complex ACPrb_D(    struct d_ *, double);
  19. #else
  20. void ACLoad_D();
  21. _complex ACPrb_D();
  22. #endif
  23.  
  24. #define GD    (Instance->dcv_gj)        /* diode conductance */
  25. #define CJ    (Instance->d_sda.d_ac.dac_cj)    /* diode capacitance */
  26.  
  27. void ACLoad_D(    /* Process diode for AC analysis */
  28.   Instance,    /* device to evaluate */
  29.   Omega        /* 2*pi*frequency */
  30.   )
  31. struct d_ *Instance;
  32. double Omega;
  33.  
  34. /*
  35. whjb    24 Mar 87    created (from code taken from ACLoad)
  36. pwt    06 Aug 87    re-written
  37. pwt    04 Mar 88    re-named
  38. */
  39. { double gspr;    /* area-scaled series cond. */
  40.  
  41. /* Stuff terms into matrix */
  42.  
  43.   AC_MAT_I(d_Np) = AC_MAT_I(d_pN) = -(
  44.   AC_MAT_I(d_NN) = AC_MAT_I(d_pp) = Omega*CJ );
  45.  
  46.   AC_MAT_R(d_Np) = AC_MAT_R(d_pN) = -GD;
  47.   AC_MAT_R(d_NN) = GD;
  48.  
  49.   AC_MAT_R(d_Pp) = AC_MAT_R(d_pP) = -(
  50.   AC_MAT_R(d_PP) = gspr = Instance->d_area * Instance->d_model->D_rs );
  51.  
  52.   AC_MAT_R(d_pp) = gspr + GD;
  53.  
  54.   } /* End ACLoad_D */
  55.  
  56. _complex ACPrb_D(    /* Calc. diode current (for Probe) for AC analysis */
  57.   Instance,    /* device to evaluate */
  58.   Omega        /* 2*pi*frequency */
  59.   )        /* return: complex current */
  60. struct d_ *Instance;
  61. double Omega;
  62. /*
  63. pwt    04 Mar 88    creation
  64. */
  65. { _complex vj, yj;
  66.  
  67.   vj.re = VltVct [Instance->d_p] - VltVct [Instance->d_N];
  68.   vj.im = VltVctI[Instance->d_p] - VltVctI[Instance->d_N];
  69.  
  70.   yj.re = GD; yj.im = Omega*CJ;
  71.  
  72.   return cmul(yj,vj);
  73.   }
  74.