How to create resistor in PySpice: Minimal example
This creates a resistor named R1 which has its + pin connected to node n1 and its - pin connected to GND. The value of the resistor is set to 1kΩ.
pyspice_resistor_example.py
r1 = circuit.R('R1', 'n1', circuit.gnd, 1@u_kΩ)Full example:
pyspice_resistor_full_example.py
import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()
from PySpice.Probe.Plot import plot
from PySpice.Spice.Netlist import Circuit
from PySpice.Unit import *
circuit = Circuit("MyCircuit")
r1 = circuit.R('R1', 'n1', circuit.gnd, 1@u_kΩ)Check out similar posts by category:
Electronics, Python, SPICE
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow