summaryrefslogtreecommitdiff
path: root/OSCAD/LPCSim/report/report.tex
blob: 0a090c1ac53feb5ab3a61db3662623d32ab9a7de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
\documentclass[a4paper,10pt]{report}
\pagestyle{plain}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{algorithmic}
% Title Page
\title{MiniSim}
\author{Yogesh Dilip Save}

\begin{document}
\maketitle
\chapter*{Introduction}
MiniSim is a circuit simulator to assist students in improving their knowledge in field of circuit simulation. The purpose of this project is not only to improve the understanding of student toward building simulator but also add some features which are not available in commercial simulator.

\section*{Features}
Analysis Options
\begin{enumerate}
\item Operating Point Analysis
\item DC Analysis
\item Transient Analysis 
\end{enumerate}
Devices Suported
\begin{enumerate}
\item All linear components (Resistances, Independent voltage and current sources, controlled sources).
\item Non-linear components (Diode)
\item User Defined Non-linear component
\item Time Dependent Component (Capacitor)
\item MOSFET
\end{enumerate}

\chapter*{User Defined Components}
How to define a new component?
\par
Consider, a non-linear resistance,
$$I=\frac{1}{R}V^2$$

It is two step processs:
\begin{enumerate}
\item Create  a file \$CompName.sci
\item Define 
\begin{enumerate}
\item Function in the $i=g(v)$ form
\item Jacobian of the function 
\end{enumerate}
\end{enumerate}

{\bf Syntax:-}
\newline 
function I=\$CompName\_func(voltage,parameter)
\$par\_2=parameter(2)
\$par\_3=parameter(3)

\chapter*{Algorithms}
{\bf Circuit Simulator} (Main Program)
\small
\begin{algorithmic}[1]
\STATE Get Analysis Options.
\STATE Read Circuit from file and convert it into graph.
\STATE Linearize non-linear components.
\STATE Build Modified Nodal Matrix.
\STATE Do Operating Point Analysis.
\STATE Print Operating Point Solution.
\IF {DC Analysis}
\FOR{Sweep Voltage = Intial : Final}
\STATE Do DC Analysis.
\STATE Store output variables.
\ENDFOR
\STATE Print/Plot output.
\ENDIF
\IF {Transient Analysis}
\FOR{time = Intial : Final}
\STATE Do Transient Analysis.
\STATE Store output variables.
\ENDFOR
\STATE Print/Plot output.
\ENDIF
\end{algorithmic}
\normalsize

{\bf Procedure:}{Get Analysis Options}
\small
\begin{algorithmic}[1]
\IF{Operating Point Analysis}
\STATE Analysis=Operating Point Analysis
\ENDIF
\IF{Transient Analysis}
\STATE Analysis=Transient Analysis
\STATE Get Start time, Stop time and Step size 
\ENDIF
\IF{DC Analysis}
\STATE Analysis=DC Analysis
\STATE Get Start voltage, Stop voltage and Step size 
\ENDIF
\STATE Get output variables for printing and plotting.
\STATE Find number of nodes in the circuit.
\end{algorithmic}

{\bf Procedure:}{Build Modified Nodal Matrix (Stamp table approach)}
\small
\begin{algorithmic}[1]
\STATE $Size(A,b) \gets N-1+T$
\FORALL {Edges}
\IF {Conductance}
\STATE A(Source,Source)+=conductance value
\STATE A(Source,Sink)-=conductance value
\STATE A(Sink,Source)-=conductance value
\ENDIF
\IF {Current Source}
\STATE b(Source)+= value
\STATE b(Sink)-= value
\ENDIF
\IF {Voltage Source}
\STATE A(Source,i*)=1; A(Sink,i*)=-1
\STATE A(i*,Source)=1; A(i*,Sink)=-1
\STATE b(i*)= value
\ENDIF
\IF {Voltage Controlled Current Source}
\STATE A(Source,CSource)+= value; A(Source,CSink)-= value
\STATE A(Sink,CSource)-= value; A(Sink,CSink)+= value
\ENDIF
\IF {Voltage controlled Voltage Source}
\STATE A(Source,i*)=1; A(Sink,i*)=-1
\STATE A(i*,Source)=1; A(i*,Sink)=-1
\STATE A(i*,CSource)=-value; A(i*,CSink)=value
\ENDIF
\IF {Current controlled Current Source}
\STATE A(Source,i*)=1; A(Sink,i*)=-1
\STATE A(i*,i*)=1; A(i*,j*)=-value
\ENDIF
\IF {Current controlled Voltage Source}
\STATE A(Source,i*)=1; A(Sink,i*)=-1
\STATE A(i*,Source)=1; A(i*,Sink)=-1
\STATE A(i*,i*)=-value
\ENDIF
\ENDFOR
\end{algorithmic}
$N$=Number of Nodes.\newline
$T$=Number of devices whose device characteristic can not be expressed in terms of voltage.
\normalsize
\newline

{\bf Procedure:}{Operating Point Analysis}
\small
\begin{algorithmic}[1]
\STATE Find Node Potential and Current through devices whose device characteristic can not be expressed in terms of voltage.
\STATE Find branch voltage and node potentail.
\STATE Find branch current from branch voltage using device characteristics.
\IF{Non-linear component}
\STATE {\bf NR:} Check  device characteristics of non-linear devices.
\IF {Device characteristics is not satisfied}
\STATE Call Newton Raphson procedure
\STATE Find Node Potential and Current through devices whose device characteristic can not be expressed in terms of voltage.
\STATE Find branch current from branch voltage using device characteristics.
\STATE Go to {\bf NR}
\ENDIF
\STATE Check for KCL
\ENDIF 
\end{algorithmic}
\normalsize

{\bf Procedure}{Check for Device characteristics of Non-linear elements}
\small
\begin{algorithmic}[1]
\FORALL {Non-linear devices}
\STATE Compute actual current/voltage by its device characteristics.
\STATE Compare actual current/voltage with that of by anlysis.
\ENDFOR
\end{algorithmic}
\normalsize

{\bf Procedure:}{Newton Raphson}
\small
\begin{algorithmic}[1]
\STATE Update the value of the linearized model of non-linear elements.
\STATE Update Modified Nodal matrix.
\end{algorithmic}
\normalsize

{\bf Procedure:}{Transient Analysis}
\small
\begin{algorithmic}[1]
\STATE Discretize time dependent Component and Update Modified Nodal matrix.
\STATE Do Operating Point Analysis.
\end{algorithmic}
\normalsize

{\bf Procedure:}{Discretization}
\small
\begin{algorithmic}[1]
\STATE Compute time dependent source value at time t.
\STATE Compute the values of static model of dynamic component at time t.
\STATE Update Modified Nodal matrix. 
\end{algorithmic}
\normalsize

{\bf Procedure:}{DC Analysis}
\small
\begin{algorithmic}[1]
\STATE Modify the value of the sweep source and update Modified Nodal matrix.
\STATE Do Operating Point Analysis.
\end{algorithmic}
\normalsize

\chapter*{Examples}
In this chapter, some basic circuits and simulation results with minsim are presented. 
\section*{RC Circuit}
 
\end{document}