Skip to content

Commit 14f5c75

Browse files
committed
add model
1 parent 3021900 commit 14f5c75

File tree

1 file changed

+129
-0
lines changed

1 file changed

+129
-0
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
"""
2+
NPN(;name, B_F, B_R, Is, V_T, V_A, Phi_C, Phi_E, Z_C, Z_E, Tau_f, Tau_r, C_jC0, C_jE0, C_CS, gamma_C, gamma_E, NF, NR)
3+
4+
Creates an NPN Bipolar Junction Transistor following a modified Ebers-Moll model.
5+
"""
6+
7+
8+
9+
@mtkmodel NPN begin
10+
@variables begin
11+
V_BE(t)
12+
V_BC(t)
13+
ICC(t)
14+
IEC(t)
15+
16+
C_jC(t)
17+
C_jE(t)
18+
C_DC(t)
19+
C_DE(t)
20+
21+
I_sub(t)
22+
V_sub(t)
23+
V_CS(t)
24+
end
25+
26+
@structural_parameters begin
27+
use_substrate = false
28+
use_Early = true
29+
use_advanced_continuation = false
30+
end
31+
32+
@components begin
33+
b = Pin()
34+
e = Pin()
35+
c = Pin()
36+
37+
if use_substrate
38+
s = Pin()
39+
end
40+
end
41+
42+
@parameters begin
43+
B_F = 50.0
44+
B_R = 0.1
45+
Is = 1e-16
46+
V_T = 0.02
47+
48+
if use_Early
49+
V_A = 0.02
50+
end
51+
52+
Phi_C = 0.8
53+
Phi_E = 0.6
54+
55+
if use_advanced_continuation
56+
Z_C = 0.1
57+
Z_E = 0.1
58+
end
59+
60+
Tau_f = 0.12e-9
61+
Tau_r = 5e-9
62+
63+
C_jC0 = 0.5e-12
64+
C_jE0 = 0.4e-12
65+
66+
C_CS = 1e-12
67+
68+
gamma_C = 0.5
69+
gamma_E = 1.0 / 3.0
70+
71+
NF = 1.0
72+
NR = 1.0
73+
end
74+
75+
@equations begin
76+
V_BE ~ b.v - e.v
77+
V_BC ~ b.v - c.v
78+
79+
ICC ~ Is * (exp(V_BE / V_T) - 1)
80+
IEC ~ Is * (exp(V_BC / V_T) - 1)
81+
82+
if !use_advanced_continuation
83+
C_jC ~ ifelse(V_BC / Phi_C > 0.0, 1 + gamma_C * V_BC / Phi_C,
84+
(C_jC0) / (1 - V_BC / Phi_C)^gamma_C)
85+
C_jE ~ ifelse(V_BE / Phi_E > 0.0, 1 + gamma_E * V_BE / Phi_E,
86+
(C_jE0) / (1 - V_BE / Phi_E)^gamma_E)
87+
end
88+
89+
if use_advanced_continuation
90+
C_jC ~ if V_BC > Phi_C - Z_C
91+
((C_jC0 * gamma_C * (1 - ((Phi_C - Z_C) / Phi_C))^(-gamma_C - 1)) / Phi_C) *
92+
V_BC -
93+
((C_jC0 * gamma_C * (1 - ((Phi_C - Z_C) / Phi_C))^(-gamma_C - 1)) / Phi_C) *
94+
(Phi_C - Z_C) + (C_jC0) / (1 - (Phi_C - Z_C) / Phi_C)^gamma_C
95+
else
96+
(C_jC0) / (1 - V_BC / Phi_C)^gamma_C
97+
end
98+
99+
C_jE ~ if V_BE > Phi_E - Z_E
100+
((C_jE0 * gamma_E * (1 - ((Phi_E - Z_E) / Phi_E))^(-gamma_E - 1)) / Phi_E) *
101+
V_BE -
102+
((C_jE0 * gamma_E * (1 - ((Phi_E - Z_E) / Phi_E))^(-gamma_E - 1)) / Phi_E) *
103+
(Phi_E - Z_E) + (C_jE0) / (1 - (Phi_E - Z_E) / Phi_E)^gamma_E
104+
else
105+
(C_jE0) / (1 - V_BE / Phi_E)^gamma_E
106+
end
107+
end
108+
109+
C_DE ~ Tau_f * (Is / (NF * V_T)) * exp(V_BE / (NF * V_T))
110+
C_DC ~ Tau_r * (Is / (NR * V_T)) * exp(V_BC / (NR * V_T))
111+
112+
if use_substrate
113+
s.i ~ I_sub
114+
s.v ~ V_sub
115+
V_CS ~ c.v - V_sub
116+
end
117+
118+
if !use_substrate
119+
V_sub ~ c.v
120+
end
121+
122+
I_sub ~ ifelse(use_substrate, -C_CS * D(V_CS), -C_CS * D(V_sub))
123+
124+
C.i ~ (ICC - IEC) * ifelse(use_Early, (1 - V_BC * V_A), 1.0) - IEC / B_R -
125+
(C_jC + C_DC) * D(V_BC) - I_sub
126+
B.i ~ IEC / B_R + ICC / B_F + (C_jC + C_DC) * D(V_BC) + (C_jE + C_DE) * D(V_BE)
127+
E.i ~ -C.i - B.i - I_sub
128+
end
129+
end

0 commit comments

Comments
 (0)