# Optimization of DC Energy Storage in Tokamak Poloidal Coils
## 7 Models for Circuital Simulations  
To evaluate the optimal balance between the size of the DC energy storage and the peak power drawn from the grid, an electrical model must be implemented in a software tool for power electronics. The specialized tool PLECS was used to simulate the block diagram in Figure 5 for each PF coil, including all the components necessary for the operations but not reported in Figure 5. The most relevant principles of the developed model are described in this section. The implementation of the scheme in Figure 5 in a software environment for circuit simulation can adequately reproduce the behavior of the tokamak PS system only by adopting a method to model the effect of the mutual couplings. Without these couplings, the ratings of the components would appear higher, resulting in an oversized design. An inductance matrix \(\underline{M}\) with any number \(N\) of rows/columns is not available in any software for circuits. Anyway, the computational burden of only six coupled PS circuits is already unmanageable, while an optimization process requires many simulations. Therefore, it is fundamental to introduce a method to emulate all the effects through a simplified approach. In the most general case, the vector, \(\underline{z}(t)\), of the voltages across all the PF coils and all the other poloidal cross-section elements can be obtained by the vector, \(\underline{i}(t)\), of the impressed currents through the following formula:  
\[\underline{z}(t)=\frac{d\left[\underline{M}(t)\times\underline{i}(t)\right] }{dt} \tag{20}\]  
In this formula, the mutual inductance matrix, \(\underline{M}\), is also time dependent. This is not manageable by a circuital simulator. If the voltage and current profiles are known for the coil under analysis, the situation can be modeled using a standard system with constant mutual inductance. To this aim, the voltage across the \(k\)-th PF coil can be expressed as  
\[v_{k}(t)=\sum_{n=1}^{N}M_{kn}\frac{di_{n}(t)}{dt} \tag{21}\]  
where \(M_{kn}\) is the mutual inductance between the \(k\)-th PF coil and the \(n\)-th element (with \(n=1\div 6\) for the PF coils and \(n=7\div N\) for the passive elements) and \(i_{n}(t)\) is the corresponding current. The auto-inductance and the current of the considered coil can be denoted with \(L_{k}\) and \(i_{k}(t)\), respectively. Instead of considering all the \(N\) elements, a coil is magnetically coupled to a single fictitious auxiliary coil having a controlled current source in series \(i_{\text{A}}(t)\). In this case, (21) can be rewritten as  
\[v_{kA}(t)=L_{k}\frac{di_{k}(t)}{dt}+M_{kA}\frac{di_{A}(t)}{dt} \tag{22}\]  
The two previous formulas provide the same voltage across the coil at every time instant \(v_{kA}(t)=v_{k}(t)\). Hence, the controlled current \(i_{\text{A}}(t)\) is dynamically determined through a simple control loop that forces the desired equality in (22). Integrating and solving for \(i_{\text{A}}(t)\), the condition becomes  
\[i_{\text{A}}(t)=\frac{1}{M_{kA}}\left(\int_{0}^{t}v_{k}(\tau)d\tau-L_{k}i_{k} (t)\right) \tag{23}\]  
Since \(v_{k}(t)\), \(L_{k}\), and \(i_{k}(t)\) are always known, all the mutual couplings can be emulated by controlling the current in the auxiliary inductor using (23). The value of \(M_{kA}\) (like the \(L_{A}\) of the auxiliary coil) can be arbitrarily chosen, provided that it is coherent with the other circuit parameters. Figure 10 depicts the block scheme implementing the previous algorithm for mutual coupling contribution. Figure 11 schematizes the logic emulating the behavior of the charger with a controlled current source. The charger supplies current whenever the DC link voltage drops below a reference threshold, but without overcoming the imposed limit on \(P_{\text{gridmax}}\). The threshold control includes a hysteresis band between the \(V_{\text{max}}\) and (\(V_{\text{max}}-10\) V). When the charger is activated, it supplies the maximum current that it can provide based on the fixed \(P_{\text{gridmax}}\) and \(V_{\text{max}}\).