API reference
Every name elecdef exports, as printed by python -m elecdef api.
## elecdef
class At(*conds: 'Quantity | Range | Enum') -> 'None'
The conditions a figure holds under, one per kind, in a canonical order.
class Body(width: 'Quantity | None' = None, height: 'Quantity | None' = None, depth: 'Quantity | None' = None, ip: 'IpCode | None' = None, temperature: 'Ranges' = (), mounting: 'Mounting | None' = None) -> 'None'
The physical body of a part.
Temperature rows tell operating (RATED) from storage (LIMITING) by their role.
class Breaker(poles: 'int | None' = None, current: 'Range | None' = None, curve: 'TripCurve | None' = None, icn: 'Range | None' = None, icu: 'Range | None' = None, ics: 'Range | None' = None, rating: 'Rating | None' = None, aux: 'tuple[Contact, ...]' = (), connection: 'Connection | None' = None, body: 'Body | None' = None, symbol: 'Symbol | None' = None) -> 'None'
A circuit breaker: current, trip curve and breaking capacities, pole pins, auxiliaries.
Pins and links are computed on every read, so `replace(breaker, poles=1)` leaves none stale.
class Coil(kind: 'CoilKind | None' = None, voltage: 'Ranges' = (), pick_up: 'Range | None' = None, drop_out: 'Range | None' = None, resistance: 'Range | None' = None, power: 'Ranges' = (), apparent_power: 'Ranges' = (), operate_time: 'Range | None' = None, release_time: 'Range | None' = None, suppression: 'Suppression | None' = None, connection: 'Connection | None' = None, own_pins: 'tuple[Pin, ...]' = (), symbol: 'Symbol | None' = None) -> 'None'
One coil: kind, drive figures, suppression, and the pins computed from kind and suppression.
`own_pins` holds only pins the author gave; with none, `pins` is A1 and A2 read on every access.
class Connection(technology: 'Technology | None' = None, conductor: 'Ranges' = (), conductor_awg: 'Ranges' = (), conductors_per_clamp: 'int | None' = None, strip_length: 'Quantity | None' = None, torque: 'Range | None' = None, screw: 'ScrewSize | None' = None, pitch: 'Quantity | None' = None, material: 'ConductorMaterial | None' = None) -> 'None'
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
class Contact(form: 'ContactForm | None' = None, features: 'frozenset[ContactFeature]' = <factory>, switching: 'Ranges' = (), voltage: 'Ranges' = (), min_load_voltage: 'Range | None' = None, min_load_current: 'Range | None' = None, material: 'ContactMaterial | None' = None, mechanical_life: 'int | None' = None, electrical_life: 'int | None' = None, connection: 'Connection | None' = None, number: 'int | None' = None, scheme: 'Marking | None' = None, own_pins: 'tuple[Pin, ...]' = (), symbol: 'Symbol | None' = None) -> 'None'
One contact: form, ratings per condition, and the pins computed from number and scheme.
`own_pins` holds only what the author gave; `pins` is read from `number` and `scheme` each time.
class ContactBlock(contacts: 'tuple[Contact, ...]' = (), numbered_from: 'int' = 1, actuator: 'ActuatorKind | None' = None, body: 'Body | None' = None, symbol: 'Symbol | None' = None) -> 'None'
A coil-less carrier of contacts numbered AUX from `numbered_from`.
class Contactor(coil: 'Coil | None' = None, main: 'tuple[Contact, ...]' = (), aux: 'tuple[Contact, ...]' = (), rating: 'Rating | None' = None, body: 'Body | None' = None) -> 'None'
A contactor: a coil, MAKE main contacts numbered MAIN 1..n, then auxiliaries AUX 1..n.
A mirror contact is an auxiliary whose features hold `ContactFeature.MIRROR`.
class Device(pins: 'tuple[Pin, ...]' = (), links: 'tuple[Link, ...]' = (), rating: 'Rating | None' = None, connection: 'Connection | None' = None, body: 'Body | None' = None, symbol: 'Symbol | None' = None) -> 'None'
A thing with no block of its own yet: its pins and links are stored as given.
Every field is unfilled by default.
class Fuse(system: 'FuseSystem | None' = None, fuse_class: 'FuseClass | None' = None, current: 'Range | None' = None, voltage: 'Ranges' = (), breaking_capacity: 'Ranges' = (), speed: 'FuseSpeed | None' = None, indicator: 'bool' = False, connection: 'Connection | None' = None, symbol: 'Symbol | None' = None) -> 'None'
A fuse: system, class, current, voltage and breaking capacity, and its two pins.
The pins are `1` (LINE) and `2` (LOAD), joined by a protective link.
class Issue(code: 'IssueCode', message: 'str', subject: 'str') -> 'None'
One finding: a code, a message and the subject path it concerns, such as `coil.voltage`.
class IssueCode
The closed set of issue codes; `check` reports the first six, `pick` the last two.
class Overload(poles: 'int | None' = None, setting: 'Range | None' = None, trip_class: 'TripClass | None' = None, reset: 'Reset | None' = None, phase_failure: 'bool' = False, aux: 'tuple[Contact, ...]' = (), connection: 'Connection | None' = None, body: 'Body | None' = None, symbol: 'Symbol | None' = None) -> 'None'
A motor overload relay: main pins per pole, then auxiliaries numbered OVERLOAD.
Pins and links are computed on every read, so `replace(overload, poles=2)` leaves none stale.
class Pick(found: 'Range | None' = None, issue: 'Issue | None' = None) -> 'None'
The answer of `pick`: exactly one of the range found or the issue.
class PlcCard(supply: 'SupplyInput | None' = None, groups: 'tuple[ChannelGroup, ...]' = (), form: 'CardForm | None' = None, role: 'CardRole | None' = None, bus: 'Bus | None' = None, sil: 'Sil | None' = None, pl: 'Pl | None' = None, body: 'Body | None' = None) -> 'None'
A PLC card: supply, groups of channels, form, role, bus and safety levels.
It stores no pins: `pins` are the supply pins, then each group's channel pins and common pins.
class PowerSupply(kind: 'PsuKind | None' = None, input: 'SupplyInput | None' = None, markings: 'tuple[str, ...]' = ('+', '-'), output_voltage: 'Range | None' = None, output_current: 'Ranges' = (), boost_current: 'Range | None' = None, hold_up: 'Range | None' = None, overload: 'OverloadBehaviour | None' = None, circuit_class: 'CircuitClass | None' = None, isolated: 'bool | None' = None, redundant: 'bool | None' = None, efficiency: 'Ranges' = (), ok_contact: 'Contact | None' = None, connection: 'Connection | None' = None, body: 'Body | None' = None, symbol: 'Symbol | None' = None) -> 'None'
A power supply: input, output figures and OK contact; the pins are read on every access.
Outputs: the first PLUS, the second MINUS, a further one PLUS; the OK contact is AUX 1.
class Product(mpn: 'str', manufacturer: 'str', block: 'Block', name: 'str | None' = None) -> 'None'
A maker's product: part number, manufacturer, optional name and the block it is.
`check` reports the figures the block's kind needs only for a block inside a Product.
class Quantity(value: 'Decimal', unit: 'Unit') -> 'None'
A Decimal and its Unit; `==` compares as written, `same` and ordering in base units.
class Range(role: 'Role', *, min: 'Quantity | None' = None, nom: 'Quantity | None' = None, typ: 'Quantity | None' = None, max: 'Quantity | None' = None, at: 'At' = At(items=())) -> 'None'
A figure as a datasheet states it: a role, up to four ends, and its conditions.
Ranges(iterable=(), /)
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
class Rating(voltage: 'Ranges' = (), insulation_voltage: 'Range | None' = None, impulse_voltage: 'Range | None' = None, thermal_current: 'Range | None' = None, frequency: 'Range | None' = None, overvoltage_category: 'OvervoltageCategory | None' = None, pollution_degree: 'PollutionDegree | None' = None, current: 'Ranges' = (), power_loss: 'Range | None' = None) -> 'None'
A part's ratings: voltages, currents, thermal current, power loss, frequency, clearances.
Every field is unfilled by default.
class Relay(kind: 'RelayKind | None' = None, coil: 'Coil | None' = None, contacts: 'tuple[Contact, ...]' = (), latching: 'bool' = False, force_guided: 'bool' = False, timer_function: 'TimerFunction | None' = None, body: 'Body | None' = None) -> 'None'
A relay: a coil and contacts numbered 1..n on every read (the timer scheme for a timer).
It owns no pin and no symbol of its own, so it has no connection.
class Role
What a stated figure means: the maker's rating, an extreme withstood, or a reference band.
class Symbol(key: 'str', version: 'int') -> 'None'
A reference to a drawn symbol by key and version.
Nothing else of the symbol is held here.
class TerminalBlock(kind: 'LevelKind | None' = None, levels: 'tuple[Level, ...]' = (), sides: 'tuple[Connection, ...]' = (), cross_section: 'Quantity | None' = None, short_time_current: 'Range | None' = None, width: 'Quantity | None' = None, rail: 'Rail | None' = None, rating: 'Rating | None' = None, body: 'Body | None' = None, symbol: 'Symbol | None' = None) -> 'None'
A terminal block: its levels, the connection on each side and its mounting.
Pins are computed from the levels on every read.
class Unit
A unit of one kind with an exact factor to the base unit; `U.V(24)` builds a Quantity.
check(block: 'Block | Product') -> 'tuple[Issue, ...]'
Report the content issues of a block, or of the block inside a Product, as a tuple.
A figure a block kind needs is reported only inside a Product; a bare block is a template.
pick(ranges: 'tuple[Range, ...]', *ask: 'Quantity | Range | Enum') -> 'Pick'
The one range whose conditions cover every ask, else NO_RATING or AMBIGUOUS_RATING.
## elecdef.vocab
class ActuatorKind
The kind of operating head.
class Armour
The armour construction.
class Bus
The field or network bus.
class CardForm
The build form of a card.
class CardRole
The role of a card in a station.
class CircuitClass
The protective class of a circuit.
class Coding
The connector coding key.
class CoilKind
The drive kind of a coil.
class CoilState
The state of a coil a figure is stated for.
class Colour
A conductor colour code.
class ConductorClass
The conductor stranding class.
class ConductorKind
The construction of a conductor a terminal range is stated for.
class ConductorMaterial
The metal a conductor is made of.
class ConnectorFamily
The connector family.
class ContactFeature
A special property of a contact.
class ContactForm
The switching form of a contact.
class ContactMaterial
The contact surface material.
class CoreRole
The role of a core in a cable.
class Current
The current kind a figure is stated for.
class DiType
The digital input type.
class FuseClass
The fuse operating class, as typed on the fuse.
class FuseSpeed
The fuse speed letters.
class FuseSystem
The fuse construction system.
class Gender
The connector gender.
class Insulation
The conductor insulation material.
class IpCode
Ingress protection class, by name.
class Kind
The physical kind a unit belongs to; conversion and comparison stay inside one kind.
class LevelKind
The kind of a terminal level.
class Locking
How a connector locks.
class Mounting
How a part is fixed in place.
class OutputKind
The digital output stage.
class OverloadBehaviour
How a supply behaves on overload.
class OvervoltageCategory
Overvoltage category of the installation point.
class Pl
The performance level.
class Polarity
The digital channel polarity.
class PollutionDegree
Pollution degree of the environment.
class PortKind
The kind of a data port.
class Potential
The potential a level carries.
class PsuKind
The kind of power supply.
class Rail
The mounting rail kind.
class RelayKind
The kind of relay.
class Reset
How a protective device is reset.
class RtdType
The resistance thermometer type.
class Scheme
The wire colour scheme family.
class Screen
The screen construction.
class ScrewSize
Terminal screw thread size.
class SheathMaterial
The outer sheath material.
class Signal
The signal kind of a channel.
class Sil
The safety integrity level.
class Suppression
How a coil is suppressed against switch-off spikes.
class Technology
How a conductor or part is joined.
class ThermocoupleType
The thermocouple type letter.
class TimerFunction
The function of a timing relay.
class TripClass
The motor protection trip class.
class TripCurve
The breaker trip curve letter.
class Utilisation
The utilisation code a contact rating is stated for.
## elecdef.connections
BOLT: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
CRIMP: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
IDC: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
PLUG_IN: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
PRESS_IN: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
PUSH_IN: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
SCREW: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
SMD: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
SOLDER: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
SPRING_CAGE: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
TENSION: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
THT: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
WIRE_WRAP: Connection
One connection point: its technology, conductor range, strip length and torque.
Every field is unfilled by default, so a leaf states only its technology.
## elecdef.pins
class Link(markings: 'tuple[str, ...]', kind: 'LinkKind', closed_at_rest: 'bool | None' = None) -> 'None'
A join between the two pins named by `markings`; `closed_at_rest` is for a switched link.
class LinkKind
How two pins of a part are joined.
class Marking
The marking schemes; TIMER and PLAIN are proposed, not sourced.
class Pin(marking: 'str', role: 'PinRole', side: 'Side | None' = None, alternates: 'tuple[str, ...]' = ()) -> 'None'
One pin: its marking, its role, its side and the alternate markings it may carry.
class PinRole
What a pin does in its part.
class Side
Which side of a part a pin is on.
contact_pins(form: 'ContactForm', n: 'int', scheme: 'Marking') -> 'tuple[tuple[Pin, ...], tuple[Link, ...]]'
Return the pins and links of contact `n` (1 to 9) in `form` under `scheme`.
Raises TypeError for an `n` out of range or a form the scheme does not have.
## elecdef.supply
class SupplyInput(voltage: 'Ranges' = (), current: 'Ranges' = (), pins: 'tuple[Pin, ...]' = (Pin(marking='+', role=<PinRole.PLUS: 7>, side=None, alternates=()), Pin(marking='-', role=<PinRole.MINUS: 8>, side=None, alternates=())), connection: 'Connection | None' = None) -> 'None'
What a powered thing draws: voltage and current per conditions, and its supply pins.
The pins default to a plus and a minus; a connection is unfilled until a leaf states one.
## elecdef.plc
class AnalogIo(span: 'Range | None' = None, bits: 'int | None' = None, wires: 'int | None' = None, rtd: 'RtdType | None' = None, thermocouple: 'ThermocoupleType | None' = None, accuracy: 'Ranges' = ()) -> 'None'
An analog channel: a voltage or current span, resolution, wires, sensor type and accuracy.
Every field is unfilled by default; the block holds no pin and no connection.
class Channel(signal: 'Signal | None' = None, number: 'int | None' = None, electrical: 'DigitalInput | DigitalOutput | AnalogIo | Contact | None' = None, pins: 'tuple[Pin, ...]' = (), symbol: 'Symbol | None' = None) -> 'None'
One channel: its signal, number, electrical block and the pins it is wired on.
A leaf like Device: the pins are stored as given. A group's template carries no number or pins.
class ChannelGroup(template: 'Channel | None' = None, markings: 'tuple[str, ...]' = (), common: 'tuple[str, ...]' = (), isolated: 'bool | None' = None, group_current: 'Range | None' = None, connection: 'Connection | None' = None) -> 'None'
Channels that share a template and a common: one per marking, numbered from `first`.
`common` holds the markings of the group's common pins; every channel shares one `electrical`.
class DigitalInput(input_type: 'DiType | None' = None, polarity: 'Polarity | None' = None, voltage: 'Ranges' = (), off_max: 'Range | None' = None, on_min: 'Range | None' = None, current: 'Ranges' = (), filter_time: 'Range | None' = None) -> 'None'
What a digital input channel accepts: its type, polarity, voltage, thresholds and filter.
Every field is unfilled by default; the block holds no pin and no connection.
class DigitalOutput(kind: 'OutputKind | None' = None, polarity: 'Polarity | None' = None, current: 'Ranges' = (), short_circuit_protected: 'bool | None' = None) -> 'None'
What a digital output channel delivers: its stage, polarity and current.
Every field is unfilled by default; the block holds no pin and no connection.
## elecdef.tables
AWG: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
AWG_METRIC: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
BREAKER_CURRENTS: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
BREAKER_CURVES: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
BREAKER_ICN: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
CABLE_VOLTAGES: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
CORE_COLOURS: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
CROSS_SECTIONS: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
E_SERIES: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
OVERVOLTAGE_IMPULSE: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
TRIP_TIMES: tuple
Built-in immutable sequence.
If no argument is given, the constructor returns an empty tuple.
If iterable is specified the tuple is initialized from iterable's items.
If the argument is a tuple, the return value is the same object.
## elecdef.terminal
class Level(marking: 'str', potential: 'Potential', kind: 'LevelKind') -> 'None'
One level of a terminal: its marking, the potential it carries and its kind.
## elecdef.fuse
class FuseHolder(system: 'FuseSystem | None' = None, poles: 'int | None' = None, disconnect: 'bool' = False, indicator: 'bool' = False, rating: 'Rating | None' = None, connection: 'Connection | None' = None, body: 'Body | None' = None, symbol: 'Symbol | None' = None) -> 'None'
A fuse holder: pins `2p-1` and `2p` per pole, each pole joined by a protective link.
## elecdef.conductor
class Conductor(material: 'ConductorMaterial | None' = None, conductor_class: 'ConductorClass | None' = None, area: 'Quantity | None' = None, gauge: 'Quantity | None' = None, insulation: 'Insulation | None' = None, max_temperature: 'Quantity | None' = None, colour: 'tuple[Colour, ...]' = (), voltage_u0: 'Quantity | None' = None, voltage_u: 'Quantity | None' = None) -> 'None'
One conductor: material, stranding class, cross-section, gauge, insulation and colour.
It has no pins; a product must fill the area.
## elecdef.cable
class Cable(conductor: 'Conductor | None' = None, cores: 'tuple[Core, ...]' = (), screen: 'Screen | None' = None, armour: 'Armour | None' = None, outer_diameter: 'Quantity | None' = None, bend_radius_static: 'Range | None' = None, bend_radius_moving: 'Range | None' = None, sheath_material: 'SheathMaterial | None' = None, sheath_colour: 'Colour | None' = None, temperature: 'Ranges' = (), halogen_free: 'bool | None' = None, flame_retardant: 'bool | None' = None, voltage_u0: 'Quantity | None' = None, voltage_u: 'Quantity | None' = None, type_code: 'TypeCode | None' = None) -> 'None'
A cable: its conductor, cores, screen, sheath and ratings.
Pins are computed on read: one per core, plus SH (role SCREEN) when a screen is set.
class Core(number: 'int | None' = None, colour: 'tuple[Colour, ...]' = (), pair: 'int | None' = None, role: 'CoreRole | None' = None, conductor: 'Conductor | None' = None) -> 'None'
One core of a cable: its number, colour code, pair, role and own conductor.
class TypeCode(scheme: 'Scheme', text: 'str') -> 'None'
A cable type designation: the scheme family and the text as printed.
## elecdef.connector
class Connector(family: 'ConnectorFamily | None' = None, coding: 'Coding | None' = None, poles: 'int | None' = None, gender: 'Gender | None' = None, locking: 'Locking | None' = None, shielded: 'bool' = False, rating: 'Rating | None' = None, connection: 'Connection | None' = None, body: 'Body | None' = None, symbol: 'Symbol | None' = None) -> 'None'
A connector: family, coding, poles, gender, locking and whether it is shielded.
Pins `1..poles` are computed on every read. Every field is unfilled by default.
## elecdef.computer
class Computer(supply: 'SupplyInput | None' = None, power: 'Range | None' = None, ports: 'tuple[Port, ...]' = (), body: 'Body | None' = None) -> 'None'
A computer: the supply it draws, its power and its data ports.
Pins are the supply pins, then one `<KIND><n>` pin per port instance, numbered per kind.
class Port(kind: 'PortKind', count: 'int' = 1, connector: 'Connector | None' = None) -> 'None'
A data port: its kind, how many there are and the connector it takes, if stated.