29 Example 7
From [1]
29.1 Circuit Description
We start with a system of differential-algebraic equations (DAE) that describes a circuit. The equations are given by:
\begin{pmatrix} C & -C & 0 \\ -C & C & 0 \\ 0 & 0 & 0 \end{pmatrix} \begin{pmatrix} v'_1 \\ v'_3 \\ i \end{pmatrix} + \begin{pmatrix} 0 & 0 & -1 \\ 0 & 1/R & 0 \\ -1 & 0 & 0 \end{pmatrix} \begin{pmatrix} v_1 \\ v_3 \\ i \end{pmatrix} =\begin{pmatrix} 0 \\ 0 \\ V(t) \end{pmatrix}
Semi-Explicit Formulation
We decompose the system into differential (blue) and algebraic (red) components as follows:
\left\{ \color{blue} \begin{aligned} v'_1 &= v_{1,\text{dot}} \\ v'_3 &= v_{3,\text{dot}} \end{aligned} \right. \quad \bigoplus \quad \left\{ \color{DarkRed} \begin{aligned} C({\color{blue}v_{1,\text{dot}}}-{\color{blue}v_{3,\text{dot}}})-{\color{blue}i} & = 0, \quad\text{(Constraint 1)}\\[0.5em] RC({\color{blue}v_{1,\text{dot}}}-{\color{blue}v_{3,\text{dot}}})-v_3 &= 0, \quad\text{(Constraint 2)} \\[0.5em] v_1 + V(t) & = 0, \quad\text{(Constraint 3)} \end{aligned} \right.
In this system:
- Differential variables: v_1, v_3.
- Algebraic variables: v_{1,\text{dot}}, v_{3,\text{dot}}, i.
We begin by attempting to solve for the variables (v_{1,\text{dot}}, v_{3,\text{dot}}, and i), but the system is not explicitly solvable at this stage. We need to reduce the index of the system. To do this, we differentiate the algebraic constraints.
Index Reduction Procedure
We attempt to solve for v_{1,\text{dot}}, v_{3,\text{dot}} and i_{\text{dot}} but the system is not yet solvable explicitly. We proceed by differentiating.
Step 1: Differentiate algebraic constraints
Now we must derivate the constraints in order to reduce the index. Here we want to differentiate only the algebraic equation that can reduce the index and do not introduce new differential equation. Here we want to avoid to introduce derivative of the algebraic variable unless is strictly necessary.
We construct a dependency table to identify which constraints to differentiate:
\begin{array}{c|ccc} & v_{1,\text{dot}} & v_{3,\text{dot}} & i \\[1em] \hline \\[0.1em] \text{(Constraint 1)} & 1 & 1 & 1 \\[1em] \text{(Constraint 2)} & 1 & 1 & 0 \\[1em] \text{(Constraint 3)} & 0 & 0 & 0 \end{array}
A 0 means no dependence on the corresponding variable, while a 1 indicates dependence. Notice that Constraint 3 does not depend on v_{1,\text{dot}}, v_{3,\text{dot}}, or i, making it the most suitable candidate for differentiation.
We differentiate Constraint 3:
\text{(Constraint 3)}' = v'_1 - V'(t) = v_{1,\text{dot}} - V'(t)
After differentiation, the system becomes:
\left\{ \color{blue} \begin{aligned} v'_1 &= v_{1,\text{dot}} \\ v'_3 &= v_{3,\text{dot}} \end{aligned} \right. \quad \bigoplus \quad \left\{ \color{DarkRed} \begin{aligned} C(v_{1,\text{dot}}-v_{3,\text{dot}})-i & = 0, \quad\text{(Constraint 1)}\\[0.5em] RC(v_{1,\text{dot}}-v_{3,\text{dot}})-v_3 &= 0, \quad\text{(Constraint 2)} \\[0.5em] v_{1,\text{dot}} + V'(t) & = 0, \quad\text{(Constraint 3)}' \\[1em] \color{DarkGreen} v_1 + V(t) & \color{DarkGreen} = 0, \quad\text{(Constraint 3)} \end{aligned} \right.
Here, the red equations represent the newly derived algebraic equations, while the green equation represents the original constraint that has now been removed from the system. This hidden constraint must still be satisfied, but it can be accounted for through proper initial conditions.
Step 2: Differentiate (again) the algebraic constraints
To find the right candidate(s) here we write a table of the dependencies \begin{array}{c|ccc} & v_{1,\text{dot}} & v_{3,\text{dot}} & i \\[1em] \hline \\[0.1em] \text{(Constraint 1)} & 1 & 1 & 1 \\[1em] \text{(Constraint 2)} & 1 & 1 & 0 \\[1em] \text{(Constraint 3)}' & 1 & 0 & 0 \end{array}
None of the constraints can be differentiated further at this stage. Therefore, we check the Jacobian of the system to determine whether it is singular. If the Jacobian is non-singular, we can solve the system and the DAE will be reduced to index-1.
We analyze the sparsity pattern of the Jacobian matrix:
\bm{S} = \begin{pmatrix} 1 & 1 & 1 \\ 1 & 1 & \cdot\\ 1 & \cdot & \cdot \end{pmatrix}
This structure suggests that the matrix is non-singular, but we will use MATLAB’s sprank function to check for its rank:
sparsity_pattern = [
1 1 1; % Constraint 1
1 1 0; % Constraint 2
1 0 0]; % Constraint 3'
fprintf('Estimated rank = %d\n', sprank(sparsity_pattern) )
> Estimated rank = 3Since the matrix is structurally non-singular, we proceed by solving for the derivatives:
\begin{aligned} v_{1,\text{dot}} & = -V'(t) \\ v_{3,\text{dot}} & = v_{1,\text{dot}} - v_3/(RC) = -V'(t) - v_3/(RC) \\ i &= C(v_{1,\text{dot}} -v_{3,\text{dot}} ) = v_3/R \end{aligned}
and thus the DAE is of index-1. The DAE is better written as
\left\{ \color{blue} \begin{aligned} v'_1 &= v_{1,\text{dot}} \\ v'_3 &= v_{3,\text{dot}} \end{aligned} \right. \quad \bigoplus \quad \left\{ \color{DarkRed} \begin{aligned} \begin{pmatrix} C & -C & -1 \\ RC & -RC & 0 \\ 1 & 0 & 0 \end{pmatrix} \begin{pmatrix} v_{1,\text{dot}} \\ v_{2,\text{dot}} \\ i \end{pmatrix} &= \begin{pmatrix} 0 \\ v_3 \\ -V'(t) \end{pmatrix},\\[2em] \color{DarkGreen} v_1 + V(t) & \color{DarkGreen} = 0, \quad\text{(Constraint 3)} \end{aligned} \right.
where the green part are the hidden constraints that are satisfied by choosing the correct initial conditions.
Note that we have done one derivation on the constraints and the DAE is of index 1, thus, the original DAE is of index 2.
29.2 Baumgarte Stabilization
To avoid drift in the hidden constraints, we apply Baumgarte stabilization:
\text{(Constraints 3)}'+{\color{DarkOrange}\frac{1}{\tau}}\text{(Constraints 3)}=0
and substituting the expression
v_{1,\text{dot}}+V'(t)+ \frac{v_1 + V(t)}{\color{DarkOrange}\tau}0
The stabilized constraints are:
\color{DarkRed} \begin{pmatrix} C & -C & -1 \\ RC & -RC & 0 \\ 1 & 0 & 0 \end{pmatrix} \begin{pmatrix} v_{1,\text{dot}} \\ v_{2,\text{dot}} \\ i \end{pmatrix} = \begin{pmatrix} 0 \\ v_3 \\ -V'(t) - {\color{DarkOrange}(v_1 + V(t))/\tau} \end{pmatrix}