Table of Contents

"generator" command

Purpose

Sets up an input waveform for transient and Fourier analysis. Emulates a laboratory type function generator.

Syntax

generator {option-name=value ...} 

Comments

This command sets up a singal source that is conceptually separate from the circuit. To use it, make the value of a component “generator(1)”, or substitute a scale factor for the parameter.

The SPICE style input functions also work, but are considered to be part of the circuit, instead of part of the test equipment.

The parameters available are designed to emulate the controls on a function generator. There are actually two generators here: sine wave and pulse. If both are on (by setting non-zero parameters) the sine wave is modulated by the pulse, but either can be used alone.

Unless you change it, it is a unit-step function at time 0. The purpose of the command is to change it.

This command does not affect AC or DC analysis in any way. It is only for transient and Fourier analysis. In AC analysis, the input signal is always a sine wave at the analysis frequency.

Typical usage is the name of the control followed by its value, or just plain Generator to display the present values.

The actual time when switching takes place is ambiguous by one time step. If precise time switching is necessary, use the Skip option on the transient analysis command, to force more resolution. This ambiguity can usually be avoided by specifying finite rise and fall times.

Parameters

frequency The frequency of the sine wave generator for a transient analysis. The sine wave is modulated by the pulse generator. A frequency of zero puts the pulse generator on line directly.
amplitude The overall amplitude of the pulse and sine wave. A scale factor. It applies to everything except the offset and initial values.
phase The phase of the sine wave, at the instant it is first turned on.
max The amplitude of the pulse, when it is `on'. (During the width time) If the sine wave is on (frequency not zero) this is the amplitude of the sine wave during the first part of the period. The max is scaled by amplitude.
min The amplitude of the pulse, when it is `off'. (After it falls, but before the next period begins.) Although we have called these min and max, there is no requirement that max be larger than min. If the sine wave is on, this is its amplitude during the second part of the period. The min is scaled by amplitude.
offset The DC offset applied to the entire signal, at all times after the initial delay. The offset is not scaled by amplitude.
initial The initial value of the pulse generator output. It will have this value starting at time 0, until delay time has elapsed. It will never return to this value, unless you restart at time 0.
rise The rise time, or the time it takes to go from min to max, or for the first rise, initial to max. The rise is linear.
fall The fall time. (The time required to go from max back to min.)
delay The waiting time before the first rise.
width The length of time the output of the generator has the value max. A width of zero means that the output remains high for the remainder of the period. If you really want a width of zero, use a very small number, less than the step size.
period The time for repetition of the pulse. It must be greater than the sum of rise + fall + width. A period of zero means that the signal is not periodic and so will not repeat.

Examples

The generator command … gen Display the present settings.

gen freq=1k

Sets the sine wave to 1 kHz. All other parameters are as they were before.

gen freq=0

Turns off the sine wave, leaving only the pulse.

gen ampl=0

Sets the amplitude to zero, which means the circuit has no input, except for possibly a DC offset.

gen period=.001 freq=1Meg

Sets the period back to 1 millisecond. Applies 1 mHz modulation to the pulse, resulting in a pulsed sine wave. In this case, a 100 microsecond 10 volt burst, repeating every millisecond. Between bursts, you will get 2.5 volts, with reversed phase. The old values, in this case from 2 lines back (above) are kept. (Ampl 5 Rise 10u Fall 10u …)

gen freq=60 phase=90 delay=.1

The sine wave frequency is 60 Hertz. Its phase is 90 degrees when it turns on, at time .1 seconds. It turns on sharply at the peak.

A component using it … V12 1 0 generator(1) Use the generator as the circuit input through this voltage source. The DC and AC values are 0.

V12 1 0 tran generator(1) ac 10 dc 5

Same as before, except that the AC value is 10 and DC value is 5.

Rinput 1 0 tran generator(1)

Unlike SPICE, the functions can be used on other components. The resistance varies in time according to the “generator”.