-
Notifications
You must be signed in to change notification settings - Fork 3
Simulation: DC Operating Point Analysis
DC Operating Point Analysis is performed using three mutually recursive main functions and several helper functions. The main functions are:
-
ModifiedNodalAnalysisDC
: Main MNA implementation -
transformAllDiodes
: Finds the correct operating modes of linearized diodes (see Handling Linearized Diodes) -
newtonRaphson
: Extends MNA for non-linear components (see Extension for real diodes)
The helper functions are mostly used to help in the required transformations in the CanvasState
for MNA to run, and in the creation of the MNA matrix. In all cases, their names are representative of their operation. These are:
combineGrounds
shortInductorsForDC
getDiodeValues
findVd
calcVectorBElement
calcMatrixElementValue
findComponentCurrents
Modified Nodal Analysis is thoroughly explained (with plethora of examples) on this webpage. Under the same page, in the section Algorithmic MNA the algorithm used by ADDIE to solve the circuits is described.
A crusial pre-processing step, in order to guarantee a smooth execution of the MNA algorithm is to combine all grounds to 1 main ground. This is done using the combineGrounds
function which involves two steps: (i)
selecting a random ground component in the circuit (will serve as the main ground), and (ii) traversing
through the list of connections and updating any connection that starts or ends at a ground symbol
to instead start or end at the chosen main ground
As seen in the provided link which analyses MNA, the G matrix of the MNA matrix is calculated using the conductances of the components. The impedance and conductance of an inductor and a capacitor are given by:
Component | Impedance | Conductance |
---|---|---|
Capacitor | Zc = 1/jwC | Gc = jwC |
Inductor | ZL = jwL | GL = 1/jwL |
Therefore, in DC (w=0), the conductance of a capacitor is 0, and therefore, doesn't affect the MNA algorithm described above. However, the conductance of an inductor is infinite in DC, and thus, requires some pre-processing, as adding infinite elements in the MNA matrix would make the matrix non-invertible and, by extension, the circuit non-solvable.
To solve this issue, (and many other issues which will follow in this page), the canvas state is transformed before running the simulation into an equivalent circuit with the characteristics that we want.
In this case, all inductors are transformed to 0V Voltage Sources (Voltage Source (DC 0)
) using the shortInductorsForDC
function.
'Linearized Diodes' refers to the linear equivalent model of a diode with the following characteristics:
Region | Condition | Equation |
---|---|---|
Conducting Mode (“on”) | I > 0 | V = 0.7 |
Non-conducting Mode (“off”) | V < 0.7 | I = 0 |
The algorithm employed to identify the mode of each diode (DiodeL
) is identical to the on-paper algorithm,
and consists of:
- Make a guess about the operating mode of the diode
- Using that mode, solve the circuit
- If the condition is met, the guess was correct and the correct solution has been obtained. Otherwise, the correct mode is guaranteed to be the not-selected mode
For a circuit with a single diode, for example, the algorithm will initially transform locally the diode
to a VoltageSource (DC 0.7)
. Then, MNA will run (no diode present, run as before) and the
condition will be checked (I > 0). If the condition is satisfied, the transformDiodes
function returns
the transformed circuit (with the VoltageSource (DC 0.7)
). However, if the condition is not met, the
diode is transformed into a CurrentSource (0.0)
. This means that the ModifiedNodalAnalysis
and
transformDiodes
functions are mutually recursive, as for the latter to produce a correctly transformed
CanvasState, the former must be used to check the conditions.
When dealing with circuits containing multiple diodes, simply checking each diode individually is insufficient to guarantee an accurate solution. This is because the mode of one diode may depend on the state of another diode. To address this challenge, diode circuits are solved using an exhaustive search approach. In other words, all possible combinations of diode modes are checked, resulting in a total of 2n combinations for a circuit with n diodes.
So, essentially, this is what the transformDiodes
function does: it searches (exhaustively) for the correct diode modes, checking each compination individually to find the one that satisfies the condition.
To enhance performance in time domain simulations, the previously (at the previous time step) correct modes are the first ones to be checked at the next time step. These are stored as a list of booleans cachedDiodeModes
where true
represents conducting mode and false
non-conducting mode.
In order to support real diodes, and by extension any other non-linear component, Modified Nodal Analysis must be used with the iterative newton-raphson method. This is done by using the linear companion models of non-linear components. In this section, a circuit with a real diode will be solved step-by-step to help in the understanding of the algorithm.
Starting from the linear companion model of the diode, this is described in the image below. A good starting point for the linear companion models of MOSFETS and transistors is this paper.
where:
-
$I_S$ is the saturation current (set to 3.35 nA in ADDIE) -
$V_t$ is the thermal voltage (set to 0.04942V in ADDIE) -
$V_d$ is the voltage accross the diode
The two constants (Constants
section in Simulation.fs
(lines 10-20).
The approach which will be followed is the following:
- Start from an initial solution
$𝑿^0$ - Solve the linear companion model by applying MNA and using the initial solution to find the value of 𝑉_𝑑
- Obtain
$𝑿^1$ and repeat step 2 until convergence$|𝑉_𝑑^{(𝑛+1)}− 𝑉_𝑑^{(𝑛+1)}| < ε$
We will solve the following circuit:
We can derive a pseudo-random initial solution
By solving the above system we obtain