notchFilter.mo 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. model notchFilter
  2. // Parameters
  3. parameter Modelica.Units.SI.PotentialDifference Vt "testAmplitude";
  4. parameter Modelica.Units.SI.Frequency Ft "testFrequency";
  5. // Components
  6. Modelica.Electrical.Analog.Basic.Ground ground_in annotation(
  7. Placement(visible = true, transformation(origin = {-80, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  8. Modelica.Electrical.Analog.Basic.Ground ground annotation(
  9. Placement(transformation(origin = {28, -18}, extent = {{-10, -10}, {10, 10}})));
  10. Modelica.Electrical.Analog.Basic.Ground ground_out annotation(
  11. Placement(visible = true, transformation(origin = {80, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  12. Modelica.Electrical.Analog.Basic.Capacitor C1(C(displayUnit = "nF") = 1e-9, v(start = 0)) annotation(
  13. Placement(visible = true, transformation(origin = {-20, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  14. Modelica.Electrical.Analog.Basic.Capacitor C2(C(displayUnit = "pF") = 1e-9, v(start = 0)) annotation(
  15. Placement(visible = true, transformation(origin = {20, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  16. Modelica.Electrical.Analog.Basic.Capacitor C3(C(displayUnit = "pF") = 2e-9, v(start = 0)) annotation(
  17. Placement(visible = true, transformation(origin = {0, 20}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  18. Modelica.Electrical.Analog.Basic.Resistor R1(R(displayUnit = "kOhm") = 1600) annotation(
  19. Placement(visible = true, transformation(origin = {-20, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  20. Modelica.Electrical.Analog.Basic.Resistor R2(R(displayUnit = "kOhm") = 1600) annotation(
  21. Placement(visible = true, transformation(origin = {20, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  22. Modelica.Electrical.Analog.Basic.Resistor R3a(R(displayUnit = "kOhm") = 1600) annotation(
  23. Placement(transformation(origin = {12, -18}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  24. Modelica.Electrical.Analog.Basic.Resistor R3b(R(displayUnit = "kOhm") = 1600) annotation(
  25. Placement(transformation(origin = {-12, -18}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  26. Modelica.Electrical.Analog.Sensors.VoltageSensor V_out annotation(
  27. Placement(visible = true, transformation(origin = {60, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  28. Modelica.Electrical.Analog.Sources.SineVoltage V_in(V(displayUnit = "V") = Vt, f(displayUnit = "Hz") = Ft) annotation(
  29. Placement(visible = true, transformation(origin = {-60, 0}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  30. // Equations
  31. equation
  32. connect(C3.n, R3a.p) annotation(
  33. Line(points = {{0, 10}, {0, -1}, {12, -1}, {12, -8}}, color = {0, 0, 255}));
  34. connect(V_out.p, C2.n) annotation(
  35. Line(points = {{50, 0}, {40, 0}, {40, -40}, {30, -40}}, color = {0, 0, 255}));
  36. connect(R1.n, R2.p) annotation(
  37. Line(points = {{-10, 40}, {10, 40}}, color = {0, 0, 255}));
  38. connect(C3.p, R2.p) annotation(
  39. Line(points = {{0, 30}, {0, 40}, {10, 40}}, color = {0, 0, 255}));
  40. connect(V_out.n, ground_out.p) annotation(
  41. Line(points = {{70, 0}, {80, 0}, {80, -20}}, color = {0, 0, 255}));
  42. connect(V_in.p, C1.p) annotation(
  43. Line(points = {{-50, 0}, {-40, 0}, {-40, -40}, {-30, -40}}, color = {0, 0, 255}));
  44. connect(R2.n, C2.n) annotation(
  45. Line(points = {{30, 40}, {40, 40}, {40, -40}, {30, -40}}, color = {0, 0, 255}));
  46. connect(V_in.n, ground_in.p) annotation(
  47. Line(points = {{-70, 0}, {-80, 0}, {-80, -20}}, color = {0, 0, 255}));
  48. connect(R1.p, C1.p) annotation(
  49. Line(points = {{-30, 40}, {-40, 40}, {-40, -40}, {-30, -40}}, color = {0, 0, 255}));
  50. connect(R3b.p, C3.n) annotation(
  51. Line(points = {{-12, -8}, {-12, -1}, {0, -1}, {0, 10}}, color = {0, 0, 255}));
  52. connect(C1.n, C2.p) annotation(
  53. Line(points = {{-10, -40}, {10, -40}}, color = {0, 0, 255}));
  54. connect(R3a.n, C2.p) annotation(
  55. Line(points = {{12, -28}, {12, -32}, {0, -32}, {0, -40}, {10, -40}}, color = {0, 0, 255}));
  56. connect(R3b.n, C1.n) annotation(
  57. Line(points = {{-12, -28}, {-12, -32}, {0, -32}, {0, -40}, {-10, -40}}, color = {0, 0, 255}));
  58. connect(ground.p, C3.n) annotation(
  59. Line(points = {{28, -8}, {28, -1}, {0, -1}, {0, 10}}, color = {0, 0, 255}));
  60. annotation(uses(Modelica(version = "4.0.0")), Diagram);
  61. end notchFilter;