4

I have a simple circuit with a SawTooth voltage source in SystemModeler 12.0.

How would I add a noise component to a sawtooth waveform?

  • I have added a NormalNoise block named normalNoise1 to my model.
  • I can plot normalNoise1 in my output run.
  • I would like to add normalNoise1.y to the amplitude of my SawTooth source. In my case this would be 20 + normalNoise1.y.
  • When I tried using 20 + normalNoise1.y as an expression for the amplitude entry of the SawTooth source, I get an error.

My two questions are:

  • Is there a good reference for the syntax for the expression editor in SystemModeler? I have looked for some examples that use expressions but am not finding anything.
  • Is it even possible to use a noise block in this way?
Doug Kimzey
  • 2,279
  • 1
  • 14
  • 21

1 Answers1

1

You cannot write 20 + normalNoise1.y as the expression for the amplitude, since the amplitude is a parameter (something that you set once, and is constant during the whole simulation), and normalNoise1.y is a variable (changes during the simulation).

I'm not sure what you are trying to achieve. What does a sawtooth with a noisy amplitude look like? If you want the sum of a regular sawtooth and some noise, you can achieve that using three components:

  • Noise block (like you have)
  • Modelica.Blocks.Sources.SawTooth block (with a set amplitude, like 20)
  • Modelica.Blocks.Math.Add to add the two together
  • Modelica.Electrical.Analog.Sources.SignalVoltage to get the signal into your circuit
Malte Lenz
  • 2,471
  • 19
  • 21
  • I don't believe that the Modelica.Blocks.Math.Add will work with the voltage signal type. I think the only solution is to write a custom C++ function. – Doug Kimzey Oct 23 '19 at 14:39
  • You can find a number of examples of noisy sawtooth waves in Google images and the ElectricalEngineering exchange. – Doug Kimzey Oct 23 '19 at 14:41
  • I edited my answer for how you could get a sawtooth signal into an electric circuit. – Malte Lenz Oct 23 '19 at 14:43