1

Z3Py online is a very powerful tool to determine the DC operating point of a given MOSFET amplifier. With the aim to illustrate that we will consider the following circuit

enter image description here

The parameters of the MOSFET amplifier are:

k = 1.25 * 10^(-4) , V_T = 1.5 , R_D = 10^4 , V = 15

To determine the DC operating point we use the following Z3Py code:

I_D, k, V_GS, V_T, V_DS, V, R_D = Reals('I_D k V_GS V_T V_DS V R_D')
equations = [
I_D == k * (V_GS - V_T)**2, V_GS == V_DS, 
V_DS == V - R_D * I_D,
]
print "MOSFET equations:"
print equations
problem = [
k == 1.25*10**(-4),
V_T == 1.5,
R_D   == 10**4,
V == 15, V_GS > V_T
]
print "Problem:"
print problem 

print "Solution:"
solve(equations + problem)

Using this code online, we obtain the following output

MOSFET equations:
[I_D = k·(V_GS - V_T)2, V_GS = V_DS, V_DS = V - R_D·I_D]
Problem:
[k = 1/8000, V_T = 3/2, R_D = 10000, V = 15, V_GS > V_T]
Solution:
[I_D = 0.0010589410?,
V = 15,
R_D = 10000,
V_T = 3/2,
k = 1/8000,
V_GS = 4.4105890714?,
V_DS = 4.4105890714?]

It can also try it online here.

As we can see Z3PY is able to compute the correct solution I_D , V_GS and V_DS in a very compact and efficient form.

Other example

enter image description here

This problem is solved using the following code

I_D, k, V_GS = Reals('I_D k V_GS')
V_T, V_I, R_S = Reals('V_T V_I R_S')
V_O, V_DD, R_L = Reals('V_O V_DD R_L')
equations = [
I_D == (k/2) * (V_GS - V_T)**2, V_I == V_GS + R_S * I_D, 
V_O == V_DD - R_L * I_D,
]
print "MOSFET equations:"
print equations
problem = [
k == 2,
V_T == 2,
V_DD   == 145,
V_I == 6.5, R_S == 22, R_L ==82, V_GS > V_T
]
print "Problem:"
print problem 

print "Solution:"
solve(equations + problem)
problem1 = [
k == 2,
V_T == 2,
V_DD   == 145,
V_I == 6.5 + 1, R_S == 22, R_L ==82, V_GS > V_T
]
print "Problem 1"
print problem1
print "Solution 1:" 
solve(equations + problem1)
problem2 = [
k == 2,
V_T == 2,
V_DD   == 145,
V_I == 6.5 + 10**(-3), R_S == 22, R_L ==82, V_GS > V_T
]
print "Problem 2"
print problem2
print "Solution 2:" 
solve(equations + problem2)

Using this code online we obtain the following output

MOSFET equations:
[I_D = (k/2)·(V_GS - V_T)2, V_I = V_GS + R_S·I_D, V_O = V_DD - R_L·I_D]
Problem:
[k = 2, V_T = 2, V_DD = 145, V_I = 13/2, R_S = 22, R_L = 82, V_GS > V_T]
Solution:
[I_D = 0.1849949805?,
R_L = 82,
R_S = 22,
V_I = 13/2,
V_DD = 145,
V_T = 2,
k = 2,
V_O = 129.8304115963?,
V_GS = 2.4301104282?]
Problem 1
[k = 2, V_T = 2, V_DD = 145, V_I = 15/2, R_S = 22, R_L = 82, V_GS > V_T]
Solution 1:
[I_D = 0.2282823186?,
R_L = 82,
R_S = 22,
V_I = 15/2,
V_DD = 145,
V_T = 2,
k = 2,
V_O = 126.2808498705?,
V_GS = 2.4777889896?]
Problem 2
[k = 2, V_T = 2, V_DD = 145, V_I = 6501/1000, R_S = 22, R_L = 82, V_GS > V_T]
Solution 2:
[I_D = 0.1850381539?,
R_L = 82,
R_S = 22,
V_I = 6501/1000,
V_DD = 145,
V_T = 2,
k = 2,
V_O = 129.8268713797?,
V_GS = 2.4301606140?]

It can also try it online here.

Other example

enter image description here

This problem is solved using the following code

I_D, k, V_GS = Reals('I_D k V_GS')
V_T, V_EQ, R_S = Reals('V_T V_EQ R_S')
V_DS, V_DD, R_D = Reals('V_DS V_DD R_D')
equations = [
I_D == (k/2) * (V_GS - V_T)**2, V_EQ == V_GS + R_S * I_D, 
V_DS == V_DD - (R_D + R_S )* I_D,
]
print "MOSFET equations:"
print equations
problem = [
k == 25*10**(-6),
V_T == 1,
V_DD   == 10,
V_EQ == 4, R_S == 39*10**3, R_D == 75*10**3, V_GS > V_T
]
print "Problem:"
print problem 

print "Solution:"
solve(equations + problem)

Using this code online we obtain the following output

MOSFET equations:
[I_D = (k/2)·(V_GS - V_T)2, V_EQ = V_GS + R_S·I_D, V_DS = V_DD - (R_D + R_S)·I_D]
Problem:
[k = 1/40000, V_T = 1, V_DD = 10, V_EQ = 4, R_S = 39000, R_D = 75000, V_GS > V_T]
Solution:
[I_D = 0.0000343918?,
R_D = 75000,
R_S = 39000,
V_EQ = 4,
V_DD = 10,
V_T = 1,
k = 1/40000,
V_DS = 6.0793307846?,
V_GS = 2.6587184263?]

It can also try it online here .

Other example:

enter image description here

This problem is solved using the following code

I_D, k, V_GS = Reals('I_D k V_GS')
V_T = Real('V_T')
R_D = Real('R_D')
V_DS, V_DD = Reals('V_DS V_DD')
equations = [
I_D == (k) * (V_GS - V_T - (V_DS) /2)*V_DS, V_DD == V_GS, 
V_DS == V_DD - (R_D)* I_D,
]
print "MOSFET equations:"
print equations
problem = [
k == 250*10**(-6),
V_T == 1,
V_DD   == 4,
R_D == 1600, V_DS < V_GS  -  V_T
]
print "Problem:"
print problem 

print "Solution:"
solve(equations + problem)

Using this code online we obtain the following output

MOSFET equations:
[I_D = k·(V_GS - V_T - V_DS/2)·V_DS, V_DD = V_GS, V_DS = V_DD - R_D·I_D]
Problem:
[k = 1/4000, V_T = 1, V_DD = 4, R_D = 1600, V_DS < V_GS - V_T]
Solution:
[I_D = 0.0010634763?,
R_D = 1600,
V_DD = 4,
V_T = 1,
k = 1/4000,
V_GS = 4,
V_DS = 2.2984378812?]

It can also try it online here .

Please let me know what do you think about this and if you know a more efficient code for such class of problems. Many thnaks.

4

0 回答 0