0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OpenModelicaによるアナログフィルタ(RCローパス)

Posted at

OpenModelicaを使ってみよう

ArduinoやRaspberryPiを用いた電子工作をする時,信号の高周波振動を低減するために,ブレッドボードなどを使って抵抗RとコンデンサCを利用したローパスフィルタ(アナログ回路)を検討することが多いと思います.

そんな時,適切な抵抗値・コンデンサ値を決めるために,無償のシミュレータOpenModelicaを使って,任意のRCローパスフィルタの挙動を確認する簡単な例を示します.

OMEditを用いたRC回路モデル

▢ Electricalから,Alanlog/Basic内に抵抗やコンデンサブロックを使用
▢ Sources内のパルス電圧ブロックを使用

Electricブロック.JPG

注意事項として,プロットしたい電圧にセンサブロックを配置するのを忘れないこと.

RCフィルタモデル.JPG

RCフィルタによる出力電圧の挙動を確認

青色:パルス入力電圧
赤色:RCフィルタ後の出力電圧

RCフィルタ電圧.JPG

RC_filter.mo
model RC_filter
  Modelica.Electrical.Analog.Basic.Ground ground annotation(
    Placement(visible = true, transformation(origin = {0, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Basic.Capacitor capacitor(C = 10e-6)  annotation(
    Placement(visible = true, transformation(origin = {0, 6}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Basic.Resistor resistor(R = 10000)  annotation(
    Placement(visible = true, transformation(origin = {-28, 42}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  Modelica.Electrical.Analog.Sources.PulseVoltage pulseVoltage(V = 5, period = 2, width = 50)  annotation(
    Placement(visible = true, transformation(origin = {-62, 2}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Electrical.Analog.Sensors.VoltageSensor voltageSensor annotation(
    Placement(visible = true, transformation(origin = {34, 32}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
equation
  connect(pulseVoltage.p, resistor.p) annotation(
    Line(points = {{-62, 12}, {-62, 42}, {-38, 42}}, color = {0, 0, 255}));
  connect(resistor.n, capacitor.p) annotation(
    Line(points = {{-18, 42}, {0, 42}, {0, 16}}, color = {0, 0, 255}));
  connect(pulseVoltage.n, ground.p) annotation(
    Line(points = {{-62, -8}, {-62, -24}, {0, -24}, {0, -30}}, color = {0, 0, 255}));
  connect(capacitor.n, ground.p) annotation(
    Line(points = {{0, -4}, {0, -30}}, color = {0, 0, 255}));
  connect(voltageSensor.p, resistor.n) annotation(
    Line(points = {{34, 42}, {-18, 42}, {-18, 42}, {-18, 42}}, color = {0, 0, 255}));
  connect(voltageSensor.n, ground.p) annotation(
    Line(points = {{34, 22}, {34, -24}, {0, -24}, {0, -30}}, color = {0, 0, 255}));

annotation(
    uses(Modelica(version = "3.2.3")));
end RC_filter;
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?