サイトマップ

回路の素101 034 加算回路 反転アンプ型

回路の素101 034 加算回路 反転アンプ型

複数の信号を足し合わせて、反転して出力
入力ごとにゲインの設定が可能
数十MHzまでの回路で使用

回路図作成

  • 基本的な構成

各入力  i に対するゲインは下記

 A_{i} = - \frac{R_i}{R_F}

今回の場合は  A_1 ,  A_2 ともに 1

応答性確認

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

import matplotlib.pyplot as plt
import numpy as np

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 = 'PrimaryCircuit3-034.raw'
LTR = RawRead(fname)
x     = LTR.get_trace('time').get_time_axis(0)

tmp1  = LTR.get_trace('V(vin1)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vin1')
tmp1  = LTR.get_trace('V(vin2)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vin2')
tmp1  = LTR.get_trace('V(vout)').get_wave(0)
ax2.plot(x * 1000, tmp1, label='Vout')

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

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

fig.tight_layout()

fig.savefig('PrimaryCircuit3-034_Graph1.png')

2つの信号の合成されて反転されたものが出力されている

周波数特性

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

from PyLTSpice import SimCommander

fname = 'PrimaryCircuit3-034'
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 1k 10Meg
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)

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(-35, 5)

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

fig.tight_layout()

fig.savefig('PrimaryCircuit3-034_Graph2.png')

高域の特性はオペアンプの特性で決まる

改良された回路1

単電源で動く回路

応答性確認

import matplotlib.pyplot as plt
import numpy as np

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 = 'PrimaryCircuit3-034-2.raw'
LTR = RawRead(fname)
x     = LTR.get_trace('time').get_time_axis(0)

tmp1  = LTR.get_trace('V(vin1)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vin1')
tmp1  = LTR.get_trace('V(vin2)').get_wave(0)
ax1.plot(x * 1000, tmp1, label='Vin2')
tmp1  = LTR.get_trace('V(vout)').get_wave(0)
ax2.plot(x * 1000, tmp1, label='Vout')

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

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

fig.tight_layout()

fig.savefig('PrimaryCircuit3-034_Graph3.png')

オフセットが2.5V追加されている
1kHz/5kHzに対しては、ほぼそのまま入力が加算されて出力されている

周波数特性(低域)

from PyLTSpice import SimCommander

fname = 'PrimaryCircuit3-034-2'
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)

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(-35, 5)

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

fig.tight_layout()

fig.savefig('PrimaryCircuit3-034_Graph4.png')

入力側の低域のカットオフ周波数は、16Hzになっている
入力のカットオフ周波数も、入力ごとに設計することができる

改良された回路2

出力にローパスフィルタを持たせた回路

周波数特性

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 = 'PrimaryCircuit3-034-3.raw'
LTR = RawRead(fname)

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(-35, 5)

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

fig.tight_layout()

fig.savefig('PrimaryCircuit3-034_Graph5.png')

出力のカットオフ周波数が、1.6kHzと設計通りになっている
減衰率は 20dB/dec

参考文献

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