Sine, Capacitor, Ramp, and Exponential waveforms can be automatically generated using State label equations. These are special state label equations that generate both the waveform and the state values at the same time. See Section 1.3 Generating Waveforms and States with Equations for general information on label equations.
This is an older method of generating analog waveform data and these equations generate "one-time" results (the generated events react thereafter the same as if you had manually drawn these events). Unlike the Waveform Equation Blocks described in the previous section (Section 8.2: Waveform Equation Blocks for editable Analog waveforms ), the original equation cannot be changed to change the waveform, only the individual events can be edited.
For all the functions shown in this section, there is also an optional last parameter that can specify the number of points to use when drawing the waveform. For example, the first equation could also be written as SinStart(5,20,100,40) to indicate that 40 points should be used to draw the waveform. If no points are specified the tool will decide how many points to use. The sampling frequency can also be forced to be a particular value for all new signals when the Enforce as Sampling Period check box is checked in the the Edit Text and Edge Grids dialog.
Generate the Analog State Label equations:
•Double-click on a signal's name to open the Signal Properties dialog. •Use the QuickFill button (black triangle) to quickly add one of Analog State Label equations to the Label Equation edit box. |
•Replace the dummy parameters in the equation with values that will generate the waveform. •Press the Label Eqn button to generate the waveform. |
Sine Wave Equations
•A SinStart equation will generate a waveform with initial state at zero and that slowly increases in amplitude over the duration specified. |
SinStart([amplitudeV], [period], [duration])
|
•A Sin equation will generate a regular sine wave using the amplitude, period, and duration specified. |
Sin([amplitudeV], [period], [duration])
|
•A SinEnd equation will generate a waveform that starts with the full amplitude specified and slowly decreases to amplitude zero over the specified duration. The rate at which it decreases depends on the amplitude and duration specified. |
SinEnd([amplitudeV], [period], [duration])
|
Capacitor Equations
•The CapCharge function generates a waveform that represents a charging capacitor. The initial state will have the lowest value specified by the amplitude. The value will then slowly grow at a rate controlled by the value of RC (the circuit’s RC time constant). The generated waveform will be for the specified duration, regardless of whether or not the 'capacitor' has reached its full charge by the end of the specified duration. |
CapCharge([amplitude], [RC], [duration])
|
•The CapDischarge function performs the inverse of the CapCharge function. A waveform will be generated that represents a capacitor discharging. The initial state will be the peak value specified by the amplitude. The rate of discharge is controlled by the value of RC. The generated waveform will be controlled by the duration specified. The end of the generated waveform will be at the end of the duration regardless of whether or not the 'capacitor' is fully discharged. |
CapDischarge([amplitude], [RC], [duration])
|
Ramp Waveforms
•The Ramp equation generates a ramp. In the picture the Ramp was applied once going up and then again going down. |
Ramp([StartV], [EndV], [Duration])
|
Exponential Waveforms
•The Exponential equation generates an exponential waveform. |
Exponential(amplitudeV, exponent, duration, offset)
|
Setting the Sampling Frequency of an Analog Label Equation
You can set the sampling frequency when you create an analog signal using the optional numberOfPoints parameter. If not specified, numberOfPoints defaults to a value that tends to yield a relatively smooth curve. But when you have a specific sampling frequency requirement for your analog signal, you will need to override the default. Below is an example using the Sin() function.
To create a 3V sine wave with frequency of 5MHz, a sampling frequency of 100MHz and 400 ns duration, the following calculations must be performed:
period = 1/frequency = 1/5MHz = 200 ns
sampling period = 1/sampling frequency = 1/100MHz = 10 ns
numberOfPoints = duration/sampling period = 400 ns / 10 ns = 40
The final equation to create this signal would be:
//Sin(amplitudeV, period, duration,numberOfPoints)
Sin(3, 200, 400,40)
Enforcing the Sampling Frequency of Analog Label Equations:
Normally, the analog label equations pick a sampling frequency that will result in a smooth curve. This often results in a waveform with a lot of points very close together. There is a way to force the sampling period to be a specific time interval.
•Choose the Options > Text and Edge Grid Settings menu to open the Edit Text and Edge Grids dialog. |
•Check the Enforce as Sampling Period check box to take control of the sample period away from the equation generator. •Type the sampling period into the Horizontal box. This will force analog equations to generate evenly spaced points on this grid. Notice that this will also force new digital signal waveforms to be drawn on this grid, so you may wish to change the settings after generating the analog waveforms. |
•In this example, the exponential for SIG1 was created while the sampling period was forced to 5000 ps. Note that the "digitally displayed" version of SIG1 (below the "analog displayed" version) has a state value every 5000 ps. |