示例#1
0
from lcapy import Vstep, R, L, C
import numpy as np
from matplotlib.pyplot import figure, savefig, show

a = Vstep(5) + L(10)
b = a | R(5)

t = np.linspace(-1, 10, 1000)

fig = figure()
ax = fig.add_subplot(111)
# Open-circuit voltage across R
ax.plot(t, b.v.evaluate(t), linewidth=2)
ax.set_xlabel('Time (s)')
ax.set_ylabel('Voltage (V)')
ax.grid(True)

fig = figure()
ax = fig.add_subplot(111)
# Short-circuit current through R
ax.plot(t, b.isc.evaluate(t), linewidth=2)
ax.set_xlabel('Time (s)')
ax.set_ylabel('Current (A)')
ax.grid(True)

show()
示例#2
0
from lcapy import Vstep, R, L, C
import numpy as np
from matplotlib.pyplot import figure, savefig, show

# This is posed as an initial value problem so cannot
# determine result for t < 0.
a1 = Vstep(5) + L(10, 0)
a2 = a1 | C(1, 5)
b1 = a1 | R(5)
b2 = a2 | R(5)

t = np.linspace(-1, 10, 1000)

fig = figure()
ax = fig.add_subplot(111)
# Open-circuit voltage across R
ax.plot(t, b1.v.evaluate(t), linewidth=2, label='without C')
ax.plot(t, b2.v.evaluate(t), linewidth=2, label='with C')
ax.legend()
ax.set_xlabel('Time (s)')
ax.set_ylabel('Voltage (V)')
ax.grid(True)

fig = figure()
ax = fig.add_subplot(111)
# Short-circuit current through R
ax.plot(t, b1.isc.evaluate(t), linewidth=2, label='without C')
ax.plot(t, b2.isc.evaluate(t), linewidth=2, label='with C')
ax.legend()
ax.set_xlabel('Time (s)')
ax.set_ylabel('Current (A)')
示例#3
0
from lcapy import Vstep, R, L, C, t
from matplotlib.pyplot import savefig
from numpy import linspace

a = Vstep(10) + R(0.1) + C(0.4) + L(0.2, 0)

vt = linspace(0, 10, 1000)
a.Isc(t).plot(vt)

savefig('series-VRLC1-isc.png')
示例#4
0
from lcapy import Vstep, R, L, C
import numpy as np
from matplotlib.pyplot import figure, savefig, show

a = (Vstep(5) + L(10)) | R(5)
b = Vstep(5) + L(10) + R(5)

t = np.linspace(-1, 10, 1000)

fig = figure()
ax = fig.add_subplot(111)
# Open-circuit voltage across R
ax.plot(t, a.v.evaluate(t), linewidth=2)
ax.set_xlabel('Time (s)')
ax.set_ylabel('Voltage (V)')
ax.grid(True)

fig = figure()
ax = fig.add_subplot(111)
# Short-circuit current through R
ax.plot(t, b.isc.evaluate(t), linewidth=2)
ax.set_xlabel('Time (s)')
ax.set_ylabel('Short-circuit current (A)')
ax.grid(True)

show()
示例#5
0
from lcapy import Vstep, R, L, C
import sympy as sym

R1 = R('R')
L1 = L('L')

a = Vstep(10) + R1 + L1

a.Isc.pprint()
示例#6
0
from lcapy import Vstep, R, L, C
import numpy as np
from matplotlib.pyplot import figure, savefig, show

# Human body model from MIL-STD-883, Method 3015.8,
Cbody = 100e-12
Rbody = 1.5e3

# Open-circuit voltage on body.
Vbody = 5e3

# Device input capacitance.
Cdev = 5e-12

a1 = Vstep(Vbody) + C(Cbody) + R(Rbody)
b1 = a1.load(C(Cdev))

t = np.linspace(0, 50e-9, 1000)

fig = figure()
ax = fig.add_subplot(111)
ax.plot(t * 1e9, b1.v.evaluate(t) / 1e3, linewidth=2)
ax.set_xlabel('Time (ns)')
ax.set_ylabel('Voltage (kV)')
ax.grid(True)

vdev = b1.v.evaluate(t)
idev = b1.i.evaluate(t)

fig = figure()
ax = fig.add_subplot(111)
示例#7
0
from lcapy import Vstep, R, L, C
from matplotlib.pyplot import savefig, show
from numpy import linspace

a = Vstep(10) + R(0.1) + C(0.4) + L(0.2, 0)

tv = linspace(0, 10, 1000)
a.Isc.transient_response().plot(tv)

savefig('series-VRLC1-isc.png')

show()


示例#8
0
from lcapy import Vstep, R, L, C
import numpy as np
from matplotlib.pyplot import figure, savefig, show

a = (Vstep(5) + R(5)) | C(0.5)

t = np.linspace(-1, 10, 1000)

fig = figure()
ax = fig.add_subplot(111)
ax.plot(t, a.v.evaluate(t), linewidth=2)
ax.set_xlabel('Time (s)')
ax.set_ylabel('Voltage (V)')
ax.grid(True)

show()