Jak vytvořit constant voltage source v PySpice

To vytvoří voltage source nazvaný V1, který má svůj + pin connected na node n1 a svůj - pin connected na GND. Voltage source je nastaven na 5V DC.

pyspice_voltage_source.py
source = circuit.VoltageSource('V1', 'n1', circuit.gnd, dc_value=5@u_V)

Kompletní příklad:

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)

Podívejte se na podobné články podle kategorie: Elektronika Python SPICE