libs.elements package

Subpackages

Submodules

libs.elements.Component module

class libs.elements.Component.Component(pos: ndarray, mu_r: float, maxh: float)

Bases: object

Parent class contains the parameters to describe the position and magnetic properties of a component in the simulation. The shape and rotation is defined in one of the subclasses.

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

  • mu_r (float) – Permeability of the magnet.

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

abstract convert_to_si() None

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

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

arguments.

Returns:

Instance of the Component class.

Return type:

Component

abstract gui() Component

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

abstract 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]

maxh: float
mu_r: float
pos: ndarray
abstract reset() None

Calls the init method with the actual class attributes.

abstract classmethod template() Component

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

Returns:

Object of the Component class.

Return type:

Component

abstract 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]

abstract update(t: float) None

Method to update the states of a time dependent component.

Parameters:

t (float) – Current time stamp.

libs.elements.Magnet module

class libs.elements.Magnet.Magnet(pos: ndarray, m: float, mu_r: float, temperature: float, tk: float, maxh: float)

Bases: object

Parent class contains the parameters to describe the position and magnetic properties of a magnet in the simulation. The shape and rotation is defined in one of the subclasses.

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

  • m (float) – Magnetisation of the magnet at room temperature.

  • mu_r (float) – Permeability of the magnet.

  • temperature (float) – Temperature at which the magnet is operated.

  • tk (float) – Temperature coefficiency of the magnetisation in the area of 20-100°C.

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

abstract convert_to_si() None

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

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

arguments.

Returns:

Instance of the Magnet class.

Return type:

Magnet

abstract gui() Magnet

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

abstract 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]

m: float
maxh: float
mu_r: float
pos: ndarray
abstract reset() None

Calls the init method with the actual class attributes.

temperature: float
abstract classmethod template() Magnet

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

Returns:

Object of the Magnet class.

Return type:

Magnet

tk: float
abstract 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.Sensor module

class libs.elements.Sensor.Sensor(pos: ndarray, maxh: float)

Bases: object

Parent class contains the parameters to describe the position and max mesh size of a sensor in the simulation. The shape and rotation is defined in one of the subclasses.

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

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

abstract convert_to_si() None

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

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

arguments.

Returns:

Instance of the Sensor class.

Return type:

Sensor

abstract get_data(*args) None

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

abstract gui() Sensor

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

abstract 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]

maxh: float
pos: ndarray
abstract reset() None

Calls the init method with the actual class attributes.

abstract 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.

abstract classmethod template() Sensor

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

Returns:

Object of the Sensor class.

Return type:

Sensor

abstract 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.SimParams module

class libs.elements.SimParams.SimParams(boundaries: ndarray, t0: float, t1: float, samples: int, maxh_global: float, tol: float, maxit: int, **kwargs)

Bases: object

The parameters to specify the finite element space are summarized in this class.

Parameters:
  • boundaries (numpy.ndarray) – The dimensions in mm of the 3D space containing the scenery.

  • t0 (float) – Start time of the simulation.

  • t1 (float) – End time of the simulation.

  • samples (int) – Number of time samples.

  • maxh_global (float) – The maximum mesh size of all simulation elements including the air surrounding the elements.

  • tol (float) – The maximum tolerated iteration error of the finite element magnetic field calculation.

  • maxit (int) – The maximum number of allowed iterations to calculate the magnetic field.

  • t (np.ndarray) – Array containing the time stamps of the simulation.

boundaries: ndarray
classmethod from_dict(dictionary: Dict[any]) SimParams
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 SimParams class.

Return type:

SimParams

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_global: float
maxit: int
reset() None

Calls the init method with the actual class attributes.

samples: int
t: ndarray
t0: float
t1: float
classmethod template()
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]s

tol: float

Module contents