Optimizing the differential pair connection scheme (i.e., the set of pairs) of a toroidal array of magnetic sensors dedicated to measuring slowly rotating asymmetric fields can enhance the mode number detection capability and failure-resilience. In this work, the condition number obtained from singular value decomposition of the design matrix is used as a metric to evaluate the quality of a connection scheme. A large number of possible pair connections are usually available, so evaluating all of them may require extensive use of computational resources and can be very time-consuming. Alternative methods to reduce the number of pairs evaluated without losing the capabilities of toroidal mode detection are presented in this paper. Three examples of the applications of such analysis for the 3D magnetic diagnostic system of DIII-D are also presented: the addition of two new toroidal arrays with n > 3 detection capabilities, the modification of an existing toroidal array in the low field side of the machine to accommodate the addition of a helicon antenna, and the design of changes in several toroidal arrays in the high field side to accommodate the addition of a lower hybrid current drive antenna on the center post.

## I. INTRODUCTION

Stationary or slowly rotating three-dimensional (3D) magnetic structures arising from global, long-wavelength tearing or kink modes can have a large impact on tokamak plasma stability and transport. They can be detrimental if they lock to the wall,^{1} but they can also be beneficial, for example, to achieve edge-localized mode (ELM) suppression^{2} or to extract information about the plasma stability.^{3} The 3D magnetic fields in tokamaks are about four orders of magnitude smaller than the toroidally symmetric equilibrium magnetic field (δB/B ≤ 10^{−4}). Detecting such a small perturbation is challenging because its quasi-dc nature precludes the use of time-domain Fourier analysis to discriminate it from the stationary equilibrium field. However, the toroidal symmetry of tokamak plasmas enables the use of differential pairs of sensors located at the same poloidal and radial location but different toroidal locations such that the symmetric component of the magnetic field is removed and the 3D part is highlighted. This also enhances the signal/noise as it allows for a larger signal gain and better use of the digitizer dynamic range.^{4,5} Data from such arrays in DIII-D have been shown to agree quantitatively with predictions by several linear and nonlinear MHD codes.^{6}

When designing such a system, two main aspects need to be considered: (a) magnetic probes require resources, including space on the inner vessel, vacuum feedthroughs to connect them to the exterior of the machine, integrators, amplifiers, digitizers, and other electronics for signal conditioning, so it is desirable to use the minimum number that will satisfy the requirements for detection of the desired range of mode numbers; (b) even a relatively small number of probes can have a very large number of possible pair connections.

This article discusses the technique used to efficiently optimize the number, location, and connection of a toroidal array of probes used for the 3D magnetic measurements^{5,7} of DIII-D.^{8} Section II introduces the singular value decomposition (SVD),^{9} explains how it is used to quantify the quality of a connection scheme, and describes the methods used to reduce the computational burden to optimize it. Section III reports examples of how such an optimization has been used to inform changes in the DIII-D 3D magnetic system. Section IV discusses uncertainties related to the use of this method.

## II. OPTIMIZATION OF THE CONNECTION SCHEME

### A. The design matrix

To extract information about the toroidal spectrum of the quasi-static 3D perturbations from a group of toroidally distributed sensors, the data are fitted to a sum of toroidal Fourier harmonics $\delta B\varphi =\u2211nbne\u2212in\varphi $, where *b*_{n} are complex amplitudes for each toroidal mode number *n* and ϕ is a geometrical toroidal angle. The fit is done solving the following equation:

where **A** is the design matrix containing a set of orthogonal basis functions evaluated at each of the sensors, ** s** is a vector of predicted sensor measurements, and

**is a vector of coefficients of the basis functions. The elements of**

*b***A**are

*A*

_{jl}= 〈exp(

*in*

_{l}

*ϕ*

_{j})〉 for single sensors or

*A*

_{jl}= 〈exp(

*in*

_{l}

*ϕ*

_{j,1})〉 − 〈exp(

*in*

_{l}

*ϕ*

_{j,2})〉 for differential pairs, where the averages are done over the active area of the sensors,

*j*indicates the distinct measurements (whether from differenced pairs or individual sensors), and

*l*indicates the harmonics to fit.

^{7}The real matrix

**A**has columns for each of the complex basis function coefficients,

When **A** has a number of rows (i.e., the number of distinct measurements, *k*) greater than or equal to the number of columns (i.e., the number of basis function coefficients), factorization using singular value decomposition (SVD)^{9} allows us to express it as

where ** U** and

**are orthonormal matrices containing left and right singular vectors, respectively, and the elements of**

*V***,**

*W**w*

_{ij}=

*w*

_{i}

*δ*

_{ij}, are called the singular values of

**. The uncertainty of measurements constraining any given right singular vector (a unique combination of the original basis functions) is proportional to the inverse of the corresponding singular value.**

*A*^{9}The condition number κ of the matrix

**A**is defined as κ (

**A**) = max(

*w*

_{i})/min(

*w*

_{i}), and it is used as a dimensionless figure of merit to evaluate the quality of a design matrix. A well-conditioned matrix has a low condition number (ideally 1), which indicates that all the possible combinations of basis function coefficients are equally constrained by the measurements. Larger condition numbers mean that there are certain combinations of basis functions that are less well constrained by the measurements than others. For example, if all sensors are spaced 90° apart, they can constrain only one of the

*n*= 2 mode coefficients and thus the condition number of any

**A**that includes

*n*= 2 would be infinite. Note that the condition number provides information only about the quality of the most constrained combination of mode coefficients compared to the least constrained, so it is a good figure of merit only when at least one of the modes of interest is well constrained.

### B. Optimization methods

The optimization of the sensors’ location and connection scheme is driven by the number of toroidal mode components the toroidal array is intended to measure simultaneously. The minimum number of independent measurements *k* to be considered is given by the number of toroidal modes to be fit *N*. The number of measurements *k* must be greater than or equal to the number of mode coefficients *c* (2*N* if all *n* ≠ 0; 2*N* − 1 if *n* = 0 is included in the basis). This can be seen immediately from the condition number, which is infinite when the above condition is not satisfied. More sensors than the theoretical minimum are required for uncertainty assessment, so the true requirement for scientific application is *k* > *c*. Note that pairing sensors automatically removes the *n* = 0 coupling, which otherwise needs to be included in single-sensor analysis. However, *s* sensors can yield at most *s* − 1 linearly independent differences. Thus, a fewer independent measurements (but the same number of sensors) are needed to fit the same number of asymmetric toroidal modes when using pairs.

Once the toroidal modes to be measured and, therefore, the minimum number of independent measurements are determined, it is important to assess the appropriate size of a sensor and the possible locations where it can be installed. The details about the choice of the size of the sensors can be found in Refs. 4 and 5. For the optimization of the connection scheme, it is important to highlight that the possible locations where a probe can be installed in DIII-D are constrained by the available spaces under the armor tiles^{10} and that the possible variation in toroidal location under a tile is of the order of tenths of a degree (much smaller than the highest toroidal variation we are interested in, and therefore negligible).

Assuming *s* locations where a sensor can be installed, the number of unique ways a pair can be made is

where the direction of the connection does not matter (connecting probe A with probe B is the same as connecting B with A) and a probe cannot be connected to itself. The number of possible combinations of these pairs to get *k* measurements is given by

where the minimum value of *k* is determined by the number of toroidal modes the array is intended to measure and the maximum value is determined by the available resources (probes, vacuum feedthrough channels, integrators, digitizer channels, etc).

For example, there are about 1.6 × 10^{12} possible ways to make seven measurements with 20 possible locations where a sensor can be installed. This becomes about 7 × 10^{14} if the number of required measurements is 9. Such large numbers of possible combinations would require a large number of computational resources to evaluate all the possible condition numbers, with many of these combinations being equivalent for the purpose of detecting toroidal modes. There are several possible approaches to identify a connection scheme that determine schemes with a low enough condition number for the detection of the desired set of toroidal modes without evaluating all the possibilities. To choose the connection schemes in DIII-D, three main approaches are used depending on the constraints.

One approach, called “method 1,” allows for the possibility of using a toroidal array both as single sensors and as pairs. In this case, the number and locations of sensors to be installed are first optimized by the single sensors’ measurements, which have far fewer cases than pair combinations. The possible connections are then evaluated using a reduced number of possible sensor locations. The total number of cases to explore in this case is

where *k*_{1} is the number of measurements needed for the single sensor array and *k*_{2} is the number of measurements needed for the pairs.

An alternative approach, called “method 2” or the “Monte Carlo method,” consists in randomly sampling a finite number of possible probes’ location, connection schemes, or both. This method allows for finding a “good enough” solution using a limited number of resources. When the available sensor locations are reasonable for the modes of interest (not all within a few degrees of one another when measuring *n* = 1, for example), the condition number of a large percentage of possible connections is reasonably low (below 10). Thus, this approach can be expected to efficiently find many solutions with a sufficiently low condition number for robust application in experiments.

Another method, called “method 3,” can be used when the importance of the modes to be detected by a toroidal array is not equal. This is, for example, the case when an array is used mainly for *n* = 1 locked mode detection but may also be useful to measure *n* = 2 or *n* = 3 plasma response to externally applied perturbations. In this case, an iterative optimization in order of “most important” basis functions is used. If the columns of matrix **A** from Eq. (1) are ordered by importance, given the location of the first sensor, all the following locations and connections can be determined by incrementally optimizing the corresponding sub-matrices. The second sensor/connection is chosen to minimize κ of the first two columns, the third sensor/connection is chosen to minimize κ of the first three columns given the previous sensors/connections, and so on.

Although more advanced optimization approaches, such as Bayesian analysis,^{11,12} exist, we did not consider them since the three simple methods presented above have been sufficient to provide connection schemes with an adequate condition number.

### C. Resilience to a sensor failure

As mentioned before, most of the magnetic sensors used at DIII-D for 3D measurements are installed inside the vacuum vessel and therefore difficult to access. This suggests that another important aspect to consider is the capability to use the toroidal array to detect the desired set of toroidal modes despite a potential sensor failure.

To evaluate the impact of losing one of the *k* + 1 sensors used, for each connection scheme, *k* + 1 more connection schemes are considered, which correspond to the same connections minus those that use the “broken” probe. To reduce the number of connection schemes to consider, the impact of losing a sensor is evaluated only for those that have a low enough condition number. An example is shown in Fig. 1. Here, the possible connection schemes to have eight pair measurements with 20 possible equidistant installation locations are explored using the Monte Carlo method with 10^{4} random cases. Empty circles are all the condition numbers as a function of the connection scheme sample number. In blue are highlighted those below κ = 4, the threshold chosen to evaluate the impact of losing a sensor on the capability to detect *n* ≤ 3. The red dots correspond to the worst condition number found when a sensor is removed. Of several schemes with a condition number lower than 4, only a few of them have a condition number lower than 10 when one probe is removed. For example, the scheme highlighted by the blue dashed line has the lowest condition number (2.0), but poor resilience to the loss of a probe. The loss of a certain critical probe in this configuration results in κ > 10, meaning that the remaining pairs can no longer constrain all modes *n* ≤ 3. On the contrary, the scheme highlighted by the vertical red dashed line has a good condition number to detect *n* ≤ 3 (2.4), and if any probe fails, the worst condition number would be 4.5, leaving the array still capable of detecting *n* ≤ 3.

The results obtained when the failure of a sensor is added to the analysis suggest that one constraint can be added to the initial methodology to strongly reduce the number of possible connection schemes analyzed: a sensor can be connected to only two other sensors. This is intuitive since the loss of a sensor that has more than two connections would lead to the loss of more than two measurements. Therefore, its loss would, on average, be more important than the loss of any other sensor in the scheme, possibly leading to a situation with not enough measurements *k*.

### D. Experimental example

To highlight the importance of the optimization of the condition number, experimental data from DIII-D are shown in Fig. 2. In the reported discharge, a set of external driving coils produced an *n* = 2 perturbation with a change in polarity every 100 ms. A toroidal array of poloidal magnetic sensors located at the outboard midplane is used to measure such a perturbation combined with the plasma response. The toroidal array is comprised of ten sensors. This allows us to use several subsets of it to resolve *n* ≤ 3 with different condition numbers and to compare the resulting fits. In this example, four different set of pairs have been used. In Fig. 2(a), all the available pairs have been used for a condition number of κ = 1.8, and in Fig. 2(b), two pairs were removed, resulting in κ = 1.9. In Fig. 2(c), the same number of probes of Fig. 2(b) is used, but this time κ = 6.4. Figure 2(d) shows the results for three removed pairs with a resulting κ = 8.9. The four cases are all consistent with the periodicity of the externally applied field. In Figs. 2(a) and 2(b), despite a different number of sensors, the condition numbers and the results are similar: a dominant n = 2 perturbation of about 5 G and the n = 1 and n = 3 components with an amplitude of about 1 G. Increasing the condition number leads to a non-physical larger amplitude of the two odd modes for several time intervals.

## III. DIII-D 3D MAGNETIC DIAGNOSTIC SYSTEM

After the 2013 major upgrade of the 3D magnetic diagnostic system of DIII-D,^{5} a few changes have been made to it and some more have been prepared. This section discusses the probe locations and connection schemes of the modified toroidal arrays.

Figure 3 shows a block diagram of the circuit used to connect a pair of probes and acquire their difference. The signals from the two sensors are subtracted using a balancing circuit that is used to calibrate and remove any difference in the signals due to a small difference in the sensor’s dimensions and locations. The combined signal is then integrated, amplified, and digitized. Such a scheme is used both for arrays of discrete poloidal field probes and of larger radial field loops (saddle loops). A detailed description of the sensors, the connections, and the possible errors in the measurements can be found in Refs. 4 and 5.

Figure 4 shows the size and the location of the sensors used for 3D magnetic measurements, with the horizontal axis being the toroidal location and the vertical axis being the vertical location with respect to the midplane. The top panel shows the sensors in the high field side (HFS), and the bottom one shows those in the low field side (LFS). The system has a total of 164 sensors grouped in seven internal toroidal arrays of poloidal (solid rectangles) and radial (blue open rectangles) sensors, three external toroidal arrays of radial sensors (red open rectangles), and two internal vertical arrays of poloidal and radial sensors, where internal and external are with respect to the vacuum vessel. Compared to the system presented in Ref. 5, we have the following:

Two external toroidal arrays of radial sensors have been added above and below the midplane.

The array of poloidal sensors at Z ∼ 0.7 m in the LFS has been modified.

Two sensors of each of the four toroidal arrays in the HFS are planned to be relocated (not shown here).

### A. Toroidal arrays of external saddle loops

Two arrays of 12 external saddle loops each have been refurbished and connected to the electronic chain. They are located on the external surface of the vacuum vessel, centered at Z = ±0.8065 m. They extend for 30° in the toroidal direction and are about 0.45 m tall. The connection scheme of both the arrays is the same and was chosen using the Monte Carlo method. The optimization was made to use the arrays for the simultaneous detection of all toroidal modes with *n* ≤ 4 with a condition number κ < 3, with the capability to detect the same set of modes also if a sensor fails and with the constraint that the maximum number of connections is 12.

As a result, the two arrays currently have a connection scheme that allows for the detection of *n* ≤ 4 with κ = 1.98, the worst condition number in the case of a failing sensor is κ = 2.94, and they can also detect *n* ≤ 5 with κ = 2 when all the sensors are working.

### B. Toroidal array of poloidal sensors above the midplane

The array of poloidal sensors in the LFS centered at Z ∼ 0.7 m had to be modified due to the installation of a helicon antenna^{13} that extends toroidally from about ϕ ≈ 150° to ϕ ≈ 210°. The main constraints in designing this array are as follows:

the need to remove the sensor at ϕ = 157° due to conflicts with the supporting structure of the antenna,

the possibility to install up to five new sensors in six available locations, and

the capability to detect

*n*≤ 3 with κ < 3.

Figure 5 shows the new connection scheme of the toroidal array. The blue dots are the position of the existing sensors, the green dots are the new sensors, and the unusable probe is indicated in red. The orange lines show a connection of probe pairs that allows for the detection of n ≤ 3 with κ = 2.5. The toroidal location where a new probe could have been but was not installed is ϕ = 292°.

### C. HFS toroidal arrays

The possible installation of a lower hybrid current drive antenna in the HFS^{14} requires a study of how to rearrange all the toroidal arrays in the HFS since it may have an impact on the group of four sensors at ϕ ≈ 10° and on those at ϕ ≈ 340°. In this case, the analysis is focused on five possible new locations for the two groups of sensors to relocate, with the only constraint that the sensors at ϕ ≈ 138° must be connected to those at ϕ ≈ 198° since they are also a part of the vertical array (see Fig. 4).

Figure 6 shows two possible connection schemes. The labels correspond to the toroidal location of the saddle loops. Both the options shown suggest to relocate the sensors at ϕ = 11° and at ϕ = 341° to ϕ = 26° and ϕ = 304°. The connection proposed in Fig. 6(a) allows for a detection of *n* ≤ 3 with κ = 2.46, but if the sensor at ϕ = 26° fails, the condition number would rise up to κ_{1} = 11.34, making the array unusable. The connection proposed in Fig. 6(b) allows for the detection of *n* ≤ 3 with κ = 2.67, and the worst condition number found if a sensor fails is κ_{1} = 6.66.

## IV. ON THE UNCERTAINTIES

For the measurement of small 3D magnetic fields in DIII-D, the chief sources of uncertainty include noise, drift of the analog integrators’ output, and pickup of the axisymmetric field due to the imperfect balance of the differential pairs. The first of these is a truly random error, while the other two are usually uncorrelated between sensors, so they can be treated as random in analysis of a multi-probe array. The magnitudes of the uncertainties depend, in part, on the analysis method–the error due to noise can be reduced by time averaging of the data, while the error due to integrator drift and axisymmetric field coupling can be reduced by re-zeroing the data before an event of interest. With care, uncertainties of a few tenths of a Gauss can be achieved.^{5,6}

Of interest for this study is to understand how uncertainties in the measurements can affect the solution to Eq. (1). This problem can be expressed as

where ** δs** is a vector of errors in the measurements

**and**

*s***is the resulting vector of errors in the fitted coefficients**

*δb***. Using the Euclidean norm of vector**

*b***,**

*x*it is possible to demonstrate that

This inequality shows that the condition number is also a relative error magnification factor.^{15} A poorly conditioned matrix can amplify the errors in the input data, and the condition number quantifies the worst-case amplification. Thus, this is another way to show how the condition number is a convenient, scalar figure of merit for optimizing a set of sensor measurements.

For a specific design matrix ** A**, the uncertainties

**in the fitted results can be calculated in a more fine-grained way. The solution to Eq. (1) is found by a least-squares fit to the data, expressed as**

*δb***=**

*b*

*A*^{†}

**, where $A\u2020=ATA\u22121AT$ is the Moore–Penrose pseudo-inverse of the design matrix.**

*s*^{16}The design matrix and its pseudo-inverse have the same condition number: $\kappa A=\kappa A\u2020$. For simplicity, we rename the pseudo-inverse as the “detection” matrix

**=**

*D*

*A*^{†}so that

**=**

*b***. If the covariance matrix for the input data**

*Ds***is defined as**

*s***(**

*σ***), where**

*s*

*σ*_{ij}(

**) is the covariance of measurements**

*s**s*

_{i}and

*s*

_{j}, then the covariance matrix for the fitted coefficients

**is given by**

*b*^{17}$\sigma b=D\sigma sDT$. If we assume that the measurement errors are uncorrelated (e.g., random noise), then the covariance matrix for

**is diagonal and contains only the variance (uncertainty squared) of the measurements: $\sigma jjs=\delta sj2$, while $\sigma i\u2260js=0$. With this constraint, the variance of the fitted coefficients reduces to**

*s*That is, the uncertainty of each fitted coefficient *δb*_{i} is a quadrature sum of the uncertainties of the input measurements, weighted by the matrix elements *D*_{ij}. Further simplification results if the input measurements all have equal uncertainties; this may be a reasonable assumption in the toroidal arrays discussed here since the sensors are identical and have equivalent locations with respect to the axisymmetric field.

The case in Sec. III B, a toroidal array with 12 irregularly space probes, can be used to illustrate how the considerations above affect the uncertainty. As a point of reference, consider first the ideal case of 12 equally spaced single probes. This configuration has a condition number *κ* = 1.0 for detecting 1 ≤ *n* ≤ 3, and the mode detection matrix is equivalent to a discrete Fourier transform with *N* = 12 equally spaced samples. If the measurements have equal uncertainties ** δs**, then the uncertainty of each Fourier coefficient is

*δb*_{0}= (2/

*N*)

^{1/2}

**= 0.41**

*δs***. In contrast, the actual configuration shown in Fig. 5 enables fitting 1 ≤**

*δs**n*≤ 3 with condition number

*κ*= 2.5. The uncertainties of the six coefficients

*δb*_{i}, as estimated using Eq. (10), range from 0.55

**to 1.02**

*δs***, with a (quadrature) average of 0.83**

*δs***. These values are consistent with the expectation that**

*δs**κ*

*δb*_{0}= 1.02

**is an upper bound for the average uncertainty and an approximate upper bound for the individual uncertainties. The reduction in uncertainty provided by multiple measurements competes with the amplification of uncertainty caused by non-ideal positions of the measurements. In this example, the two effects approximately balance each other so that the uncertainty in the mode coefficients is roughly equal to the uncertainty in an individual sensor.**

*δs*## ACKNOWLEDGMENTS

This work was supported by the U.S. DOE under Grant Nos. DE-FC02-04ER54698, DE-AC02-09CH11466, and DE-AC52-07NA27344. Part of this analysis was performed using the OMFIT integrated modeling framework.^{18}

This report was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor any agency thereof, nor any of their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof.

## DATA AVAILABILITY

The data that support the findings of this study are available from the corresponding author upon reasonable request.

## NOMENCLATURE

### Symbol and definition

**A**design matrix

*b*complex amplitude of a mode

**b**vector of harmonics coefficients

*c*total number of mode coefficients to fit

**D**Moore–Penrose pseudo-inverse of

**A***j*index for the distinct measurement

*k*total number of distinct measurements

*l*index for the harmonics to fit

*n*toroidal mode number

*N*total number of modes to fit

*p*number of possible sensors pairs

*s*number of possible sensors

**s**vector of sensor measurements

*w*singular value

- Z
vertical distance from the midplane

*δb*vector of errors harmonics coefficients

*δs*vector of errors in sensor measurements

- κ
condition number

(*σ*)*s*covariance matrix for

*s*- ϕ
geometrical toroidal angle