PythonTest.mo 2.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. model PythonTest
  2. ARM.Models.VHT vht(launchVHT = false, samplingFrequency = 16) annotation(
  3. Placement(visible = true, transformation(origin = {-12, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  4. Modelica.Blocks.Continuous.TransferFunction transferFunction(a = {1.0, 942.317, 3.94761e7}, b = {1, 1675.7, 3.94761e7}) annotation(
  5. Placement(visible = true, transformation(origin = {32, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  6. Modelica.Blocks.Nonlinear.FixedDelay fixedDelay(delayTime = 0.1) annotation(
  7. Placement(visible = true, transformation(origin = {68, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  8. Modelica.Blocks.Math.Add add annotation(
  9. Placement(visible = true, transformation(origin = {-36, -28}, extent = {{10, -10}, {-10, 10}}, rotation = -90)));
  10. Modelica.Blocks.Math.Gain gain(k = 0.8) annotation(
  11. Placement(visible = true, transformation(origin = {102, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  12. Modelica.Blocks.Noise.TruncatedNormalNoise noise(samplePeriod = 0.0000625, useAutomaticLocalSeed = true, useGlobalSeed = true, y_max = 0.1, y_min = -0.1) annotation(
  13. Placement(visible = true, transformation(origin = {-82, 8}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  14. inner Modelica.Blocks.Noise.GlobalSeed globalSeed annotation(
  15. Placement(visible = true, transformation(origin = {-86, -28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  16. ARM.Sound.WaveOutput waveOutput annotation(
  17. Placement(visible = true, transformation(origin = {24, -32}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  18. equation
  19. connect(vht.y, transferFunction.u) annotation(
  20. Line(points = {{0, 0}, {20, 0}}, color = {0, 0, 127}));
  21. connect(transferFunction.y, fixedDelay.u) annotation(
  22. Line(points = {{44, 0}, {56, 0}}, color = {0, 0, 127}));
  23. connect(add.y, vht.x) annotation(
  24. Line(points = {{-36, -16}, {-36, 0}, {-24, 0}}, color = {0, 0, 127}));
  25. connect(fixedDelay.y, gain.u) annotation(
  26. Line(points = {{80, 0}, {90, 0}}, color = {0, 0, 127}));
  27. connect(gain.y, add.u1) annotation(
  28. Line(points = {{114, 0}, {132, 0}, {132, -48}, {-30, -48}, {-30, -40}}, color = {0, 0, 127}));
  29. connect(noise.y, add.u2) annotation(
  30. Line(points = {{-70, 8}, {-54, 8}, {-54, -46}, {-42, -46}, {-42, -40}}, color = {0, 0, 127}));
  31. connect(vht.y, waveOutput.x) annotation(
  32. Line(points = {{0, 0}, {6, 0}, {6, -32}, {12, -32}}, color = {0, 0, 127}));
  33. annotation(
  34. Diagram(coordinateSystem(extent = {{-200, -200}, {200, 200}})),
  35. uses(ARM(version = "0.1.0"), Modelica(version = "4.0.0")));
  36. end PythonTest;