mirror of
https://github.com/diodeinc/pcb.git
synced 2026-09-14 20:17:19 +08:00
4413c9d4d9
* Hydrate V2 deps during migrate * Fix mixed hydrated package resolution * Simplify workspace discovery * Clean up workspace package discovery naming * Update stdlib formatting paths
69 lines
1.7 KiB
Python
69 lines
1.7 KiB
Python
"""Test for Spice model of Resistor."""
|
|
|
|
load("../../amplifiers.zen", "sallen_key_lowpass", "voltage_follower")
|
|
load("../../interfaces.zen", "Ground", "Net", "Opamp", "Power")
|
|
load("../../properties.zen", "Simulation")
|
|
load("../../simulation/helpers.zen", "use_ideal_passives")
|
|
|
|
OperationalAmplifier = Module("../../generics/OperationalAmplifier.zen")
|
|
|
|
VP = Power()
|
|
VN = Power()
|
|
INPUT = Net()
|
|
PROBE = Net()
|
|
GND = Ground()
|
|
|
|
OPAMP = sallen_key_lowpass(
|
|
name="OPAMP",
|
|
frequency="10MHz 0.1%",
|
|
GND=GND,
|
|
IN=INPUT,
|
|
OUT=PROBE,
|
|
)
|
|
|
|
OperationalAmplifier(
|
|
name="OPAMP",
|
|
VP=VP,
|
|
VN=VN,
|
|
OPA1=OPAMP,
|
|
)
|
|
|
|
|
|
Simulation(
|
|
name="test_SallenKey",
|
|
modifiers=[use_ideal_passives()],
|
|
setup=f"""
|
|
* Ground node
|
|
|
|
* Positive and negative rails
|
|
V1 {VP} {GND} DC 12V
|
|
V2 {VN} {GND} DC -12V
|
|
|
|
* Input stimulus for AC analysis. 0V - 1.8V (centered at 0.9V, 0.9V peak AC)
|
|
V3 {INPUT} {GND} DC 0.9 AC 0.9
|
|
|
|
.control
|
|
* AC analysis from 1Hz to 10kHz with 10 points per decade
|
|
ac dec 200 1 10g
|
|
|
|
* Save output as SVG
|
|
set hcopydevtype = svg
|
|
|
|
* AC magnitude response plot
|
|
hardcopy output/sallenkey_magnitude.svg vdb({PROBE}) title "Sallen Key AC Response" xlabel Frequency ylabel "Magnitude (dB)"
|
|
|
|
* AC phase response plot
|
|
hardcopy output/sallenkey_phase.svg vp({PROBE}) title "Sallen Key Phase Response" xlabel Frequency ylabel "Phase (degrees)"
|
|
.endc
|
|
""",
|
|
)
|
|
|
|
# pcb:sch OPAMP.U x=392.7000 y=62.5000 rot=0
|
|
# pcb:sch OPAMP_C1.C x=435.8800 y=-64.5000 rot=270
|
|
# pcb:sch OPAMP_C2.C x=270.7800 y=240.3000 rot=0
|
|
# pcb:sch OPAMP_R1.R x=103.1400 y=75.2000 rot=270
|
|
# pcb:sch OPAMP_R2.R x=230.1400 y=75.2000 rot=270
|
|
# pcb:sch GND.1 x=278.4000 y=354.6000 rot=0
|
|
# pcb:sch VN_VCC.1 x=435.8800 y=214.9000 rot=180
|
|
# pcb:sch VP_VCC.1 x=435.8800 y=24.4000 rot=0
|