Esempio n. 1
0
    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='')
        Wire([ll.n, ml.d])
Esempio n. 2
0
from svg_schematic import (
    Schematic, Capacitor, Ground, Inductor, Resistor, Pin, Source, Wire
)
from inform import Error, error, os_error

try:
    with Schematic(
        filename = 'mfed.svg',
        background = 'none',
    ):
        vin = Source(name='Vin', value='1 V', kind='sine')
        Ground(C=vin.n)
        rs = Resistor(name='Rs', value='50 Ω', n=vin.p, xoff=25)
        Wire([vin.p, rs.n])
        c1 = Capacitor(name='C1', value='864 pF', p=rs.p, xoff=25)
        Ground(C=c1.n)
        l2 = Inductor(name='L2', value='5.12 μH', n=c1.p, xoff=25)
        Wire([rs.p, l2.n])
        c3 = Capacitor(name='C3', value='2.83 nF', p=l2.p, xoff=25)
        Ground(C=c3.n)
        l4 = Inductor(name='L4', value='8.78 μH', n=c3.p, xoff=25)
        Wire([l2.p, l4.n])
        c5 = Capacitor(name='C5', value='7.28 nF', p=l4.p, xoff=25)
        Ground(C=c5.n)
        rl = Resistor(name='Rl', value='50 Ω', 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])
except Error as e:
    e.report()
except OSError as e:
Esempio n. 3
0
        # 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()
except OSError as e:
    error(os_error(e))
Esempio n. 4
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))