Spectrum Software
spacer
Industrial Strength Simulation
select:

divider

 

News:

Spectrum Software has released Micro-Cap 11, the eleventh generation of our SPICE circuit simulator.

For users of previous Micro-Cap versions, check out the new features available in the latest version. For those of you who are new to Micro-Cap, take our features tour to see what Micro-Cap has to offer.

 

divider

 

Noise Source Macro

 

The difficulty in creating noise sources for transient analysis has been to produce the large amounts of random data needed for transient analysis. Hundreds, if not thousands, of data points would have to be placed into a user source, table source, or the independent SPICE PWL source for a noise generator to be truly effective. However, the new REPEAT and scale features available for the PWL source, used in conjunction with the RND operator, simplify this process.

A single data point in a PWL source is specified as (tin,in) where tin is a time value and in is either a voltage or a current value depending on the source. The REPEAT feature for the PWL source lets you enter one or more data points between REPEAT and ENDREPEAT keywords. These data points will then be repeated for a user specified number of times. The scale feature lets you enter one value that will scale the tin value for all data points and another value that will scale the in value for all data points. Finally, the RND operator will calculate a random number between 0 and 1 each time it is specified. The figure below displays a macro for a noise source.

Noise Source Macro
The noise source macro is created from a SPICE independent source. This source can be found in the Waveform Sources section with the name 'V'. The macro has two parameters, ts and vs. The ts parameter scales all of the time values in the data points, and the vs parameter scales all of the voltage values in the data points. The VALUE attribute for this source is defined as:

PWL TIME_SCALE_FACTOR=ts VALUE_SCALE_FACTOR=vs 0,{rnd} REPEAT FOREVER 1,{rnd} ENDREPEAT

The PWL keyword defines this source as a piecewise linear source. Only one data point has been defined in the REPEAT-ENDREPEAT loop. This data point, 1,{rnd}, will produce a random data point every ts seconds. The voltage of the data point will be vs*RND, where the value will be in the range of 0 to vs. The loop has been specified to run forever, so it will produce random data points for as long as the simulation is specified for. The TIME_SCALE_FACTOR and VALUE_SCALE_FACTOR define the scale values for the PWL.

Noise Test Circuit
The figure above displays the test circuit for the noise source macro. This circuit is a modification of the FILTER.CIR file that comes with MC5. The circuit simulates an active Chebyshev filter that has an injected noise source inserted on top of the input pulse source.

The noise source macro has the PART attribute X1, and its VALUE attribute is defined as:

Noise(10u,100m)

The ts parameter is defined as 10u, and the vs parameter is defined as 100m. The noise source will produce random values in the range of 0 to 100mV every 10us.

The figure below shows the analysis results for this circuit. The V(In) waveform is a combination of the pulse source and the noise source. Zooming in on this waveform would display a random piecewise linear point every 10us. The V(Out) waveform is the output of the filter. As can be seen in the analysis, the Chebyshev filter is attenuating the higher frequency contributions of the noise source.

An equivalent current noise source can be generated with the current SPICE independent source. This source is called 'I' and is also available in the Waveform Sources section. It would use the exact same syntax as in this case.

Noise Macro Test Analysis
The noise source macro will produce an average value of (vs * .5). Offsets may easily be added into the PWL source to shift the voltages. To shift the random values so that it produces an approximately equal number of positive and negative values, add a -.5 offset to the data points in the PWL source. The VALUE attribute for the PWL source would now look like this:

PWL TIME_SCALE_FACTOR=ts VALUE_SCALE_FACTOR=vs 0,{rnd-.5} REPEAT FOREVER 1,{rnd-.5} ENDREPEAT

The voltages produced with this statement would be in the range of -vs/2 to vs/2.

There are a couple of situations to be careful of when using this source. If you run a long transient simulation, but have a very small ts value, then it will slow the simulation down as it will have to produce at least one data point every ts seconds. The second situation would be in running an AC analysis with this source in the schematic. This source has no AC characteristics, so it will act as a short circuit during the small signal analysis. However, to produce the small-signal circuit, AC analysis needs to run a bias point calculation first. The noise source will produce a random value for the bias point operation each time the circuit is simulated. If the circuit is sensitive to the noise source, it may alter the AC analysis results every run. In most cases though, the noise source should only have a negligible effect on the AC analysis results.
 
Return to the main Newsletter page