# Algorithms for Simulation of Shunt Currents in a Vanadium Redox Flow Battery
## 4 Methods
### Algorithms
#### 4.4.2 Codification of Node Equations
\begin{table}
\begin{tabular}{c c c c c c c c c c c c c c c} \hline \hline
**\#1** & **\#2** & **Name** & **Case** & **\#1** & **\#2** & **Name** & **Case** & **\#1** & **\#2** & **Name** & **Case** & **\#1** & **\#2** & **Name** & **Case** \\ \hline
1 & 0 & Cell & & 30 & 0 & Cell & & 61 & 0 & Cell & & 92 & 0 & Cell & \\
2 & 1 & ChA1 & & 31 & 1 & ChA1 & & 62 & 1 & ChA1 & & 93 & 1 & ChA1 & \\
3 & 2 & ChA2 & & 32 & 2 & ChA2 & & 63 & 2 & ChA2 & & 94 & 2 & ChA2 & \\
4 & 3 & ChC1 & First cell & 33 & 3 & ChC1 & First cell & 64 & 3 & ChC1 & First cell of stack & 95 & 3 & ChC1 & First cell of stack \\
5 & 4 & ChC2 & & 34 & 4 & ChC2 & & 65 & 4 & ChC2 & & 96 & 4 & ChC2 & \\
6 & 5 & MnA1 & & 35 & 5 & MnA1 & & 66 & 5 & MnA1 & & 97 & 5 & MnA1 & \\
7 & 6 & MnA2 & & 36 & 6 & MnA2 & & 67 & 6 & MnA2 & 98 & 6 & MnA2 & \\ \hline
8 & 0 & Cell & & 37 & 0 & Cell & & 68 & 0 & Cell & & 99 & 0 & Cell & \\
9 & 1 & ChA1 & & 38 & 1 & ChA1 & & 69 & 1 & ChA1 & & 100 & 1 & ChA1 & \\
10 & 2 & ChA2 & & 39 & 2 & ChA2 & & 70 & 2 & ChA2 & & 101 & 2 & ChA2 & \\
11 & 3 & ChC1 & & 40 & 3 & ChC1 & & 71 & 3 & ChC1 & & 102 & 3 & ChC1 & \\  & & Middle & & & & & Middle & & & Middle & & & Middle & \\
12 & 4 & ChC2 & cell of & 41 & 4 & ChC2 & cell of stack & 72 & 4 & ChC2 & & cell of stack & \\
13 & 5 & MnA1 & & 42 & 5 & MnA1 & & 73 & 5 & MnA1 & & 104 & 5 & MnA1 & \\
14 & 6 & MnA2 & & 43 & 6 & MnA2 & & 74 & 6 & MnA2 & & 105 & 6 & MnA2 & \\
15 & 7 & Cell & & 44 & 7 & Cell & & 75 & 7 & Cell & & 106 & 7 & Cell & \\
16 & 8 & ChA1 & & 45 & 8 & ChA1 & & 76 & 8 & ChA1 & & 107 & 8 & ChA1 & \\ \hline
17 & 0 & Cell & & 46 & 0 & Cell & & 77 & 0 & Cell & & 108 & 0 & Cell & \\
18 & 1 & ChA1 & & 47 & 1 & ChA1 & & 78 & 1 & ChA1 & & 109 & 1 & ChA1 & \\
19 & 2 & ChA2 & & 48 & 2 & ChA2 & & 79 & 2 & ChA2 & & 110 & 2 & ChA2 & \\ \hline
20 & 3 & ChC1 & Last cell of stack & 49 & 3 & ChC1 & Last cell of stack & 80 & 3 & ChC1 & Last cell of stack & 111 & 3 & ChC1 & Last cell \\
21 & 4 & ChC2 & & 50 & 4 & ChC2 & & 81 & 4 & ChC2 & & 112 & 4 & ChC2 & \\
22 & 5 & MnC1 & & 51 & 5 & MnC1 & & 82 & 5 & MnC1 & & 113 & 5 & MnC1 & \\
23 & 6 & MnC2 & & 52 & 6 & MnC2 & & 83 & 6 & MnC2 & & 114 & 6 & MnC2 & \\ \hline
24 & 0 & BrA1 & 53 & 0 & BrA1 & & 84 & 0 & BrA1 & & 115 & 1 & BrA1 & \\
25 & 1 & BrA2 & & 54 & 1 & BrA2 & & 85 & 1 & BrA2 & & 116 & 2 & BrA2 & \\
26 & 2 & BrC1 & First & 55 & 2 & BrC1 & & 86 & 2 & BrC1 & & 117 & 3 & BrC1 & Last \\
27 & 3 & BrC2 & stack & 56 & 3 & BrC2 & Middle & 87 & 3 & BrC2 & Middle & 118 & 4 & BrC2 & stack \\
28 & 4 & TrA2 & & 57 & 4 & TrA1 & stack & 88 & 4 & TrA1 & stack & 119 & 5 & TrC1 & \\
29 & 5 & TrC1 & & 58 & 5 & TrA2 & & 89 & 5 & TrA2 & & 120 & 1 & TrC2 & \\ \hline  & & & & 59 & 6 & TrC1 & & 90 & 6 & TrC1 & & & & \\  & & & & 60 & 7 & TrC2 & & 91 & 7 & TrC2 & & & & \\ \hline \multicolumn{12}{c}{**Step**} & \multicolumn{1}{c}{**Stack**} & \multicolumn{1}{c}{**Previous**} & \multicolumn{1}{c}{**Actual s**} & \multicolumn{1}{c}{**Next s**} & \multicolumn{1}{c}{**Previous c**} & \multicolumn{1}{c}{**Actual c**} & \multicolumn{1}{c}{**Next c**} \\ \hline
0 & - & - & 0 & 0 & 24 & 0 & 0 & 1 & 1 \\
2 & 1 & 2 & 0 & 24 & 53 & 1 & 8 & 17 & 30 \\
3 & 1 & 3 & 0 & 24 & 53 & 8 & 17 & 30 & \\
4 & 2 & 3 \(\to\) 1 & 24 & 53 & 84 & 17 & 30 & 37 \\
5 & 2 & 1 & 24 & 53 & 84 & 17 & 30 & 37 \\
6 & 2 & 2 & 24 & 53 & 84 & 30 & 37 & 46 \\
7 & 2 & 3 & 24 & 53 & 84 & 37 & 46 & 61 \\
8 & 3 & 3 \(\to\) 1 & 53 & 84 & 115 & 37 & 46 & 61 \\
9 & 3 & 1 & 53 & 84 & 115 & 46 & 61 & 68 \\
10 & 3 & 2 & 53 & 84 & 115 & 61 & 68 & 77 & 92 \\
11 & 3 & 3 & 53 & 84 & 115 & 68 & 77 & 92 \\
12 & 4 & 3 \(\to\) 1 & 84 & 115 & - & 68 & 77 & 92 \\
13 & 4 & 1 & 84 & 115 & - & 77 & 92 & 99 \\
14 & 4 & 2 & 84 & 115 & - & 92 & 99 & 108 & - & \\
15 & 4 & 3 & 84 & 115 & - & 99 & 108 & - & \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Full example of the update of the stack and cell pointers. precisely what was sought. In this way, the mechanisms used for the coding of the node equations could be reused.