simplipfy.Magnetic package

Submodules

simplipfy.Magnetic.MagneticTransformer module

class simplipfy.Magnetic.MagneticTransformer.MagneticTransformer(magneticFilename: str, path: str)

Bases: object

check_transformation(cptNames: list[str]) MagneticStates

Check whether a group of magnetic components can be transformed. :param cptNames: List of magnetic component identifiers.

Returns:

MagneticStates | bool

in_series(cptNames: list[str]) bool

checks if components of magnetic-circuit graph are all in series A set of components is considered to be in series if: - Only two nodes occur once (e.g. we have a connected graph component). - All internal nodes have degree 2 in the graph.

is_parallel_to_source(cpt) bool
transformed_all_elements() bool

Checks if all magnetic components have been transformed. Returns: True if all elements of magnetic circuit are transformed to electric elements

write_new_lines(cptNames: list[str]) list[str]

Generate electric netlist lines for a transformed component group. If the first component is a magnetic source (type ‘V’), the function creates an MMF source and series resistance. Otherwise, resistance of all components in the group (in series) are summed.

cptNames: List of magnetic component identifiers.

Returns: List[str]: Lines representing the equivalent electric netlist.

simplipfy.Magnetic.elements module

class simplipfy.Magnetic.elements.Gap(data: list[str | Literal['up', 'down', 'left', 'right', None]])

Bases: MagneticElementBase

core: MagneticCore = None
gap: MagneticCore = None
mf(magnetomotiveForce: float | int | Expr) Expr
mmf(magneticFlux: float | int | Expr) Expr
property mr: Expr
static parse(string: str) Gap
Parameters:

string – string to parse

Returns:

Gap object with the parsed values

parses a magnetic core from a string of the form “C length relativePermeability area”

type = 'G'
class simplipfy.Magnetic.elements.MagneticCore(data: list[str | Literal['up', 'down', 'left', 'right', None]])

Bases: MagneticElementBase

property area: Expr
property length: Expr
mf(magnetomotiveForce: float | int | Expr) Expr
mmf(magneticFlux: float | int | Expr) Expr
property mr: Expr
property p
static parse(string: str) MagneticCore
Parameters:

string – string to parse

Returns:

MagneticCore object with the parsed values

parses a magnetic core from a string of the form “C length relativePermeability area”

property permeability: Expr
property relativePermeability: Expr
type = 'C'
class simplipfy.Magnetic.elements.MagneticElementBase(data: list[str | Literal['up', 'down', 'left', 'right', None]])

Bases: ABC

componentType = ''
drawingDirection: Literal['up', 'down', 'left', 'right', None] = ''
identifier = ''
magneticConstant = pi/2500000
magneticFlux(magnetomotiveForce: float | int | Expr) Expr
property magneticResistance: Expr
magnetomotiveForce(magneticFlux: float | int | Expr) Expr
abstractmethod mf(magnetomotiveForce: float | int | Expr) Expr
abstractmethod mmf(magneticFlux: float | int | Expr) Expr
abstract property mr: Expr
negativeNode = ''
netlist = ''
static parse(string: str) list[str | Literal['up', 'down', 'left', 'right', None]]
Parameters:

string – string to parse

Returns:

(positiveNode, negativeNode)

parses the nodes from a string of the form “<componentType><identifier> <positive Node> <negative Node> {arg1}, {arg2}, … ; <drawing hint>”

positiveNode = ''
class simplipfy.Magnetic.elements.MagneticElementFkt

Bases: object

static getElement(line: str) MagneticCore | Gap | MagnetomotiveForceSource
class simplipfy.Magnetic.elements.MagnetomotiveForceSource(data: list[str | Literal['up', 'down', 'left', 'right', None]])

Bases: MagneticElementBase

core: MagneticCore = None
property currentOfSource: Expr
mf(magneticResistance: float | int | Expr) Expr
mfSource(magneticResistance: float | int | Expr) Expr
mmf(magneticFlux: float | int | Expr) Expr
property mmfSource: Expr
property mr: Expr
property numberOfWindings: Expr
static parse(string: str) MagnetomotiveForceSource
Parameters:

string – string to parse

Returns:

MagnetomotiveForceSource object with the parsed values

parses a magnetic core from a string of the form “C length relativePermeability area”

type = 'V'

simplipfy.Magnetic.magneticCircuit module

class simplipfy.Magnetic.magneticCircuit.MCircuit

Bases: object

append(element: MagneticCore | Gap | MagnetomotiveForceSource)
filterElems(type: Type[T]) list[T]
property graph: Graph

Build a graph representation of the magnetic circuit. Each component in the netlist becomes an edge in an undirected graph. netlist: Parsed magnetic netlist containing circuit components.

property netlist: str
static parse(netlist: str) MCircuit

simplipfy.Magnetic.magneticStates module

class simplipfy.Magnetic.magneticStates.MagneticStates(*values)

Bases: Enum

MagneticStates is an enumeration that defines the possible states of the Chosen Magnetic Elements. Those are used for error handling/ error messages in the frontend.

chooseOneElement = 4
duplicateElement = 1
isTransformable = 0
notInSeries = 3
notSingleSource = 2

simplipfy.Magnetic.testMagnetic module

simplipfy.Magnetic.testSVG-Generation module

Module contents