Skip to main content

Crate stem_magnet

Crate stem_magnet 

Source
Expand description

Permanent magnet definition for stem - a Simulation Toolbox for Electric Motors.

Feedback welcome!
Found a bug, missing docs, or have a feature request?
Please open an issue on GitHub.

This crate provides the Magnet trait for permanent magnets in the stem (Simulation Toolbox for Electric Motors) framework (see the stem book). The trait itself has little logic and mainly specifies an interface for using permanent magnets in simulation models.

The following predefined implementors of Magnet are available:

  • BlockMagnet: A cuboid magnet, possibly with fillets.
  • BreadLoafMagnet: A cuboid magnet for surface mounting where the surface facing the air gap is curved to improve the air gap field.
  • ArcParallelMagnet: A curved magnet for surface mounting in rotary machines where the sides are parallel to each other.
  • ArcSegmentMagnet: A curved magnet for surface mounting in rotary machines where the sides are radially oriented.

Magnet types overview

If those magnet types do not suffice, it is very easy to define your own magnet type by implementing Magnet. See the trait documentation for details.

§Serialization and deserialization

If the serde feature is enabled, all magnet types from this crate can be serialized and deserialized. During deserialization, the invariants are validated (to e.g. prevent negative length for a BlockMagnet).

Units and quantities can be deserialized from strings representing SI units via the dyn_quantity crate. Similarily, it is possible to serialize the quantities of a wire as value-unit strings using the serialize_with_units function.

See the chapter serialization and deserialization of the stem book for details.

§Acknowledgments

The technical drawings used in the docstrings have been created using LibreCAD (https://librecad.org/).

Modules§

arc
This module offers arc magnet types (via submodules which are reexported).
assembly
This module provides the MagnetAssembly, which forms a magnetic rotor pole out of one or more magnets which are packed next to each other. See the struct documentation for more.
block
This module defines a BlockMagnet - a basic cuboid magnet shape. See the struct documentation for more.
bread_loaf
This module defines a BreadLoafMagnet - a block magnet with an arced surface towards the air gap. See the struct documentation for more.
error
This module contains the Error enum, which represents the different ways building one of the predefined wires can fail due to invalid input data. The Error::Other variants supports arbitrary errors resulting from user-created wire types.
magnet
The Magnet trait for defining permanent magnets in stem.
prelude
This module reexports all wire types defined in stem_material, the Magnet trait as well as the stem_material::prelude module to simplify the usage of this crate.

Constants§

DARK_GREEN
Color used for the south side when visualizing a magnet.
RED
Color used for the north side when visualizing a magnet.