Loading...
Loading...
Add a simulation test bench to a zener file.
npx skill4agent add diodeinc/pcb spice-sim.zenpcb sim <path/to/file.zen> --setup "* empty setup check"spice_model=SpiceModel(...)<package>/testbench/test_<scenario>.zenSimulation(...)Simulation.setupDCPULSE(...)PWL(...).controltranhardcopytestbench/output/<scenario>.svgSimulation@stdlib/properties.zenload("@stdlib/properties.zen", "Simulation")
Simulation(
name="SIM",
setup="""
* raw ngspice goes here
.control
tran 10u 10m
.endc
""",
)setup"""<Part> <scenario> simulation test."""
load("@stdlib/interfaces.zen", "Ground", "Power")
load("@stdlib/units.zen", "Voltage")
load("@stdlib/properties.zen", "Simulation")
Target = Module("../Target.zen")
Resistor = Module("@stdlib/generics/Resistor.zen")
VIN = Power("VIN", voltage=Voltage("12V"))
VOUT = Power("VOUT")
GND = Ground("GND")
Target(
name="UUT",
VIN=VIN,
VOUT=VOUT,
GND=GND,
)
Resistor(
name="R_LOAD",
value="10ohm",
package="0603",
P1=VOUT,
P2=GND,
)
Simulation(
name="SIM",
setup="""
* <Part> <scenario>
V_IN VIN GND DC 12
.control
tran 10u 10m
set hcopydevtype = svg
hardcopy output/<scenario>.svg v(VIN) v(VOUT) title "<Part> <scenario>" xlabel "Time" ylabel "Voltage"
.endc
""",
)VIN = io("VIN", Net)
VOUT = io("VOUT", Net)
GND = io("GND", Net)
Component(
name="MyPart",
symbol=Symbol(library="MyPart.kicad_sym"),
pins={"VIN": VIN, "VOUT": VOUT, "GND": GND},
spice_model=SpiceModel(
"MyPart.lib",
"MyPart_SUBCKT",
nets=[VIN, VOUT, GND],
args={},
),
)V_IN VIN GND DC 5.3
V_ON ON GND PULSE(0 0.9V 1ms 10us 10us 3ms 5ms)V_IN VIN GND PWL(0 12 5m 12 5.1m 22 10m 22 10.1m 12 15m 12 15.1m 2 20m 2)setup