|
| 1 | +#################################################################################################### |
| 2 | + |
| 3 | +import matplotlib.pyplot as plt |
| 4 | + |
| 5 | +#################################################################################################### |
| 6 | + |
| 7 | +import PySpice.Logging.Logging as Logging |
| 8 | +logger = Logging.setup_logging() |
| 9 | + |
| 10 | +#################################################################################################### |
| 11 | + |
| 12 | +from PySpice.Doc.ExampleTools import find_libraries |
| 13 | +from PySpice.Probe.Plot import plot |
| 14 | +from PySpice.Spice.Library import SpiceLibrary |
| 15 | +from PySpice.Spice.Netlist import Circuit |
| 16 | +from PySpice.Unit import * |
| 17 | + |
| 18 | +#################################################################################################### |
| 19 | + |
| 20 | +from PySpice.Spice.NgSpice.Shared import NgSpiceShared |
| 21 | + |
| 22 | +#################################################################################################### |
| 23 | + |
| 24 | +from pathlib import Path |
| 25 | + |
| 26 | +# libraries_path = find_libraries() |
| 27 | +spice_library = SpiceLibrary(Path(__file__).parent) # libraries_path |
| 28 | + |
| 29 | +#################################################################################################### |
| 30 | + |
| 31 | +circuit = Circuit('Stator Drive') |
| 32 | + |
| 33 | +circuit.include(spice_library['issue-167']) |
| 34 | + |
| 35 | +circuit.X(1, 'test_netlist', 'gate_drive1', 'sw_node_hs1', 'gate_drive2', 'sw_node_hs2') |
| 36 | + |
| 37 | +print(circuit) |
| 38 | + |
| 39 | +# simulator = circuit.simulator(temperature=25, nominal_temperature=25) |
| 40 | +# analysis = simulator.transient(step_time=.005E-6, start_time=1E-3, end_time=3.5E-3, use_initial_condition=False) |
| 41 | + |
| 42 | +# NUMBER_PLOTS = '4' |
| 43 | +# #plots of circuit components |
| 44 | +# figure = plt.figure(1, (10, 5)) |
| 45 | +# plot1 = plt.subplot(int(NUMBER_PLOTS+'11')) |
| 46 | +# plot(analysis.gate_drive1) |
| 47 | +# plt.legend(('gate drive 1 [V]', '',''), loc=(.8,.8)) |
| 48 | +# plt.grid() |
| 49 | +# plt.xlabel('t [s]') |
| 50 | +# plt.ylabel('[V]') |
| 51 | +# plot2 = plt.subplot(int(NUMBER_PLOTS+'12')) |
| 52 | +# plot(analysis.sw_node_hs1) |
| 53 | +# plt.legend(('Switch Node 1',''), loc=(.05,.1)) |
| 54 | +# plt.grid() |
| 55 | +# plt.xlabel('t [s]') |
| 56 | +# plt.ylabel('[V]') |
| 57 | +# plot3 = plt.subplot(int(NUMBER_PLOTS+'13')) |
| 58 | +# plot(analysis.gate_drive2) |
| 59 | +# plt.grid() |
| 60 | +# plt.xlabel('t [s]') |
| 61 | +# plt.ylabel('[V]') |
| 62 | +# plt.legend(('gate drive 2',''), loc=(.05,.1)) |
| 63 | +# plot4 = plt.subplot(int(NUMBER_PLOTS+'14')) |
| 64 | +# plot(analysis.sw_node_hs2) |
| 65 | +# plt.grid() |
| 66 | +# plt.xlabel('t [s]') |
| 67 | +# plt.ylabel('[V]') |
| 68 | +# plt.legend(('sw node 2',''), loc=(.05,.1)) |
| 69 | +# plt.tight_layout() |
| 70 | +plt.show() |
0 commit comments