Blame view

DOCUMENTATION/USER_GUIDE/Tex/using_models_in_spice.tex 10.1 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
2
\chapter{Using the Transmission Line models in Spice} \label{using_models_in_spice}

189467e4   Steve Greedy   First Public Release
3
This chapter describes how the models, once created, can be used in the different versions of Spice supported, namely Ngspice, LTspice and PSpice.
886c558b   Steve Greedy   SACAMOS Public Re...
4

189467e4   Steve Greedy   First Public Release
5
If the GUI is being used to generate the Spice cable bundle models then the path names indicated below may be set in the GUI so that the Spice subcircuit files and the associated symbol files are copied to the appropriate directories. If PSpice is being used then there is a step using the PSpice model editor which is required to set up the model and symbol for use in schematic capture.
886c558b   Steve Greedy   SACAMOS Public Re...
6
7


189467e4   Steve Greedy   First Public Release
8
\section{Using Models in Ngspice}
886c558b   Steve Greedy   SACAMOS Public Re...
9

189467e4   Steve Greedy   First Public Release
10
The Spice cable bundle model building process creates a subcircuit file \textbf{name.lib} and a corresponding symbol file \textbf{name.sym}.
886c558b   Steve Greedy   SACAMOS Public Re...
11
12
13
14
15

For use by gshem the symbol file should be copied to the directory:

\textbf{ /usr/share/gEDA/sym/local}

189467e4   Steve Greedy   First Public Release
16
When runnning the Spice cable bundle model building process from the script \textbf{generate\_spice\_cable\_bundle\_model}, if you want to make the circuit symbols available for use by gshem you will need to add the following to the \textbf{generate\_spice\_cable\_bundle\_model} file:
886c558b   Steve Greedy   SACAMOS Public Re...
17
18
19
20
21
22
23
24
25

SYMBOL\_DIR="/usr/share/gEDA/sym/local"

Note also that you may need to change ownership of SYMBOL\_DIR with something like the following command:    
sudo chown chris:chris /usr/share/gEDA/sym/local

The symbol file (\textbf{name.sym}) contains the path to the subcircuit library file for the transmission line model. The 
symbol file may require editing to ensure that the path is correct on any given system. The line which must be checked is

189467e4   Steve Greedy   First Public Release
26
file=\textbf{PATH\_TO\_TRANSMISSION\_LINE\_SUB\_CIRCUITS/name.lib}
886c558b   Steve Greedy   SACAMOS Public Re...
27

189467e4   Steve Greedy   First Public Release
28
29
\section{Using Models in LTspice}
The Spice cable bundle model building process creates a subcircuit file \textbf{name.lib} and a corresponding symbol file \textbf{name.asy}.
886c558b   Steve Greedy   SACAMOS Public Re...
30

189467e4   Steve Greedy   First Public Release
31
In order to use the subcircuit and the associated symbol in LTspice running on windows, the symbol file, \textbf{name.asy}, should be copied into the LTspice symbol directory or a sub-directory created within this directory.
886c558b   Steve Greedy   SACAMOS Public Re...
32
33
34
35
36
37
38
39

\textbf{ C:$\backslash$Program Files$\backslash$LTC$\backslash$LTspiceV$\backslash$lib$\backslash$sym   }

The symbol file contains the path to the subcircuit library file for the transmission line model. The 
symbol file may require editing to ensure that the path is correct on any given system. The line which must be checked is

SYMATTR ModelFile \textbf{ C:$\backslash$PATH\_TO\_TRANSMISSION\_LINE\_SUB\_CIRCUITS$\backslash$name.lib}

189467e4   Steve Greedy   First Public Release
40
One this is set up correctly the symbol can be chosen and included in the schematic like any other though it is important to note that LTspice must be re-started before any changes to the symbol library take effect.
886c558b   Steve Greedy   SACAMOS Public Re...
41

189467e4   Steve Greedy   First Public Release
42
\subsection{Using Models in PSpice}
886c558b   Steve Greedy   SACAMOS Public Re...
43

189467e4   Steve Greedy   First Public Release
44
The Spice cable bundle model building process creates a subcircuit file \textbf{name.lib}. When using this model in PSpice there is an initial stage of creating a Cadence PSpice library file which includes an associated symbol. The process required is as follows:
886c558b   Steve Greedy   SACAMOS Public Re...
45
46
47

\enumerate{

189467e4   Steve Greedy   First Public Release
48
\item Start the PSpice model editor.
886c558b   Steve Greedy   SACAMOS Public Re...
49
50
51

\item Load the subcircuit file (\textbf{name.lib}) using the model input wizard (file $\rightarrow$ Model Input Wizard). The dialog box automatically fills the name of the library file to be produced (\textbf{name.olb})

189467e4   Steve Greedy   First Public Release
52
\item Reply `Yes' to the question `Do you want to attach the default rectangular symbol'. At this point the library file \textbf{name.olb} is produced.
886c558b   Steve Greedy   SACAMOS Public Re...
53
54

\item If you would like the model to be available in the default libraries loaded then you will need to edit the file: 
189467e4   Steve Greedy   First Public Release
55
\textbf{C:$\backslash$Cadence$\backslash$SPB\_17.2$\backslash$tools$\backslash$PSpice$\backslash$library$\backslash$normd.lib} to include the line
886c558b   Steve Greedy   SACAMOS Public Re...
56
57
58

.lib "name.lib"

189467e4   Steve Greedy   First Public Release
59
If this step is not done then the library file will have to loaded explicitly by editing the `Simulation Settings' in Orcad Capture, before running the simulation.
886c558b   Steve Greedy   SACAMOS Public Re...
60
61
62
63
64

}

The library will have to be loaded when placing parts in the schematic.

189467e4   Steve Greedy   First Public Release
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
\section{Spice `node zero'}\label{node_zero}

Care may be required in specifying node zero in Spice circuits containing transmission line models. Figure \ref{fig_node_zero_fig1} shows a 
typical circuit configuration in which two termination sub-circuits are connected via a three conductor transmission line. 

\begin{figure}[h]
\centering
\includegraphics[scale=0.7]{./Imgs/node_zero_fig1.eps}
\caption{Example circuit using a transmission line sub-circuit model}
\label{fig_node_zero_fig1}
\end{figure}


\begin{figure}[h]
\centering
\includegraphics[scale=0.7]{./Imgs/node_zero_fig2.eps}
\caption{Example circuit with node zero in one termination circuit only}
\label{fig_node_zero_fig2}
\end{figure}

\begin{figure}[h]
\centering
\includegraphics[scale=0.7]{./Imgs/node_zero_fig3.eps}
\caption{Example circuit with node zero in both termination circuits showing how node zero at both ends will short out any resistance in the reference conductor}
\label{fig_node_zero_fig3}
\end{figure}

Figure \ref{fig_node_zero_fig2} shows a depiction of a Spice model of this configuration in which termination 1 includes node zero and termination 2 does not include node zero. This circuit will work with the transmission line model operating as it is designed to, even if there is some loss in the reference conductor. It is important to note that voltages in termination circuit 1 should be measured relative to node zero however voltages in termination circuit 2 should be measured relative to the local reference node, in this case node $n1,2$.

Figure \ref{fig_node_zero_fig3} shows a depiction of a Spice model in which both termination 1 and termination 2 include node zero as a reference.
In this case, the d.c. resistance, $R_{dc_ref}$, of the reference conductor is effectively short circuited as depicted by the heavy line in figure  \ref{fig_node_zero_fig3} and the transmission line model may not give accurate results, especially if the d.c. resistance is significant and the analysis is at low frequency. If the reference conductor is a ground plane (which is assumed to be perfectly conducting in this work) then having node zero at both ends of the transmission line sub-circuit will not affect the results (since $R_{dc_ref}=0$ in this case). I can also be observed that an EMC oriented system model will include bonding resistances and inductances between the electronic units at either end and the ground plane. These bonding impedances will most tend to dominate the d.c. resistances of the cables and thus the effect of shorting out the d.c. resistance of the reference conductor may have a small impact.

To conclude, we recommend that node zero is only included in one transmission line termination circuit and that all voltages in a transmission line termination are measured relative to the local termination reference node. Node zero should only be present at both ends of a transmission line sub-circuit if there is no loss in the reference conductor.

\section{Non-convergence issues in Spice and possible solutions}
886c558b   Steve Greedy   SACAMOS Public Re...
100
101
102
103

It is not uncommon for Spice simulations to fail to run to completion 
due to non-convergence of the solution to the specified tolerances. This 
is a complicated issue due to the different solution algorithms which are
189467e4   Steve Greedy   First Public Release
104
used in each of the Spice analysis options. The main convergence issues 
886c558b   Steve Greedy   SACAMOS Public Re...
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
are related to the following:

\enumerate{
\item Newton Raphson algorithm for non-linear equations

\item D.C. bias point calculation

\item Transient Analysis

\item Timestep control
}

These aspects of Spice and the options available to change the Spice operation
to improve convergence are discussed for each. Note that not all options are
available in all versions of Spice. A detailed discussion of these issues is
found in reference \cite{Kielkowski}

\subsubsection{Newton Raphson algorithm}

The circuit equations are solved for non-linear circuit elements using
the Newton Raphson algorithm. The iteration stops when the following conditions
are satisfied:

1. For all the nodes in the circuit:
189467e4   Steve Greedy   First Public Release
129
$|$V(t)-V(t-dt)$|$ $<$ RELTOL*V(t)+VNTOL
886c558b   Steve Greedy   SACAMOS Public Re...
130
131

2 For all the branch currents in the circuit:
189467e4   Steve Greedy   First Public Release
132
$|$I(t)-I(t-dt)$|$ $<$ RELTOL*I(t)+ABSTOL
886c558b   Steve Greedy   SACAMOS Public Re...
133
134

RELTOL is a relative tolerance whose default value is 0.001
189467e4   Steve Greedy   First Public Release
135

886c558b   Steve Greedy   SACAMOS Public Re...
136
VNTOL has a default value of 1$\mu$V
189467e4   Steve Greedy   First Public Release
137

886c558b   Steve Greedy   SACAMOS Public Re...
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
ABSTOL has a default value of 1pA

If there is a convergence error in the Newton Raphson solution then it is worth
considering increasing VNTOL and/or ABSTOL. VNTOL can be set to a value RELTOL*Vsmall
where Vsmall is the smallest voltage of interest. Similarly, ABSTOL can be set to 
a value RELTOL*Ismall where Ismall is the smallest current of interest

Convergence may also be improved by increasing GMIN. This is the minimum conductance 
which is allowed between nodes. GMIN should be set to be as large as possible without
affecting the circuit operation i.e. work out the smallest resistance, R which can 
be connected between the circuit nodes then set GMIN=1/R.

If non-linear devices are included in the circuit then convergence may be improved by 
ensuring that non-linear models include some series resistance in the .MODEL definition.

\subsubsection{D.C. bias point calculation}

If Spice fails to find a d.c. bias point then the following actions may help:

1. Increase ITL1, the number of d.c. bias point iterations from the default of ITL1=100
to ITL1=500 (say)

2. Try to assist the d.c. convergence by setting some initial node values for the 
convergence calculation e.g.
.NODESET  V(n)=X

3. Use source stepping by setting ITL6 to 500 for example

\subsubsection{Transient Analysis}

In order to aid transient analysis, all non-linear device models should have their
associated capacitance values set to a non-zero value.

The number of iterations for convergence at a time point can also be increased 
for example set ITL4=40 (default value is 10). If this value is exceeded then 
the timestep is reduced. 

\subsubsection{Timestep control}

Automatic timestep control can aid convergence and speed of the solution
however there are some issues to be aware of.

1. The timestep is always less than the print interval (TSTEP) so this can be used
to set a limit on the timestep.

2. Increase ITL4 to prevent the timestep being reduced too readily. This may improve the
total simulation time. The default value is 10. 


\cleardoublepage