c = Capacitor(W=r.E, name='C', orient='v') l = Inductor(W=c.E, name='L', orient='v|') Wire([r.p, c.p, l.p], kind='-|-') Wire([r.n, c.n, l.n], kind='-|-') with Schematic(filename="rlc1b.svg"): r = Resistor(name='R', orient='h') c = Capacitor(n=r.p, name='C', orient='h|') l = Inductor(n=c.p, name='L', orient='h') with Schematic(filename="rlc2.svg"): r = Resistor(name='R', orient='v') c = Capacitor(C=r.C, off=(100, 25), name='C', orient='v') l = Inductor(C=c.C, xoff=100, name='L', orient='v|') Wire([r.p, c.p, l.p], kind='-|-') Wire([r.n, c.n, l.n], kind='-|-') with Schematic(filename="rlc3.svg"): r = Resistor(name='R', orient='v') c = Capacitor(C=r.C, xoff=100, name='C', orient='v') l = Inductor(C=c.C, xoff=100, name='L', orient='v|') Wire([r.p, shift_y(r.p, -12.5), shift_y(c.p, -12.5), c.p]) Wire([c.p, shift_y(c.p, -12.5), shift_y(l.p, -12.5), l.p]) Wire([r.n, shift_y(r.n, 12.5), shift_y(c.n, 12.5), c.n]) Wire([c.n, shift_y(c.n, 12.5), shift_y(l.n, 12.5), l.n]) except Error as e: e.report() except OSError as e: error(os_error(e))
Wire([pfet.g, gd.N]) Wire([pfet.s, pvdd.C]) nfet = MOS(g=gd.o, xoff=25, kind='n', orient='v') Wire([nfet.g, gd.o]) Wire([nfet.d, pfet.d], kind='|-') Ground(C=nfet.s) ind = Inductor(n=with_x(pfet.d, nfet.E), orient='h') Wire([pfet.d, ind.n]) cap = Capacitor(p=ind.p, orient='v') Ground(C=cap.n) out = Pin(C=ind.p, xoff=100, kind='out', name='out', w=2) out_wire = Wire([ind.p, out.C]) fb = shift_y(R1.n, 100) Rt = Resistor(n=with_x(fb, out_wire.m), orient='v') Rb = Resistor(p=with_x(fb, out_wire.m), orient='v') Wire([Rt.p, with_y(Rt.p, out.C)]) Ground(C=Rb.n) RG = Box(o=C1.n, yoff=175) rg2cmp = Wire([RG.o, cmp.ni], kind='-|-') Dot(C=with_y(rg2cmp.m, fb), color='white') Wire([ shift_x(RG.C, -30), shift(RG.C, -25, 25), shift(RG.C, 25, -25), shift_x(RG.C, 30) ])
# 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")
from svg_schematic import Schematic, Pin, Wire, shift_x, shift_y from inform import Error, error, os_error try: with Schematic(filename='pin.svg'): Wire([(0, -25), (0, 175)], color='cyan') p = Pin(kind='none', name='none', value='none value', w=5) Wire([shift_x(p.C, -50), shift_x(p.C, 50)]) p = Pin(kind='dot', name='dot', C=p.C, yoff=50, value='dot value', w=5) Wire([shift_x(p.C, -50), shift_x(p.C, 50)]) Wire([shift_y(p.C, -25), shift_y(p.C, 25)]) p = Pin(kind='in', name='in', C=p.C, yoff=50, w=5) Wire([p.C, shift_x(p.C, 25)]) p = Pin(kind='out', name='out', C=p.C, yoff=50, w=5) Wire([p.C, shift_x(p.C, -50)]) except Error as e: e.report() except OSError as e: error(os_error(e))
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])
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=50, orient='|') mr = MOS(d=lr.n, yoff=50, orient='') Wire([ll.n, ml.d])