Abstract
The design of end-of-shaft angle sensing magnetic positioning systems (MPS) requires accurate field computations in the sensing area for the magnetostatic inversion procedure. Highly resolved field computations on a 3-D domain make FEM simulations unfeasible and favour analytical solutions. Analytical textbook field solutions of a number of standard magnet shapes are however numerically unstable along symmetry axes, body edges as well as in the far field. For the particular application of an end-of-shaft system, only a particular instability close to the symmetry axis, ρ → 0 plays a detrimental role. We stabilize the field equation by mathematical reformulation of naturally occurring numerically unstable combinations of elliptic integrals in the derivation. The resulting formulas or even their ready-to-use implementation in the freely available Python package Magpylib can be used without limitations for end-of-shaft MPS designs.
1. Introduction
End-of-shaft magnetic positioning systems (MPS) are widely used for angle sensing. When a magnet, typically a cylinder magnet with diametral magnetization is mounted at the end of a rotating shaft, the rotation angle is uniquely determined by the outputs of a 2-D magnetic sensor positioned below the axis, see Figure 1. From the measurement of the field modulation, an MPS is supposed to determine the relative motion between a permanent magnet and the magnetic field sensors. The definition of the layout of a magnetic positioning system is based on the inverse magnetostatic problem, typically a global inversion algorithm such as differential evolution to map sensor outputs to the corresponding position and/or orientation of the magnet but also to solve for a number of system parameters of interest such as magnet dimension, magnetization, runout of the axis, magnet and sensor positions, tolerances for all these parameters, strayfields, etc. Needless to say, for such highly dimensional inversion algorithms to work, they rely on very accurate solutions of the “forward” magnetostatic field problem.
Figure 1.
End-of-shaft magnetic positioning system. A magnet is mounted at the end of a rotating shaft whose field is detected in the subjacent sensor array.
2. Methods
Only recently, some investigations [1,2] have addressed the issue of numerical instabilities inherent in the well-known analytical field solutions given in the literature, e.g., ref. [3]. For the end-of- shaft angle sensing systems with a 2-D sensor or sensor array (depending on how many parameters are supposed to be determined) placed below a diametrically magnetized cylinder, a numerical instability of the analytic field solution that increases as one approaches the axis ρ → 0 turns out to be particularly detrimental, as the magnetostatic field solution needed for the global optimization loses its entire floating point precision, see magnetic field component evaluations in the top row of Figure 2.
Figure 2.
Precision (number of significant figures) of the analytic field computation (Bρ, Bφ, Bz) (left, middle, right) in the sensing area (indicated by blue frames). The complete loss of precision for ρ → 0 (upper panel) is successfully remedied by our numerical stabilization (lower panel), giving at least 10 significant figures in the area of interest.
We investigated this problem, stemming from catastrophic cancellations due to definite integrals in the derivation of the field and searched for ways to stabilize the analytical expressions, shown here in an exemplary fashion for the radial field component:
with and . The precision of this stabilized radial field component is shown in the leftmost plot in the lower row of Figure 2. The other two plots to the right show the improved precision of the azimuth and axial field components, respectively.
3. Discussion
Analytical textbook magnetic field solutions of magnets shaped as cubes, cylinders, etc. have typically been written in elegant and condensed form but without consideration of direct floating point evaluation on a computer. Combinations of elliptic integrals that occur in many problems with underlying cylindrical geometry proof to be particularly troublesome when evaluation is needed for instance very close to the symmetry axis, as is the case for inverse magnetostatic computations needed for the design of angle-sensing end-of-shaft systems. We offer numerically stabilized formulas for the field as well as access to a free-to-use solution library Magpylib [4] written in Python, enabling fast and stable field evaluation that can be particularly beneficial for designing end-of-shaft systems but of course also far beyond that particular application.
Author Contributions
Conceptualization, M.O. and P.L.; methodology, M.O., P.L. and L.R.; software: M.O. and P.L.; validation, P.L., formal analysis, L.R., P.L. and M.O.; investigation, P.L., resources: M.O. and P.L.; writing—original draft preparation, P.L.; writing—review and editing, P.L.; visualization, P.L.; supervision, M.O.; project administration, M.O.; funding acquisition, M.O. All authors have read and agreed to the published version of the manuscript.
Funding
This work has been supported by Silicon Austria Labs GmbH (SAL), owned by the Republic of Austria, the Styrian Business Promotion Agency (SFG), the federal state of Carinthia, the Upper Austrian Research (UAR), and the Austrian Association for the Electric and Electronics Industry (FEEI).
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
No new data were created or analyzed in this study. Data sharing is not applicable to this article.
Conflicts of Interest
Authors P.L. and M.O. were employed by Silicon Austria Labs GmbH, and L.R. was employed by Sensitec GmbH. The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as potential conflicts of interest.
References
- Cichon, D.; Psiuk, R.; Brauer, H.; Töpfer, H. A Hall-Sensor-Based Localization Method With Six Degrees of Freedom Using Unscented Kalman Filter. IEEE Sens. J. 2019, 19, 2509–2516. [Google Scholar] [CrossRef] [Scilit]
- Ortner, M.; Leitner, P.; Slanovc, F. Numerically Stable and Computationally Efficient Expression for the Magnetic Field of a current Loop. Magnetism 2023, 3, 11–31. [Google Scholar] [CrossRef] [Scilit]
- Caciagli, A.; Baars, R.J.; Philipse, A.P.; Kuipers, B.W. Exact expression for the magnetic field of a finite cylinder with arbitrary uniform magnetization. J. Magn. Magn. Mater. 2018, 456, 423. [Google Scholar] [CrossRef] [Scilit]
- Ortner, M.; Bandeira, L.G.C. Magpylib: A free python package for magnetic field computation. SoftwareX 2020, 11, 100466. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

