Skip to content

Commit 74d14bc

Browse files
issue test codes
1 parent b15d4ed commit 74d14bc

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

issues/issue-130.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
####################################################################################################
2+
3+
from PySpice.Spice import Parser
4+
5+
####################################################################################################
6+
7+
source = """
8+
.title test
9+
Xld_D0 gnd:F12992 vdd:F3152 DNWPS AREA=16.072 PJ=20.54
10+
Xld_D0 gnd:F12992 vdd:F3152
11+
Xld_D0 gnd:F12992 vdd:F3152 DNWPS
12+
Xld_D0 gnd:F12992 vdd:F3152 AREA=16.072 PJ=20.54
13+
"""
14+
15+
parser = Parser.SpiceParser(source=source)
16+
for statement in parser._statements:
17+
print(statement)

issues/issue-133.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
####################################################################################################
2+
3+
import matplotlib.pyplot as plt
4+
5+
import PySpice.Logging.Logging as Logging
6+
logger = Logging.setup_logging()
7+
8+
from PySpice.Doc.ExampleTools import find_libraries
9+
from PySpice.Spice.Library import SpiceLibrary
10+
from PySpice.Spice.Netlist import Circuit
11+
from PySpice.Unit import *
12+
13+
####################################################################################################
14+
15+
libraries_path = find_libraries()
16+
spice_library = SpiceLibrary(libraries_path)
17+
18+
####################################################################################################
19+
20+
circuit = Circuit('test')
21+
22+
R1 = circuit.R(1, 'p1', 'p2', 4@u_kΩ)
23+
R2 = circuit.R(2, 'p2', 'p6', 1@u_kΩ)
24+
R3 = circuit.R(3, 'p1', 'p5', 1@u_kΩ)
25+
R4 = circuit.R(4, 'p5', 'p6', 1@u_kΩ)
26+
R5 = circuit.R(5, 'p6', 0, 1e-9@u_Ω)
27+
28+
I1 = circuit.I(1, 0, 'p1', 1@u_A)
29+
30+
V1 = circuit.V(1, 'p1', 'p4', -10@u_V)
31+
V2 = circuit.V(2, 'p2', 'p3', -10@u_V)
32+
33+
print(str(circuit))
34+
35+
simulator = circuit.simulator(simulator='xyce-serial')
36+
37+
analysis = simulator.operating_point()
38+
39+
for node in analysis.nodes.values():
40+
print('Node {}: {:5.2f} V'.format(str(node), float(node)))
41+
for node in analysis.branches.values():
42+
print('Node {}: {:5.2f} A'.format(str(node), float(node)))

issues/issue-150.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
####################################################################################################
2+
3+
import PySpice.Logging.Logging as Logging
4+
logger = Logging.setup_logging()
5+
6+
####################################################################################################
7+
8+
from PySpice.Spice.Netlist import Circuit
9+
from PySpice.Unit import *
10+
11+
####################################################################################################
12+
13+
thevenin_circuit = Circuit('Thevenin Representation')
14+
15+
thevenin_circuit.V('input', 1, thevenin_circuit.gnd, 10@u_V)
16+
thevenin_circuit.R('generator', 1, 'load', 10@u_Ω)
17+
thevenin_circuit.R('load', 'load', thevenin_circuit.gnd, 1@u_kΩ)
18+
19+
simulator = thevenin_circuit.simulator(simulator='xyce-serial', temperature=25, nominal_temperature=25)
20+
# simulator._spice_server._xyce_command = "C:\\progs\\Xyce 6.10 OPENSOURCE\\bin\\Xyce.exe"
21+
analysis = simulator.operating_point()
22+
23+
load_node = analysis.load
24+
print('Node {}: {:5.2f} V'.format(str(load_node), float(load_node)))
25+
#o#

0 commit comments

Comments
 (0)