Basic Circuit Elements¶
These elements are defined in the schemdraw.elements module.
2-terminal Elements¶
Two-terminal devices subclass schemdraw.elements.Element2Term
, and have leads that will be extended to make the element the desired length depending on the arguments.
All two-terminal elements define start, end, and center anchors for placing, and a few define other anchors as shown in blue in the table below.
Some elements have optional parameters, shown in parenthesis in the table below.
Single-Terminal Elements¶
Single terminal elements are drawn about a single point, and do not move the current drawing position.
Switches¶
The standard toggle switch is listed with other two-terminal elements above. Single-pole, double-throw switches are shown here, with anchors a, b, and c, and the action parameter to add an open or closing arrow.
Labels¶
The Label element can be used to add a label anywhere. The Gap is like an “invisible” element, useful for marking the voltage between output terminals.
Operational Amplifiers¶
The Opamp element defines several anchors for various inputs, including voltage supplies and offset nulls.
Cables¶
Coaxial and Triaxial cables are 2-Terminal elements that can be made with several options and anchors. Coax parameters include length, radius, and leadlen for setting the distance between leads and the shell. Triax parameters include length, radiusinner, radiusouter, leadlen, and shieldofststart for offseting the outer shield from the inner guard.
Transformers¶
The schemdraw.elements.xform.Transformer()
element is used to create various transformers.
Anchors p1, p2, s1, and s2 are defined for all transformers, with other anchors defined based on the rtaps and ltaps parameters.
-
class
schemdraw.elements.xform.
Transformer
(t1=4, t2=4, core=True, ltaps=None, rtaps=None, loop=False)¶ Transformer element
- Parameters
t1 (int) – turns on left side
t2 (int) – turns on right side
core (bool) – show the transformer core
ltaps (dict) – anchor definitions for left side. Each key/value pair defines the name/turn number
rtaps (dict) – anchor definitions for right side.
loop (bool) – Use spiral/cycloid (loopy) style
- Returns
element definition dictionary
- Return type
dict
Anchors, including a custom tap on the right side:
x = d.add(elm.Transformer(t1=4, t2=8, rtaps={'B':3}))
d.add(elm.Line, xy=x.s1, l=d.unit/4, rgtlabel='s1', color='blue')
d.add(elm.Line, xy=x.s2, l=d.unit/4, rgtlabel='s2', color='blue')
d.add(elm.Line, xy=x.p1, l=d.unit/4, d='left', lftlabel='p1', color='blue')
d.add(elm.Line, xy=x.p2, l=d.unit/4, d='left', lftlabel='p2', color='blue')
d.add(elm.Line, xy=x.B, l=d.unit/4, d='right', rgtlabel='B', color='blue')
display(d)