libs.elements.sensors package

Submodules

libs.elements.sensors.FieldRecorder module

class libs.elements.sensors.FieldRecorder.FieldRecorder(field_specifier: int, boundaries: ndarray, samples: ndarray, maxh: float, **kwargs)

Bases: object

The values necessary to describe an area for recording the magnetic field are determined in this class.

Parameters:
  • field_specifier (int) – Determines wether the magnetic flux density or the magnetic field strength field is recorded.

  • boundaries (numpy.ndarray) – Defines the boundaries in which the magnetic field is recorded.

  • samples (numpy.ndarray) – Defines the number of sample points in each dimension.

  • maxh (float) – Maximum mesh size of the field recorder measurement area.

  • field (List[numpy.ndarray]) – The measured H- or B-field:

boundaries: ndarray
convert_to_si() None

Calls the init method and converts the parameters from gui units to SI units.

field: List[ndarray]
field_specifier: int
classmethod from_dict(dictionary: Dict[any]) FieldRecorder
Method to init an instance of the Gear class by passing a dictionary with the corresponding

arguments. Arguments that are in the dictionary and not in the class are ignored while arguments missing in the dictionary get initialised with the standard values defined in the template class method.

Returns:

Instance of the FieldRecorder class.

Return type:

FieldRecorder

get_data(field: List[ndarray]) None

Method to pass the measurement data saved in a dictionary to the sensor object.

Parameters:

field (List[np.ndarray]) – Measured h- oder b-field components from a completed process.

gui() FieldRecorder

Returns a copy of the class with attributes converted to units used in the gui.

gui_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

maxh: float
reset()

Calls the init method with the actual class attributes.

samples: ndarray
set_data(data_dict: Dict[str, List], magnetic_field: MagneticField) Dict[str, List]

Method to update the sensor measurement parameters for the current simulation step.

Parameters:
  • data_dict (Dict[str, List]) – Dictionary with the measurement data, shared between processes.

  • magnetic_field (MagneticField) – Instance of the MagneticField class.

classmethod template(sim_params: Dict[str, any] | None = None)
to_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

libs.elements.sensors.GMRSensor module

class libs.elements.sensors.GMRSensor.GMRSensor(pos: ndarray, rot: ndarray, depth: float, height: float, gmr_offset: ndarray, gmr_length: float, gmr_sampling: int, sensor_sampling: int, maxh: float, **kwargs)

Bases: Sensor

Represents the sensor properties and includes the methods to calculate the output voltages of the sensor.

Parameters:
  • pos (numpy.ndarray) – Position of the sensor in the 3D space.

  • rot (numpy.ndarray) – Rotation of the sensor in the 3D space in radians. The GMR elements are arranged along the body-fixed x-axis.

  • depth (float) – Size of the sensor along the body-fixed y-axis.

  • height (float) – Size of the sensor along the body-fixed z-axis.

  • gmr_offset (numpy.ndarray) – Positions of the GMR elements along the body-fixed x-axis.

  • gmr_length (float) – Length of the GMR elements along the body-fixed x-axis.

  • gmr_sampling (int) – Number of sampling points at which the magnetic field strengths in a GMR element are measured and summarized.

  • sensor_sampling (int) – Number of sampling points at which the magnetic field is recorded along the sensor length.

  • maxh (float) – Maximum mesh size of the sensor.

  • resistance (List[numpy.ndarray]) – List of arrays with the resistance of each GMR element at each time step.

  • u_sin (List[float]) – List of the sensor voltage output U_sin at each time step.

  • u_cos (List[float]) – List of the sensor voltage output U_cos at each time step.

  • h_sensor (List[numpy.ndarray]) – Magnetic field components along the sensor during the current simulation step.

  • architectures (List[str]) – Deposited sensor designs which can be selected in the gui.

  • width (float) – Sensor length along the body-fixed x-axis regarding the GMR elements and the GMR length.

  • dim (numpy.ndarray) – Dimension of the sensor along the body-fixed coordinate axes.

  • transformation_matrix (numpy.ndarray) – The transformation matrix to transform the global coordinate system to the body-fixed coordinate system with the arrangement of the GMR elements along the body-fixed x-axis.

  • gmr_position_matrix (numpy.ndarray) – Array of points in the 3D space describing the position of each GMR element of the sensor.

  • gmr_sampling_matrix (numpy.ndarray) – Array of points in the 3D space describing the sampling points of each GMR element of the sensor.

  • sensor_sampling_matrix (numpy.ndarray) – Array of sampling points in the 3D space at which the magnetic field is measured along the sensor length.

architectures: List[str] = ['select', 'GL711', 'GL712', 'GL713', 'GL714', 'GL715']
convert_to_si() None

Calls the init method and converts the parameters from gui units to SI units.

depth: float
dim: ndarray
classmethod from_dict(dictionary: Dict[any]) GMRSensor
Method to init an instance of the Gear class by passing a dictionary with the corresponding

arguments. Arguments that are in the dictionary and not in the class are ignored while arguments missing in the dictionary get initialised with the standard values defined in the template class method.

Returns:

Instance of the GMRSensor class.

Return type:

GMRSensor

get_data(resistance: List[ndarray], u_sin: List[float], u_cos: List[float], h_sensor: List[ndarray]) None

Method to pass the measurement data saved in a dictionary to the sensor object.

Parameters:
  • resistance (List[numpy.ndarray]) – List of arrays with the resistance of each GMR element at each time step.

  • u_sin (List[float]) – List of the sensor voltage output U_sin at each time step.

  • u_cos (List[float]) – List of the sensor voltage output U_cos at each time step.

  • h_sensor (List[numpy.ndarray]) – Magnetic field components along the sensor during the current simulation step.

get_gmr_h_values(field: MagneticField) ndarray
Method to calculate the magnetic field strength sampled over the length of a GMR element for all GMR elements

of the sensor.

Parameters:

field (MagneticField) – Magnetic field.

Returns:

Magnetic field strength at the GMR elements positions.

Return type:

numpy.ndarray

get_gmr_position_matrix() ndarray

Method of calculating the coordinates in 3D space with the positions of the centers of the GMR elements.

Returns:

Matrix of GMR elements center points.

Return type:

np.ndarray

get_gmr_resistances(h_field: ndarray) ndarray
Method to calculate the GMR elements resistances in respect to a given magnetic field strength H.

The characteristic curve which indicates the relationship between field strength and resistance is deposited here.

Parameters:

h_field (numpy.ndarray) – Magnetic field strength over each GMR element.

Returns:

Resulting resistances of each GMR element.

Return type:

numpy.ndarray

get_gmr_sampling_matrix() ndarray
Method of calculating the coordinates in 3D space at which the magnetic field for a specific GMR

element is sampled. Sample points are calculated by the midpoint rule.

Returns:

Matrix of sample points.

Return type:

numpy.ndarray

get_sensor_sampling_matrix() ndarray
Method for calculating the coordinates in 3D space at which the magnetic field is sampled over the entire

sensor.

Returns:

Matrix of sample points.

Return type:

numpy.ndarray

get_transformation_matrix() ndarray
Method for calculating the transformation matrix to transform the global coordinate system into the

body-fixed coordinate system, where the x-axis points along the arrangement of the GMR elements.

Returns:

The transformation matrix.

Return type:

numpy.ndarray

static get_u_cos(r: ndarray) float

Method for calculating the cosinus sensor signal with the resistance values on each gmr element.

Returns:

Cosinus sensor signal.

Return type:

float

static get_u_sin(r: ndarray) float

Method for calculating the sinus sensor signal with the resistance values on each gmr element.

Returns:

Sinus sensor signal.

Return type:

float

gmr_length: float
gmr_offset: ndarray
gmr_position_matrix: ndarray
gmr_sampling: int
gui() GMRSensor

Returns a copy of the class with attributes converted to units used in the gui.

gui_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

h_sensor: List[ndarray]
height: float
maxh: float
pos: ndarray
reset() None

Calls the init method with the actual class attributes.

resistance: List[ndarray]
rot: ndarray
sensor_sampling: int
sensor_sampling_matrix: ndarray
set_data(data_dict: Dict[str, List], field: MagneticField) Dict[str, list]
Method to update the sensor measurement parameters for the current simulation step. Parameters to be updated

are the resistances array, the output voltages u_sin and u_cos and the H-field along the sensor axis h_sensor.

Parameters:
  • data_dict (Dict[str, List]) – Dictionary with the measurement data, shared between processes.

  • field (MagneticField) – Instance of the MagneticField class.

classmethod template() GMRSensor

Class method to init the class with a set of standard values.

Returns:

Object of the GMRSensor class.

Return type:

GMRSensor

to_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

transformation_matrix: ndarray
u_cos: List[float]
u_sin: List[float]
update(field: MagneticField) None
Method to update the sensor measurement parameters for the current simulation step. Parameters to be updated

are the resistances array, the output voltages u_sin and u_cos and the H-field along the sensor axis h_sensor.

Parameters:

field (MagneticField) – Instance of the MagneticField class.

width: float
class libs.elements.sensors.GMRSensor.GMRSensorProperties(value)

Bases: Enum

Enumeration class which assigns the properties of the stored sensors to their respective name.

GL711 = [[-455.0, -295.0, -205.0, -45.0, 45.0, 205.0, 295.0, 455.0], 85.0]
GL712 = [[-910.0, -590.0, -410.0, -90.0, 90.0, 410.0, 590.0, 910.0], 160.0]
GL713 = [[-1365.0, -885.0, -615.0, -135.0, 135.0, 615.0, 885.0, 1365.0], 245.0]
GL714 = [[-427.7, -277.3, -192.7, -42.3, 42.3, 192.7, 277.3, 427.7], 75.0]
GL715 = [[-714.35, -463.15, -321.85, -70.65, 70.65, 321.85, 463.15, 714.35], 125.0]

libs.elements.sensors.HallSensor module

class libs.elements.sensors.HallSensor.HallSensor(pos: ndarray, rot: ndarray, dim: ndarray, hall_coefficient: float, conductor_thickness: float, current: float, maxh: float, **kwargs)

Bases: Sensor

convert_to_si() None

Calls the init method and converts the parameters from gui units to SI units.

classmethod from_dict(dictionary: Dict[any]) HallSensor
Method to init an instance of the HallSensor class by passing a dictionary with the corresponding

arguments.

Returns:

Instance of the HallSensor class.

Return type:

HallSensor

get_data(hall_voltage: List[float]) None

Method to pass the measurement data saved in a dictionary to the sensor object.

Parameters:

hall_voltage (List[float]) – Hall Voltage

get_hall_voltage(field: MagneticField) float

Method for calculating the hall voltage along the body-fixed x-axis of the sensor.

Parameters:

field (MagneticField) – Instance of the MagneticField class.

Returns:

The transformation matrix.

Return type:

numpy.ndarray

get_transformation_matrix() ndarray
Method for calculating the transformation matrix to transform the global coordinate system into the

body-fixed coordinate system.

Returns:

The transformation matrix.

Return type:

numpy.ndarray

gui() HallSensor

Returns a copy of the class with attributes converted to units used in the gui.

Returns:

Object of the HallSensor class.

Return type:

HallSensor

gui_dict() Dict[str, any]

Method creates a dictionary of the class members that will be stored in the ini file. Variables not passed to the init method are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

reset() None

Calls the init method with the actual class attributes.

set_data(data_dict: Dict[str, List], field: MagneticField) Dict[str, List]
Method to update the sensor measurement parameters for the current simulation step. Parameter to be updated

is the hall_voltage.

Parameters:
  • data_dict (Dict[str, List]) – Dictionary with the measurement data, shared between processes.

  • field (MagneticField) – Instance of the MagneticField class.

classmethod template() HallSensor

Class method to init the class with a set of default values.

Returns:

Object of the HallSensor class.

Return type:

HallSensor

to_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

libs.elements.sensors.SensorTemplate module

class libs.elements.sensors.SensorTemplate.SensorTemplate(*args, **kwargs)

Bases: Sensor

convert_to_si() None

Calls the init method and converts the parameters from gui units to SI units.

classmethod from_dict(dictionary: Dict[any]) SensorTemplate
Method to init an instance of the SensorTemplate class by passing a dictionary with the corresponding

arguments.

Returns:

Instance of the SensorTemplate class.

Return type:

SensorTemplate

get_data(measurement_data) None

Method to pass the measurement data saved in a dictionary to the sensor object.

gui() SensorTemplate

Returns a copy of the class with attributes converted to units used in the gui.

Returns:

Object of the SensorTemplate class.

Return type:

SensorTemplate

gui_dict() Dict[str, any]

Method creates a dictionary of the class members that will be stored in the ini file. Variables not passed to the init method are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

reset() None

Calls the init method with the actual class attributes.

set_data(data_dict: Dict[str, List], field: MagneticField) Dict[str, List]

Method to update the sensor measurement parameters for the current simulation step.

Parameters:
  • data_dict (Dict[str, List]) – Dictionary with the measurement data, shared between processes.

  • field (MagneticField) – Instance of the MagneticField class.

classmethod template() SensorTemplate

Class method to init the class with a set of default values.

Returns:

Object of the SensorTemplate class.

Return type:

SensorTemplate

to_dict() Dict[str, any]
Method creates a dictionary of the class members that will be stored in the HDF5 file. Variables created

automatically when instantiating an object of the class are excluded from the dictionary. This creates the opportunity to initiate an instance of the class by parsing the dictionary as argument.

Returns:

The dictionary of the classes members.

Return type:

Dict[str, any]

Module contents