Jspice3
noisedef.h
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3e2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1987 Gary W. Ng
5  1992 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #ifndef NOISEDEFS
9 #define NOISEDEFS
10 
11 #include "analysis.h"
12 
13 
14 /* structure used to carry information between subparts
15  * of the noise analysis code
16  */
17 
18 typedef struct {
19  double freq;
20  double lstFreq;
21  double delFreq;
22  double outNoiz; /* integrated output noise as of last frequency point */
23  double inNoise; /* integrated input noise as of last frequency point */
24  double GainSqInv;
25  double lnGainInv;
26  double lnFreq;
27  double lnLastFreq;
28  double delLnFreq;
29  int outNumber; /* keeps track of the current output variable */
30  int numPlots; /* keeps track of the number of active plots so we can
31  close them in loop. */
32  unsigned int prtSummary;
33  double *outpVector; /* pointer to our array of noise outputs */
34  GENERIC *NplotPtr; /* the plot pointer */
35  IFuid *namelist; /* list of plot names */
36 } Ndata;
37 
38 
39  /* structure used to describe an noise analysis */
40 
41 typedef struct {
42  int JOBtype;
43  JOB *JOBnextJob; /* pointer to next thing to do */
44  char *JOBname; /* name of this job */
45  char *Noutput; /* name of the noise output summation node */
46  char *NoutputRef; /* name of the noise output reference node */
47  char *Ninput; /* name of AC source used to input ref. the noise */
48  double NsavOnoise; /* integrated output noise when we left last time */
49  double NsavInoise; /* integrated input noise when we left last time */
50  int NStpsSm; /* number of steps before we output a noise summary report */
51  Ndata *NdataPtr; /* pointer to substructure for subroutines */
52  int NposOutNode; /* node numbers for output */
54  int Nstep; /* step count, for summary print */
55  struct sACprms AC; /* AC parameter storage */
56  struct sDCTprms DC; /* DC parameter storage */
57 } NOISEAN;
58 
59 
60 /* codes for saving and retrieving integrated noise data */
61 
62 #define LNLSTDENS 0 /* array loc that log of the last noise density stored */
63 #define OUTNOIZ 1 /* array loc that integrated output noise is stored */
64 #define INNOIZ 2 /* array loc that integrated input noise is stored */
65 
66 #ifndef NSTATVARS
67 #define NSTATVARS 3 /* number of "state" variables that must be stored for
68  each noise generator.
69  in this case it is three: LNLSTDENS, OUTNOIZ
70  and INNOIZ */
71 #endif
72 
73 /* noise analysis parameters */
74 
75 #define N_OUTPUT 1
76 #define N_OUTREF 2
77 #define N_INPUT 3
78 #define N_PTSPERSUM 4
79 
80 
81 /* noise routine operations/modes */
82 
83 #define N_DENS 1
84 #define INT_NOIZ 2
85 #define N_OPEN 1
86 #define N_CALC 2
87 #define N_CLOSE 3
88 #define SHOTNOISE 1
89 #define THERMNOISE 2
90 #define N_GAIN 3
91 
92 
93 /* tolerances and limits to make numerical analysis more robust */
94 
95 #define N_MINLOG 1E-38
96 /* the smallest number we can take the log of */
97 
98 
99 #define N_MINGAIN 1E-20
100 /* the smallest input-output gain we can tolerate
101  * (to calculate input-referred noise we divide
102  * the output noise by the gain)
103  */
104 
105 #define N_INTFTHRESH 1E-10
106 /* the largest slope (of a log-log noise spectral
107  * density vs. freq plot) at which the noise
108  * spectum is still considered flat. (no need for
109  * log curve fitting)
110  */
111 
112 #define N_INTUSELOG 1E-10
113 /* decides which expression to use for the integral of
114  * x**k. If k is -1, then we must use a 'ln' form.
115  * Otherwise, we use a 'power' form. This
116  * parameter is the region around (k=) -1 for which
117  * use the 'ln' form.
118  */
119 
120 
121 /* misc constants */
122 
123 /* maximum length for noise output variables we will generate */
124 #define N_MXVLNTH 64
125 
126 
127 #ifdef __STDC__
128 extern int NOISEan(GENERIC *, int);
129 extern int NOISEaskQuest(GENERIC*,GENERIC*,int,IFvalue*);
130 extern int NOISEparse(GENERIC*,GENERIC*,int,GENERIC*,char**,GENERIC*,GENERIC*);
131 extern int NOISEsetParm(GENERIC*,GENERIC*,int,IFvalue*);
132 extern void NevalSrc(double*,double*,CKTcircuit*,int,int,int,double);
133 extern double Nintegrate(double,double,double,GENERIC*);
134 #else
135 extern int NOISEan();
136 extern int NOISEaskQuest();
137 extern int NOISEparse();
138 extern int NOISEsetParm();
139 extern void NevalSrc();
140 extern double Nintegrate();
141 #endif
142 
143 
144 #endif /* NOISEDEFS */
double delLnFreq
Definition: noisedef.h:28
int NOISEparse()
double * outpVector
Definition: noisedef.h:33
char * Ninput
Definition: noisedef.h:47
double lstFreq
Definition: noisedef.h:20
int NnegOutNode
Definition: noisedef.h:53
double lnLastFreq
Definition: noisedef.h:27
IFuid * namelist
Definition: noisedef.h:35
void NevalSrc()
double lnGainInv
Definition: noisedef.h:25
int JOBtype
Definition: noisedef.h:42
Definition: cktdefs.h:23
JOB * JOBnextJob
Definition: noisedef.h:43
GENERIC * IFuid
Definition: ifsim.h:72
unsigned int prtSummary
Definition: noisedef.h:32
GENERIC * NplotPtr
Definition: noisedef.h:34
char * NoutputRef
Definition: noisedef.h:46
int Nstep
Definition: noisedef.h:54
double lnFreq
Definition: noisedef.h:26
double Nintegrate()
int NOISEan()
double GainSqInv
Definition: noisedef.h:24
char * JOBname
Definition: noisedef.h:44
int outNumber
Definition: noisedef.h:29
int NposOutNode
Definition: noisedef.h:52
int numPlots
Definition: noisedef.h:30
int NStpsSm
Definition: noisedef.h:50
double NsavOnoise
Definition: noisedef.h:48
int NOISEsetParm()
double delFreq
Definition: noisedef.h:21
double outNoiz
Definition: noisedef.h:22
double inNoise
Definition: noisedef.h:23
double freq
Definition: noisedef.h:19
double NsavInoise
Definition: noisedef.h:49
int NOISEaskQuest()
char * Noutput
Definition: noisedef.h:45
Ndata * NdataPtr
Definition: noisedef.h:51
char GENERIC
Definition: ifsim.h:27
Definition: noisedef.h:18