A large ‘Active Magnetic Shield’ for a high-precision experiment

We present a novel Active Magnetic Shield (AMS), designed and implemented for the n2EDM experiment at the Paul Scherrer Institute. The experiment will perform a high-sensitivity search for the electric dipole moment of the neutron. Magnetic-field stability and control is of key importance for n2EDM. A large, cubic, 5 m side length, magnetically shielded room (MSR) provides a passive, quasi-static shielding-factor of about \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$10^5$$\end{document}105 for its inner sensitive volume. The AMS consists of a system of eight complex, feedback-controlled compensation coils constructed on an irregular grid spanned on a volume of less than 1000 m3 around the MSR. The AMS is designed to provide a stable and uniform magnetic-field environment around the MSR, while being reasonably compact. The system can compensate static and variable magnetic fields up to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\pm \, 50 \, {\upmu }\hbox {T}$$\end{document}±50μT (homogeneous components) and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\pm \, 5 \, {\upmu }\hbox {T/m}$$\end{document}±5μT/m (first-order gradients), suppressing them to a few \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$${\upmu }\hbox {T}$$\end{document}μT in the sub-Hertz frequency range. The presented design concept and implementation of the AMS fulfills the requirements of the n2EDM experiment and can be useful for other applications, where magnetically silent environments are important and spatial constraints inhibit simpler geometrical solutions.


Introduction
High-precision measurements in fundamental physics, using particles, nuclei, atomic, or molecular systems, require exquisite temporal stability and spatial uniformity of many environmental parameters to control systematic effects and fully exploit their statistical sensitivity.The control of the magnetic field is of particular importance in those experiments sensitive to the coupling of the magnetic field to the spin of the system through its magnetic moment.For example, experiments searching for permanent or variable electric dipole moments (EDMs), signals of dark matter fields, neutron-antineutron and mirror-neutron oscillations, Lorentz invariance violation, or new forces [1][2][3][4][5].Most of them deploy dedicated coil systems generating uniform magnetic fields inside magnetically shielded volumes.Shielding of these volumes can be achieved by means of passive or active magnetic shielding (AMS), separately, or, in combination.Passive shields are built from high-permeability materials and rely on their magnetic properties.Active magnetic shields are based on feedback-controlled coils, where magnetic sensors detect changes of the magnetic field, and an algorithm calculates the proper response to adjust the coil currents and counteract the perturbation.
Since the 1980s, numerous active shields have been built for different applications [6][7][8][9][10][11][12], covering a wide range of research areas such as ion beams, electron microscopes, and bio-medical applications, as well as high-precision measurements of EDMs [1,2,13,14].In particular, an active magnetic shield was successfully used for the first time by our collaboration in the nEDM experiment, which provides the current best measurement of the neutron EDM [15].The system consisted of six actively-controlled rectangular coils with size of approximately 8 m × 6 m, located in a Helmholtzlike positioning.The coils were built around a control volume of 2.5 m × 2.5 m × 3 m.The system was crucial to fully exploit the statistical sensitivity of the experiment [6].
In this paper, we report on the design-path, implementation, and initial performance characterization of a dedicated AMS for the n2EDM experiment [16][17][18], currently undergoing commissioning at the ultracold neutron (UCN) source [19][20][21] at the Paul Scherrer Institute (PSI).A tenfold improvement in statistical sensitivity of n2EDM over nEDM will be realized by many innovations, primarily by improved adaption to the UCN source and two enlarged verticallystacked UCN storage-chambers.The target systematic error budget yields stringent requirements for the magneticfield stability and uniformity, and, thus, advanced shielding from magnetic-field disturbances.The n2EDM experiment uses a combination of passive and active shieldings around the sensitive volume.The passive shielding is provided by a Magnetically Shielded Room (MSR) [22] with a base size of 5.2 m x 5.2 m and a height of 4.8 m.It is composed of five mu-metal layers, one ULTRAVAC layer, and one intermittent RF-shielding layer with a shielding factor of 10 5 at 0.01 Hz and rising with frequency to 10 8 at 1 Hz, as shown in Fig. 1.
The specifications for the n2EDM internal magnetic field are discussed in detail in Ref. [16].A crucial requirement is that the average magnitudes of magnetic fields in the two UCN storage chambers (vertically separated by 18 cm) must not differ by more than 10 pT, which corresponds to a vertical magnetic-field gradient smaller than 0.6 pT/cm.This limits the systematic effects coming from the different resonance conditions in the two chambers.
Due to the quasi-static shielding factor of the MSR of 10 5 , slow external field changes of order 1 µT will lead to internal field changes of order 10 pT.As the shell structure of the MSR and its high-quality, innermost layer tend to homogenize magnetic field changes, internal magneticfield gradients resulting from external gradients are further suppressed [23].Thus, an external, inhomogeneous variation of a few µT around the MSR can be tolerated.However, larger field variations on the outside of the MSR could cause larger-than-allowed internal gradients.In addition, larger external field changes can change the magnetization of the outermost mu-metal layer of the MSR, which will, in turn, slowly propagate through the MSR layers, and result in undesirable drifts of the inner magnetic field.
The task for the AMS in n2EDM is thus to provide a magnetic field around the MSR that is stable to within a few µT, even with sub-Hertz external variations, in order to meet the 10 pT conditions on the inside.For large, slow magnetic field variations, of order ten or several tens of µT, this also corresponds to an improved overall shielding performance in the low-frequency regime, see Fig. 1.
Fig. 1: Frequency-dependent shielding-factors of the MSR.The light green region and the colored curves for each spatial direction were obtained using external reference excitation coils to produce 2 µT peak-to-peak sinusoidal fields at the central position of the MSR final location prior to the MSR assembly.The dark green region is the expected improved shielding-factor provided by the AMS system for large disturbances of order several 10 µT in the lowfrequency range.Adapted from Ref. [22].This paper describes the design and implementation of the AMS system for the n2EDM experiment (see [17,18]) and is organized as follows: (i) The magnetic fields over the complete volume occupied by the entire experimental apparatus were mapped before setting up the n2EDM experiment and are described in Sec. 2. The disturbance of the field resulting from neighbouring magnetic instruments was evaluated.All relevant fields could be reproducibly measured and described to µT precision by superpositions of homogeneous (three directions) and first-order gradient (five independent components) magnetic-field contributions.This established the need for eight independent and ideally 'orthogonal' coils for the field compensation system.
(ii) A method was developed to design optimal coils for specific magnetic fields when constraining the currentcarrying wires to a predetermined, irregular grid on a surface around the volume of interest [17,24], described in Sec. 3.
(iii) A scaled-down prototype was developed and served as a proof-of-concept system, see Sec. 4. It allowed tests of various design options, including an irregular geometry, the powering of the coils, and the implementation of feedback sensors and appropriate algorithms, with and without mumetal.
(iv) A scheme to systematically simplify the individual, optimal, full-scale coils was developed to ease practical construction of the AMS without sacrificing the specified performances [18] (Sec.5.1).This included reducing windings in the eight coils and their efficient powering with eight current sources, each feeding three circuits.
(v) The system was constructed with careful quality control during assembly of the system with more than 55 km of cabling, as described in Sec.5.2.
(vi) Current sources were developed and implemented (Sec. 5. 3).An array of three-axis fluxgate sensors was implemented to monitor the magnetic field and inform the feedback algorithm (Sec.5.4).
(vii) The commissioning of the full AMS system was successfully completed with various performance studies, as described in Sec. 6.

Mapping of the experimental area
The n2EDM experiment is located at PSI in UCN area South.Before setting up n2EDM, its predecessor nEDM was disassembled and the area cleared.Figure 2 shows a view of the empty experimental area.The concrete blocks are part of the biological shield of the UCN source (to the left) and of the medical cyclotron COMET (forward direction and to the right).These blocks cannot be moved, and thus ultimately limit the space available for the n2EDM experiment.The MSR was decoupled from the rest of the hall on its own foundation, which is seen in the picture as brown floor, indicating approximately the size of the MSR base.Given the size of the MSR and the spatial constraints of the biological shields, the coils of the AMS system have to be as close as around 1 m to the MSR, and still providing the desired homogeneous field in the volume of interest.This immediately excludes AMS field generation with simple Helmholtz-like coil systems.Fig. 2: Picture taken during a magnetic-field mapping in UCN area South at PSI [18].The area was emptied before the n2EDM experiment was set up.Two people are moving the 'mapping tower' around.About half height of the tower in the displayed position marks the center of n2EDM.The UCN source is behind the concrete shielding to the left, and a superconducting magnet (blue) to fully polarize UCN directed to n2EDM, is visible on the platform.See main text for further details.
Before designing the AMS system, the magnetic field of the experimental area was extensively mapped [17,18] to determine the components of the magnetic field that have to be compensated.The measured field was then decomposed, by a least-squares fit, into zeroth order, homogeneous fields, first-order gradients, and higher-order contributions, obtaining field maps and interpolated continuous fields.
Figure 2 shows the mobile 'mapping tower' in action.The tower was constructed using up to five identical, 2 mlong aluminum triangle-truss segments from commercially available event stage equipment.Each segment carried three 3-axis fluxgate sensors.The segments were vertically stacked and mounted on a heavy aluminum base plate on wheels.The position and orientation of this cart in the area was measured by three string potentiometers attached to a rigid coordinate system referenced to the area.The full area could thus be magnetically mapped within minutes, with spatial resolution limited by the reproducibility of the order of 0.1 m.
Several strong superconducting magnets at 10 m to 50 m distances contribute with fields in the tens of µT range and field gradients of a few µT/m.Their influence is particularly severe as their fields can change during n2EDM measurements without prior notice.Typical time scale of such uncontrolled changes can vary from minutes to tens of minutes, possibly several times a day.So that the AMS can compensate those changes, for each of the known strong nearby magnets, the mapping was performed with it on and off.
Thereby, the change of the magnetic field in the space of the n2EDM experiment was measured.
The superconducting magnet shown in Fig. 2 is less problematic, as it is self-shielded with a known steep field gradient and controlled by the n2EDM experiment operation.During n2EDM operation it is always ramped up and running very stably in a persistent mode.
The reproducibility of maps taken under similar conditions was of the order of a few µT, where the limitation might be due to drifts of the fields themselves or uncertainties of the measurement and the analysis procedures.Importantly, it was found that the measured fields could be sufficiently described, with 1 µT-accuracy, with only homogeneous and first-order gradient fields.
We concluded that the AMS needed only coils to compensate homogeneous fields in the three independent spatial directions, and five independent first-order gradients.Therefore, a system could be designed using only eight independent coils.
Concerning field strengths, it was found that a range of ±50 µT for the three homogeneous components of the field, and up to ±5 µT/m for the five first-order gradients would be sufficient to meet our requirements.These values already include a safety margin of 20%.
3 The concept of the AMS design

Working principle
In a volume with no magnetised parts, any magnetic field can be generated by the correct current distribution on the surface of this volume.The currents on the surface can thus be chosen to exactly counteract the effect of any external field, stabilising the field inside.In a practical realisation, there is a finite number of coils on the surface, and the field is measured only in a finite number of points.Figure 3 depicts a simple realisation with a single coil (shown in yellow) and eight 3-axis sensors (shown in green).Here, an external magnetic field B B B e influences the target volume, in which the field is to be stabilised (depicted in blue, occupied by the MSR of n2EDM).We aim, however, for optimal (in the least-squares sense) stabilization at the eight green points where three-axis sensors are placed.Their readings B B B m are used to calculate currents I I I feeding a coil system to counteract external field changes.Obviously, in the real application, the coils are much more complicated than shown.In principle one can aim at any target field at the surface of the sensitive volume.In our application aiming at zero field is most reasonable.
In the absence of the MSR and other magnetization, one obtains a linear dependence between B B B m and the coil currents.In fact, we initially assume, and later prove experimentally in section 6.2, that a linear dependence also holds Fig. 3: The volume of interest for the target fields of the n2EDM AMS system are given by the outside wall of the MSR (depicted in violet).An external magnetic field B B B e is detected by magnetic-field sensors (green).As an example, the yellow coils could aim to compensate the external field.In practice, the AMS coils are more complicated due to spatial limitations and their close proximity to the MSR.for a demagnetized MSR exposed only to small magnetic fields.One can write: The matrix M M M contains the proportionality factors, which relate the current in the AMS coils to the magnetic fields measured at the sensor positions.For a built system, the entries of M M M can be measured using the installed coils and sensors (see Sec. 4.2).During design of the coil itself, they can be calculated, without the MSR using Biot-Savart's law, and with the MSR, using a sufficiently realistic finite-element simulation of the full system.Equation 1 can be written components-wise in the following way: B e,1y B e,1z . . .
Matrix M M M has dimensions 3 n × k, where k is the number of coils (for the AMS system k = 8, see Sec. 3.3), and n is the number of magnetic-field sensors.
Next, one implements an iterative process using the measured changes in B B B m (see Sec. 5.5) to calculate appropriate changes for I I I to zero B B B m again.In the applied feedback algorithm the pseudo-inverse of M M M is used.In order to calculate the pseudo-inverse we start with a Singular Value Decomposition: where U U U and V V V are unitary matrices and S S S is diagonal.The latter is called the spectrum and describes the effect of combinations of coils on the magnetic sensors.The pseudo-inverse M M M −1 can be calculated as: The ratio of extreme values of the spectrum, s min and s max , defines a condition number C of the matrix M M M: The condition number is an important characteristic of the system design of the feedback-matrix quality.It represents the sensitivity of the sensors to current changes.A low condition number means that there are particular combinations of currents I that have small influence on the readings of the sensors measuring B B B m .When inverted, this leads to small changes in the sensors to cause large changes in the currents, rendering the system to be unstable.The condition number is later used in the optimization of the sensor positions in the AMS system (Sec.4).

Design challenges
In a volume with no magnetized parts, any magnetic field can be generated by the correct current distribution on the surface of this volume.In particular, the currents on the surface can be chosen to exactly counteract the effect of any external field, making the inner magnetic field zero.The MSR can be demagnetized and reside in the zero field inside the volume with exactly the same currents as needed for the empty volume without the MSR.
In the real experiment, currents cannot be arbitrarily distributed on a surface.They must follow predefined, discrete paths and the fields can only be adjusted by varying current values.The spatial discretization is a grid to which the current carrying wires are fixed.The discretized current distribution can approximate the target field well, if the discretization in small compared to the distance between the target volume and the surface.
Several constraints for the AMS system were already mentioned.The coil system must be large compared to the size of the MSR, however, the walls of the experimental area ultimately limit the size of the surface to which the AMS could be mounted.In addition, the experimental area must be accessible.It should be possible for persons with reasonably sized equipment to enter the experiment without breaking the currents in the AMS.It should also be possible to open the AMS from the top to insert large equipment with the crane.Various other installations penetrate surfaces around the MSR such that the grid for the AMS must be adapted to the needs of other subsystems.
The shielding blocks seen in Fig. 2 as well as the regular floor of the experimental hall are made of steel-reinforced concrete with some magnetic response.The latter was investigated and fortunately found to be rather weak and finally negligible if a minimal distance to the walls is maintained.

Method of simple coil design and its application for the AMS system
The aforementioned requirements and constraints of the system called for the development of a flexible method to design coils that could be practically built.
The employed method of coil design [17,24] is based on three key inputs: (i) target fields, which have to be compensated by the coils; (ii) a fixed grid where coil wires can be placed; and (iii) points of interest (POIs) of target fields, covering the fiducial volume of interest densely enough (Fig. 4, left).The grid can be subdivided into many small coils called tiles.A tile is the smallest building block of the grid.The smaller this elementary building block is, the more homogeneous the field can be.For practical reasons, we have chosen to make most tiles rectangular; however, the method could deal with any shape.It is also worth reiterating that the method does not require the grid to be regular.In fact, the AMS system of the n2EDM experiment (Sec.5) is implemented on an irregular grid.
Once target fields, grid, and POIs are defined, the magnetic field at the POIs, B B B POI , created by the currents I I I in the tiles, can be described similarly to Eq. 1 by In this design phase, each element of proportionality matrix M M M D can now be calculated numerically using Biot-Savart's law.Using a least-squares method we find the current needed in each tile to approximate the target field.For the AMS system, there were 308 tiles in total (see Sec. 5.1).The calculation is simplified by cancelling counteracting currents on the grid structure.The algorithm described in [17] decomposes this grid of currents into simple loops, which are closed current paths that can be wound on the grid.The result of this step is a set of such loops, that each need to be powered with a specific design current to generate the target field.Examples of such simple loops are depicted in different colors in the right panel of Fig. 4.
Fig. 4: Illustrations of the method of simple coil design [24].Left: Initial definition of the grid (bold tiles) around points of interest (blue dots).Right: a set of simple loops (different colors) obtained in the course of simple coil design, representing the current paths needed to create the desired field (here: homogeneous in the indicated direction).Numbers and arrows indicate values of the currents and their directions in the corresponding loops.More details can be found in [17].
In order to change the magnitude of the field generated by a system of loops, all loop currents in the system need to change proportionally to the design current.Thus, the set of loops for a specific target field can be connected in series, creating one coil.The number of windings for each loop can be adjusted, such that the coil could be powered by one current source.However, for the AMS system it was decided to split each coil into three electrical circuits: with large, medium and small elementary currents (which will still be changed with the same proportionality and are integer multiples of the smallest current).For example, choosing elementary currents as [15A, 5A, 1A], a loop with a current of 73 A would be wound as follows: The choice of the smallest elementary current leads to some imperfection, here on the order of 0.5/73 ≈ 0.7% or 0.4 µT for 50 µT, within the requirements of the system.This approach allowed minimization of winding efforts and selfinductance, while keeping the number of current source channels reasonable.In our case, we constructed eight independent coils, each with three circuits for the elementary currents.They are operated by eight current sources, each with three channels for the different currents.
The described method of coil design for an AMS offers advantages over approaches using simple geometric coils, namely in two areas.1) The size of the coil system can be decreased relative to the size of the sensitive volume.A loss of performance, e.g., in the homogeneity of a given volume, can always be counteracted by choosing a denser grid.2) The method allows construction of a coil for any field and the grid geometry that can be chosen almost arbitrarily.In particular, we have chosen to construct coils that produce orthogonal fields.The magnetic field is described as a superposition of orthogonal, cartesian harmonic polynomials: Here H n are expansion coefficients and P n (r) = (P nx , P ny , P nz ) are polynomials as defined in Table 1 for the three homogeneous and five first-order gradient fields.Terms of higher n correspond to higher-order gradients.The advantages of this decomposition are that the polynomials are orthogonal and each basis state satisfies Maxwell's equations.This method was initially considered by G. Wyszynski [25].We used this approach to define eight AMS coils: three coils to compensate homogeneous fields, and five to compensate linear magnetic field gradients.

The AMS prototype
Before applying the simple-coil method to design and construct the AMS system for n2EDM, we studied a smallerscale prototype [17,18] at ETH Zurich (Fig. 5).

The prototype design and construction
The prototype consisted of the eight types of coils as intended for the AMS system.Similar in specifications, the system was designed to compensate target fields of ±50 µT for homogeneous fields, and ±20 µT/m for the first-order Coil n P nx P ny P nz Table 1: List of the Cartesian harmonic polynomials and associated names of the individual coils.
gradients.It also aimed at a homogeneity of a few µT in the volume of interest.
The prototype was built on an aluminum-profile frame of 1.3 m × 2.3 m × 1.3 m in x-, y-, and z-directions, respectively, providing a grid of squares as shown in Fig. 5.The sensitive, fiducial volume for the target fields was chosen to be a cube of 98 cm × 98 cm × 98 cm, placed asymmetrically in y-direction and centered in x and z, as shown in Fig. 6 (grey contour), in which a cubic mu-metal shield could be placed.We kept the x − z side of the frame at y = 0 completely open, opposite to the front-side seen in Fig. 5.This enabled easy access to the inside, e.g., to install a magneticfield mapping device and the mu-metal, and in addition demonstrated the feasibility of designing and building coils with a more complex, irregular geometry.
The mu-metal cube in the prototype served as the emulation of the MSR of n2EDM concerning the fields on its outside.Its purpose was not to be an efficient magnetic shield but rather to provide a mu-metal surface to affect the fields between the mu-metal and the coil cage.It can be demagnetized using a set of demagnetization coils wound through the cube.
The design method restricted the wires of the coil system to take paths on the grid, similar to the ones shown in the right panel of Fig. 4. As described in Sec.3.1, each of the coils used three circuits with different values of maximal currents (here: 5 A, 1 A, and 0.2 A).In total, eight current sources, each feeding three circuits, were used to provide all eight coils with their currents.
As an example, Fig. 6 shows a simulation of the y-component of the magnetic field produced by the homogeneous y-field coil of the prototype in the x − y midplane.The map depicts deviations of the magnetic field from the target value Fig. 5: Photo of the AMS prototype [17,18] mounted in the ETH laboratory.The smaller side of the frame, facing the window as seen on the photo, was kept open without windings -to allow easy access to the inside of the system.T Fig. 7: The map of the magnetic field produced by the first-gradient coil of the AMS prototype (G 1 , as defined in Table 1), measured at the central x − z plane at y = 115 cm.Adapted from [17].

Performance of the prototype
Validation of the AMS fields.We built a mapper robot carrying a movable three-axis fluxgate sensor to automatically measure the magnetic field in a large part of the volume inside the coil cage.In a first characterization, the static performance of the prototype was assessed by comparing the predicted and the measured fields for each coil.As an example, Fig. 7 shows measurement results for the magnetic field produced by the first-gradient coil G 1 (as defined in Table 1) at the central x−z plane, at y = 115 cm.As expected, the coil produces mainly B x and B z components of the field.The deviation of the measured fields from the target values do not exceed a few µT, which was the design goal and have been confirmed for all coils.
Dynamic field stabilisation.As a next step, we implemented a dynamic field stabilisation to actively suppress variable magnetic-field perturbations.This mode is based on continuous monitoring of the magnetic-field changes by fluxgate sensors with ±200 µT range, 1 kHz bandwidth, and ±0.5 µT accuracy.The sensors were mounted around the volume of interest and a dedicated DAQ system, based on Beckhoff EtherCAT modules [26], was used to read their outputs, and to control the coil currents [17].
The dynamic mode of operation relies on the quality of the feedback matrix M (Eq.1), which itself strongly depends on the number and positioning of the fluxgates, requiring optimization.The optimization without mu-metal is straightforward.It is somewhat more challenging with mu-metal due to its strong position-dependent impact on the magnetic field in its vicinity.The magnetic fields of the setup with the mu-metal cube were simulated with COMSOL [27] and validated by measurements.With these simulations, the condition number (see Sec. 3.1) of the feedback matrix M could Fig. 8: Visualization of the feedback matrix M (see Eq. 1 and [17]).The rows designate the coils of the AMS prototype and the columns correspond to the absolute readings in x, y and z directions of the eight fluxgates (FG).be minimized by selecting proper positions for the feedback sensors.
It was found that sufficiently stable performance can be reached with eight sensors placed close to the corners of the mu-metal.This fits well the intuitive understanding of the effects of mu-metal.Close to the surface of the mu-metal, field components parallel to the surface will be small while the orthogonal component remains.As the fluxgate magnetometers used for feedback are three-axis devices, this would mean that a fluxgate aligned near a large flat surface can measure the orthogonal field well with one axis, while two axes provide relatively little useful information.Thus, positioning fluxgates closer to mu-metal edges and corners turns out to be more informative.
With the fluxgates mounted at their optimal positions, the feedback matrix was determined by measuring the magnetic-field components while scanning each coil current separately over the whole available range.For fields up to ±50 µT, relevant here, the response was found to be linear.The slopes, obtained by linear regressions for each spatial field component versus current, correspond to the elements of the matrix M. They are displayed in Fig. 8 for the eight 3-axis sensors and eight coils.

Shielding Factor
Fig. 9: Frequency-dependent shielding factor of the AMS prototype along its x direction measured with the perturbation from a square-shaped coil with 1 m side at a distance of about 3 m, producing external sinusoidal fields of different frequencies.Adapted from [18].See text for details.
Shielding performance of the AMS prototype.The obtained feedback matrix was used to operate the AMS in dynamicstabilization mode.To test this regime, magnetic-field perturbations can be generated using a coil placed at some location around the setup.For this measurement, the square excitation coil with sides around 1 m was used.The coil was oriented perpendicular to the x axis and placed at about x = 3 m with its center on the y, z coordinate of the center of the sensitive volume.The current source for the coil was modulated with a waveform generator to produce sinusoidal fields, with an uncompensated, maximal amplitude of about 8 µT at the central sensor position.The readout bandwidth was 200 Hz and the update rate of the feedback system was around 30 Hz.
The AMS shielding performance was characterized by a shielding factor S, defined as the ratio: where B on/off center denotes the magnetic-field value at the center of the sensitive volume (corresponding also to the center of the mu-metal cube) with the active compensation on or off, respectively.The mu-metal cube was not used for the particular measurement explained here.In addition to the feedback sensors, one additional sensor to measure B center was mounted.
Figure 9 shows the obtained result for S and its frequency dependence up to 1 Hz.The measured shielding factor stays stable around 12 in the low-frequency range.The decrease of the shielding factor above 100 mHz is from the limited response of the system caused by the inductance of the coils on the aluminum frame of the cage.The frequency dependence of the shielding factor stays the same for similar measurements with the coil positioned at other locations.However, the magnitude of S strongly depends on the distance and orientation of the excitation coil.This can be understood qualitatively, as the magnitude of the higher order gradients of the fields within the sensitive volume depends on distance and orientation of the coil, and cannot in principle be compensated by a first-order AMS.Also, this was quantitatively confirmed using a COMSOL simulation of the system.
In summary, we successfully demonstrated an implementation of the method of simple coil design with the prototype AMS system, achieving the expected static and dynamic performance.The prototype design with an open-side demonstrated that this approach is capable of handling irregular grids, which is important to account for doors and other openings at the n2EDM experiment.Based on this feasibility demonstration, confidence was gained for the design and construction of the much larger AMS for n2EDM.

The AMS system for n2EDM
Given the experience with the prototype and the requirements resulting from the mapping of the experimental area, the AMS system for n2EDM was designed.Compared to the prototype, the definition of the grid structure was more constrained by the needs of n2EDM and the available space, much more ampere-turns were necessary for similar field strengths, mechanical stability was more important, and much improved quality control was needed for the construction process.

AMS coil design
The design of the AMS coil system involved several steps, with iterations: (i) the choice of a surface and a grid on which the coil system could be constructed around the MSR, taking into account all constraints from experimental needs, equipment and area; (ii) finding the currents on the grid structure to create the target homogeneous and first-order gradient fields; (iii) organization of the currents in loops and coils as well as simplification of the optimal solution by the exclusion of (simple loop) currents contributing negligibly within the specified uncertainties.
Grid design.Placing the grid structure as far away as possible from the surface of the MSR ensures better field homogeneity.The main limitation was the size of the experimental area.Similarly, the whole experiment, and the MSR in particular, benefits from a clean, temperature-stabilized environment.The n2EDM experiment therefore must be separated from the main experimental hall and requires a thermal enclosure.The solution was the construction of a wooden house ('thermohouse'), similar in principle to the one of the nEDM experiment [6].The AMS was planned to be installed on the inside of the walls of the thermohouse, which could then almost fill the experimental area.This way, optimal access to the experimental equipment and the coil system was guaranteed.The power dissipation from the coils was studied and taken into account in the lay-out of the airconditioning system of the enclosure.It was assumed and later verified that the total the dissapated heat was quite stable for all observed external field conditions, even with dynamically controlled currents of the AMS.
The possibility to fix the AMS to the walls and the roof of the thermohouse simplified its construction, given the mechanical stability of the structure, which was designed to carry the additional, substantial weight of the coils.
Figure 10 shows the final grid of the AMS coil system with dimensions of 10.3 m × 8.6 m × 8.9 m around the MSR.It has rectangular tiles of around 1.5 m average sidelength, with a total of 308 tiles, 473 vertices, and 778 edges.
The process of designing the grid was mainly heuristic and required several iterations.The density of the grid mesh was optimized [18] to achieve the best possible fieldhomogeneity around the MSR, while trying to keep the wiring effort reasonable.To make easy access for doors and other openings for the infrastructure of the experiment, we increased the size of tiles when possible or introduced special pieces, called 'connected doors' (see Fig. 12).A connected door is a separate grid structure placed on a detachable part, which is electrically part of a coil but, for the optimization of the circuit, topologically separated from the rest of the grid.The design method easily allows such separations.For maintenance, it is then possible to completely detach the connected door making a larger opening to access the experiment.
Given the irregular layout of the experimental area and the thermohouse, the AMS tiles located at the kink in the wall (see Fig. 10, lower right corner of the layout; and Fig. 12 for the top view) would carry high currents while having little effect on the field quality.Such high currents are not ideal for the AMS system: they increase cable thickness and heating effects, requiring bulky cabling and possibly dedicated cooling.To solve this, a regularization procedure was used in the optimization, turning the proportionality equation Eq. 1 into a system of equations: where M is the proportionality matrix, B is the target magnetic field and I represents the currents in the tiles.The second equation penalizes large currents.It includes the regularization parameters λ , which must be numerically determined for each coil, so a set of eight λ -values is neccessary for the full system.Optimal λ -values should then produce solutions with low total currents and still achieve the performance goal of µT-fields.An example of the λ optimization for the X-coil is shown in Fig. 11.Increasing λ reduces the mean edge-currents and thus the total current, as expected, while λ -values above 10 −8 T/A cause the residual from the target field to diverge.The total current is minimal and constant for λ ≤ 6 • 10 −9 T/A.Appropriate values for λ were determined for all eight coils.
Choice of optimization volume.A shell of 20 cm thickness around the outer layer of the MSR was chosen as the volume of interest for the optimization (shown in blue on Fig. 12).In the real system, magnetic-field sensors are installed inside of this shell.The sensors need to be placed at a distance from the mu-metal to work reliably and the target fields need only to be reached close to the MSR surface.Making the volume for the target fields larger would require larger currents and smaller grid spacing for the AMS.Within the shell, the AMS field was numerically evaluated on random POIs, drawn from a uniform distribution.A set of 9600 POIs was used in the performance evaluation.It was checked that the sampling of the MSR surface by these points was sufficiently dense.Fig. 11: The largest deviations ('min' for negative and 'max' for positive) from the target field at the MSR are plotted against the λ -parameter for the procedure of optimizing currents of the X-coil.More details in [18].A ±1 µT performance goal is indicated by the green box.The axis on the right gives the average currents in the edges of the grid and the orange curve shows its decrease with increasing λ .Final adjustments.The application of our method of coil design (Sec.3.3) yields a large number of simple loops on the predefined grid.These loops are not all equally important for the performance of the AMS.For the practical implementation, the number of loops can be reduced as long as the target fields can be achieved.The initial set of simple coils was ordered by importance with respect to the field intensity they produced in the volume of interest.The performance of the system was then recalculated for configurations where subsequently the least important simple loops were left out.
As an example, Fig. 13 shows a comparison of the residual fields at the POI close to the MSR for different numbers of the most important loops of the 4th gradient coil.The target field for the gradients is 5 µT/m and residuals refer to the 'full field' configuration producing this gradient.The best solution for this coil had 123 simple loops.However, the performance stays close to optimal down to a reduced number of the 70 most important loops.This procedure was used for all eight AMS coils, yielding a reduction of 40% in the total number of simple loops while still reaching the target fields.
Complete system.The final design of the AMS system comprises eight coils matched to the optimized grid.Each of the coils consists of 50-70 simple loops to achieve the target fields.An example of a subset of the main simple loops of the Y-coil is shown in Fig. 10.As in the prototype, each coil consists of three electrical circuits with large, medium, and small elementary currents.This minimized wiring effort, total weight, and power dissipation, while keeping the number of current sources at a manageable level.Table 2 summarizes the chosen elementary currents and the numbers of simple loops for all coils.Fig. 14: Two-dimensional maps of the calculated magnetic-field residuals at z = 0, which is the vertical center of the MSR.The x and y coordinates are given in meters.outline of the MSR is depicted as a gray square.The residuals are plotted for the full field in all coils including cross compensation, see text.Adapted from [18].The calculated residual fields from the target field of the finalized coils are shown in Fig. 14 for the so-called 'fullfield' configuration, in which all coils are powered to simultaneously produce the homogeneous fields of 50 µT in each spatial direction as well as the five 5 µT/m gradients, see Tab. 1.Each coil was designed individually to compensate one of these eight basis fields.Due to the discretization and the simplification inherent to the design method, the fields generated by the coils slightly deviate from their target fields, within the allowed ranges.Such deviations will add up (vectorially) when operating the coils together.Large deviations do not usually occur at the same place and in the same directions, they appear rather more randomly, leading even to some 'cross compensation', with the result dis-played in Fig. 14.The residual of each coil's field from its target value can itself be represented as an expansion in the same basis fields produced by the other coils (plus neglected higher-order fields).Therefore, when measuring the response matrix for the built system, these effects are taken into account automatically.
Other, potentially important aspects of the real-world AMS system are the unavoidable imperfections of the current paths.One of these issues arises from the bending of cable bundles at each vertex.Obviously, these are not 90 degree corners but require bending radius up to 10 cm.Another imperfection is the position of the wires in the bundles with respect to the ideal grid.On some edges of the system, the area crossed by all cables was up to 80 cm 2 ; necessarily some wires are displaced by several cm from their ideal position.All these effects were simulated and in all cases we concluded that they were tolerable or even negligible.Again, aforementioned cross-compensation helps considerably: while a coil might slightly deviate from its ideal performance, it will still be completely linearly independent of the other seven coils and the system can function almost equally well.

The AMS technical implementation
The AMS coil system was mounted in the thermohouse of n2EDM over the course of approximately one year.An overview of the construction process is presented here, while more details are found in Ref. [18]. Figure 15 shows a picture of the finalized system.
The AMS grid structure was formed by cable trays out of stainless steel, mounted directly onto the inner walls of the wooden thermohouse around the MSR.The cable trays were grounded in a way to inhibit closed loops and eddy currents through the trays.In order to mount the coils of Fig. 15: Photograph of the AMS coil system constructed on the walls of the thermohouse around the MSR.On the righthand side, in the middle tiles, and on the back-side to the left of the MSR, a few DIN rails are visible which are wired to connect circuits, as explained in the main text.Of course, the AMS extends fully around the MSR, also on the entire floor.The platform visible in front of the MSR is about m above floor level.
Table 2 efficiently onto the grid (Fig. 10) along their calculated paths, one could not simply wind long cables.Instead, cables of a simple loop were bundled and installed on the cable trays along the roughly 500 different paths.The ends of the wires of the bundles were carefully crimped to form the loops.All the simple loops for each elementary current were connected in series such that a 'coil' consisted of three independent circuits.The installation of a bundle carefully followed a detailed plan, connecting it at some start position in the thermohouse and following a prescribed path along numbered vertices.The start and the end position of the circuits were later connected to terminals on DIN rails, which themselves were connected appropriately with interconnection wires.At each vertex of the grid the correct direction had to be checked, going straight or around a corner.A system of bar-codes on the wires and QR-codes near the vertices on the walls, both completed with human-readable names, along with a dedicated smartphone scanning-app, were developed for a continuous verification and quality control during the installation.Completed circuits were electrically checked and DC resistances were measured to guarantee quality of crimp connections.This way, a total of 55 km of wire was installed, without any indications of error.

AMS current sources
To power the AMS coils, we have designed and built bipolar high-power current sources in-house at PSI, based on APEX-PA93 linear operational amplifiers [28].Each current source consists of three channels, delivering the elementary currents to the corresponding three circuits of a coil (Fig. 16).The currents of all three channels change proportionally to their control voltages, which can be set in the range from −10 V to 10 V.This allows for an efficient realization of the three-fold powering approach described in Sec.3.3.For coils with different design currents (see Table 2) the software will command them with properly reduced values.Depending on the channel, up to six APEX amplifiers were connected in parallel and complemented by a system of matched resistors to deliver the required output current and distribute the power dissipation.An internal stabilization network combined with external damping resistors enables the current source to drive inductive loads up to 1 H.This is important because although the self-inductance of the coils ranges only from 3 mH to 75 mH, their mutual inductance is up to 500 mH.
Each of the current sources is supplied with ±50 V from an external switching power supply with a large filter capacitor to ensure a low-noise level of operation.The total heat dissipation in each of the current sources can reach up to 500 W, which is removed by an efficient built-in cooling system.
As part of the performance verification of the current sources, they were connected to the coils and their responses measured to a square-shaped input signal with the maximum amplitude of 10 V.The output signals reached their maxima with typical time constants of approximately 80 ms, fast enough for dynamic AMS operation in the sub-Hertz frequency range, as required.

Fluxgates sensors
Eight 3-axis SENSYS fluxgate sensors [29] were installed around the MSR to measure the magnetic field and provide feedback information for the dynamic mode of the AMS.The initial optimization of their positions was carried out similarly to the one of the prototype (Sec.4.2) and positions close to the corners of the MSR were found.
In Sec.6.2, results of the dynamic shielding performance are reported, based on these positions of the fluxgates and the control system, described in the next section.

Control system
The control system is based on Beckhoff modules ELM3148 (24 bit ADCs) and EL4134 (16 bit DACs) operating at 1kHz.The readings from all fluxgate channels are stored in the array B B B m that has up to 51 entries.There is a minimal delay of two cycles for any reaction.Thus, the currents I I I of the next cycle [i + 1] are calculated as: where B B B t is the target field, normally chosen as 0. The feedback matrix M M M −1 is the pseudo-inverse (calculated offline as explained in Eq. ( 4)) of the response matrix M M M. The latter is obtained by scanning all coil currents individually and analysing their response by linear regression (as described in Sec.4.2).A multiplication constant k k k slows down the feedback to avoid oscillations.We use the same value of 0.013, found empirically, for all eight coils.This results in a characteristic time constant of about 50 ms.A faster operation is prevented by the current sources, but was never intended.While the performance is satisfactory already, potential improvements will be studied once commissioning of other n2EDM subsystems, which it would interfere with, is completed.A more detailed simulation model with improved utility for various numerical studies is being deployed, additional fluxgate sensors are being installed, and further optimization of sensor positions and feedback algorithms pursued.

The AMS performance measurements
After the installation and the commissioning of all AMS coils and power supplies, we validated the static magneticfield generation and measured the shielding performance of the AMS, as described below.

Magnetic fields generated by the AMS coils
As the MSR was installed in the experimental area before the AMS system, the actual magnetic fields generated by the Fig. 17: Example of an AMS validation measurement: comparison between the measured (crosses) and the simulated (dotted line) magnetic field values for B x , B y , and B z components produced by the Y-coil.The measurements were taken along the gray line in the inset (y-direction) at z =−1 m.Adapted from [18].AMS coils are not the simple homogeneous and first-order gradient fields as designed, but are modified by the MSR.
Thus, after the quality control described in Sec.5.2, which guaranteed the proper pathways for the currents, actual magnetic-field measurements were compared to results of a FEM simulation model implemented in COMSOL [27].We used the design fields as imported background fields and the outermost mu-metal surface of the MSR as a 10 cm thick layer of high magnetic permeability.It was verified that above a certain permeability and thickness, the results of the simulation became independent of these details.
As the experimental area around the AMS was already partially occupied by other equipment after its completion, magnetic-field measurements around the MSR had to be done in a sampling mode rather than in form of full field maps (as described for the empty area in Sec. 2).
The magnetic fields created by individual coils were measured in some selected, easily accessible areas, usually along a straight aluminum profile with one fluxgate, and compared to the simulation.Figure 17 shows an example of such a comparison.The measured and the simulated magnetic-field values for the B x , B y and B z components produced by the Ycoil are shown.The current of the Y-coil was pulsed on and off for the measurement to enable proper background-field subtraction.The coil current was chosen to be half of the maximum current.The measurements were taken along the grey line shown in the inset, at a height of z =−1 m (below the center of the MSR) in the y-direction at a distance of about 20 cm from the MSR surface.
The result of the measurement agrees with the simulations, and the behaviour of the magnetic-field components is as expected for this example.The design field at the sampled positions without MSR would only have a B y component, with B x = B z = 0.One can see this feature emerging for large positive and negative values of y.While the nonexistent B z component is unaffected by the mu-metal shield, the B y component gets absorbed into the mu-metal by drawing it into the B x component with maximal amplitude at the edge of the MSR around y ≈ −2.8 m.A similar qualitative and quantitative agreement was observed for the other coils, which confirms a good understanding of the AMS coil system as built.

AMS shielding measurements
Commissioning measurements of the dynamic AMS shielding were performed outside and inside the MSR during ramps of the superconducting high magnetic-field facility 'SUL-TAN' [30].Magnets of this facility were already of concern to the predecessor nEDM experiment [6].The facility is about 30 m away from the n2EDM experiment.Its magnets can ramp up to 11.5 T, producing fields up to 40 µT at the MSR front and back walls mainly in horizontal direction with the AMS system off.
The magnetic fields outside the MSR were measured by the eight 3-axis SENSYS fluxgates [29] involved in the feedback, as previously described, and by several additional monitor fluxgates.The magnetic field inside the MSR was measured by a much more sensitive optically-pumped QuSpin magnetometer (Gen3, zero-field configuration) [31].It was placed roughly at the center of the MSR with one of its two sensitive directions along the z-axis, the most relevant for nEDM measurements, and the other one was oriented along the direction of the largest SULTAN perturbation.A second QuSpin sensor, installed close to the first one, was used to ensure that field changes could be identified as such and readings of one sensor were not simply due to sensor drift.
Figure 18 shows magnetic-field values measured during the SULTAN ramps with the AMS in static mode and dynamic mode, respectively.In static mode, Fig. 18 (a), the background field was compensated only approximately some time before the ramp, keeping AMS currents constant.Thus, the initial spread of the fluxgate readings was not illustrating an optimal zero-field setting.During the SULTAN ramp, the measured magnetic field changed from several µT up to roughly 100 µT, depending on the positions of the fluxgates.The fluxgates positioned near the corners of the MSR, fields get amplified and are at some points much larger than in the empty-area mapping (Sec.2).When the AMS system is operated in dynamic mode, Fig. 18 (b), the corresponding magnetic-field changes in the feedback fluxgates are reduced to a level of a few µT.
The measurements with the QuSpin sensor, shown in Fig. 18 (c), additionally show the passive shielding of the MSR.As determined with the earlier mapping campaign, the field variation from the SULTAN ramp at the location of the QuSpin sensor would be about 40 µT without the MSR.A rough analysis of the magnetic field as measured by the QuSpin inside the MSR, during the ramps, found field changes of about 60 -80 pT.This would correspond to a quasi-static shielding factor of the MSR of roughly (5 − 7) × 10 5 .It is well known that the magnetic-shielding performance of such magnetic shields improves for larger field variations due to the increase of permeability µ r for larger magneticfield strength H until saturation effects set in.It is therefore very important to describe the excitation field when quoting a shielding factor.For this particular example, the MSR of n2EDM has a quasi-static shielding factor of 1 × 10 5 for an excitation field corresponding to ±2 µT at the unshielded sensor location [22].This is the relevant shielding factor for n2EDM, as µT-size perturbations will still be possible, even with a perfectly functioning AMS.
When the AMS system is in dynamic mode, the Qu-Spin sensor measures a more attenuated signal, see Fig. 18 (d).The amplitude of this remaining field change is about 8 pT, a factor of 7-10 smaller, compared to the SULTAN ramp when the AMS is in static mode.It is, however, not straightforward to take this as the shielding factor of the AMS system alone, as we just saw that the passive, quasistatic shielding performance of the MSR depends on the size of field perturbations on the shield, which in turn depends on AMS performance.
Nevertheless, we can deduce the approximate shielding factor for the combined system of the AMS and the MSR for large and slowly changing perturbations (here a onehour ramp to 40 µT) as 5 × 10 6 .More importantly, the result demonstrates that the goal of suppressing field changes down to below 10 pT inside the MSR was achieved, which was set up as a requirement for the n2EDM experiment.
Another interesting observation from the comparison between Figs. 18 (c) and (d) is that at least in this set of measurements it appears that the larger field variation on the outside of the MSR in the static case caused the field inside of the MSR to drift more, about 30-40 pT, compared to the dynamic case with a drift of less than 10 pT.One can see, that the drift following the ramp-up in (c) is opposite to the induced change, while the drift following the ramp-down is in opposite direction.This is expected from the reaction of the mu-metal layers of the MSR to the perturbation.Such drifts are part of unwanted behaviour of a passive magnetic shield, which, when exposed to large external field variations, slowly absorbs the remanent field until it reaches the state of lowest energy.The AMS system largely reduces the impact of such effects.7 Summary The AMS system was designed and built to compensate homogeneous and first-order gradient external magnetic-field changes around the MSR of the n2EDM experiment.It was developed using a novel method of coil design.After successful prototyping at ETH Zurich, the AMS system was constructed and commissioned at the n2EDM experiment at PSI.First performance measurements demonstrated its ability to suppress magnetic-field changes of about ±50 µT (homogeneous) and ±5 µT/m (first-order gradients), to the level of a few µT.The optimization of the AMS system using measurements and improved simulations, e.g., concerning fluxgate positioning and feedback algorithm, is ongoing and might further improve its performance.In any case, with the performance demonstrated in this paper, the combined system of AMS and MSR meets the specifications of the n2EDM experiment, providing a magnetic-field stability within the neutron volume at the 10 pT level.

Fig. 6 :
Fig.6: Simulation of the y-component of the magnetic field produced by the y-coil of the AMS prototype in the x-y midplane.Shown are deviations of the magnetic field from the target value of 50 µT.The grey contour depicts the volume of a removable cubic mu-metal shield, which was not considered in the simulation.Figure is adapted from[17].

Fig. 10 :
Fig. 10: The AMS grid (in yellow) around the MSR.Part of the grid is not shown in the picture to allow the view onto the MSR.The colored lines represent as an example the main simple loops of the Y-coil.

Fig. 12 :Fig. 13 :
Fig. 12: Schematic top view of the AMS grid.A connected door is shown in red.The volume of the POI is indicated in blue around the MSR (green).The orange area depicts part of the AMS, which has only a minor impact on the field homogeneity around the MSR.Adapted from [18].

Fig. 16 :
Fig.16: Simplified scheme of the bipolar current source, developed to power AMS coil.Each current source consists of three channels (here: 15A, 5A and 1A), with their output currents proportionally to their individual control voltage.

Fig. 18 :
Fig. 18: The AMS suppression of magnetic fields from SULTAN: (a-b) -magnetic fields measured by the feedback fluxgates outside the MSR during two different SULTAN ramps with the AMS system in static (a) and dynamic (b) modes; (c-d)the magnetic fields of the SULTAN magnet for the two ramps (dotted grey line, right scale) along with the corresponding magnetic field measured by an optically-pumped (QuSpin) magnetometer [31] inside the MSR (black line, left scale).

Foundation-
Flanders (BE) under Grant No. G.0D04.21N.Collaborators at the University of Sussex acknowledge support from the School of Mathematical and Physical Sciences, as well as from the STFC under grant ST/S000798/1.We acknowledge the support from the DFG (DE) on PTB core facility center of ultra-low magnetic field KO 5321/3-1 and TR 408/11-1.We acknowledge funding provided by the Institute of Physics Belgrade through a grant by the Ministry of Education, Science and Technological Development of the Republic of Serbia.This work is also supported by Sigma Xi grants # G2017100190747806 and # G2019100190747806, and by the award of the Swiss Government Excellence Scholarships (SERI-FCS) # 2015.0594.

Table 2 :
Values of the three elementary currents I and numbers of simple loops N for the eight coils of the final AMS design.