A capacitor is a device which relates charge and voltage.

If the charge-voltage relation is linear, as shown in Figure 1(a), then:

$$q = Cv\\ \label{eq:qcv}$$

where the constant, $$C$$, is defined as the device capacitance. Since $$v=g(t)$$, then differentiating both sides of equation \eqref{eq:qcv} with respect to time admits the following current-voltage relation:

$$\frac{dq}{dt} = i = C\frac{dv}{dt} \\ \label{eq:dqdt}$$

If the charge-voltage relation is non-linear, as shown in Figure 1(b), then:

$$q = f(v) \\ \label{eq:qfv}$$

Since $$v=g(t)$$, then differentiating both sides of equation \eqref{eq:qfv} with respect to time (using the Chain rule) admits the following current-voltage relation:

$$\frac{dq}{dt} = \frac{dq}{dv}\frac{dv}{dt} \\ \label{eq:dqdt1}$$ $$i = C(v)\frac{dv}{dt} \\ \label{eq:dqdt2}$$

The capacitance, $$C(v)$$, is defined as:

$$C(v) = \frac{dq}{dv} \\ \label{eq:cv}$$

If the capacitance of equation \eqref{eq:qcv} is not constant, but rather a function of time, $$C=C(t)$$, then differentiating both sides of equation \eqref{eq:cv} admits the following current-voltage relationship:

$$i = C(t)\frac{dv(t)}{dt} + v(t)\frac{dC(t)}{dt} \\ \label{eq:ct}$$

In many semiconductor devices the stored charge is often a function of multiple voltage sources:

$$q = f(\begin{matrix} v_1, & v_2, & \dots, & v_n \end{matrix}) \\ \label{eq:qmul}$$

Since $$v_n=g(t)$$, then differentiating both sides of \eqref{eq:qmul} with respect to time (using the Chain rule) admits the following current-voltage relation:

$$\frac{dq}{dt} = \frac{\partial q}{\partial v_1}\frac{dv_1}{dt} + \frac{\partial q}{\partial v_2}\frac{dv_2}{dt} + \dots + \frac{\partial q}{\partial v_n}\frac{dv_n}{dt} \\ \label{eq:qtmul}$$

Obtaining a closed-form expression of equation \eqref{eq:qtmul} involves computation of all partial derivatives. In many cases this may not be possible or is impractical to do so. Alternatively, equation \eqref{eq:qtmul} may be approximated by numerically differentiating equation \eqref{eq:qmul} and modelling the capacitor as voltage dependent current source.

## Example

### Variac Modelling

As an example of non-linear capacitance modelling, consider the network shown below. The charge stored in capacitor $$C_2$$ is a non-linear function of the applied bias voltage, $$v_{C_2} \left( t \right)$$:

$$q_{C_2} = Q_0v_{C_2}^2 + \frac{Q_0}{4}v_{C_2} \\ \label{eq:q_variac}$$

Differentiating equation \eqref{eq:q_variac} using the Chain rule, the closed-form expression relating current and voltage is obtained:

$$\frac{dq_{C_2}}{dt} = i_{C_2} = \left( 2Q_0v_{C_2} + \frac{Q_0}{4} \right) \frac{dv_{C_2}}{dt} = C_2(v_{C_2})\frac{dv_{C_2}}{dt} \\ \label{eq:q_variac_current}$$ A simple electrical network. Capacitor $$C_2$$ is a variac.

The state vector for the network shown above may be written as:

$\mathbf{x} = \begin{bmatrix} v_{C_1} \\ v_{C_2} \\ i_{L} \\ \end{bmatrix}$

The complete system of equations represeting this electrical network are given in equations \eqref{eq:ex1_qf} and \eqref{eq:ex1_bf}.

$\begin{bmatrix} C_{2} \left(v_{C_2} \right)& 0 \\ 0 & C_{1} \\ \end{bmatrix} \begin{bmatrix} \frac{dv_{C_2}}{dt} \\ \frac{dv_{C_1}}{dt} \\ \end{bmatrix} = \begin{bmatrix} i_{R_2} - i_{R_1} \\ i_{L} - i_{R_1} \\ \end{bmatrix} \label{eq:ex1_qf}$ $\begin{bmatrix} L \\ \end{bmatrix} \begin{bmatrix} \frac{di_{L}}{dt} \\ \end{bmatrix} = \begin{bmatrix} v_{in} - v_{C_1} \\ \end{bmatrix} \label{eq:ex1_bf}$

The algebraic constraints of equations \eqref{eq:ex1_qf} and \eqref{eq:ex1_bf} can be determined by solving the $$\mathbf{B_f}$$ and $$\mathbf{Q_f}$$ system of equations.

$\mathbf{B_f} = \begin{bmatrix} -1 & 0 & 1 & 1 & 0 & 0 \\ 1 & -1 & 0 & -1 & 1 & 0 \\ -1 & 1 & 0 & 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} v_{in} \\ v_{C_2} \\ v_{L} \\ v_{C_1} \\ v_{R_1} \\ v_{R_2} \\ \end{bmatrix} = \mathbf{0} \label{eq:ex1_bf1}$ $\mathbf{Q_f} = \begin{bmatrix} 1 & 0 & 1 & 0 & -1 & 1 \\ 0 & 1 & 0 & 0 & 1 & -1 \\ 0 & 0 & -1 & 1 & 1 & 0 \\ \end{bmatrix} \begin{bmatrix} i_{S} \\ i_{C_2} \\ i_{L} \\ i_{C_1} \\ i_{R_1} \\ i_{R_2} \\ \end{bmatrix} = \mathbf{0} \label{eq:ex1_qf1}$

The quantities $$v_{in}$$, $$v_{C_1}$$, $$v_{C_2}$$ and $$i_L$$ are known from the state variables and system inputs and can be treated as constants in the solution of equations \eqref{eq:ex1_bf1} and \eqref{eq:ex1_qf1}. However, the quantities $$i_{S}$$, $$i_{C_1}$$, $$i_{C_2}$$ and $$v_L$$ must be solved for. In addition, resistors $$R_1$$ and $$R_2$$ contribute only a single variable and this is chosen as the branch voltages ($$v_{R_1}$$ and $$v_{R_2}$$). Therefore, the complete system of linear equations is given in \eqref{eq:ex1_linag}.

$\begin{bmatrix} 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 & \frac{-1}{R_1} & \frac{1}{R_2} \\ 0 & 1 & 0 & 0 & \frac{1}{R_1} & \frac{-1}{R_2} \\ 0 & 0 & 0 & 1 & \frac{1}{R_1} & 0 \\ \end{bmatrix} \begin{bmatrix} i_{S} \\ i_{C_2} \\ v_{L} \\ i_{C_1} \\ v_{R_1} \\ v_{R_2} \\ \end{bmatrix} = \begin{bmatrix} v_{in} - v_{C_1} \\ -v_{in} + v_{C_2} + v_{C_1} \\ v_{in} - v_{C_2} \\ -i_{L} \\ 0 \\ i_{L} \\ \end{bmatrix} \label{eq:ex1_linag}$

### VCCS Modelling

As an alternative to modelling capacitor $$C_2$$ as a variac, it may be replaced with a VCCS, as shown in the network below. A simple electrical network. Capacitor $$C_2$$ has been replaced with a VCCS.

The control voltage of the VCCS is the applied bias voltage between nodes 1 and 3. The current is approximated by numerically differentiating equation \eqref{eq:q_variac}. This requires that state be saved between successive time steps in the solution of the ODEs to apply suitable numerical differentiation methods. For example, if the backwards Euler method is employed, then equation \eqref{eq:q_variac_current} may be approximated as:

$$\frac{dq_{C_2}}{dt} = i_{C_2} \left( v_{C_2} \left(t_n \right) \right) \approx \frac{q_{C_2} \left( v_{C_2} \left(t_n \right) \right) - q_{C_2} \left( v_{C_2} \left( t_{n-1} \right) \right)}{h} \\ \label{eq:q_variac_current_numerical}$$

Where $$h$$ is the timestep size between steps $$t_n$$ and $$t_{n-1}$$. As the network now only contains two passive elements, the state vector may be written as:

$\mathbf{x} = \begin{bmatrix} v_{C_1} \\ i_{L} \\ \end{bmatrix}$

The complete system of equations represeting this electrical network are given in equations \eqref{eq:ex2_qf} and \eqref{eq:ex2_bf}.

$\begin{bmatrix} C_{1} \\ \end{bmatrix} \begin{bmatrix} \frac{dv_{C_1}}{dt} \\ \end{bmatrix} = \begin{bmatrix} i_{L} - i_{R_1} \\ \end{bmatrix} \label{eq:ex2_qf}$ $\begin{bmatrix} L \\ \end{bmatrix} \begin{bmatrix} \frac{di_{L}}{dt} \\ \end{bmatrix} = \begin{bmatrix} v_{in} - v_{C_1} \\ \end{bmatrix} \label{eq:ex2_bf}$

The algebraic constraints of equations \eqref{eq:ex2_qf} and \eqref{eq:ex2_bf} can be determined by solving the $$\mathbf{B_f}$$ and $$\mathbf{Q_f}$$ system of equations.

$\mathbf{B_f} = \begin{bmatrix} -1 & 1 & 0 & 0 & 0 & 1 \\ -1 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 0 & -1 & 1 & 1 \\ \end{bmatrix} \begin{bmatrix} v_{in} \\ v_{C_2} \\ v_{L} \\ v_{C_1} \\ v_{R_1} \\ v_{R_2} \\ \end{bmatrix} = \mathbf{0} \label{eq:ex2_bf1}$ $\mathbf{Q_f} = \begin{bmatrix} 1 & 1 & 1 & 0 & 0 & 0 \\ 0 & 0 & -1 & 1 & 1 & 0 \\ 0 & -1 & 0 & 0 & -1 & 1 \\ \end{bmatrix} \begin{bmatrix} i_{S} \\ i_{C_2} \\ i_{L} \\ i_{C_1} \\ i_{R_1} \\ i_{R_2} \\ \end{bmatrix} = \mathbf{0} \label{eq:ex2_qf1}$

The quantities $$v_{in}$$, $$v_{C_1}$$ and $$i_L$$ are known from the state variables and system inputs and can be treated as constants in the solution of equations \eqref{eq:ex2_bf1} and \eqref{eq:ex2_qf1}. VCCS capacitor $$C_2$$ has one independent variable, $$v_{C_2}$$, and the current, $$i_{C_2}$$, is a non-linear function of this variable. In addition, the quantities $$i_{S}$$, $$i_{C_1}$$, $$v_{R_1}$$, $$v_{R_2}$$ and $$v_L$$ must all be solved for. Therefore, the complete system of linear equations is given in \eqref{eq:ex2_nonlinag}.

$$-v_{in} + v_{C_2} + v_{R_2} = 0 \\ -v_{in} + v_{L} + v_{C_1} = 0 \\ -v_{C_1} + v_{R_1} + v_{R_2} = 0 \\ i_{S} + i_{C_2} \left( v_{C_2} \right) + i_{L} = 0 \\ -i_{L} + i_{C_1} + \frac{v_{R_1}}{R_1} = 0 \\ -i_{C_2} \left( v_{C_2} \right) - \frac{v_{R_1}}{R_1} + \frac{v_{R_2}}{R_2} = 0 \\ \label{eq:ex2_nonlinag}$$

This system of equations is non-linear and must be solved using the Newton-Rhapson method.