stem_core
Magnetic core definition definition for stem - a Simulation Toolbox for Electric Motors.
The full API documentation is available at https://docs.rs/stem_core/0.0.1/stem_core.
Feedback welcome!
Found a bug, missing docs, or have a feature request?
Please open an issue on GitHub.
This crate is part of the stem (Simulation Toolbox for Electric Motors) framework. See the stem book for an introduction.
stem_core builds upon the stem_magnet and stem_slot crates and provides the
LinCore and RotCore types for defining linear and rotary magnetic cores
of radial flux machines. The magnetic core is the centerpiece of the stator or
rotor of an electrical machine. It guides the magnetic flux and holds all
other active parts of the motor such as magnets or winding coils. The following
image shows a RotCore with surface magnets, a double-layered winding and
a FluxBarrier with interior magnets:
This image was produced with examples/readme_plots.rs.
The two fundamental core types LinCore and RotCore are modular: Air
gap shape and flux barriers can be customized independently via AirGap and
FluxBarrier trait objects, allowing the usage of user defined air
gaps or flux barriers. Additionally, the crate also provides a couple of
predefined AirGaps and FluxBarriers:
From left to right: PlainAirGap, SlottedAirGap and StraightIndentsAirGap.
From left to right: Spoke1FluxBarrier, V1rFluxBarrier and V2rFluxBarrier.
Example
The following code snippet shows how to create the RotCore showcased in the
first image and how to calculate various properties (e.g. for use in
simulations). Note the tight integration of stem_magnet and stem_slot into
stem_core:
use FRAC_PI_2;
use Arc;
use assert_abs_diff_eq;
use *;
use SemiTrapezoidWidthsAndHeightsBuilder;
let slot: SemiTrapezoidSlot = SemiTrapezoidWidthsAndHeightsBuilder
.try_into
.expect;
let air_gap = new;
let fb = V1rFluxBarrier ;
let core: RotCore = RotCoreBuilder
.try_into.expect;
// Calculate some properties of the core
assert_abs_diff_eq!;
assert_abs_diff_eq!;
assert_abs_diff_eq!;
// Carter factor for a given air gap
assert_abs_diff_eq!;
// The core has a slot -> Retrieve the "Slot" trait object
assert!;
// Evaluate the slotting ordinals (infinite iterator)
use Ratio;
let mut ordinals = core.slotting_ordinals;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
// ...
// Calculate the skew factor for different mechanical ordinals
assert_abs_diff_eq!;
assert_abs_diff_eq!;
// Iterate over all the orange coils shown in the image (should be 28 * 2 = 56)
assert_eq!;
// Return the mass of all interior magnets shown in the image
assert_abs_diff_eq!;
// Return the mass of all surface magnets shown in the image
let magnet = with_const_thickness.expect;
let surface_magnets = new;
assert_abs_diff_eq!;
Serialization and deserialization
If the serde feature is enabled, all types from this crate can be
serialized and deserialized. During deserialization, the invariants are
validated (to e.g. prevent a negative axial core length).
Units and quantities can be deserialized from strings representing SI units via the dyn_quantity crate. Similarly, it is possible to serialize quantities as value-unit strings using the serialize_with_units function.
See the chapter serialization and deserialization of the stem book for details.
Visualization
If the cairo feature is enabled, the core shapes can be drawn onto a
cairo context using the drawing mechanics from the
planar_geo crate. See its documentation
for details.
Acknowledgments
The technical drawings used in the docstrings have been created using LibreCAD (https://librecad.org/).