Esempio n. 1
0
# Generates schematic as an .svg file.
# Requires svg_schematic:
#     git clone https://github.com/KenKundert/svg_schematic.git
#     cd svg-schematic
#     python3 setup.py --user --upgrade install

from svg_schematic import (Schematic, shift, shift_x, shift_y, midpoint, Box,
                           Ground, Label, Source, Wire)

with Schematic(filename="msnm.svg"):
    v = Source(kind='noise', value='S(f)', orient='v')
    Ground(C=v.n, orient='v')

    m = Source(C=shift_x(v.p, 200), kind='mult')
    Wire([v.p, m.W])
    wm = Wire([m.S, shift_y(m.S, 25)])
    Label(C=wm.e, loc='S', name='m(t)')
    Label(C=midpoint(v.p, m.W), loc='N', name='stationary noise')

    wo = Wire([m.E, shift_x(m.E, 210)])
    Label(C=wo.e, kind='arrow', loc='NW', name='cyclostationary noise')

    Box(C=shift(v.C, 100, -3),
        w=5.5,
        h=3.2,
        line_width=0.5,
        background='none',
        stroke_dasharray="4 2")
Esempio n. 2
0
from svg_schematic import Schematic, Box, Wire, Label, shift_x, shift_y

with Schematic(filename='network-map.svg', line_width=2):
    # work network
    work = Box(w=6.5, h=4.5, stroke_dasharray="4 2")
    Label(C=work.SW, loc='ne', name='work')
    bastion = Box(S=work.S, yoff=-25, w=5.5, h=2, color='lightgray')
    Wire([bastion.E, shift_x(bastion.E, 75)])
    Label(C=bastion.SW, loc='ne', name='bastion')
    www = Box(NE=bastion.N,
              off=(-12.5, 25),
              w=2,
              h=1,
              color='white',
              name='www')
    mail = Box(NW=bastion.N,
               off=(12.5, 25),
               w=2,
               h=1,
               color='white',
               name='mail')
    dump = Box(SW=bastion.NW, yoff=-25, w=2.5, h=1, name='dump')
    laptop = Box(SE=bastion.NE,
                 yoff=-25,
                 w=2.5,
                 h=1,
                 name='my laptop',
                 stroke_dasharray="2 2")

    # home network
    home = Box(N=work.S, yoff=50, w=6.5, h=2, stroke_dasharray="4 2")
Esempio n. 3
0
from svg_schematic import Schematic, Source, Label
from inform import Error, error, os_error

try:
    with Schematic(filename = 'source.svg'):
        s = Source(kind='empty', name='Ve')
        Label(C=s.p, name='p', loc='w', kind='dot', color='blue', w=2)
        Label(C=s.n, name='n', loc='w', kind='dot', color='blue', w=2)

        s = Source(kind='vdc', name='Vd', C=s.C, xoff=150)
        Label(C=s.p, name='p', loc='w', kind='dot', color='blue', w=2)
        Label(C=s.n, name='n', loc='w', kind='dot', color='blue', w=2)

        s = Source(kind='idc', name='Id', C=s.C, xoff=150)
        Label(C=s.p, name='p', loc='w', kind='dot', color='blue', w=2)
        Label(C=s.n, name='n', loc='w', kind='dot', color='blue', w=2)

        s = Source(kind='sine', name='Vs', C=s.C, xoff=150)
        Label(C=s.p, name='p', loc='w', kind='dot', color='blue', w=2)
        Label(C=s.n, name='n', loc='w', kind='dot', color='blue', w=2)

        s = Source(kind='sum', name='S', yoff=150)
        Label(C=s.p, name='p', loc='w', kind='dot', color='blue', w=2)
        Label(C=s.n, name='n', loc='w', kind='dot', color='blue', w=2)

        s = Source(kind='mult', name='M', C=s.C, xoff=150)
        Label(C=s.p, name='p', loc='w', kind='dot', color='blue', w=2)
        Label(C=s.n, name='n', loc='w', kind='dot', color='blue', w=2)

        s = Source(kind='cv', name='Vc', C=s.C, xoff=150)
        Label(C=s.p, name='p', loc='w', kind='dot', color='blue', w=2)
Esempio n. 4
0
from svg_schematic import Schematic, Box, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='box.svg'):
        b = Box(name='4 bit', value='Flash')
        Label(C=b.i, name='i', loc='w', kind='dot', color='blue')
        Label(C=b.o, name='o', loc='e', kind='dot', color='blue')

        b = Box(name='𝘻⁻¹', w=1, h=1, C=b.C, xoff=150)
        Label(C=b.i, name='i', loc='w', kind='dot', color='blue')
        Label(C=b.o, name='o', loc='e', kind='dot', color='blue')
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 5
0
#!/usr/bin/env python3

from svg_schematic import (Schematic, Amp, Dot, Ground, Label, Pin, Resistor,
                           Source, Wire)
from inform import Error, error, os_error

try:
    with Schematic(filename="inverting.svg", font_size=16,
                   font_family='serif'):

        vin = Pin(kind='in', name='in', w=1.5)
        vout = Pin(C=vin.C, xoff=350, kind='out', name='out', w=2)
        Wire([vin.C, vout.C])
        rin = Resistor(W=vin.C, xoff=25, name='Rin')
        vg = Dot(C=rin.E, xoff=25)
        rfb = Resistor(W=vg.C, xoff=25, name='Rfb')
        oj = Dot(C=rfb.E, xoff=25)
        amp = Amp(C=rfb.C, yoff=75, orient='-', kind='oa')
        Wire([oj.C, amp.o], kind='|-')
        gnd = Ground(C=amp.pi, xoff=-25, orient='h|')
        Wire([gnd.C, amp.pi])
        Wire([vg.C, amp.ni], kind='|-')
        Label(C=vg.C, name='Vg', loc='sw')

except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 6
0
from svg_schematic import Schematic, Diode, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='diode.svg'):
        d = Diode(name='D1')
        Label(C=d.c, name='c', loc='e', kind='dot', color='blue')
        Label(C=d.a, name='a', loc='w', kind='dot', color='blue')
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 7
0
from svg_schematic import Schematic, Ground, Label
from inform import Error, error, os_error

try:
    with Schematic(filename = 'ground.svg'):
        g = Ground()
        Label(C=g.t, name='t', loc='n', kind='dot', color='blue')
        # Label(C=g.N, name='N', loc='n', kind='dot', color='blue')
        # Label(C=g.NE, name='NE', loc='ne', kind='dot', color='blue')
        # Label(C=g.E, name='E', loc='e', kind='dot', color='blue')
        # Label(C=g.SE, name='SE', loc='se', kind='dot', color='blue')
        # Label(C=g.S, name='S', loc='s', kind='dot', color='blue')
        # Label(C=g.SW, name='SW', loc='sw', kind='dot', color='blue')
        # Label(C=g.W, name='W', loc='w', kind='dot', color='blue')
        # Label(C=g.NW, name='NW', loc='nw', kind='dot', color='blue')
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 8
0
from svg_schematic import Schematic, Label, Wire, shift_x, shift_y
from inform import Error, error, os_error

try:
    with Schematic(filename='label.svg'):
        Wire([(0, -25), (0, 225)], color='cyan')
        l = Label(kind='plain', name='plain', loc='se', w=3)
        Wire([shift_x(l.C, -50), shift_x(l.C, 50)])
        l = Label(kind='arrow', name='arrow', C=l.C, yoff=50, loc='se', w=3)
        Wire([shift_x(l.C, -50), shift_x(l.C, 50)])
        l = Label(kind='arrow|', name='arrow|', C=l.C, yoff=50, loc='se', w=3)
        Wire([shift_x(l.C, -50), shift_x(l.C, 50)])
        l = Label(kind='slash', name='slash', C=l.C, yoff=50, loc='se', w=3)
        Wire([shift_x(l.C, -50), shift_x(l.C, 50)])
        l = Label(kind='dot', name='dot', C=l.C, yoff=50, loc='se', w=3)
        Wire([shift_x(l.C, -50), shift_x(l.C, 50)])
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 9
0
from svg_schematic import Schematic, Capacitor, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='capacitor.svg'):
        c = Capacitor(name='C1', value='1.2pF')
        Label(C=c.p, name='p', loc='n', kind='dot', color='blue')
        Label(C=c.n, name='n', loc='s', kind='dot', color='blue')
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 10
0
from svg_schematic import Schematic, BJT, Label
from inform import Error, error, os_error

try:
    with Schematic(
        filename = 'orient.svg',
        background = 'none',
    ):
        q11 = BJT(orient='v')
        l11 = Label(N=q11.S, name="orient='v'")
        q12 = BJT(W=q11.E, xoff=50, orient='v|')
        l12 = Label(N=q12.S, name="orient='v|'")
        q13 = BJT(W=q12.E, xoff=50, orient='v-')
        l13 = Label(N=q13.S, name="orient='v-'")
        q14 = BJT(W=q13.E, xoff=50, orient='v|-')
        l14 = Label(N=q14.S, name="orient='v|-'")
        q21 = BJT(N=l11.S, yoff=25, orient='h')
        l21 = Label(N=q21.S, name="orient='h'")
        q22 = BJT(N=l12.S, yoff=25, orient='h|')
        l22 = Label(N=q22.S, name="orient='h|'")
        q23 = BJT(N=l13.S, yoff=25, orient='h-')
        l23 = Label(N=q23.S, name="orient='h-'")
        q24 = BJT(N=l14.S, yoff=25, orient='h|-')
        l24 = Label(N=q24.S, name="orient='h|-'")
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 11
0
    MOS,
    Inductor,
    Label,
    Source,
    Wire,
    midpoint,
    shift,
    shift_y,
)
from inform import Error, error, os_error

try:
    with Schematic(filename="oscillator.svg", background='none', line_width=2):

        # resonator
        vdd = Label(loc='n', nudge=10, name=r'$V_{\rm dd}$')
        Wire([vdd.C, shift_y(vdd.C, 25)])
        ll = Inductor(p=shift(vdd.C, -125, 25),
                      orient='v',
                      name=r'$\frac{1}{2} L$')
        lr = Inductor(p=shift(vdd.C, 125, 25),
                      orient='v|',
                      name=r'$\frac{1}{2} L$')
        c = Capacitor(C=midpoint(ll.n, lr.n), orient='h', name='$C$')
        Wire([ll.p, lr.p])
        Wire([ll.n, c.p])
        Wire([lr.n, c.n])

        # gain stage
        ml = MOS(d=ll.n, yoff=75, orient='|')
        mr = MOS(d=lr.n, yoff=75, orient='')
Esempio n. 12
0
    with Schematic(filename='inverter.svg', line_width=2, background='none'):

        # transistor version
        mp = MOS(kind='p')
        mn = MOS(N=mp.S, kind='n')
        vin = Pin(C=midpoint(mp.g, mn.g),
                  xoff=-50,
                  kind='in',
                  name=r'$V_{\rm in}$',
                  w=2)
        vout = Pin(C=midpoint(mp.d, mn.d),
                   xoff=50,
                   kind='out',
                   name=r'$V_{\rm out}$',
                   w=2)
        Label(C=mp.s, loc='n', name=r'$V_{\rm dd}$')
        Ground(C=mn.s)
        Wire([vin.t, mp.g], kind='-|')
        Wire([vin.t, mn.g], kind='-|')
        Wire([vout.t, mp.d], kind='-|')
        Wire([vout.t, mn.d], kind='-|')

        # gate version
        inv = Gate(N=mn.S, yoff=25, kind='inv')
        vin = Pin(t=inv.i, xoff=-25, kind='in', name=r'$V_{\rm in}$', w=2)
        vout = Pin(t=inv.o, xoff=25, kind='out', name=r'$V_{\rm out}$', w=2)
        Wire([inv.o, vout.t])
        Wire([inv.i, vin.t])

except Error as e:
    e.report()
Esempio n. 13
0
from svg_schematic import Schematic, Gate, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='gate.svg'):
        u = Gate(kind='inv', name='U')
        Label(C=u.i, name='i', loc='w', kind='dot', color='blue', w=2)
        Label(C=u.o, name='o', loc='e', kind='dot', color='blue', w=2)

except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 14
0
                           Ground, Inductor, Label, MOS, Pin, Resistor, Switch,
                           Wire, shift, shift_x, shift_y, with_x, with_y,
                           midpoint)
from inform import Error, error, os_error

try:
    with Schematic(filename="buck.svg", line_width=2, background='none'):

        pvdd = Pin(kind='in', name='pvdd', w=2)
        avdd = Pin(C=pvdd.C, yoff=50, kind='in', name='avdd', w=2)
        Wire([avdd.C, shift_x(avdd.C, 50)])

        lvl = Pin(C=avdd.C, yoff=90, kind='in', name='lvl', w=2)
        reference = Converter(i=lvl.C, xoff=75, name='ref')
        lvl2ref = Wire([lvl.C, reference.i])
        Label(C=lvl2ref.m, kind='slash', name='6', loc='se')

        amp = Amp(pi=reference.o, xoff=50, kind='oa', name='amp')
        Wire([reference.o, amp.pi])
        C1 = Capacitor(p=amp.C, off=(-12.5, 75), orient='h')
        R1 = Resistor(p=C1.p, xoff=12.5, orient='h')
        C2 = Capacitor(C=midpoint(R1.C, C1.C), yoff=50, orient='h')
        Wire([C1.n, with_y(C1.n, amp.o)], kind='-|')
        Wire([R1.n, amp.ni], kind='|-')
        Wire([C2.p, R1.n], kind='-|')
        Wire([C2.n, C1.n], kind='-|')

        cmp = Amp(pi=amp.o, xoff=125, kind='comp', name='cmp')
        Wire([amp.o, cmp.pi])

        gd = Box(i=cmp.o, xoff=50, name='gate', value='drivers')
Esempio n. 15
0
    with_x,
    with_y,
)
from inform import Error, error, os_error

try:
    with Schematic(filename='pipeline-adc.svg', line_width=2):

        # Stage 1
        i = Pin(kind='in', name='in')
        s1 = Box(NW=i.t,
                 off=(25, -62.5),
                 w=10.5,
                 h=4.5,
                 background='lightgray')
        Label(C=s1.SE, loc='nw', name='Stage 1')
        adc = Box(W=i.t, off=(75, 100), name='2 bit', value='Flash')
        dac = Box(i=adc.o, xoff=50, name='2 bit', value='DAC')
        sh = Box(C=with_x(i.t, midpoint(adc.C, dac.C)), name='SAH')
        sum = Source(W=with_x(i.t, dac.E), xoff=25, kind='sum', orient='h|')
        Label(C=sum.W, loc='nw', name='+')
        Label(C=sum.S, loc='se', name='−')
        amp = Amp(i=sum.E, xoff=25, kind='se', name='4×')
        Wire([i.t, sh.i])
        Wire([sh.o, sum.W])
        Wire([sum.E, amp.i])
        Wire([shift_x(i.t, 50), adc.i], kind='|-')
        Wire([adc.o, dac.i])
        Wire([dac.o, sum.S], kind='-|')

        # Stages 2, 3, 4
Esempio n. 16
0
from svg_schematic import Schematic, BJT, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='bjt.svg'):
        q = BJT(kind='npn', name='Qn')
        Label(C=q.c, name='c', loc='n', kind='dot', color='blue')
        Label(C=q.b, name='b', loc='w', kind='dot', color='blue')
        Label(C=q.e, name='e', loc='s', kind='dot', color='blue')

        q = BJT(kind='pnp', name='Qp', C=q.C, xoff=150)
        Label(C=q.e, name='e', loc='n', kind='dot', color='blue')
        Label(C=q.b, name='b', loc='w', kind='dot', color='blue')
        Label(C=q.c, name='c', loc='s', kind='dot', color='blue')
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 17
0
from svg_schematic import (Schematic, shift_x, shift_y, Amp, Box, Ground,
                           Label, Pin, Source, Wire)

with Schematic(
        filename='receiver.svg',
        font_size=12,
        font_family='sans',
        outline='none',
        pad=20,
        line_width=2,
) as schematic:

    # Input from horn antenna
    rf_in = Pin(kind='in', name='L-band Horn', w=3)
    Label(C=rf_in.C, yoff=15, loc='w', name='fc=1420MHz', w=3.5, nudge=14)
    Label(C=rf_in.C, yoff=30, loc='w', name='BW=15MHz', w=3.5, nudge=14)

    # First preamp
    rf_preamp1 = Amp(i=rf_in.t, xoff=25, kind='se', name='RF Preamp1')
    Label(C=rf_preamp1.S, loc='s', name='A>=26dB')
    Wire([rf_in.t, rf_preamp1.i])

    # Second preamp
    rf_preamp2 = Amp(i=rf_preamp1.o, xoff=25, kind='se', name='RF Preamp2')
    Label(C=rf_preamp2.S, loc='s', name='A>=26dB')
    Wire([rf_preamp1.o, rf_preamp2.i])

    # RF band-pass filter
    rf_bpf = Box(i=rf_preamp2.o, xoff=25, name='RF BPF')
    l = Label(C=rf_bpf.S, loc='s', name='fc=1380MHz')
Esempio n. 18
0
from svg_schematic import Schematic, MOS, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='mos.svg'):
        m = MOS(kind='n', name='Mn')
        Label(C=m.d, name='d', loc='n', kind='dot', color='blue')
        Label(C=m.g, name='g', loc='w', kind='dot', color='blue')
        Label(C=m.s, name='s', loc='s', kind='dot', color='blue')

        m = MOS(kind='p', name='Mp', C=m.C, xoff=150)
        Label(C=m.s, name='s', loc='n', kind='dot', color='blue')
        Label(C=m.g, name='g', loc='w', kind='dot', color='blue')
        Label(C=m.d, name='d', loc='s', kind='dot', color='blue')

        m = MOS(kind='', name='M', C=m.C, xoff=150)
        Label(C=m.d, name='d', loc='n', kind='dot', color='blue')
        Label(C=m.g, name='g', loc='w', kind='dot', color='blue')
        Label(C=m.s, name='s', loc='s', kind='dot', color='blue')
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 19
0
from svg_schematic import Schematic, Switch, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='switch.svg'):
        s = Switch(kind='spst', name='φ₁')
        Label(C=s.i, name='i', loc='w', kind='dot', color='blue', w=2)
        Label(C=s.ot, name='ot', loc='e', kind='dot', color='blue', w=2)
        Label(C=s.o, name='o', loc='e', kind='dot', color='blue', w=2)
        Label(C=s.ob, name='ob', loc='e', kind='dot', color='blue', w=2)

        s = Switch(kind='spdt', name='φ₂', C=s.C, xoff=150)
        Label(C=s.i, name='i', loc='w', kind='dot', color='blue', w=2)
        Label(C=s.ot, name='ot', loc='e', kind='dot', color='blue', w=2)
        Label(C=s.o, name='o', loc='e', kind='dot', color='blue', w=2)
        Label(C=s.ob, name='ob', loc='e', kind='dot', color='blue', w=2)
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 20
0
from svg_schematic import Schematic, Label, Resistor, Wire, with_x
from inform import Error, error, os_error

try:
    with Schematic(
            filename='wires.svg',
            background='none',
            line_width=2,
    ):
        r11 = Resistor(orient='h')
        r12 = Resistor(orient='h', n=r11.p, off=(50, 50))
        w = Wire([r11.p, r12.n], kind='plain')
        c = with_x(w.m, r12.E)
        Label(name="kind='plain'", C=c, xoff=25, loc='e', w=5)

        r21 = Resistor(orient='h', C=r11.C, yoff=100)
        r22 = Resistor(orient='h', n=r21.p, off=(50, 50))
        w = Wire([r21.p, r22.n], kind='|-')
        c = with_x(w.m, r22.E)
        Label(name="kind='|-'", C=c, xoff=25, loc='e', w=5)

        r31 = Resistor(orient='h', C=r21.C, yoff=100)
        r32 = Resistor(orient='h', n=r31.p, off=(50, 50))
        w = Wire([r31.p, r32.n], kind='-|')
        c = with_x(w.m, r32.E)
        Label(name="kind='-|'", C=c, xoff=25, loc='e', w=5)

        r41 = Resistor(orient='h', C=r31.C, yoff=100)
        r42 = Resistor(orient='h', n=r41.p, off=(50, 50))
        w = Wire([r41.p, r42.n], kind='|-|')
        c = with_x(w.m, r42.E)
Esempio n. 21
0
from svg_schematic import Schematic, Amp, Converter, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='amp.svg'):
        origin = (0, 0)
        a = Amp(C=origin, kind='se', name='As')
        Label(C=a.pi, name='pi', loc='w', kind='dot', color='blue', w=2)
        Label(C=a.i, name='i', loc='w', kind='dot', color='blue', w=2)
        Label(C=a.ni, name='ni', loc='w', kind='dot', color='blue', w=2)
        Label(C=a.po, name='po', loc='e', kind='dot', color='blue', w=2)
        Label(C=a.o, name='o', loc='e', kind='dot', color='blue', w=2)
        Label(C=a.no, name='no', loc='e', kind='dot', color='blue', w=2)

        a = Amp(kind='oa', name='Ao', C=a.C, xoff=200)
        Label(C=a.pi, name='pi', loc='w', kind='dot', color='blue', w=2)
        Label(C=a.i, name='i', loc='w', kind='dot', color='blue', w=2)
        Label(C=a.ni, name='ni', loc='w', kind='dot', color='blue', w=2)
        Label(C=a.po, name='po', loc='e', kind='dot', color='blue', w=2)
        Label(C=a.o, name='o', loc='e', kind='dot', color='blue', w=2)
        Label(C=a.no, name='no', loc='e', kind='dot', color='blue', w=2)

        a = Amp(kind='da', name='Ad', C=a.C, xoff=200)
        Label(C=a.pi, name='pi', loc='w', kind='dot', color='blue', w=2)
        Label(C=a.i, name='i', loc='w', kind='dot', color='blue', w=2)
        Label(C=a.ni, name='ni', loc='w', kind='dot', color='blue', w=2)
        Label(C=a.po, name='po', loc='e', kind='dot', color='blue', w=2)
        Label(C=a.o, name='o', loc='e', kind='dot', color='blue', w=2)
        Label(C=a.no, name='no', loc='e', kind='dot', color='blue', w=2)

        a = Amp(kind='comp', name='Ac', C=a.C, xoff=200)
Esempio n. 22
0
#!/usr/bin/env python3

from svg_schematic import (Schematic, Amp, Dot, Ground, Label, Pin, Resistor,
                           Source, Wire)
from inform import Error, error, os_error

try:
    with Schematic(filename="noninverting.svg", line_width=2):

        vin = Source(kind='sine')
        Label(C=vin.p, name='Vin', loc='n')
        Ground(C=vin.n)
        amp = Amp(pi=vin.p, xoff=100, kind='oa')
        Label(C=amp.ni, xoff=-25, name='Vf', loc='n')
        Wire([vin.p, amp.pi])
        out = Pin(C=amp.o, xoff=50, name='out', w=2)
        Wire([amp.o, out.C])
        oj = Dot(C=amp.o, xoff=25)
        r1 = Resistor(p=amp.ni, off=(-25, 50), name='R1', orient='v')
        Wire([r1.N, amp.ni], kind='|-')
        r2 = Resistor(C=amp.C, yoff=75, name='R2')
        Wire([r1.p, r2.W], kind='|-')
        Wire([oj.C, r2.E], kind='|-')
        fj = Dot(C=r2.W, xoff=-25)
        Ground(C=r1.n)

except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 23
0
from svg_schematic import Schematic, Resistor, Label
from inform import Error, error, os_error

try:
    with Schematic(filename='resistor.svg'):
        r = Resistor(name='Rs', value='50Ω')
        Label(C=r.p, name='p', loc='e', kind='dot', color='blue')
        Label(C=r.n, name='n', loc='w', kind='dot', color='blue')
except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 24
0
    with Schematic(filename='mfed.svg', line_width=2, background='none'):

        vin = Source(name='Vin', value='1 V', kind='sine')
        Ground(C=vin.n)
        rs = Resistor(name='Rs', value=Rref, n=vin.p, xoff=25)
        Wire([vin.p, rs.n])
        c1 = Capacitor(name='C1', value=C1, p=rs.p, xoff=25)
        Ground(C=c1.n)
        l2 = Inductor(name='L2', value=L2, n=c1.p, xoff=25)
        Wire([rs.p, l2.n])
        c3 = Capacitor(name='C3', value=C3, p=l2.p, xoff=25)
        Ground(C=c3.n)
        l4 = Inductor(name='L4', value=L4, n=c3.p, xoff=25)
        Wire([l2.p, l4.n])
        c5 = Capacitor(name='C5', value=C5, p=l4.p, xoff=25)
        Ground(C=c5.n)
        rl = Resistor(name='Rl', value=Rref, p=c5.p, xoff=100, orient='v')
        Ground(C=rl.n)
        out = Pin(name='out', C=rl.p, xoff=50, w=2)
        Wire([l4.p, out.t])
        Label(S=c3.N, yoff=-50, name=f'{Fo} LPF', loc='s')
        Dot(C=c1.p)
        Dot(C=c3.p)
        Dot(C=c5.p)
        Dot(C=rl.p)

except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))
Esempio n. 25
0
#!/usr/bin/env python3

from svg_schematic import Schematic, Amp, Box, Label, Pin, Source, Wire, shift_x
from inform import Error, error, os_error

try:
    with Schematic(
        filename = "feedback.svg",
        font_size=16,
        font_family='serif'
    ):

        summer = Source(kind='sum')
        amp = Amp(W=summer.E, xoff=25, name='$a$', kind='se')
        fb = Box(C=amp.C, yoff=100, name='$f$', h=1, orient='|')
        Label(C=summer.W, name='$+$', loc='nw')
        Label(C=summer.S, name='$-$', loc='sw')
        i = Pin(C=summer.W, xoff=-50, name='in', kind='in')
        o = Pin(C=amp.E, xoff=50, name='out', kind='out')

        Wire([i.C, summer.W])
        Wire([summer.E, amp.i])
        Wire([amp.E, o.C])
        Wire([shift_x(amp.E, 25), fb.i], kind='|-')
        Wire([summer.S, fb.W], kind='|-')

except Error as e:
    e.report()
except OSError as e:
    error(os_error(e))