-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathver.py
132 lines (121 loc) · 3.65 KB
/
ver.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
list = [] #the oringin list to store the information
list_content = [] #proceed input information
str = '' # a string to store the information from every lines
info_node = {} # a list to store every nodes and label
info_branch = {}
NumnodeS = 0 #number of nodes
info_control_commands = {} # information of every control command
matrix = [[[0 for j in range(10)] for j in range(1000)] for i in range(1000)] #the matrix that store the circuit
matrix_nodes = [[0 for j in range(1000)] for i in range(1000)]
matrix_source_controled = [[0 for j in range(100)] for i in range(100)]
matrix_V = [0 for j in range(10)]
matrix_RHS = [0 for j in range(20)]
matrix_RHS_fff = []
label_c = []
label_l = []
label_dio = []
label_mos = []
res = 0;
matrix_dc = []
info_plot = []
t_start = 0;
lp_s = 1000
te = 0.01
num_branch = 0
conversion = {'f':10**-15,'p':10**-12,'n':10**-9,'u':10**-6,'m':10**-3,'k':10**3,'meg':10**6,'g':10**9,'t':10**12}#unit conversion
class Element:
def __init__(self,id,u,v,s):
self.ID = id
self.node1 = u
self.node2 = v
self.value = s
class cElement:
def __init__(self,id,u,v,s,ic):
self.ID = id
self.node1 = u
self.node2 = v
self.value = s
self.ic = ic
class Source:
def __init__(self,id,u,v,s,a):
self.ID = id
self.node1 = u
self.node2 = v
self.value = s
self.oth = a
class Source_controled:
def __init__(self,id,u,v,p,q,s):
self.ID = id
self.node1 = u
self.node2 = v
self.node_control1 = p
self.node_control2 = q
self.value = s
class diode:
def __init__(self,id,u,v,ty):
self.ID = id
self.node1 = u
self.node2 = v
self.type = ty
self.value = ty
class Source_controled_fh:
def __init__(self,id,u,v,c,s):
self.ID = id
self.node1 = u
self.node2 = v
self.cl = c
self.value = s
class Control:
def __init__(self,op,control):
self.command = op
self.oth = control
class tran:
def __init__(self,tran,a,b,c):
self.tran = tran;
self.step = a
self.stop = b
self.start = c
class plot:
def __init__(self,plot,a,b):
self.commannd = plot
self.tran = a
self.list = b
class mos:
def __init__(self,id,nd,ng,ns,nb,mna,l,w):
self.ID = id
self.d = nd
self.g = ng
self.s = ns
self.b = nb
self.mname = mna
self.l = l
self.w = w
class dc:
def __init__(self,dc,con,start,end,step):
self.command = dc
self.control = con
self.start = start
self.end = end
self.step = step
def init():
list = [] #the oringin list to store the information
list_content = [] #proceed input information
str = '' # a string to store the information from every lines
info_node = {} # a list to store every nodes and label
info_branch = {}
NumnodeS = 0 #number of nodes
info_control_commands = {} # information of every control command
matrix = [[[0 for j in range(10)] for j in range(1000)] for i in range(1000)] #the matrix that store the circuit
conversion = {'f':10**-15,'p':10**-12,'n':10**-9,'u':10**-6,'m':10**-3,'k':10**3,'meg':10**6,'g':10**9,'t':10**12}#unit conversion
matrix_nodes = [[0 for j in range(1000)] for i in range(1000)]
matrix_source_controled = [[0 for j in range(100)] for i in range(100)]
matrix_V = [0 for j in range(10)]
matrix_RHS = [0 for j in range(20)]
matrix_RHS_fff = []
lp_s = 100
T = 10
num_branch = 0
label_c = []
label_l = []
label_dio = []
res = 0;