The Signal Generator allows you to specify a standard waveform as the data source for a DataBlock. The generated Signal can be used as the specified stimulus or expected response values.
Note: Reactive TestCases provide another, more powerful, method of using C# code to define Signal patterns.
To use the Signal Generator:
1.Create a DataBlock that spans the time domain where you want the waveform to exist. If you want the waveform to cover the full extent of the Signal, ensure that the Signal has only one Data Block. By default, a Signal has one DataBlock that spans the Signal from beginning to end.
2.Right-click in the Plot Area of the signal, somewhere between the beginning and end of the DataBlock, then select DataBlock‑>Properties...
![]() |
3.Select the Data Source tab, then select the Signal Generator radio button.
4.Choose the waveform that you want to use.
5.Provide the parameters for that waveform.
Note: Once you have generated a signal, you can access the DataBlock Properties by double-clicking on the signal.
You can define a Signal Generator with a C# Snippet, or use one of the pre-defined generators:
You can write a Signal Generator in C#. The one available pre-defined variable is time. Some examples C# Snippet Signal Generators are: •value = 0.5 * (1 + Math.Sin(time)); //Sine wave •value = (time/10)%1; //Sawtooth waveform with a period of 10 seconds •if (time%5 >2) value = 0.3; else value = 0.2; •value = ((int) time/10.0); //Inserts a stair step waveform that steps up in increments of 0.1. The fourth example generates the following waveform: Below is a more complex example:
|
The image below shows typical Sine Wave settings:
The image below shows typical Random Wave settings:
The image below shows typical PWM settings:
The image below shows typical Sawtooth Wave settings: |