如何在 PySpice 中创建恒定电压源
这会创建一个名为 V1 的电压源,其 + 引脚连接到节点 n1,- 引脚连接到 GND。电压源设置为 5V DC。
pyspice_voltage_source.py
source = circuit.VoltageSource('V1', 'n1', circuit.gnd, dc_value=5@u_V)完整示例:
pyspice_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")
source = circuit.VoltageSource('V1', 'n1', circuit.gnd, dc_value=5@u_V)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