
Untitled
By: a guest on
May 12th, 2012 | syntax:
None | size: 1.77 KB | hits: 10 | expires: Never
/* HelmholtzCoils - demonstrating separation of analysis and toolkit interface in NDIToolbox by creating a
simple magnetic field calculator
Chris Coughlin (TRI/Austin, Inc.)
*/
#ifndef HELMHOLTZCOILS_H_
#define HELMHOLTZCOILS_H_
#define _USE_MATH_DEFINES // Required on some platforms to get mathematical constants
#include <cmath>
#include <cfloat>
static const double mu_0 = 4*M_PI*1e-7;
class HelmholtzCoils {
public:
HelmholtzCoils(int turns_per_coil, double current_per_coil, double coil_radius):
N(turns_per_coil), I(current_per_coil), a(coil_radius), lhcoil_position(-a/2), rhcoil_position(a/2) { }
const double H(const double position) const; // Magnetic field at position (m) in A/m
const double centerH(void) const { return H(0); } // Magnetic field at dead center of coils
const double B(const double position) const { return mu_0*H(position)*1000; } // Flux density at position (m) in mT
const double centerB(void) const { return B(0); } // Flux density at dead center of coils
const double B_mG(const double position) const { return B(position) * 1e4; } // Flux density at position (m) in mG
const double wirelength(void) const; // Length of wire (m) to make N turns of radius a
const double awg_recommendation(void) const; // Lookup table to make AWG recommendations based on current I
private:
int N; // Turns per coil
double I; // Current (A) per coil
double a; // Common radius (m) of coils
double lhcoil_position; // Position of left coil (m), defined as -a/2
double rhcoil_position; // Position of right coil (m), defined as a/2
// Geometry correction for magnetic field calcs
const double geometry_correction(const double coil_position, const double position) const;
};
#endif // HELMHOLTZCOILS_H_