サイトマップ

回路の素101 025 1次ハイ・パス・フィルタ 反転アンプ型

回路の素101 025 1次ハイ・パス・フィルタ 反転アンプ型

減衰率20dB/dec
ゲインも設定できる

回路図作成

  • 基本的な構成

カットオフ周波数  f_c は下記で設定できる

 f_c = \frac{1}{2 \pi C R}

今回の回路の場合、1kHz

ゲインは、

 A_{vp} = - \frac{R_F}{R}

応答性確認

100Hz入力

シミュレーションを tranモード(デフォルト) で実行し、応答を見る

import matplotlib.pyplot as plt
import numpy as np

from PyLTSpice import RawRead

fig = plt.figure(figsize=(6, 3))
ax1 = fig.add_subplot(1, 1, 1)

fname = 'PrimaryCircuit2-025.raw'
LTR = RawRead(fname)
x     = LTR.get_trace('time').get_time_axis(0)

tmp1  = LTR.get_trace('V(vin+)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vin+')
tmp1  = LTR.get_trace('V(vout)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vout')

ax1.legend(); ax1.grid()
ax1.set_xlabel('[ms]'); ax1.set_ylabel('[V]')

fig.tight_layout()

fig.savefig('PrimaryCircuit2-025_Graph1.png')

100Hzに対しては、ゲインは0.1倍、位相は270(=180+90)度進む

1kHz入力

信号源の周波数設定と、シミュレーションのパラメータを変更する

from PyLTSpice import SimCommander

fname = 'PrimaryCircuit2-025'
fname_tmp = '_1kHz'
LTC = SimCommander(fname + '.asc')

line_no = LTC._get_line_starting_with('V1')
sim_cmd = LTC.netlist[line_no]
LTC.netlist[line_no] = sim_cmd.replace('100', '1k')
print(LTC.netlist[line_no], end='')  # 確認
line_no = LTC._get_line_starting_with('.tran')
LTC.netlist[line_no] = LTC.netlist[line_no].replace('20m', '2m')
print(LTC.netlist[line_no], end='')  # 確認

# 編集したnetlistの情報でバッチ処理を実行する
run_net_file = fname + fname_tmp + '.net'
LTC.run(run_filename=run_net_file)
LTC.wait_completion()
V1 Vin+ 0 SINE(0 1.5 1k) AC 1
.tran 0 2m 0 0.1u
True
import matplotlib.pyplot as plt
import numpy as np

from PyLTSpice import RawRead

fig = plt.figure(figsize=(6, 3))
ax1 = fig.add_subplot(1, 1, 1)

LTR = RawRead(fname + fname_tmp + '.raw')
x     = LTR.get_trace('time').get_time_axis(0)

tmp1  = LTR.get_trace('V(vin+)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vin+')
tmp1  = LTR.get_trace('V(vout)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vout')

ax1.legend(); ax1.grid()
ax1.set_xlabel('[ms]'); ax1.set_ylabel('[V]')

fig.tight_layout()

fig.savefig('PrimaryCircuit2-025_Graph2.png')

ゲインは0.7倍、位相は225(=180+45)度進む

10kHz

信号源の周波数設定と、シミュレーションのパラメータを変更する

from PyLTSpice import SimCommander

fname = 'PrimaryCircuit2-025'
fname_tmp = '_10kHz'
LTC = SimCommander(fname + '.asc')

line_no = LTC._get_line_starting_with('V1')
sim_cmd = LTC.netlist[line_no]
LTC.netlist[line_no] = sim_cmd.replace('100', '10k')
print(LTC.netlist[line_no], end='')  # 確認
line_no = LTC._get_line_starting_with('.tran')
LTC.netlist[line_no] = LTC.netlist[line_no].replace('20m', '200u')
LTC.netlist[line_no] = LTC.netlist[line_no].replace('0.1u', '20n')
print(LTC.netlist[line_no], end='')  # 確認

# 編集したnetlistの情報でバッチ処理を実行する
run_net_file = fname + fname_tmp + '.net'
LTC.run(run_filename=run_net_file)
LTC.wait_completion()
V1 Vin+ 0 SINE(0 1.5 10k) AC 1
.tran 0 200u 0 20n
True
import matplotlib.pyplot as plt
import numpy as np

from PyLTSpice import RawRead

fig = plt.figure(figsize=(6, 3))
ax1 = fig.add_subplot(1, 1, 1)

LTR = RawRead(fname + fname_tmp + '.raw')
x     = LTR.get_trace('time').get_time_axis(0)

tmp1  = LTR.get_trace('V(vin+)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vin+')
tmp1  = LTR.get_trace('V(vout)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vout')

ax1.legend(); ax1.grid()
ax1.set_xlabel('[ms]'); ax1.set_ylabel('[V]')

fig.tight_layout()

fig.savefig('PrimaryCircuit2-025_Graph3.png')

ゲインは1倍、位相は180度進む

方形波応答

from PyLTSpice import SimCommander

fname = 'PrimaryCircuit2-025'
fname_tmp = '_pulse'
LTC = SimCommander(fname + '.asc')

line_no = LTC._get_line_starting_with('V1')
sim_cmd = LTC.netlist[line_no]
LTC.netlist[line_no] = sim_cmd.replace('SINE(0 1.5 100)', 'PULSE(-0.5 0.5 5m 0 0 5m 10m)')
print(LTC.netlist[line_no], end='')  # 確認

# 編集したnetlistの情報でバッチ処理を実行する
run_net_file = fname + fname_tmp + '.net'
LTC.run(run_filename=run_net_file)
LTC.wait_completion()
V1 Vin+ 0 PULSE(-0.5 0.5 5m 0 0 5m 10m) AC 1
True
import matplotlib.pyplot as plt
import numpy as np

from PyLTSpice import RawRead

fig = plt.figure(figsize=(6, 3))
ax1 = fig.add_subplot(1, 1, 1)

LTR = RawRead(fname + fname_tmp + '.raw')
x     = LTR.get_trace('time').get_time_axis(0)

tmp1  = LTR.get_trace('V(vin+)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vin+')
tmp1  = LTR.get_trace('V(vout)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vout')

ax1.legend(); ax1.grid()
ax1.set_xlabel('[ms]'); ax1.set_ylabel('[V]')

fig.tight_layout()

fig.savefig('PrimaryCircuit2-025_Graph4.png')

入力の立ち上がり、立ち下がり部が出力される(反転して出力)
オーバーシュートはほぼ発生しない

周波数特性

Vin+(V1) に AC 1の設定がついているので、シミュレーションモードをacにすれば良い

from PyLTSpice import SimCommander

fname = 'PrimaryCircuit2-025'
fname_tmp = '_ac'
LTC = SimCommander(fname + '.asc')

line_no = LTC._get_line_starting_with('.tran')
sim_cmd = LTC.netlist[line_no]
LTC.netlist[line_no] = sim_cmd.replace('.tran', ';tran')
line_no = LTC._get_line_starting_with(';ac')
sim_cmd = LTC.netlist[line_no]
LTC.netlist[line_no] = sim_cmd.replace(';ac', '.ac')
print(LTC.netlist[line_no], end='')  # 確認

# 編集したnetlistの情報でバッチ処理を実行する
run_net_file = fname + fname_tmp + '.net'
LTC.run(run_filename=run_net_file)
LTC.wait_completion()
.ac oct 40 1 10k
True
from PyLTSpice import RawRead

fig = plt.figure(figsize=(6, 4))
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2, sharex=ax1)

fname = 'PrimaryCircuit2-025'
fname_tmp = '_ac'
LTR = RawRead(fname + fname_tmp + '.raw')

freq  = np.abs(LTR.get_trace('frequency').get_wave(0))
Vout  = LTR.get_trace("V(vout)").get_wave(0)
ax1.plot(freq, 20*np.log10(np.abs(Vout)))
ax2.plot(freq, np.angle(Vout) / np.pi * 180)

ax1.grid()
ax1.set_xlabel("[Hz]"); ax1.set_ylabel("Gain[dB]")
ax1.set_xscale('log')
ax1.set_ylim(-45, 5)

ax2.grid()
ax2.set_xlabel("[Hz]"); ax2.set_ylabel("Phase[deg]")
ax2.set_xscale('log')
ax2.set_ylim(-185, -85)

fig.tight_layout()

fig.savefig('PrimaryCircuit2-025_Graph5.png')

1kHzがカットオフ、ゲインは1、20dB/decで変化

参考文献

この記事は以下の書籍を参考にしましたが、
私の拙い知識で書いておりますので、誤り等ありましたらご指摘ください