% !TeX spellcheck = en_GB
%
%
% v 2.3  Feb 2019   Volker RW Schaa
%		# changes in the collaboration therefore updated file "jacow-collaboration.tex"
%		# all References with DOIs have their period/full stop before the DOI (after pp. or year)
%		# in the author/affiliation block all ZIP codes in square brackets removed as it was not %         understood as optional parameter and ZIP codes had bin put in brackets
%       # References to the current IPAC are changed to "IPAC'19, Melbourne, Australia"
%       # font for ‘url’ style changed to ‘newtxtt’ as it is easier to distinguish "O" and "0"
%
\documentclass[a4paper,
               %boxit,        % check whether paper is inside correct margins
               %titlepage,    % separate title page
               %refpage       % separate references
               %biblatex,     % biblatex is used
               keeplastbox,   % flushend option: not to un-indent last line in References
               %nospread,     % flushend option: do not fill with whitespace to balance columns
               %hyphens,      % allow \url to hyphenate at "-" (hyphens)
               %xetex,        % use XeLaTeX to process the file
               %luatex,       % use LuaLaTeX to process the file
               ]{jacow}
%
% ONLY FOR \footnote in table/tabular
%
\usepackage{pdfpages,multirow,ragged2e} %
\usepackage{subfigure} %SJB
%
% CHANGE SEQUENCE OF GRAPHICS EXTENSION TO BE EMBEDDED
% ----------------------------------------------------
% test for XeTeX where the sequence is by default eps-> pdf, jpg, png, pdf, ...
%    and the JACoW template provides JACpic2v3.eps and JACpic2v3.jpg which
%    might generates errors, therefore PNG and JPG first
%
\makeatletter%
	\ifboolexpr{bool{xetex}}
	 {\renewcommand{\Gin@extensions}{.pdf,%
	                    .png,.jpg,.bmp,.pict,.tif,.psd,.mac,.sga,.tga,.gif,%
	                    .eps,.ps,%
	                    }}{}
\makeatother

% CHECK FOR XeTeX/LuaTeX BEFORE DEFINING AN INPUT ENCODING
% --------------------------------------------------------
%   utf8  is default for XeTeX/LuaTeX
%   utf8  in LaTeX only realises a small portion of codes
%
\ifboolexpr{bool{xetex} or bool{luatex}} % test for XeTeX/LuaTeX
 {}                                      % input encoding is utf8 by default
 {\usepackage[utf8]{inputenc}}           % switch to utf8

\usepackage[USenglish]{babel}

%
% if BibLaTeX is used
%
\ifboolexpr{bool{jacowbiblatex}}%
 {%
  \addbibresource{jacow-test.bib}
  \addbibresource{biblatex-examples.bib}
 }{}
\listfiles

%%
%%   Lengths for the spaces in the title
%%   \setlength\titleblockstartskip{..}  %before title, default 3pt
%%   \setlength\titleblockmiddleskip{..} %between title + author, default 1em
%%   \setlength\titleblockendskip{..}    %afterauthor, default 1em

\begin{document}

\title{CBETA Permanent Magnet Production Run}

\author{S. Brooks\thanks{sbrooks@bnl.gov}, G. Mahler, J. Tuozzolo, R. Michnoff\\ Brookhaven National Laboratory, Upton, Long Island, New York}
	
\maketitle

%
\begin{abstract}
214 neodymium permanent magnets have been manufactured for the return loop of the CBETA \cite{CBETA} multi-turn ERL being built at Cornell University.  There are 5 types of quadrupole and combined-function gradient magnets using a variant of the circular Halbach design.  These are made out of NdFeB material and glued into an aluminium housing with water channels for temperature stabilisation.  The NdFeB wedges and magnet construction were done by outside companies, while the final ``tuning'' using inserts containing 64 iron wires per magnet was done at BNL over a period of about 6 months.  Average relative field errors of 2.3$\times10^{-4}$ were achieved on the beam region.  The magnet strengths vary by type but are of order 10\,T/m for quadrupole component and up to 0.3\,T for the dipole.  This paper reports on the field quality and timeline achieved in this production process.
\end{abstract}


\section{Magnet Types and Quantities}
\newcommand{\comment}[1]{}
The different magnet types required for the CBETA fixed-field return loop are specified in Table \ref{tab:magspec}.

\begin{table*}[!hbt]
   \centering
   \caption{Magnet Specifications}
   \begin{tabular}{lcccccc}
       \toprule
       \textbf{Magnet type} & \textbf{Count} & \textbf{Dipole} & \textbf{Gradient} & \textbf{Length} & \textbf{Aperture radius} & \textbf{Good field radius} \\
        & & \textbf{(T)} & \textbf{(T/m)} & \textbf{(mm)} & \textbf{(mm)} & \textbf{(mm)} \\
       \midrule
QF & 107 & 0 & -11.5624 & 133 & 43.1 & 25 \\
BD & 32 & -0.3081 & 11.1475 & 122 & 40.1 & 25 \\
BDT2 & 20 & -0.2543 & 11.1475 & 122 & 44.938 & 25 \\
BDT1 & 28 & -0.1002 & 11.1475 & 122 & 49.085 & 25 \\
QD & 27 & 0 & 11.1434 & 122 & 40.1 & 25 \\
QFH & 1 & 0 & -11.5624 & 66.5 & 43.1 & 25 \\
BDH & 1 & -0.3081 & 11.1475 & 61 & 40.1 & 25 \\
       \bottomrule
   \end{tabular}
   \label{tab:magspec}
\end{table*}

The BDH and QFH magnets are half-length versions of BD and QF, used once each at the ends of the accelerator for better matching.  That leaves five distinct magnet cross-sections as shown in Figure \ref{fig:magnettypes}.

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THPTS088f1}
   \caption{Permanent magnet cross-sections with 1\,cm grid.}
   \label{fig:magnettypes}
\end{figure}

Q-type magnets are quadrupoles, while BD-type include both bending and a horizontally-defocussing gradient.  The sequence BD, BDT2, BDT1, QD gradually decreases the bending component to zero to allow the adiabatic transition from curved arc to straight as shown in Figure \ref{fig:cbetaloop}.

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THPTS088f2}
   \caption{The fixed-field return loop for the CBETA ERL.}
   \label{fig:cbetaloop}
\end{figure}

The transitional magnets have larger aperture so that further intermediate values of the dipole, on a continuous range, may be obtained by displacing them horizontally.


\section{Production Method}
Each full-length magnet contains 32 permanent magnet wedges: two layers of the designs shown in Figure \ref{fig:magnettypes}.  The BD-types require 16 distinct types of wedge when magnetisation angles are also considered, whereas the Q-type magnets can be built from four types of wedge, some inserted backwards.  In total there are 56 different wedge types and 7648 wedges (including spares), which were ordered from Allstar Magnetics \cite{Allstar} and produced in China.  RMS magnetisation accuracies of 1\% strength and 1$^\circ$ angle were achieved for most wedges, with larger angle tolerances allowed for the smallest two BD-type wedges, which are more difficult to manufacture and contribute less to the total field.  Quality control was achieved with the testing process in Figure \ref{fig:prodtestflow}.

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THPTS088f3}
   \caption{Production and testing flow.}
   \label{fig:prodtestflow}
\end{figure}

Manufacture of the aluminium frames and gluing the magnet wedges into them was done by KYMA \cite{KYMA}, who had previous experience with making undulator magnets and the strong forces between permanent magnet blocks.  Wedges had to be positioned within $\pm$0.25\,mm to ensure field quality and this was achieved.  Field strength could be re-tuned during production by changing the thickness of brass shims inserted between the wedges, which was done successfully for the QD magnets.  The frames were made in left-right halves with pins to accurately align them with each other when assembled onto the vacuum chamber.  Threaded rods had to be used to overcome repulsive and attractive forces during this assembly.

\subsection{Magnet Tuning}

\comment{
\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{rotcoil}
   \caption{rotcoil}
   \label{fig:rotcoil}
\end{figure}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{magtuned}
   \caption{magtuned}
   \label{fig:magtuned}
\end{figure}
}

\begin{figure}[ht]
\centering
\subfigure
{
   \includegraphics*[width=0.47\columnwidth]{THPTS088f4a}
   \label{subfig:rotcoil}
}
\subfigure
{
   \includegraphics*[width=0.47\columnwidth]{THPTS088f4b}
   \label{subfig:magtuned}
}
\caption{\subref{subfig:rotcoil} QD magnet being measured with a rotating coil at BNL magnet division. \subref{subfig:magtuned} BD magnet with tuning wire pack inserted.}
\label{fig:rotcoilmagtuned}
\end{figure}

Once the magnets reached BNL, they were tuned using the method in \cite{IPAC17}, where 3D printed plastic tuning packs \cite{CBETAnotewireholders} containing iron wires were inserted to cancel the multipole errors measured in the magnet by a rotating coil.  Figure \ref{fig:rotcoilmagtuned} shows two steps in this process.

As the NdFeB material has a temperature coefficient of -1.1$\times 10^{-3}$/K, chillers were used to circulate water through the magnets during this process, with a temperature of 85\,$^\circ$F maintained to within $\pm$0.2\,K.

\subsection{Schedule Achieved}
Up to five prototypes of each magnet type were received and tested before approving final production, as shown in the early part of Figure \ref{fig:progress}.  There was then typically several weeks lead time before full production of the aluminium frames and magnets could occur, leading to the various magnet types being made in turns, as shown in Figure \ref{fig:progresstypes}.

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THPTS088f5}
   \caption{Fraction of magnets completed over time.}
   \label{fig:progress}
\end{figure}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THPTS088f6}
   \caption{Fraction of each magnet type completed over time.}
   \label{fig:progresstypes}
\end{figure}

The start of full production was defined by the first large batch of 27 magnets arriving at BNL and the statistics until completion are given in Table \ref{tab:prodstats}.  Two rotating coils were used in parallel for much of this time.

\begin{table}[!hbt]
   \centering
   \caption{Main Production Run Statistics}
   \begin{tabular}{ll}
       \toprule
\textbf{Magnets tuned	} & 200 \\
& (excl. early samples) \\
\textbf{Rotating coil measurements} & 545 \\
\textbf{Start date} & July 9, 2018 \\
\textbf{End date} & November 14, 2018 \\
\textbf{Total weeks} & 18.2 \\
\textbf{Magnets tuned per week} & 10.96 \\
\textbf{(avg.)} &  \\
\textbf{Rotating coil measurements} & 29.88 \\
\textbf{per week (avg.)} & \\
\textbf{Rotating coil measurements} & 2.73 \\
\textbf{per magnet (avg.)} & \\
       \bottomrule
   \end{tabular}
   \label{tab:prodstats}
\end{table}

The diagonal line in Figure \ref{fig:progress} shows a linear interpolation from the production start until the project milestone deadline of November 30$^\mathrm{th}$.


\section{Field Quality Results}

Several field quality metrics were calculated for each magnet from rotating coil data and compared to the acceptance thresholds given in Table \ref{tab:quality}.

\begin{table}[!hbt]
   \centering
   \caption{Quality Measures Used for Magnet Acceptance}
   \begin{tabular}{lcc}
       \toprule
       \textbf{Quality measure} & \textbf{Limit} & \textbf{Units} \\
       \midrule
Maximum field error on midplane & $\le$ 1.5 & Gauss \\
Multipole FOM & $\le$ 10 & units \\
CBETA-scaled multipole FOM & $\le$ 0.375 & \\
Quadrupole strength error & $\le$ 0.05 & \% \\
       \bottomrule
   \end{tabular}
   \label{tab:quality}
\end{table}

The maximum field error is measured on the $y=0$ midplane good field region, which is $\pm$25\,mm in $x$.  All field values are averages derived by dividing the integrated field measured by the rotating coil by the nominal magnet length.

The multipole figure of merit (FOM) is defined as $\sqrt{\sum_{n\ge\mathrm{sext}}b_n^2+a_n^2}$ where $b_n$ and $a_n$ are the normal and skew harmonics, respectively, measured in ``units'' defined as $10^{-4}$ of the main quadrupole field at $R=25$\,mm.

The CBETA-scaled multipole FOM is defined as $\sqrt{\sum_{n\ge\mathrm{sext}}\left(\frac{b_n}{b_{\mathrm{lim},n}}\right)^2+\left(\frac{a_n}{a_{\mathrm{lim},n}}\right)^2}$, where the limits for each individual harmonic are derived from tracking studies with errors \cite{CBETAnoteLou}.  It was found the FOM had to be less than 0.75 to preserve beam quality under the assumption that the magnets were the only source of error, so half this value was used as the production limit.

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THPTS088f7}
   \caption{Multipole FOM of magnets before and after tuning.}
   \label{fig:multipolefom}
\end{figure}

Figure \ref{fig:multipolefom} shows how the multipole FOM of magnets decreased during the tuning process to be uniformly better than the limit.  Similar results were obtained for the CBETA-scaled FOM (see \cite{CBETAnotemagprod} for more detail).

\begin{table}[!hbt]
   \centering
   \caption{Multipole Figure of Merit Statistics}
   \begin{tabular}{lcc}
       \toprule
       \textbf{Multipole FOM (units)} & \textbf{Initial} & \textbf{Tuned} \\
       \midrule
Average & 41.09 & 3.09 \\
RMS & 46.92 & 3.70 \\
Maximum & 112.87 & 9.63 \\
Minimum & 14.64 & 0.52 \\
Median & 32.76 & 2.33 \\
       \bottomrule
   \end{tabular}
   \label{tab:multipolefom}
\end{table}

Table \ref{tab:multipolefom} gives summary statistics for the multipole FOM of all CBETA magnets.

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THPTS088f8}
   \caption{Relative field errors before and after tuning.}
   \label{fig:relerror}
\end{figure}

\newcommand{\B}{\mathbf B}
Figure \ref{fig:relerror} expresses the field quality as a relative error $\max|\B-\B_\mathrm{goal}|/\max|\B_\mathrm{goal}|$ taken over the midplane good field region.

\begin{table}[!hbt]
   \centering
   \caption{Relative Field Error Statistics}
   \begin{tabular}{lcc}
       \toprule
       \textbf{Relative field error} & \textbf{Initial} & \textbf{Tuned} \\
       \midrule
Average & 1.82$\times10^{-3}$ & 2.19$\times10^{-4}$ \\
RMS & 2.20$\times10^{-3}$ & 2.56$\times10^{-4}$ \\
Maximum & 9.81$\times10^{-3}$ & 6.15$\times10^{-4}$ \\
Minimum & 4.41$\times10^{-4}$ & 3.05$\times10^{-5}$ \\
Median & 1.50$\times10^{-3}$ & 1.90$\times10^{-4}$ \\
       \bottomrule
   \end{tabular}
   \label{tab:relerror}
\end{table}

Table \ref{tab:relerror} gives summary statistics for the relative field error.

\section{Conclusion}
The magnet production run was a success, producing all magnets with good field quality within the deadline.

The cost per magnet for NdFeB material was \$3303 and the total cost fit within the planned CBETA budget.  Note, however, that the cost of rare earth materials can vary substantially with fluctuations in global market supply.


%
% only for "biblatex"
%
\ifboolexpr{bool{jacowbiblatex}}%
	{\printbibliography}%
	{%
	% "biblatex" is not used, go the "manual" way
	
	%\begin{thebibliography}{99}   % Use for  10-99  references
	\begin{thebibliography}{9} % Use for 1-9 references

\bibitem{CBETA} G.H. Hoffstaetter \emph{et al.}, ``CBETA Design Report, Cornell-BNL ERL Test Accelerator'', arXiv:1706.04245 (2017).

\bibitem{Allstar} \url{https://allstarmagnetics.com/}

\bibitem{KYMA} \url{http://www.kyma-undulators.eu/}

\bibitem{IPAC17} S.J. Brooks \emph{et al.}, ``Production of Low Cost, High Field Quality Halbach Magnets'', Proc. IPAC 2017.

\bibitem{CBETAnotewireholders} S.J. Brooks, CBETA note 018 ``Description of CBETA Magnet Tuning Wire Holders'' (2017), available from \url{https://www.classe.cornell.edu/CBETA_PM/index_notes.html}

\bibitem{CBETAnoteLou} W. Lou, CBETA note 037 ``CBETA 4-pass Orbit Correction and Tolerance Study'' (2018). % for CBETA-scaled FOM tolerance values

\bibitem{CBETAnotemagprod} S.J. Brooks, CBETA note 035 ``CBETA Halbach Magnet Production Run'' (2018). % basically this paper but more graphs/statistics

	\end{thebibliography}
} % end \ifboolexpr

\end{document}
